Example #1
0
        public virtual void Initialize(ArrayList attribList)
        {
            IIndexStore store;

            if (attribList != null && attribList.Count > 0)
            {
                IEnumerator e = attribList.GetEnumerator();

                while (e.MoveNext())
                {
                    string attribName = e.Current.ToString();
                    if (commonRbStores != null && commonRbStores.ContainsKey(_type + ":" + attribName))
                    {
                        IIndexStore commonStore = (IIndexStore)commonRbStores[_type + ":" + attribName];
                        IndexTable.Add(attribName, commonStore);
                    }
                    else
                    {
                        String storeDataType = String.Empty;
                        if (_typeMap != null)
                        {
                            storeDataType = _typeMap.GetAttributeType(this.TypeName, attribName);
                        }
                        Type genericType = typeof(RBStore <>).MakeGenericType(Common.MemoryUtil.GetDataType(storeDataType));
                        store = (IIndexStore)Activator.CreateInstance(genericType, new object[] { CacheName, storeDataType, attribName, _haveDuplicateKeys });
                        IndexTable.Add(attribName, store);
                    }
                }
                if (commonRbStores != null && commonRbStores.ContainsKey(TAG_INDEX_KEY))
                {
                    store = (IIndexStore)commonRbStores[TAG_INDEX_KEY];
                    IndexTable.Add(TAG_INDEX_KEY, store);
                }
                else
                {
                    Type genericType = typeof(RBStore <>).MakeGenericType(Common.MemoryUtil.GetDataType(Common.MemoryUtil.Net_System_String));
                    store = (IIndexStore)Activator.CreateInstance(genericType, new object[] { CacheName, Common.MemoryUtil.Net_System_String, TAG_INDEX_KEY, _haveDuplicateKeys });
                    IndexTable.Add(TAG_INDEX_KEY, store);
                }
            }

            if (!IndexTable.ContainsKey(TAG_INDEX_KEY) && commonRbStores != null && commonRbStores.ContainsKey(TAG_INDEX_KEY))
            {
                store = (IIndexStore)commonRbStores[TAG_INDEX_KEY];
                IndexTable.Add(TAG_INDEX_KEY, store);
            }
        }
Example #2
0
        public virtual void Initialize(ArrayList attribList)
        {
            IIndexStore store = null;

            if (attribList != null && attribList.Count > 0)
            {
                IEnumerator e = attribList.GetEnumerator();

                while (e.MoveNext())
                {
                    string attribName    = e.Current.ToString();
                    String storeDataType = String.Empty;
                    if (this._typeMap != null)
                    {
                        storeDataType = _typeMap.GetAttributeType(this.TypeName, attribName);
                    }
                    Type genericType = typeof(RBStore <>).MakeGenericType(Common.MemoryUtil.GetDataType(storeDataType));
                    store = (IIndexStore)Activator.CreateInstance(genericType, new object[] { _cacheName, storeDataType, attribName });
                    _indexTable.Add(attribName, store);
                }
            }
        }
Example #3
0
        public virtual void Initialize(ArrayList attribList)
        {
            IIndexStore store = null;

            if (attribList != null && attribList.Count > 0)
            {
                IEnumerator e = attribList.GetEnumerator();

                while (e.MoveNext())
                {
                    string attribName = e.Current.ToString();

                    String storeDataType = String.Empty;
                    if (this._typeMap != null)
                    {
                        storeDataType = _typeMap.GetAttributeType(this.TypeName, attribName);
                    }

                    store = new RBStore(_cacheName, storeDataType);
                    _indexTable.Add(attribName, store);
                }
            }
        }
Example #4
0
        public void createSharedTypeAttributeIndex(Hashtable knownSharedClasses, Hashtable indexedClasses)
        {
            Hashtable commonRBStore = new Hashtable();
            Dictionary <string, AttributeIndex> sharedAttributeIndexMap = new Dictionary <string, AttributeIndex>();
            IEnumerator iteouterSharedTypes = knownSharedClasses.GetEnumerator();
            Type        genericType         = typeof(RBStore <>).MakeGenericType(Common.MemoryUtil.GetDataType(Common.MemoryUtil.Net_System_String));
            IIndexStore store = (IIndexStore)Activator.CreateInstance(genericType, new object[] { _cacheName, Common.MemoryUtil.Net_System_String, this.TAG_INDEX_KEY });

            commonRBStore.Add(this.TAG_INDEX_KEY, store);

            while (iteouterSharedTypes.MoveNext())
            {
                DictionaryEntry outerEntry      = (DictionaryEntry)iteouterSharedTypes.Current;
                Hashtable       outerEntryValue = (Hashtable)outerEntry.Value;
                string          name            = (string)outerEntryValue["name"];
                string[]        temp            = StringHelperClass.StringSplit(name, ":", true);
                string          outerTypeName   = temp[0];
                //Create Attribute Index even if not queryindexed
                sharedAttributeIndexMap.Add(outerTypeName, new AttributeIndex(_cacheName, outerTypeName));

                sharedAttributeIndexMap[outerTypeName].TypeMap = _typeMap;

                if (indexedClasses.Count > 0 && isQueryindexed(outerTypeName, indexedClasses))
                {
                    Hashtable outerTypeAttributes = (Hashtable)outerEntryValue["attribute"];
                    if (outerTypeAttributes != null)
                    {
                        IEnumerator iteOuterTypeAttribute = outerTypeAttributes.GetEnumerator();
                        while (iteOuterTypeAttribute.MoveNext())
                        {
                            DictionaryEntry tempEntry          = (DictionaryEntry)iteOuterTypeAttribute.Current;
                            Hashtable       outerAttributeMeta = (Hashtable)tempEntry.Value;

                            string outerOrderNo       = (string)outerAttributeMeta["order"];
                            string outerAttributeName = (string)outerAttributeMeta["name"];
                            if (isQueryindexedAttribute(outerTypeName, outerAttributeName, indexedClasses))
                            {
                                IEnumerator iteInnerSharedTypes = knownSharedClasses.GetEnumerator();
                                while (iteInnerSharedTypes.MoveNext())
                                {
                                    DictionaryEntry innerEntry = (DictionaryEntry)iteInnerSharedTypes.Current;

                                    Hashtable innerEntryValue = (Hashtable)innerEntry.Value;
                                    string    name1           = (string)innerEntryValue["name"];
                                    string[]  temp1           = StringHelperClass.StringSplit(name1, ":", true);
                                    string    innerTypeName   = temp1[0];
                                    if (!outerTypeName.Equals(innerTypeName) && isQueryindexed(innerTypeName, indexedClasses))
                                    {
                                        Hashtable innerTypeAttributes = (Hashtable)((Hashtable)innerEntry.Value)["attribute"];

                                        IEnumerator iteInnerTypeAttribute = innerTypeAttributes.GetEnumerator();
                                        while (iteInnerTypeAttribute.MoveNext())
                                        {
                                            DictionaryEntry tempEntry1         = (DictionaryEntry)iteInnerTypeAttribute.Current;
                                            Hashtable       innerAttributeMeta = (Hashtable)tempEntry1.Value;

                                            string innerorderNo       = (string)innerAttributeMeta["order"];
                                            string innerAttributeName = (string)innerAttributeMeta["name"];
                                            if (innerorderNo.Equals(outerOrderNo) && isQueryindexedAttribute(innerTypeName, innerAttributeName, indexedClasses))
                                            {
                                                if (commonRBStore.ContainsKey(outerTypeName + ":" + outerAttributeName))
                                                {
                                                    if (!commonRBStore.ContainsKey(innerTypeName + ":" + innerAttributeName))
                                                    {
                                                        IIndexStore commonRB = (IIndexStore)commonRBStore[outerTypeName + ":" + outerAttributeName];
                                                        commonRBStore.Add(innerTypeName + ":" + innerAttributeName, commonRB);
                                                    }
                                                    break;
                                                }
                                                else
                                                {
                                                    String storeDataType = TypeInfoMap.GetAttributeType(innerTypeName, innerAttributeName);
                                                    genericType = typeof(RBStore <>).MakeGenericType(Common.MemoryUtil.GetDataType(storeDataType));
                                                    IIndexStore commonRB = (IIndexStore)Activator.CreateInstance(genericType, new object[] { _cacheName, storeDataType, innerAttributeName });

                                                    commonRBStore.Add(innerTypeName + ":" + innerAttributeName, commonRB);
                                                    commonRBStore.Add(outerTypeName + ":" + outerAttributeName, commonRB);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }


            if (sharedAttributeIndexMap.Count > 0)
            {
                IEnumerator iteSharedIndexMap = sharedAttributeIndexMap.GetEnumerator();
                while (iteSharedIndexMap.MoveNext())
                {
                    List <AttributeIndex> sharedTypes = new List <AttributeIndex>();
                    System.Collections.Generic.KeyValuePair <string, AttributeIndex> outerEntry = (System.Collections.Generic.KeyValuePair <string, AttributeIndex>)iteSharedIndexMap.Current;
                    string         outerTypeName    = (string)outerEntry.Key;
                    AttributeIndex outerSharedIndex = (AttributeIndex)outerEntry.Value;
                    foreach (System.Collections.Generic.KeyValuePair <string, AttributeIndex> innerEntry in sharedAttributeIndexMap)
                    {
                        string innerTypeName = (string)innerEntry.Key;
                        if (!innerTypeName.Equals(outerTypeName))
                        {
                            AttributeIndex innerSharedIndex = (AttributeIndex)innerEntry.Value;
                            sharedTypes.Add(innerSharedIndex);
                        }
                    }
                    outerSharedIndex.CommonRBStores = commonRBStore;
                    _sharedAttributeIndex.Add(outerTypeName, outerSharedIndex);
                }
            }
        }