コード例 #1
0
ファイル: MDBArea.cs プロジェクト: saleyn/agni
        protected MDBArea(MDBDataStore store, IConfigSectionNode node) : base(store)
        {
            if (store == null || node == null || !node.Exists)
            {
                throw new MDBException(StringConsts.ARGUMENT_ERROR + "MDBArea.ctor(store==null|node==null|!Exists)");
            }


            ConfigAttribute.Apply(this, node);

            var dsnode = node[CommonApplicationLogic.CONFIG_DATA_STORE_SECTION];

            if (!dsnode.Exists)
            {
                throw new MDBException(StringConsts.MDB_AREA_CONFIG_NO_DATASTORE_ERROR.Args(node.RootPath));
            }

            m_PhysicalDataStore = FactoryUtils.MakeAndConfigure <ICRUDDataStoreImplementation>(dsnode, args: new [] { this });
        }
コード例 #2
0
ファイル: MDBPartitionedArea.cs プロジェクト: saleyn/agni
        internal MDBPartitionedArea(MDBDataStore store, IConfigSectionNode node) : base(store, node)
        {
            m_Name = node.AttrByName(Configuration.CONFIG_NAME_ATTR).ValueAsString(string.Empty).Trim();

            if (m_Name.IsNullOrWhiteSpace())
            {
                throw new MDBException(StringConsts.MDB_AREA_CONFIG_NO_NAME_ERROR);
            }

            if (m_Name.EqualsOrdIgnoreCase(CENTRAL_AREA_NAME))
            {
                throw new MDBException(StringConsts.MDB_AREA_CONFIG_INVALID_NAME_ERROR + "MDBPartitionedArea can not be called '{0}'".Args(CENTRAL_AREA_NAME));
            }

            m_Partitions = new List <Partition>();
            foreach (var pnode in node.Children.Where(cn => cn.IsSameName(CONFIG_PARTITION_SECTION)))
            {
                var partition = new Partition(this, pnode);
                m_Partitions.Add(partition);
            }

            if (m_Partitions.Count == 0)
            {
                throw new MDBException(StringConsts.MDB_AREA_CONFIG_NO_PARTITIONS_ERROR.Args(Name));
            }

            if (m_Partitions.Count != m_Partitions.Distinct().Count())
            {
                throw new MDBException(StringConsts.MDB_AREA_CONFIG_DUPLICATE_RANGES_ERROR.Args(Name));
            }

            m_Partitions.Sort();// sort by StartGDID

            for (var i = 0; i < m_Partitions.Count; i++)
            {
                m_Partitions[i].__setOrder(i);
            }
        }
コード例 #3
0
 internal MDBCentralArea(MDBDataStore store, IConfigSectionNode node) : base(store, node)
 {
     m_CentralPartition = new Partition(this, node);
 }