Esempio n. 1
0
 /// <summary>Creates a new instance of the DefaultPersistenceManager.</summary>
 public ContentPersister(IRepository <int, ContentItem> itemRepository, INHRepository <int, ContentDetail> linkRepository,
                         IItemFinder finder)
 {
     this.itemRepository = itemRepository;
     this.linkRepository = linkRepository;
     this.finder         = finder;
 }
Esempio n. 2
0
 public VersionManager(IRepository<int, ContentItem> itemRepository, IItemFinder finder, StateChanger stateChanger, EditSection config)
 {
     this.itemRepository = itemRepository;
     this.finder = finder;
     this.stateChanger = stateChanger;
     maximumVersionsPerItem = config.Versions.MaximumPerItem;
 }
Esempio n. 3
0
 /// <summary>Stores dependencies</summary>
 /// <param name="finder"></param>
 /// <param name="persister"></param>
 /// <param name="activator"></param>
 public ContainerRepository(IPersister persister, IItemFinder finder, IHost host, ContentActivator activator)
 {
     this.finder    = finder;
     this.persister = persister;
     this.host      = host;
     this.activator = activator;
 }
Esempio n. 4
0
 public TrashHandler(IPersister persister, IItemFinder finder, ISecurityManager security, ContainerRepository <TrashContainerItem> container, StateChanger stateChanger)
 {
     this.finder       = finder;
     this.persister    = persister;
     this.security     = security;
     this.container    = container;
     this.stateChanger = stateChanger;
 }
 public LinkFixupScheduledAction(IItemFinder finder, IPersister persister, IHost host, IFileSystem fs, IEngine engine)
 {
     _finder = finder;
     _persister = persister;
     _host = host;
     _fs = fs;
     _rpp = engine.Resolve<RequestPathProvider>();
 }
 public LinkFixupScheduledAction(IItemFinder finder, IPersister persister, IHost host, IFileSystem fs, IEngine engine)
 {
     _finder    = finder;
     _persister = persister;
     _host      = host;
     _fs        = fs;
     _rpp       = engine.Resolve <RequestPathProvider>();
 }
Esempio n. 7
0
        public override void Execute()
        {
            this.definitions = Engine.Resolve <IDefinitionManager>();
            this.finder      = Engine.Resolve <IItemFinder>();

            foreach (var definition in definitions.GetDefinitions())
            {
                definition.NumberOfItems = finder.Where.Type.Eq(definition.ItemType).Count();
            }
        }
        public override void Execute()
        {
            this.definitions = Engine.Resolve<IDefinitionManager>();
            this.finder = Engine.Resolve<IItemFinder>();

            foreach (var definition in definitions.GetDefinitions())
            {
                definition.NumberOfItems = finder.Where.Type.Eq(definition.ItemType).Count();
            }
        }
 public ReplicationManager(
     IPersister persister,
     IItemFinder finder,
     IReplicationStorage repstore,
     IFileSystemFactory fileSystemFactory,
     DatabaseSection dataBaseSection,
     ISecurityManager security
     )
     : this(persister, finder, repstore, fileSystemFactory, dataBaseSection, security, null, null)
 {
     // needed to be able to execute N2 unit tests w/o additional dependecies
 }
Esempio n. 10
0
 public ReplicationManager(
     IPersister persister,
     IItemFinder finder,
     IReplicationStorage repstore,
     IFileSystemFactory fileSystemFactory,
     DatabaseSection dataBaseSection,
     ISecurityManager security
 )
     : this(persister, finder, repstore, fileSystemFactory, dataBaseSection, security, null, null)
 {
     // needed to be able to execute N2 unit tests w/o additional dependecies
 }
Esempio n. 11
0
        public Checkout(IItemFinder itemFinder, List<SpecialPrice> specials)
        {
            // guard clauses here to catch any issues early on if a null object is passed into this class
            if (itemFinder == null)
                throw new ArgumentNullException("itemFinder");
            if (specials == null)
                throw new ArgumentNullException("specials");

            _itemFinder = itemFinder;
            _specials = specials;

            _items = new List<Item>();
        }
Esempio n. 12
0
        public ItemBridge(ContentActivator activator, IItemFinder finder, IPersister persister, ISecurityManager security, IHost host, EditSection config)
        {
            this.security = security;
            this.activator = activator;
            this.finder = finder;
            this.persister = persister;
            this.host = host;
            this.editorUsernames = ToArray(config.Editors.Users);
            this.administratorUsernames = ToArray(config.Administrators.Users);

            Type configuredUserType = Type.GetType(config.Membership.UserType);
            if (configuredUserType == null) throw new ArgumentException("Couldn't create configured membership user type: " + config.Membership.UserType);
            if (!typeof(User).IsAssignableFrom(configuredUserType)) throw new ArgumentException("Configured membership user type '" + config.Membership.UserType + "' doesn't derive from '" + typeof(User).AssemblyQualifiedName + "'");
            this.userType = configuredUserType;
        }
Esempio n. 13
0
        public Checkout(IItemFinder itemFinder, List <SpecialPrice> specials)
        {
            // guard clauses here to catch any issues early on if a null object is passed into this class
            if (itemFinder == null)
            {
                throw new ArgumentNullException("itemFinder");
            }
            if (specials == null)
            {
                throw new ArgumentNullException("specials");
            }

            _itemFinder = itemFinder;
            _specials   = specials;

            _items = new List <Item>();
        }
Esempio n. 14
0
		public override void TestFixtureSetUp()
		{
			base.TestFixtureSetUp();

			CreateRootItem();
			SaveVersionAndUpdateRootItem();
			CreateStartPageBelow(rootItem);
			item1 = CreatePageBelow(startPage, 1);
			item2 = CreatePageBelow(startPage, 2);
			item3 = CreatePageBelow(startPage, 3);
			all = new[] { rootItem, startPage, item1, item2, item3 };

			engine.Resolve<IHost>().DefaultSite.RootItemID = rootItem.ID;
			engine.Resolve<IHost>().DefaultSite.StartPageID = startPage.ID;

			ISessionProvider sessionProvider = engine.Resolve<ISessionProvider>();
			finder = new ItemFinder(sessionProvider, new DefinitionMap());
		}
Esempio n. 15
0
        public override void SetUp()
        {
            base.SetUp();

            CreateRootItem();
            SaveVersionAndUpdateRootItem();
            CreateStartPageBelow(rootItem);
            item1 = CreatePageBelow(startPage, 1);
            item2 = CreatePageBelow(startPage, 2);
            item3 = CreatePageBelow(startPage, 3);

            engine.Resolve<IHost>().DefaultSite.RootItemID = rootItem.ID;
            engine.Resolve<IHost>().DefaultSite.StartPageID = startPage.ID;

            finder = new ItemFinder(sessionProvider, new DefinitionMap());

            sessionProvider.OpenSession.Session.Clear();
        }
Esempio n. 16
0
        public override void SetUp()
        {
            base.SetUp();

            CreateRootItem();
            SaveVersionAndUpdateRootItem();
            CreateStartPageBelow(rootItem);
            item1 = CreatePageBelow(startPage, 1);
            item2 = CreatePageBelow(startPage, 2);
            item3 = CreatePageBelow(startPage, 3);

            engine.Resolve <IHost>().DefaultSite.RootItemID  = rootItem.ID;
            engine.Resolve <IHost>().DefaultSite.StartPageID = startPage.ID;

            finder = new ItemFinder(sessionProvider, new DefinitionMap());

            sessionProvider.OpenSession.Session.Clear();
        }
Esempio n. 17
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            CreateRootItem();
            SaveVersionAndUpdateRootItem();
            CreateStartPageBelow(rootItem);
            item1 = CreatePageBelow(startPage, 1);
            item2 = CreatePageBelow(startPage, 2);
            item3 = CreatePageBelow(startPage, 3);
            all   = new[] { rootItem, startPage, item1, item2, item3 };

            engine.Resolve <IHost>().DefaultSite.RootItemID  = rootItem.ID;
            engine.Resolve <IHost>().DefaultSite.StartPageID = startPage.ID;

            ISessionProvider sessionProvider = engine.Resolve <ISessionProvider>();

            finder = new ItemFinder(sessionProvider, new DefinitionMap());
        }
Esempio n. 18
0
        public ItemBridge(ContentActivator activator, IItemFinder finder, IPersister persister, ISecurityManager security, IHost host, EditSection config)
        {
            this.security               = security;
            this.activator              = activator;
            this.finder                 = finder;
            this.persister              = persister;
            this.host                   = host;
            this.editorUsernames        = ToArray(config.Editors.Users);
            this.administratorUsernames = ToArray(config.Administrators.Users);

            Type configuredUserType = Type.GetType(config.Membership.UserType);

            if (configuredUserType == null)
            {
                throw new ArgumentException("Couldn't create configured membership user type: " + config.Membership.UserType);
            }
            if (!typeof(User).IsAssignableFrom(configuredUserType))
            {
                throw new ArgumentException("Configured membership user type '" + config.Membership.UserType + "' doesn't derive from '" + typeof(User).AssemblyQualifiedName + "'");
            }
            this.userType = configuredUserType;
        }
        public ReplicationManager(
            IPersister persister,
            IItemFinder finder,
            IReplicationStorage repstore,
            IFileSystemFactory fileSystemFactory,
            DatabaseSection dataBaseSection,
            ISecurityManager security,
            IIndexer indexer,    // optional
            IFlushable flushable // optional
            )
        {
            _repstore  = repstore;
            _security  = security;
            _persister = persister;
            _finder    = finder;
            _indexer   = indexer;
            _flushable = flushable;

            // detect sync direction from Database Type and double check via config
            string value = ConfigurationManager.AppSettings["XmlReplication"] ?? "false";

            IsSlave  = value.Equals("Slave", StringComparison.InvariantCultureIgnoreCase) & (dataBaseSection.Flavour == DatabaseFlavour.Xml);
            IsMaster = value.Equals("Master", StringComparison.InvariantCultureIgnoreCase) & !IsSlave;

            if (IsMaster || IsSlave)
            {
                // only initialize if replication is active
                var storageConfig = (FileSystemNamespace)Enum.Parse(typeof(FileSystemNamespace),
                                                                    ConfigurationManager.AppSettings["AzureReplicationStorageContainerName"] ??
                                                                    "ReplicationStorageDebug");

                _fileSystem = fileSystemFactory.Create(storageConfig);

                // constructing these dependencies to ensure same filesystem and simplify construction
                _replicationWriteLockManager = new ReplicationWriteLockManager(_fileSystem);
                _replicationReadLockManager  = new ReplicationReadLockManager(_fileSystem);
            }
            _replicationLogPath = "/_Xml_Sync_Log";
        }
Esempio n. 20
0
 public LanguageGateway(
     IPersister persister,
     IItemFinder finder,
     IEditUrlManager editUrlManager,
     IDefinitionManager definitions,
     IHost host,
     ISecurityManager security,
     IWebContext context,
     StructureBoundDictionaryCache<int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     EngineSection config)
 {
     this.persister = persister;
     this.finder = finder;
     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;
 }
Esempio n. 21
0
 public LanguageGateway(
     IPersister persister,
     IItemFinder finder,
     IEditUrlManager editUrlManager,
     IDefinitionManager definitions,
     IHost host,
     ISecurityManager security,
     IWebContext context,
     StructureBoundDictionaryCache <int, LanguageInfo[]> languagesCache,
     DescendantItemFinder descendantFinder,
     EngineSection config)
 {
     this.persister        = persister;
     this.finder           = finder;
     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;
 }
Esempio n. 22
0
 public DescendantItemFinder(IItemFinder finder, IDefinitionManager definitions)
 {
     this.finder      = finder;
     this.definitions = definitions;
 }
Esempio n. 23
0
 public NewsContainerController(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 24
0
 public FindingTextSearcher(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 25
0
 /// <summary>Creates a new instance of the <see cref="IntegrityManager"/>.</summary>
 /// <param name="definitions">The definition manager.</param>
 /// <param name="urlParser"></param>
 public IntegrityManager(Definitions.IDefinitionManager definitions, IItemFinder finder, Web.IUrlParser urlParser)
 {
     this.definitions = definitions;
     this.finder      = finder;
     this.urlParser   = urlParser;
 }
Esempio n. 26
0
 public FindingContentSearcher(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 27
0
 public VersionManager(IRepository<int, ContentItem> itemRepository, IItemFinder finder, StateChanger stateChanger)
 {
     this.itemRepository = itemRepository;
     this.finder = finder;
     this.stateChanger = stateChanger;
 }
Esempio n. 28
0
 public MyComponent(IItemFinder finder, IPersister persister)
 {
     this.finder = finder;
     this.persister = persister;
 }
Esempio n. 29
0
        public static ContentPersister SetupFakePersister(out FakeRepository <ContentItem> repository, out FakeRepository <ContentDetail> linkRepository, out IItemFinder finder)
        {
            repository     = new Fakes.FakeRepository <ContentItem>();
            linkRepository = new Fakes.FakeRepository <ContentDetail>();
            finder         = MockRepository.GenerateStub <N2.Persistence.Finder.IItemFinder>();

            return(new ContentPersister(repository, linkRepository, finder));
        }
Esempio n. 30
0
 public ContentQueryProvider(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 31
0
 public MyComponent(IItemFinder finder, IPersister persister)
 {
     this.finder    = finder;
     this.persister = persister;
 }
Esempio n. 32
0
 public BlogPostContainerController(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 33
0
        public static void Setup(out N2.Edit.IEditManager editor, out IVersionManager versions, IDefinitionManager definitions, IPersister persister, IItemFinder finder)
        {
            var changer = new N2.Edit.Workflow.StateChanger();

            versions = new VersionManager(persister.Repository, finder, changer, new N2.Configuration.EditSection());
            editor   = new EditManager(definitions, persister, versions, new SecurityManager(new ThreadContext(), new EditSection()), null, null, null, changer, new EditableHierarchyBuilder(new SecurityManager(new ThreadContext(), new EditSection()), new EngineSection()), null);
        }
Esempio n. 34
0
		public AppPathRebaser(IItemFinder finder, IPersister persister, IHost host)
		{
			this.finder = finder;
			this.persister = persister;
			this.host = host;
		}
Esempio n. 35
0
 public ItemModule(IBaseModuleService baseModuleService, IItemFinder itemFinder) : base("item", baseModuleService, itemFinder)
 {
     this.RequiresAuthorization();
 }
Esempio n. 36
0
 public FindingTextSearcher(IItemFinder finder)
 {
     this.finder = finder;
 }
Esempio n. 37
0
		/// <summary>Creates a new instance of the <see cref="IntegrityManager"/>.</summary>
		/// <param name="definitions">The definition manager.</param>
		/// <param name="finder"></param>
		/// <param name="urlParser"></param>
		public IntegrityManager(Definitions.IDefinitionManager definitions, IItemFinder finder, Web.IUrlParser urlParser)
		{
			this.definitions = definitions;
			this.finder = finder;
			this.urlParser = urlParser;
		}
Esempio n. 38
0
 public AppPathRebaser(IItemFinder finder, IPersister persister, IHost host)
 {
     this.finder    = finder;
     this.persister = persister;
     this.host      = host;
 }
Esempio n. 39
0
        public ReplicationManager(
            IPersister persister,
            IItemFinder finder,
            IReplicationStorage repstore,
            IFileSystemFactory fileSystemFactory,
            DatabaseSection dataBaseSection,
            ISecurityManager security,
            IIndexer indexer, // optional
            IFlushable flushable // optional
            )
        {
            _repstore = repstore;
            _security = security;
            _persister = persister;
            _finder = finder;
            _indexer = indexer;
            _flushable = flushable;

            // detect sync direction from Database Type and double check via config
            string value = ConfigurationManager.AppSettings["XmlReplication"] ?? "false";
            IsSlave = value.Equals("Slave", StringComparison.InvariantCultureIgnoreCase) & (dataBaseSection.Flavour == DatabaseFlavour.Xml);
            IsMaster = value.Equals("Master", StringComparison.InvariantCultureIgnoreCase) & !IsSlave;

            if (IsMaster || IsSlave)
            {
                // only initialize if replication is active
                var storageConfig = (FileSystemNamespace) Enum.Parse(typeof (FileSystemNamespace),
                               ConfigurationManager.AppSettings["AzureReplicationStorageContainerName"] ??
                               "ReplicationStorageDebug");

                _fileSystem = fileSystemFactory.Create(storageConfig);

                // constructing these dependencies to ensure same filesystem and simplify construction
                _replicationWriteLockManager = new ReplicationWriteLockManager(_fileSystem);
                _replicationReadLockManager = new ReplicationReadLockManager(_fileSystem);
            }
            _replicationLogPath = "/_Xml_Sync_Log";
        }
        private readonly IItemFinder _itemFinder; // TODO maybe create a new interface instead of extending deprecated one

        public ContentFinder(IItemFinder itemFinder)
        {
            _itemFinder = itemFinder;
        }