コード例 #1
0
ファイル: ContentChangeTracker.cs プロジェクト: Jobu/n2cms
        public ContentChangeTracker(IIndexer indexer, IPersister persister, IWorker worker, ConnectionMonitor connection, IErrorNotifier errors, DatabaseSection config)
        {
            this.indexer = indexer;
            this.persister = persister;
            this.worker = worker;
            this.errors = errors;
            this.async = config.Search.AsyncIndexing;
            this.handleErrors = config.Search.HandleErrors;

            RetryInterval = TimeSpan.FromMinutes(2);

            if(config.Search.Enabled)
            {
                connection.Online += delegate
                {
                    persister.ItemSaved += persister_ItemSaved;
                    persister.ItemMoving += persister_ItemMoving;
                    persister.ItemMoved += persister_ItemMoved;
                    persister.ItemCopied += persister_ItemCopied;
                    persister.ItemDeleted += persister_ItemDeleted;
                };
                connection.Offline += delegate
                {
                    persister.ItemSaved -= persister_ItemSaved;
                    persister.ItemMoving -= persister_ItemMoving;
                    persister.ItemMoved -= persister_ItemMoved;
                    persister.ItemCopied -= persister_ItemCopied;
                    persister.ItemDeleted -= persister_ItemDeleted;
                };
            }
        }
コード例 #2
0
        public LinkGenerator(IPersister persister, ConnectionMonitor connection, CacheWrapper cacheWrapper, IRequestLogger logger)
        {
            _logger = logger;

            // DON'T USE DISTRIBUTED CACHE FOR N2 internal data 
            // _urlCache = cacheService.GetCache<string>(new CacheConfig("LinkGenerator_urlCache", 1800));
            _urlCache = new HttpRuntimeCacheWrapper<string>("LinkGenerator_urlCache", cacheWrapper);
            _itemCache = new HttpRuntimeCacheWrapper<object>("LinkGenerator_urlCache_item", cacheWrapper);

            // hook up to persister events
            connection.Online += delegate
            {
                persister.ItemSaved += persister_ItemSaved;
                persister.ItemMoving += persister_ItemMoving;
                persister.ItemMoved += persister_ItemMoved;
                persister.ItemCopied += persister_ItemCopied;
                persister.ItemDeleted += persister_ItemDeleted;
                persister.FlushCache += persister_ItemInvalidated;
            };
            connection.Offline += delegate
            {
                persister.ItemSaved -= persister_ItemSaved;
                persister.ItemMoving -= persister_ItemMoving;
                persister.ItemMoved -= persister_ItemMoved;
                persister.ItemCopied -= persister_ItemCopied;
                persister.ItemDeleted -= persister_ItemDeleted;
                persister.FlushCache -= persister_ItemInvalidated;
            };
        }
コード例 #3
0
ファイル: XmlInstallationManager.cs プロジェクト: Biswo/n2cms
		public XmlInstallationManager(IHost host, IPersister persister, XmlContentRepository repository, ConnectionMonitor connectionContext, Importer importer, IWebContext webContext, ContentActivator activator)
            : base(connectionContext, importer, webContext, persister, activator)
        {
            this.host = host;
            this.persister = persister;
			this.repository = repository;
        }
コード例 #4
0
 public MongoInstallationManager(MongoDatabaseProvider database, IHost host, IPersister persister, ConnectionMonitor connectionContext, Importer importer, IWebContext webContext, ContentActivator activator)
     : base(connectionContext, importer, webContext, persister, activator)
 {
     this.database = database;
     this.host = host;
     this.persister = persister;
 }
コード例 #5
0
        public ContentChangeTracker(IAsyncIndexer indexer, IPersister persister, ConnectionMonitor connection, DatabaseSection config)
        {
            this.indexer = indexer;

            if (!config.Search.Enabled)
                return;
            if (!string.IsNullOrEmpty(config.Search.IndexOnMachineNamed) && config.Search.IndexOnMachineNamed != Environment.MachineName)
                return;

            connection.Online += delegate
            {
                IsMonitoring = true;
                persister.ItemSaved += persister_ItemSaved;
                persister.ItemMoving += persister_ItemMoving;
                persister.ItemMoved += persister_ItemMoved;
                persister.ItemCopied += persister_ItemCopied;
                persister.ItemDeleted += persister_ItemDeleted;
            };
            connection.Offline += delegate
            {
                IsMonitoring = false;
                persister.ItemSaved -= persister_ItemSaved;
                persister.ItemMoving -= persister_ItemMoving;
                persister.ItemMoved -= persister_ItemMoved;
                persister.ItemCopied -= persister_ItemCopied;
                persister.ItemDeleted -= persister_ItemDeleted;
            };
        }
コード例 #6
0
		public InstallationManager(ConnectionMonitor connectionContext, Importer importer, IWebContext webContext, IPersister persister, ContentActivator activator)
		{
			this.connectionContext = connectionContext;
			this.importer = importer;
			this.webContext = webContext;
			this.persister = persister;
			this.activator = activator;
		}
コード例 #7
0
		/// <summary>
		/// Initializes a new instance of the <see cref="VirtualFolderInitializer"/> class.
		/// </summary>
		/// <param name="host">The host.</param>
		/// <param name="persister">The persister.</param>
		/// <param name="fs">The fs.</param>
		/// <param name="virtualNodes">The virtual nodes.</param>
		/// <param name="editConfig">The edit config.</param>
		public VirtualFolderInitializer(IHost host, IPersister persister, IFileSystem fs, VirtualNodeFactory virtualNodes, ConnectionMonitor monitor, UploadFolderSource folderSource, FolderNodeProvider nodeProvider)
		{
			this.host = host;
			this.persister = persister;
			this.virtualNodes = virtualNodes;
			this.monitor = monitor;
			this.folderSource = folderSource;
			this.nodeProvider = nodeProvider;
		}
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VirtualFolderInitializer"/> class.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <param name="persister">The persister.</param>
 /// <param name="fs">The fs.</param>
 /// <param name="virtualNodes">The virtual nodes.</param>
 /// <param name="editConfig">The edit config.</param>
 public VirtualFolderInitializer(IHost host, IPersister persister, IFileSystem fs, VirtualNodeFactory virtualNodes, ConnectionMonitor monitor, EditSection editConfig, ImageSizeCache imageSizes, FolderNodeProvider nodeProvider)
 {
     this.host = host;
     this.persister = persister;
     this.virtualNodes = virtualNodes;
     this.monitor = monitor;
     this.folders = editConfig.UploadFolders;
     this.nodeProvider = nodeProvider;
 }
コード例 #9
0
ファイル: InstallationManager.cs プロジェクト: Jobu/n2cms
 public InstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext)
 {
     this.host = host;
     this.map = map;
     this.activator = activator;
     this.importer = importer;
     this.persister = persister;
     this.sessionProvider = sessionProvider;
     this.configurationBuilder = configurationBuilder;
     this.webContext = webContext;
     this.connectionContext = connectionContext;
 }
コード例 #10
0
		public InstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config)
		{
			this.host = host;
			this.map = map;
			this.activator = activator;
			this.importer = importer;
			this.persister = persister;
			this.sessionProvider = sessionProvider;
			this.configurationBuilder = configurationBuilder;
			this.webContext = webContext;
			this.connectionContext = connectionContext;
			this.isDatabaseFileSystemEnbled = config.Files.StorageLocation == FileStoreLocation.Database;
		}
コード例 #11
0
ファイル: Tracker.cs プロジェクト: steeintw/n2cms
        public Tracker(Persistence.IPersister persister, IRepository<ContentDetail> detailRepository, N2.Web.IUrlParser urlParser, ConnectionMonitor connections, N2.Web.IErrorNotifier errorHandler)
        {
            this.persister = persister;
            this.detailRepository = detailRepository;
            this.urlParser = urlParser;
            this.errorHandler = errorHandler;

            connections.Online += delegate
            {
                persister.ItemSaving += persister_ItemSaving;
            };
            connections.Offline += delegate
            {
                persister.ItemSaving -= persister_ItemSaving;
            };
        }
コード例 #12
0
ファイル: UrlParser.cs プロジェクト: LordDelacroix/n2cms
        public UrlParser(IPersister persister, IWebContext webContext, IHost host, N2.Plugin.ConnectionMonitor connections, HostSection config)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            IsOnline             = connections.IsConnected ?? true;
            connections.Online  += (s, a) => IsOnline = true;
            connections.Offline += (s, a) => IsOnline = false;

            this.persister  = persister;
            this.webContext = webContext;
            this.host       = host;

            ignoreExistingFiles = config.Web.IgnoreExistingFiles;
        }
コード例 #13
0
		public ContentPartTemplateProvider(
			ContentActivator activator, 
			DefinitionBuilder builder, 
			IProvider<HttpContextBase> httpContextProvider, 
			//IProvider<VirtualPathProvider> vppProvider, 
			//IRepository<ContentItem> repository, 
			ConnectionMonitor connection,
			IHost host)
		{
			_activator = activator;
			_builder = builder;
			_httpContextProvider = httpContextProvider;
			_connection = connection;
			//_vpp = vppProvider.Get();
			//_repository = repository;
			_host = host;
		}
コード例 #14
0
ファイル: Tracker.cs プロジェクト: faester/n2cms
        public Tracker(Persistence.IPersister persister, N2.Web.IUrlParser urlParser, ConnectionMonitor connections, N2.Web.IErrorNotifier errorHandler, Configuration.EditSection config)
		{
			this.repository = persister.Repository;
			this.urlParser = urlParser;
            this.errorHandler = errorHandler;

			if (config.LinkTracker.Enabled)
			{
				connections.Online += delegate
				{
					persister.ItemSaving += persister_ItemSaving;
				};
				connections.Offline += delegate
				{
					persister.ItemSaving -= persister_ItemSaving;
				};
			}
		}
コード例 #15
0
        public MultipleSitesInitializer(IPersister persister, IHost host, ISitesProvider sitesProvider, ConnectionMonitor context, HostSection config, IDefinitionManager ignored)
        {
            Debug.WriteLine("MultipleSitesInitializer");

            if (config.MultipleSites && config.DynamicSites)
            {
                context.Online += delegate
                {
                    host.AddSites(sitesProvider.GetSites());
                    persister.ItemSaved += delegate(object sender, ItemEventArgs e)
                    {
                        if (e.AffectedItem is ISitesSource)
                        {
                            IList<Site> sites = Host.ExtractSites(config);
                            sites = Host.Union(sites, sitesProvider.GetSites());

                            host.ReplaceSites(host.DefaultSite, sites);
                        }
                    };
                };
            }
        }
コード例 #16
0
        public ContentChangeTracker(IAsyncIndexer indexer, IPersister persister, ConnectionMonitor connection, DatabaseSection config)
        {
            this.indexer = indexer;

            if(config.Search.Enabled)
            {
                connection.Online += delegate
                {
                    persister.ItemSaved += persister_ItemSaved;
                    persister.ItemMoving += persister_ItemMoving;
                    persister.ItemMoved += persister_ItemMoved;
                    persister.ItemCopied += persister_ItemCopied;
                    persister.ItemDeleted += persister_ItemDeleted;
                };
                connection.Offline += delegate
                {
                    persister.ItemSaved -= persister_ItemSaved;
                    persister.ItemMoving -= persister_ItemMoving;
                    persister.ItemMoved -= persister_ItemMoved;
                    persister.ItemCopied -= persister_ItemCopied;
                    persister.ItemDeleted -= persister_ItemDeleted;
                };
            }
        }
コード例 #17
0
		public TraceReaderMessageProvider(N2.Configuration.ConfigurationManagerWrapper config, ConnectionMonitor monitor)
		{
			monitor.Online += monitor_Online;
			reportingLevel = config.Sections.Management.Collaboration.ErrorReportingLevel;
		}
コード例 #18
0
		public RavenInstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config, RavenConnectionProvider cp)
			: base(connectionContext, importer, webContext, persister, activator)
		{
			this.cp = cp;
		}
コード例 #19
0
 public MultipleSitesParser(IPersister persister, IWebContext webContext, IHost host, N2.Plugin.ConnectionMonitor connections, HostSection config)
     : base(persister, webContext, host, connections, config)
 {
 }