示例#1
0
 public DefinitionBuilder(DefinitionMap staticDefinitions, ITypeFinder typeFinder, TransformerBase <IUniquelyNamed>[] transformers, EngineSection config)
 {
     this.staticDefinitions = staticDefinitions;
     this.typeFinder        = typeFinder;
     this.transformers      = transformers;
     this.config            = config;
 }
示例#2
0
 public WebAppTypeFinder(Web.IWebContext webContext, EngineSection engineConfiguration)
 {
     this.webContext = webContext;
     this.ensureBinFolderAssembliesLoaded = engineConfiguration.DynamicDiscovery;
     foreach (var assembly in engineConfiguration.Assemblies.AllElements)
         AssemblyNames.Add(assembly.Assembly);
 }
示例#3
0
		protected virtual void RegisterConfiguredComponents(IServiceContainer container, EngineSection engineConfig)
		{
			foreach (ComponentElement component in engineConfig.Components)
			{
				Type implementation = Type.GetType(component.Implementation);
				Type service = Type.GetType(component.Service);

				if (implementation == null)
					throw new ComponentRegistrationException(component.Implementation);

				if (service == null && !String.IsNullOrEmpty(component.Service))
					throw new ComponentRegistrationException(component.Service);

				if (service == null)
					service = implementation;

				string name = component.Key;
				if (string.IsNullOrEmpty(name))
					name = implementation.FullName;

				if (component.Parameters.Count == 0)
				{
					container.AddComponent(name, service, implementation);
				}
				else
				{
					container.AddComponentWithParameters(name, service, implementation,
														 component.Parameters.ToDictionary());
				}
			}
		}
示例#4
0
        public override void Execute()
        {
            if (engine == null) engine = N2.Context.Current;
            if (config == null) config = ConfigurationManager.GetSection("n2/engine") as EngineSection;

            if (config == null || !config.Scheduler.KeepAlive)
            {
                Repeat = Repeat.Once;
                return;
            }

            try
            {
                Url url = Url.ServerUrl;
                if (url == null)
                    return;

                using (WebClient wc = new WebClient())
                {
                    wc.Headers["N2KeepAlive"] = "true";
                    url = url.SetPath(config.Scheduler.KeepAlivePath.ResolveUrlTokens());
                    string response = wc.DownloadString(url);
                    Debug.WriteLine("Ping " + url + ": " + response);
                    logger.Debug("Ping " + url + ": " + response);
                }
            }
			catch(SecurityException ex)
			{
				N2.Engine.Logger.Warn("Stopping keep-alive after exception (probably medium trust environemtn): ", ex);
				Repeat = Repeat.Once;
			}
        }
示例#5
0
        public override void SetUp()
        {
            base.SetUp();

            config  = TestSupport.SetupEngineSection();
            actions = new ScheduledAction[] { new OnceAction(), new RepeatAction() };

            heart       = mocks.Stub <IHeart>();
            heart.Beat += null;
            raiser      = LastCall.IgnoreArguments().GetEventRaiser();
            mocks.Replay(heart);

            errorHandler = mocks.DynamicMock <IErrorNotifier>();
            mocks.Replay(errorHandler);

            ctx = mocks.DynamicMock <IWebContext>();
            mocks.Replay(ctx);

            engine = new Fakes.FakeEngine();
            engine.Container.AddComponentInstance("", typeof(IErrorNotifier), MockRepository.GenerateStub <IErrorNotifier>());

            worker = new AsyncWorker();
            worker.QueueUserWorkItem = delegate(WaitCallback function)
            {
                function(null);
                return(true);
            };

            scheduler = new Scheduler(engine, heart, worker, ctx, errorHandler, actions, config);
            scheduler.Start();
        }
        protected virtual void RegisterConfiguredComponents(IServiceContainer container, EngineSection engineConfig)
        {
            foreach (ComponentElement component in engineConfig.Components)
            {
                Type implementation = Type.GetType(component.Implementation);
                Type service = Type.GetType(component.Service);

                if (implementation == null)
                    throw new ComponentRegistrationException(component.Implementation);

                if (service == null && !String.IsNullOrEmpty(component.Service))
                    throw new ComponentRegistrationException(component.Service);

                if (service == null)
                    service = implementation;

                string name = component.Key;
                if (string.IsNullOrEmpty(name))
                    name = implementation.FullName;

                if (component.Parameters.Count == 0)
                {
                    container.AddComponent(name, service, implementation);
                }
                else
                {
                    container.AddComponentWithParameters(name, service, implementation,
                                                         component.Parameters.ToDictionary());
                }
            }
        }
示例#7
0
        public static WebAppTypeFinder TypeFinder(EngineSection config)
        {
            var context = new ThreadContext();
            var finder  = new WebAppTypeFinder(new TypeCache(new N2.Persistence.BasicTemporaryFileHelper(context)), config);

            finder.AssemblyRestrictToLoadingPattern = new System.Text.RegularExpressions.Regex("N2.Tests");
            return(finder);
        }
示例#8
0
 public PluginFinder(ITypeFinder typeFinder, ISecurityManager security, EngineSection config)
 {
     addedPlugins    = config.InterfacePlugins.AllElements;
     removedPlugins  = config.InterfacePlugins.RemovedElements;
     this.typeFinder = typeFinder;
     this.security   = security;
     this.plugins    = FindPlugins();
 }
示例#9
0
 public WebAppTypeFinder(Web.IWebContext webContext, EngineSection engineConfiguration)
 {
     this.webContext = webContext;
     this.ensureBinFolderAssembliesLoaded = engineConfiguration.DynamicDiscovery;
     foreach (var assembly in engineConfiguration.Assemblies.AllElements)
     {
         AssemblyNames.Add(assembly.Assembly);
     }
 }
示例#10
0
        public static WebAppTypeFinder TypeFinder()
        {
            var config = new EngineSection();

            config.Assemblies.Clear();
            config.Assemblies.Add(new AssemblyElement {
                Assembly = typeof(TestSupport).Assembly.FullName
            });

            return(TypeFinder(config));
        }
示例#11
0
        public void DisabledScheduler_DoesntExecuteActions()
        {
            config = new EngineSection {
                Scheduler = new SchedulerElement {
                    Enabled = false
                }
            };
            scheduler = new Scheduler(engine, heart, worker, ctx, errorHandler, actions, config);

            scheduler.Actions.Count.ShouldBe(0);
        }
示例#12
0
        public void Scheduler_OnMachineWithOtherName_DoesntExecuteActions()
        {
            config = new EngineSection {
                Scheduler = new SchedulerElement {
                    ExecuteOnMachineNamed = "SomeOtherMachine"
                }
            };
            scheduler = new Scheduler(engine, heart, worker, ctx, errorHandler, actions, config);

            scheduler.Actions.Count.ShouldBe(0);
        }
示例#13
0
        public void Scheduler_OnMachineWithName_ExecutesActions()
        {
            config = new EngineSection {
                Scheduler = new SchedulerElement {
                    ExecuteOnMachineNamed = Environment.MachineName
                }
            };
            scheduler = new Scheduler(engine, heart, worker, ctx, errorHandler, actions, config);

            scheduler.Actions.Count.ShouldBe(2);
        }
示例#14
0
 public ErrorHandler(IWebContext context, ISecurityManager security, InstallationManager installer,
     EngineSection config, EditSection editConfig)
     : this(context, security, installer)
 {
     this.editConfig = editConfig;
     action = config.Errors.Action;
     mailTo = config.Errors.MailTo;
     mailFrom = config.Errors.MailFrom;
     maxErrorReportsPerHour = config.Errors.MaxErrorReportsPerHour;
     handleWrongClassException = config.Errors.HandleWrongClassException;
     mailSender = new SmtpMailSender();
 }
示例#15
0
 public ErrorHandler(IWebContext context, ISecurityManager security, InstallationManager installer,
                     EngineSection config, EditSection editConfig)
     : this(context, security, installer)
 {
     this.editConfig           = editConfig;
     action                    = config.Errors.Action;
     mailTo                    = config.Errors.MailTo;
     mailFrom                  = config.Errors.MailFrom;
     maxErrorReportsPerHour    = config.Errors.MaxErrorReportsPerHour;
     handleWrongClassException = config.Errors.HandleWrongClassException;
     mailSender                = new SmtpMailSender();
 }
示例#16
0
 public LanguageGatewaySelector(
     IPersister persister,
     IHost host,
     StructureBoundDictionaryCache <int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     ILanguageGateway languages,
     EngineSection config)
 {
     this.persister        = persister;
     this.host             = host;
     this.languagesCache   = languagesCache;
     this.descendantFinder = descendantFinder;
     this.languages        = languages;
     Enabled          = config.Globalization.Enabled;
     LanguagesPerSite = config.Globalization.LanguagesPerSite;
 }
示例#17
0
 public LanguageGatewaySelector(
     IPersister persister,
     IHost host,
     StructureBoundDictionaryCache<int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     ILanguageGateway languages,
     EngineSection config)
 {
     this.persister = persister;
     this.host = host;
     this.languagesCache = languagesCache;
     this.descendantFinder = descendantFinder;
     this.languages = languages;
     Enabled = config.Globalization.Enabled;
     LanguagesPerSite = config.Globalization.LanguagesPerSite;
 }
示例#18
0
        public void AutoInitialized_PluginInitializers_CanBeRemoved_UsingConfiguration_ByType()
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(typeof(PlugIn1).Assembly, new[] { typeof(PlugIn2) });

            EngineSection config = CreateConfiguration(null, new[]
            {
                new PluginInitializerElement {
                    Name = "ignored", Type = typeof(PlugIn2).AssemblyQualifiedName
                }
            });
            PluginBootstrapper invoker = new PluginBootstrapper(typeFinder, config);

            invoker.InitializePlugins(null, invoker.GetPluginDefinitions());

            Assert.That(PlugIn2.WasInitialized, Is.False);
        }
示例#19
0
        public void Plugins_CanBeInitialized_FromConfiguration()
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(typeof(PlugIn1).Assembly, new[] { typeof(PlugIn3) });

            EngineSection config = CreateConfiguration(new[]
            {
                new PluginInitializerElement {
                    Name = "ignored", Type = typeof(PlugIn3).AssemblyQualifiedName
                }
            }, null);
            PluginBootstrapper invoker = new PluginBootstrapper(typeFinder, config);

            invoker.InitializePlugins(null, invoker.GetPluginDefinitions());

            Assert.That(PlugIn3.WasInitialized, Is.True);
        }
示例#20
0
        public override void Execute()
        {
            if (engine == null)
            {
                engine = N2.Context.Current;
            }
            if (config == null)
            {
                config = ConfigurationManager.GetSection("n2/engine") as EngineSection;
            }

            if (config == null || !config.Scheduler.KeepAlive)
            {
                Repeat = Repeat.Once;
                return;
            }

            if (Debugger.IsAttached)
            {
                return;
            }

            try
            {
                Url url = Url.ServerUrl;
                if (url == null)
                {
                    return;
                }

                using (WebClient wc = new WebClient())
                {
                    wc.Headers["N2KeepAlive"] = "true";
                    url = url.SetPath(config.Scheduler.KeepAlivePath);
                    string response = wc.DownloadString(url);
                    Debug.WriteLine("Ping " + url + ": " + response);
                    logger.Debug("Ping " + url + ": " + response);
                }
            }
            catch (SecurityException ex)
            {
                Trace.TraceWarning("Stopping keep-alive after exception (probably medium trust environemtn): " + ex);
                Repeat = Repeat.Once;
            }
        }
示例#21
0
 public WebAppTypeFinder(TypeCache assemblyCache, EngineSection engineConfiguration)
 {
     this.assemblyCache    = assemblyCache;
     this.dynamicDiscovery = engineConfiguration.DynamicDiscovery;
     this.enableTypeCache  = engineConfiguration.Assemblies.EnableTypeCache;
     if (!string.IsNullOrEmpty(engineConfiguration.Assemblies.SkipLoadingPattern))
     {
         this.AssemblySkipLoadingPattern = new Regex(engineConfiguration.Assemblies.SkipLoadingPattern);
     }
     if (!string.IsNullOrEmpty(engineConfiguration.Assemblies.RestrictToLoadingPattern))
     {
         this.AssemblyRestrictToLoadingPattern = new Regex(engineConfiguration.Assemblies.RestrictToLoadingPattern);
     }
     logger.DebugFormat("EnableTypeCache: {0}, DynamicDiscovery: {1}, AssemblySkipLoadingPattern:{2}, AssemblyRestrictToLoadingPattern: {3}", enableTypeCache, dynamicDiscovery, AssemblySkipLoadingPattern, AssemblyRestrictToLoadingPattern);
     foreach (var assembly in engineConfiguration.Assemblies.AllElements)
     {
         logger.DebugFormat("Adding configured assembly {0}", assembly.Assembly);
         AssemblyNames.Add(assembly.Assembly);
     }
 }
示例#22
0
        protected void btnEnable_Click(object sender, EventArgs args)
        {
            try
            {
                System.Configuration.Configuration cfg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");

                EngineSection engineConfiguration = (EngineSection)cfg.GetSection("n2/engine");
                engineConfiguration.Globalization.Enabled = true;

                cfg.Save();

                cvLanguageRoots.IsValid = Engine.Resolve <ILanguageGateway>().GetAvailableLanguages().GetEnumerator().MoveNext();
                Initialize();
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                cvEnable.IsValid = false;
            }
        }
示例#23
0
        private void ActivateEngineSection(EngineSection section, bool activate)
        {
            switch (section)
            {
            case EngineSection.Main:
                ActivateEngines(_mainEngines, activate, ref _isMainEngineActive);
                break;

            case EngineSection.Right:
                ActivateEngines(_rightEngines, activate, ref _isRightEngineActive);
                break;

            case EngineSection.Left:
                ActivateEngines(_leftEngines, activate, ref _isLeftEngineActive);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(section), section, null);
            }
        }
示例#24
0
 public LanguageGateway(
     IPersister persister,
     IEditUrlManager editUrlManager,
     IDefinitionManager definitions,
     IHost host,
     ISecurityManager security,
     IWebContext context,
     StructureBoundDictionaryCache<int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     EngineSection config)
 {
     this.persister = persister;
     this.editUrlManager = editUrlManager;
     this.definitions = definitions;
     this.host = host;
     this.security = security;
     this.context = context;
     this.languagesCache = languagesCache;
     this.descendantFinder = descendantFinder;
     Enabled = config.Globalization.Enabled;
 }
示例#25
0
 public LanguageGateway(
     IPersister persister,
     IEditUrlManager editUrlManager,
     IDefinitionManager definitions,
     IHost host,
     ISecurityManager security,
     IWebContext context,
     StructureBoundDictionaryCache <int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     EngineSection config)
 {
     this.persister        = persister;
     this.editUrlManager   = editUrlManager;
     this.definitions      = definitions;
     this.host             = host;
     this.security         = security;
     this.context          = context;
     this.languagesCache   = languagesCache;
     this.descendantFinder = descendantFinder;
     Enabled = config.Globalization.Enabled;
 }
示例#26
0
 public EditableHierarchyBuilder(ISecurityManager security, EngineSection config)
 {
     this.security             = security;
     this.defaultContainerName = config.Definitions.DefaultContainerName;
 }
示例#27
0
 public MediumTrustTypeFinder(IWebContext webContext, EngineSection engineConfiguration)
     : base(webContext)
 {
     this.engineConfiguration = engineConfiguration;
 }
示例#28
0
 public CrossLinkDefinitionBuilder(DefinitionMap staticDefinitions, CrossLinkTypeFinder typeFinder, TransformerBase <IUniquelyNamed>[] transformers, EngineSection config)
     : base(staticDefinitions, typeFinder, transformers, config)
 {
 }
示例#29
0
 public PluginBootstrapper(ITypeFinder typeFinder, EngineSection config)
     : this(typeFinder)
 {
     addedInitializers = config.PluginInitializers.AllElements;
     removedInitializers = config.PluginInitializers.RemovedElements;
 }
		public MediumTrustTypeFinder(TypeCache assemblyCache, EngineSection engineConfiguration)
			: base(assemblyCache, engineConfiguration)
		{
			this.engineConfiguration = engineConfiguration;
		}
示例#31
0
 public PluginBootstrapper(ITypeFinder typeFinder, EngineSection config)
     : this(typeFinder)
 {
     addedInitializers   = config.PluginInitializers.AllElements;
     removedInitializers = config.PluginInitializers.RemovedElements;
 }
示例#32
0
 public DefinitionBuilder(DefinitionMap staticDefinitions, ITypeFinder typeFinder, EngineSection config)
 {
     this.staticDefinitions = staticDefinitions;
     this.typeFinder        = typeFinder;
     this.config            = config;
 }
示例#33
0
 public ErrorHandler(IWebContext context, ISecurityManager security, InstallationManager installer,
     IMailSender mailSender, EngineSection config, EditSection editConfig)
     : this(context, security, installer, config, editConfig)
 {
     this.mailSender = mailSender;
 }
示例#34
0
 public LanguageInterceptor(IPersister persister, IDefinitionManager definitions, IWebContext context, ILanguageGateway gateway, EngineSection config)
     : this(persister, definitions, context, gateway)
 {
     enabled = config.Globalization.Enabled;
     autoDeleteTranslations = config.Globalization.AutoDeleteTranslations;
 }
示例#35
0
 public ErrorHandler(IWebContext context, ISecurityManager security, InstallationManager installer,
                     IMailSender mailSender, EngineSection config, EditSection editConfig)
     : this(context, security, installer, config, editConfig)
 {
     this.mailSender = mailSender;
 }
示例#36
0
 public SafeContentRenderer(EngineSection config)
 {
     this.config = config;
     AllowHtml   = config.DefaultHtmlEscape;
 }
示例#37
0
 public MediumTrustTypeFinder(IWebContext webContext, EngineSection engineConfiguration)
     : base(webContext)
 {
     this.engineConfiguration = engineConfiguration;
 }
示例#38
0
 public MediumTrustTypeFinder(TypeCache assemblyCache, EngineSection engineConfiguration)
     : base(assemblyCache, engineConfiguration)
 {
     this.engineConfiguration = engineConfiguration;
 }
 public LanguageInterceptor(IPersister persister, ContentActivator activator, IWebContext context, ILanguageGateway gateway, EngineSection config)
     : this(persister, activator, context, gateway)
 {
     enabled = config.Globalization.Enabled;
     autoDeleteTranslations = config.Globalization.AutoDeleteTranslations;
 }
        public void Configure(IEngine engine, EngineSection engineConfig)
        {
            Environment.UseReflectionOptimizer = false;

            engine.Container.AddComponentInstance("n2.engine", typeof(IEngine), engine);
            engine.Container.AddComponentInstance("n2.engineConfig", typeof(EngineSection), engineConfig);
            engine.Container.AddComponent("n2.stateChanger", typeof(StateChanger), typeof(StateChanger));
            engine.Container.AddComponent("n2.webContext", typeof(IWebContext), typeof(AdaptiveContext));
            engine.Container.AddComponent("n2.typeFinder", typeof(ITypeFinder), typeof(MediumTrustTypeFinder));
            engine.Container.AddComponent("n2.adapterProvider", typeof(IContentAdapterProvider), typeof(ContentAdapterProvider));
            engine.Container.AddComponent("n2.pluginBootstrapper", typeof(IPluginBootstrapper), typeof(PluginBootstrapper));
            engine.Container.AddComponent("n2.classMappingGenerator", typeof(ClassMappingGenerator), typeof(ClassMappingGenerator));
            engine.Container.AddComponent("n2.configurationBuilder", typeof(ConfigurationBuilder), typeof(ConfigurationBuilder));
            engine.Container.AddComponent("n2.sessionFactorySource", typeof(IConfigurationBuilder), typeof(ConfigurationSource));
            engine.Container.AddComponent("n2.itemNotifier", typeof(IItemNotifier), typeof(NHInterceptor));
            engine.Container.AddComponent("n2.interceptor", typeof(IInterceptor), typeof(NHInterceptor));
            engine.Container.AddComponent("n2.sessionProvider", typeof(ISessionProvider), typeof(SessionProvider));
            engine.Container.AddComponent("n2.repository", typeof(IRepository<>), typeof(NHRepository<>));
            engine.Container.AddComponent("n2.repository", typeof(IRepository<,>), typeof(NHRepository<,>)); // obsolete
            engine.Container.AddComponent("n2.repository.nh", typeof(INHRepository<>), typeof(NHRepository<>));
            engine.Container.AddComponent("n2.versioning", typeof(IVersionManager), typeof(VersionManager));
            engine.Container.AddComponent("n2.persister", typeof(IPersister), typeof(ContentPersister));
            engine.Container.AddComponent("n2.itemFinder", typeof(IItemFinder), typeof(ItemFinder));
            //trail tracker
            engine.Container.AddComponent("n2.attributeExplorer", typeof(AttributeExplorer), typeof(AttributeExplorer));
            engine.Container.AddComponent("n2.editableHierarchyBuilder", typeof(EditableHierarchyBuilder), typeof(EditableHierarchyBuilder));
            engine.Container.AddComponent("n2.definitions", typeof(IDefinitionManager), typeof(DefinitionManager));
            engine.Container.AddComponent("n2.definitionBuilder", typeof(DefinitionBuilder), typeof(DefinitionBuilder));
            engine.Container.AddComponent("n2.host", typeof(IHost), typeof(Host));
            engine.Container.AddComponent("n2.sitesProvider", typeof(ISitesProvider), typeof(DynamicSitesProvider));
            engine.Container.AddComponent("n2.htmlFilter", typeof(HtmlFilter), typeof(HtmlFilter));
            engine.Container.AddComponent("n2.requestPathAnalyzer", typeof(RequestPathProvider), typeof(RequestPathProvider));
            engine.Container.AddComponent("n2.ajaxRequestDispatcher", typeof(AjaxRequestDispatcher), typeof(AjaxRequestDispatcher));
            engine.Container.AddComponent("n2.cacheManager", typeof(ICacheManager), typeof(CacheManager));
            engine.Container.AddComponent("n2.security", typeof(ISecurityManager), typeof(SecurityManager));
            engine.Container.AddComponent("n2.securityEnforcer", typeof(ISecurityEnforcer), typeof(SecurityEnforcer));
            engine.Container.AddComponent("n2.fileSystem", typeof(IFileSystem), typeof(VirtualPathFileSystem));
            engine.Container.AddComponent("n2.defaultDirectory", typeof(IDefaultDirectory), typeof(DefaultDirectorySelector));
            engine.Container.AddComponent("n2.directorySelector", typeof(IEditManager), typeof(EditManager));
            engine.Container.AddComponent("n2.edit.navigator", typeof(Navigator), typeof(Navigator));
            engine.Container.AddComponent("n2.treeSorter", typeof(ITreeSorter), typeof(TreeSorter));
            engine.Container.AddComponent("n2.edit.navigationSettings", typeof(NavigationSettings), typeof(NavigationSettings));
            engine.Container.AddComponent("n2.heart", typeof(IHeart), typeof(Heart));
            engine.Container.AddComponent("n2.integrity", typeof(IIntegrityManager), typeof(IntegrityManager));
            engine.Container.AddComponent("n2.integrityEnforcer", typeof(IIntegrityEnforcer), typeof(IntegrityEnforcer));
            engine.Container.AddComponent("n2.installer", typeof(InstallationManager), typeof(InstallationManager));
            engine.Container.AddComponent("n2.errorHandler", typeof(IErrorNotifier), typeof(ErrorHandler));

            engine.Container.AddComponent("n2.itemXmlWriter", typeof(ItemXmlWriter), typeof(ItemXmlWriter));
            engine.Container.AddComponent("n2.itemXmlReader", typeof(ItemXmlReader), typeof(ItemXmlReader));

            engine.Container.AddComponent("n2.exporter", typeof(Exporter), typeof(GZipExporter));
            engine.Container.AddComponent("n2.importer", typeof(Importer), typeof(GZipImporter));

            engine.Container.AddComponent("n2.worker", typeof(IWorker), typeof(AsyncWorker));

            engine.Container.AddComponent("n2.requestHandler", typeof(RequestLifeCycleHandler), typeof(RequestLifeCycleHandler));
            engine.Container.AddComponent("n2.pluginFinder", typeof(IPluginFinder), typeof(PluginFinder));
            engine.Container.AddComponent("n2.scheduler", typeof(Scheduler), typeof(Scheduler));

            engine.Container.AddComponentInstance("n2.serviceContainer", typeof(IServiceContainer), engine.Container);
            engine.Container.AddComponent("n2.serviceRegistrator", typeof(ServiceRegistrator), typeof(ServiceRegistrator));
        }
示例#41
0
        public void Configure(IEngine engine, EngineSection engineConfig)
        {
            Environment.UseReflectionOptimizer = false;

            engine.Container.AddComponentInstance("n2.engine", typeof(IEngine), engine);
            engine.Container.AddComponentInstance("n2.engineConfig", typeof(EngineSection), engineConfig);
            engine.Container.AddComponent("n2.stateChanger", typeof(StateChanger), typeof(StateChanger));
            engine.Container.AddComponent("n2.webContext", typeof(IWebContext), typeof(AdaptiveContext));
            engine.Container.AddComponent("n2.typeFinder", typeof(ITypeFinder), typeof(MediumTrustTypeFinder));
            engine.Container.AddComponent("n2.adapterProvider", typeof(IContentAdapterProvider), typeof(ContentAdapterProvider));
            engine.Container.AddComponent("n2.pluginBootstrapper", typeof(IPluginBootstrapper), typeof(PluginBootstrapper));
            engine.Container.AddComponent("n2.classMappingGenerator", typeof(ClassMappingGenerator), typeof(ClassMappingGenerator));
            engine.Container.AddComponent("n2.configurationBuilder", typeof(ConfigurationBuilder), typeof(ConfigurationBuilder));
            engine.Container.AddComponent("n2.sessionFactorySource", typeof(IConfigurationBuilder), typeof(ConfigurationSource));
            engine.Container.AddComponent("n2.itemNotifier", typeof(IItemNotifier), typeof(NHInterceptor));
            engine.Container.AddComponent("n2.interceptor", typeof(IInterceptor), typeof(NHInterceptor));
            engine.Container.AddComponent("n2.sessionProvider", typeof(ISessionProvider), typeof(SessionProvider));
            engine.Container.AddComponent("n2.repository", typeof(IRepository <>), typeof(NHRepository <>));
#pragma warning disable 612, 618
            engine.Container.AddComponent("n2.repository", typeof(IRepository <,>), typeof(NHRepository <,>));           // obsolete
            engine.Container.AddComponent("n2.repository.nh", typeof(INHRepository <>), typeof(NHRepository <>));
#pragma warning restore 612, 618
            engine.Container.AddComponent("n2.versioning", typeof(IVersionManager), typeof(VersionManager));
            engine.Container.AddComponent("n2.persister", typeof(IPersister), typeof(ContentPersister));
            engine.Container.AddComponent("n2.itemFinder", typeof(IItemFinder), typeof(ItemFinder));
            //trail tracker
            engine.Container.AddComponent("n2.attributeExplorer", typeof(AttributeExplorer), typeof(AttributeExplorer));
            engine.Container.AddComponent("n2.editableHierarchyBuilder", typeof(EditableHierarchyBuilder), typeof(EditableHierarchyBuilder));
            engine.Container.AddComponent("n2.definitions", typeof(IDefinitionManager), typeof(DefinitionManager));
            engine.Container.AddComponent("n2.definitionBuilder", typeof(DefinitionBuilder), typeof(DefinitionBuilder));
            engine.Container.AddComponent("n2.host", typeof(IHost), typeof(Host));
            engine.Container.AddComponent("n2.sitesProvider", typeof(ISitesProvider), typeof(DynamicSitesProvider));
            engine.Container.AddComponent("n2.htmlFilter", typeof(HtmlFilter), typeof(HtmlFilter));
            engine.Container.AddComponent("n2.requestPathAnalyzer", typeof(RequestPathProvider), typeof(RequestPathProvider));
            engine.Container.AddComponent("n2.ajaxRequestDispatcher", typeof(AjaxRequestDispatcher), typeof(AjaxRequestDispatcher));
            engine.Container.AddComponent("n2.cacheManager", typeof(ICacheManager), typeof(CacheManager));
            engine.Container.AddComponent("n2.security", typeof(ISecurityManager), typeof(SecurityManager));
            engine.Container.AddComponent("n2.securityEnforcer", typeof(ISecurityEnforcer), typeof(SecurityEnforcer));
            engine.Container.AddComponent("n2.fileSystem", typeof(IFileSystem), typeof(VirtualPathFileSystem));
            engine.Container.AddComponent("n2.defaultDirectory", typeof(IDefaultDirectory), typeof(DefaultDirectorySelector));
            engine.Container.AddComponent("n2.directorySelector", typeof(IEditManager), typeof(EditManager));
            engine.Container.AddComponent("n2.edit.navigator", typeof(Navigator), typeof(Navigator));
            engine.Container.AddComponent("n2.treeSorter", typeof(ITreeSorter), typeof(TreeSorter));
            engine.Container.AddComponent("n2.edit.navigationSettings", typeof(NavigationSettings), typeof(NavigationSettings));
            engine.Container.AddComponent("n2.heart", typeof(IHeart), typeof(Heart));
            engine.Container.AddComponent("n2.integrity", typeof(IIntegrityManager), typeof(IntegrityManager));
            engine.Container.AddComponent("n2.integrityEnforcer", typeof(IIntegrityEnforcer), typeof(IntegrityEnforcer));
            engine.Container.AddComponent("n2.installer", typeof(InstallationManager), typeof(InstallationManager));
            engine.Container.AddComponent("n2.errorHandler", typeof(IErrorNotifier), typeof(ErrorHandler));

            engine.Container.AddComponent("n2.itemXmlWriter", typeof(ItemXmlWriter), typeof(ItemXmlWriter));
            engine.Container.AddComponent("n2.itemXmlReader", typeof(ItemXmlReader), typeof(ItemXmlReader));

            engine.Container.AddComponent("n2.exporter", typeof(Exporter), typeof(GZipExporter));
            engine.Container.AddComponent("n2.importer", typeof(Importer), typeof(GZipImporter));

            engine.Container.AddComponent("n2.worker", typeof(IWorker), typeof(AsyncWorker));

            engine.Container.AddComponent("n2.requestHandler", typeof(RequestLifeCycleHandler), typeof(RequestLifeCycleHandler));
            engine.Container.AddComponent("n2.pluginFinder", typeof(IPluginFinder), typeof(PluginFinder));
            engine.Container.AddComponent("n2.scheduler", typeof(Scheduler), typeof(Scheduler));

            engine.Container.AddComponentInstance("n2.serviceContainer", typeof(IServiceContainer), engine.Container);
            engine.Container.AddComponent("n2.serviceRegistrator", typeof(ServiceRegistrator), typeof(ServiceRegistrator));
        }
示例#42
0
 public LanguageInterceptor(IPersister persister, ContentActivator activator, IWebContext context, ILanguageGateway gateway, EngineSection config)
     : this(persister, activator, context, gateway)
 {
     enabled = config.Globalization.Enabled;
     autoDeleteTranslations = config.Globalization.AutoDeleteTranslations;
 }
 public CrossLinkDefinitionBuilder(DefinitionMap staticDefinitions, CrossLinkTypeFinder typeFinder, TransformerBase<IUniquelyNamed>[] transformers, EngineSection config)
     : base(staticDefinitions, typeFinder, transformers, config)
 {
 }
示例#44
0
 public DefinitionBuilder(ITypeFinder typeFinder, EngineSection config)
     : this(DefinitionMap.Instance, typeFinder, config)
 {
 }
示例#45
0
 public SafeContentRenderer(EngineSection config)
 {
     this.config = config;
     AllowHtml = config.DefaultHtmlEscape;
 }