예제 #1
0
 public DiscDataStore(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
 {
     //Fill map path
     _modulename = moduleConfig.Name;
     _dataList   = new DataList(moduleConfig);
     foreach (DomainConfigurationElement domain in moduleConfig.Domains)
     {
         _mappedPaths.Add(domain.Name, new MappedPath(tenant, moduleConfig.AppendTenant, domain.Path, domain.VirtualPath, handlerConfig.GetProperties()));
     }
     //Add default
     _mappedPaths.Add(string.Empty, new MappedPath(tenant, moduleConfig.AppendTenant, PathUtils.Normalize(moduleConfig.Path), moduleConfig.VirtualPath, handlerConfig.GetProperties()));
 }
예제 #2
0
        public SelectelStorage(String tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
        {
            _tenant     = tenant;
            _modulename = moduleConfig.Name;
            _dataList   = new DataList(moduleConfig);

            _domainsExpires = moduleConfig.Domains.Cast <DomainConfigurationElement>()
                              .Where(x => x.Expires != TimeSpan.Zero)
                              .ToDictionary(x => x.Name, y => y.Expires);

            _domainsExpires.Add(String.Empty, moduleConfig.Expires);
            _domainsAcl = moduleConfig.Domains.Cast <DomainConfigurationElement>().ToDictionary(x => x.Name, y => y.Acl);
            _moduleAcl  = moduleConfig.Acl;
        }
예제 #3
0
        private static IDataStore GetDataStore(string tenant, StorageConfigurationSection section, string module,
                                               HttpContext context, IQuotaController controller)
        {
            ModuleConfigurationElement moduleElement = section.Modules.GetModuleElement(module);

            if (moduleElement == null)
            {
                throw new ArgumentException("no such module");
            }
            HandlerConfigurationElement handler = section.Handlers.GetHandler(moduleElement.Type);

            return
                (((IDataStore)Activator.CreateInstance(handler.Type, tenant, moduleElement, context)).Configure(
                     handler.GetProperties()).SetQuotaController(moduleElement.Count?controller:null /*don't count quota if specified on module*/));
        }
예제 #4
0
        public S3Storage(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
        {
            _tenant     = tenant;
            _modulename = moduleConfig.Name;
            _dataList   = new DataList(moduleConfig);
            _domains.AddRange(
                moduleConfig.Domains.Cast <DomainConfigurationElement>().Select(x => string.Format("{0}/", x.Name)));
            //Make acl
            _domainsExpires =
                moduleConfig.Domains.Cast <DomainConfigurationElement>().Where(x => x.Expires != TimeSpan.Zero).
                ToDictionary(x => x.Name,
                             y => y.Expires);
            _domainsExpires.Add(string.Empty, moduleConfig.Expires);

            _domainsAcl = moduleConfig.Domains.Cast <DomainConfigurationElement>().ToDictionary(x => x.Name,
                                                                                                y => GetS3Acl(y.Acl));
            _moduleAcl = GetS3Acl(moduleConfig.Acl);
        }
예제 #5
0
        public DiscDataStore(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
        {
            _tenant = tenant;
            //Fill map path
            _modulename = moduleConfig.Name;
            _dataList   = new DataList(moduleConfig);
            foreach (DomainConfigurationElement domain in moduleConfig.Domains)
            {
                _mappedPaths.Add(domain.Name, new MappedPath(tenant, moduleConfig.AppendTenant, domain.Path, handlerConfig.GetProperties()));
            }
            //Add default
            _mappedPaths.Add(string.Empty, new MappedPath(tenant, moduleConfig.AppendTenant, PathUtils.Normalize(moduleConfig.Path), handlerConfig.GetProperties()));

            //Make expires
            _domainsExpires =
                moduleConfig.Domains.Cast <DomainConfigurationElement>().Where(x => x.Expires != TimeSpan.Zero).
                ToDictionary(x => x.Name,
                             y => y.Expires);
            _domainsExpires.Add(string.Empty, moduleConfig.Expires);
        }