Various minor utility used by the parser.
Esempio n. 1
0
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            base.DoParse(element, builder);

            //TODO investigate setting of scope on client cache
            //builder.AddPropertyValue("Scope", "some value");

            //TODO check if .NET client has any 'data policy' settings.

            ParsingUtils.SetPropertyValue(element, builder, "name", "name");
            ParsingUtils.SetPropertyValue(element, builder, "pool-name", "poolName");

            String cacheRef = element.GetAttribute("cache-ref");

            // add cache reference (fallback to default if nothing is specified)
            builder.AddPropertyReference("cache", (StringUtils.HasText(cacheRef) ? cacheRef : "gemfire-cache"));


            // client region attributes
            String regionAttributesRef = element.GetAttribute("attributes-ref");

            if (StringUtils.HasText(regionAttributesRef))
            {
                ObjectDefinitionBuilder attrBuilder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(RegionAttributesFactoryObject));
                builder.AddPropertyReference("attributes", regionAttributesRef);
            }

            ManagedList interests   = new ManagedList();
            XmlNodeList subElements = element.ChildNodes;

            for (int i = 0; i < subElements.Count; i++)
            {
                XmlNode subElement = subElements.Item(i);
                if (subElement.NodeType == XmlNodeType.Element)
                {
                    string name = subElement.LocalName;
                    if ("cache-listener".Equals(name))
                    {
                        builder.AddPropertyValue("cacheListeners", ParseCacheListener(parserContext, (XmlElement)subElement, builder));
                    }
                    else if ("regex-interest".Equals(name))
                    {
                        interests.Add(ParseRegexInterest(parserContext, (XmlElement)subElement));
                    }
                    else if ("key-interest".Equals(name))
                    {
                        interests.Add(ParseKeyInterest(parserContext, (XmlElement)subElement));
                    }
                    else if ("all-keys-interest".Equals(name))
                    {
                        interests.Add(ParseAllKeysInterest(parserContext, (XmlElement)subElement));
                    }
                }
            }

            if (subElements.Count > 0)
            {
                builder.AddPropertyValue("interests", interests);
            }
        }
        private object ParseConnection(XmlElement subElement)
        {
            ObjectDefinitionBuilder definitionBuilder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(PoolConnection));

            ParsingUtils.SetPropertyValue(subElement, definitionBuilder, "host", "host");
            ParsingUtils.SetPropertyValue(subElement, definitionBuilder, "port", "port");
            return(definitionBuilder.ObjectDefinition);
        }
Esempio n. 3
0
        protected override void DoParse(XmlElement element, ObjectDefinitionBuilder builder)
        {
            base.DoParse(element, builder);
            ParsingUtils.SetPropertyValue(element, builder, "name", "name");
            String attr = element.GetAttribute("cache-ref");

            // add cache reference (fallback to default if nothing is specified)
            builder.AddPropertyReference("cache", (StringUtils.HasText(attr) ? attr : "gemfire-cache"));
        }
Esempio n. 4
0
        private object ParseRegexInterest(ParserContext parserContext, XmlElement subElement)
        {
            ObjectDefinitionBuilder regexInterestBuilder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(RegexInterest));

            ParseCommonInterestAttr(subElement, regexInterestBuilder);
            ParsingUtils.SetPropertyValue(subElement, regexInterestBuilder, "pattern", "regex");

            return(regexInterestBuilder.ObjectDefinition);
        }
 protected override void DoParse(XmlElement element, ObjectDefinitionBuilder builder)
 {
     base.DoParse(element, builder);
     ParsingUtils.SetPropertyValue(element, builder, "cache-xml-location", "CacheXml");
     ParsingUtils.SetPropertyValue(element, builder, "disconnect-on-close", "DisconnectOnClose");
     ParsingUtils.SetPropertyValue(element, builder, "keepalive-on-close", "KeepAliveOnClose");
     ParsingUtils.SetPropertyValue(element, builder, "distributed-system-name", "DistributedSystemName");
     ParsingUtils.SetPropertyReference(element, builder, "properties-ref", "Properties");
 }
Esempio n. 6
0
        private object ParseKeyInterest(ParserContext parserContext, XmlElement subElement)
        {
            ObjectDefinitionBuilder keyInterestBuilder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(KeyInterest));

            ParseCommonInterestAttr(subElement, keyInterestBuilder);

            Object key = ParsingUtils.ParseRefOrNestedObjectDeclaration(parserContext, subElement, keyInterestBuilder, "key-ref");

            keyInterestBuilder.AddConstructorArg(key);
            return(keyInterestBuilder.ObjectDefinition);
        }
 private void ParseSimpleProperties(XmlElement element, ObjectDefinitionBuilder builder)
 {
     ParsingUtils.SetPropertyValue(element, builder, "free-connection-timeout", "FreeConnectionTimeout");
     ParsingUtils.SetPropertyValue(element, builder, "idle-timeout", "IdleTimeout");
     ParsingUtils.SetPropertyValue(element, builder, "load-conditioning-interval", "LoadConditioningInterval");
     ParsingUtils.SetPropertyValue(element, builder, "max-connections", "MaxConnections");
     ParsingUtils.SetPropertyValue(element, builder, "min-connections", "MinConnections");
     ParsingUtils.SetPropertyValue(element, builder, "ping-interval", "PingInterval");
     ParsingUtils.SetPropertyValue(element, builder, "read-timeout", "ReadTimeout");
     ParsingUtils.SetPropertyValue(element, builder, "retry-attempts", "RetryAttempts");
     ParsingUtils.SetPropertyValue(element, builder, "server-group", "ServerGroup");
     ParsingUtils.SetPropertyValue(element, builder, "socket-buffer-size", "SocketBufferSize");
     ParsingUtils.SetPropertyValue(element, builder, "statistic-interval", "StatisticInterval");
     ParsingUtils.SetPropertyValue(element, builder, "subscription-ack-interval", "SubscriptionAckInterval");
     ParsingUtils.SetPropertyValue(element, builder, "subscription-enabled", "SubscriptionEnabled");
     ParsingUtils.SetPropertyValue(element, builder, "subscription-message-tracking-timeout", "SubscriptionMessageTrackingTimeout");
     ParsingUtils.SetPropertyValue(element, builder, "subscription-redundancy", "SubscriptionRedundancy");
 }
Esempio n. 8
0
 private void ParseCommonInterestAttr(XmlElement element, ObjectDefinitionBuilder builder)
 {
     ParsingUtils.SetPropertyValue(element, builder, "durable", "durable");
     ParsingUtils.SetPropertyValue(element, builder, "result-policy", "policy");
 }
Esempio n. 9
0
 private object ParseCacheListener(ParserContext parserContext, XmlElement element, ObjectDefinitionBuilder builder)
 {
     return(ParsingUtils.ParseRefOrNestedObjectDeclaration(parserContext, element, builder));
 }