Exemplo n.º 1
0
        public AttributeIndex(ArrayList attribList, string cacheName, string type, TypeInfoMap typeMap)
        {
            _indexTable = new Hashtable();
            _cacheName = cacheName;
            _type = type;
            _typeMap = typeMap;

            Initialize(attribList);
        }
Exemplo n.º 2
0
        internal void GetTypeInfoMap(Connection connection)
        {
            GetTypeInfoMapCommand command = new GetTypeInfoMapCommand(false);

            Request request = new Request(false, _broker.OperationTimeOut);
            Address ipAddress = connection.ServerAddress;
            request.AddCommand(ipAddress, command);
            _broker.ExecuteRequest(request, connection, true, true);
            CommandResponse res = request.Response;
            res.ParseResponse();

            this.TypeMap = res.TypeMap;
        }
Exemplo n.º 3
0
        internal virtual bool Initialize()
        {
            bool indexedDefined = false;
            if (_props != null)
            {
                if (_props.Contains("index-for-all"))
                {
                    _indexForAll = Convert.ToBoolean(_props["index-for-all"]);
                    indexedDefined = _indexForAll;
                }

                if (_props.Contains("index-classes"))
                {
                    Hashtable indexClasses = _props["index-classes"] as Hashtable;
                    _typeMap = new TypeInfoMap(indexClasses);

                    IDictionaryEnumerator ie = indexClasses.GetEnumerator();
                    while (ie.MoveNext())
                    {
                        Hashtable innerProps = ie.Value as Hashtable;
                        string typename = "";

                        if (innerProps != null)
                        {
                            typename = (string)innerProps["id"];
                            ArrayList attribList = new ArrayList();
                            IDictionaryEnumerator en = innerProps.GetEnumerator();
                            while (en.MoveNext())
                            {
                                Hashtable attribs = en.Value as Hashtable;
                                if (attribs != null)
                                {
                                    IDictionaryEnumerator ide = attribs.GetEnumerator();
                                    while (ide.MoveNext())
                                    {
                                        Hashtable attrib = ide.Value as Hashtable;
                                        if (attrib != null)
                                        {
                                            attribList.Add(attrib["id"] as string);
                                        }
                                    }
                                }
                            }

                            //attrib level index.
                            if (attribList.Count > 0)
                            {
                                _indexMap[typename] = new AttributeIndex(attribList, _cacheName, typename, _typeMap);
                            }
                            //just a key level index.
                            else
                                _indexMap[typename] = new TypeIndex(typename, _indexForAll);
                            indexedDefined = true;
                        }
                    }
                }
            }
            else
            {
                _indexMap["default"] = new VirtualQueryIndex(_cache);
            }
            if (indexedDefined)
            {
                _asyncProcessor = new AsyncProcessor(_cache.Context.NCacheLog);
                _asyncProcessor.Start();
            }
            return indexedDefined;
        }