protected override AbstractObjectDefinition ParseInternal(XmlElement element, ParserContext parserContext)
        {
            ObjectDefinitionBuilder builder = BuildObjectDefinition(element, parserContext);
            ManagedList interceptors = null;
            XmlElement interceptorsElement = DomUtils.GetChildElementByTagName(element, "interceptors");

            if(interceptorsElement != null) {
                ChannelInterceptorParser interceptorParser = new ChannelInterceptorParser();
                interceptors = interceptorParser.ParseInterceptors(interceptorsElement, new ParserContext(parserContext.ParserHelper, builder.RawObjectDefinition));
            }
            if(interceptors == null) {
                interceptors = new ManagedList();
            }

            string datatypeAttr = element.GetAttribute("datatype");
            if(StringUtils.HasText(datatypeAttr)) {
                string[] datatypes = StringUtils.CommaDelimitedListToStringArray(datatypeAttr);
                RootObjectDefinition selectorDef = new RootObjectDefinition();
                selectorDef.ObjectTypeName = IntegrationNamespaceUtils.SELECTOR_PACKAGE + ".PayloadTypeSelector";
                selectorDef.ConstructorArgumentValues.AddGenericArgumentValue(datatypes);
                string selectorObjectName = parserContext.ReaderContext.RegisterWithGeneratedName(selectorDef);

                RootObjectDefinition interceptorDef = new RootObjectDefinition();
                interceptorDef.ObjectTypeName = IntegrationNamespaceUtils.CHANNEL_INTERCEPTOR_PACKAGE + ".MessageSelectingInterceptor";
                interceptorDef.ConstructorArgumentValues.AddGenericArgumentValue(new RuntimeObjectReference(selectorObjectName));
                string interceptorObjectName = parserContext.ReaderContext.RegisterWithGeneratedName(interceptorDef);

                interceptors.Add(new RuntimeObjectReference(interceptorObjectName));
            }

            builder.AddPropertyValue("interceptors", interceptors);
            return builder.ObjectDefinition;
        }
Beispiel #2
0
        protected override AbstractObjectDefinition ParseInternal(XmlElement element, ParserContext parserContext)
        {
            ObjectDefinitionBuilder builder      = BuildObjectDefinition(element, parserContext);
            ManagedList             interceptors = null;
            XmlElement interceptorsElement       = DomUtils.GetChildElementByTagName(element, "interceptors");

            if (interceptorsElement != null)
            {
                ChannelInterceptorParser interceptorParser = new ChannelInterceptorParser();
                interceptors = interceptorParser.ParseInterceptors(interceptorsElement, new ParserContext(parserContext.ParserHelper, builder.RawObjectDefinition));
            }
            if (interceptors == null)
            {
                interceptors = new ManagedList();
            }

            string datatypeAttr = element.GetAttribute("datatype");

            if (StringUtils.HasText(datatypeAttr))
            {
                string[]             datatypes   = StringUtils.CommaDelimitedListToStringArray(datatypeAttr);
                RootObjectDefinition selectorDef = new RootObjectDefinition();
                selectorDef.ObjectTypeName = IntegrationNamespaceUtils.SELECTOR_PACKAGE + ".PayloadTypeSelector";
                selectorDef.ConstructorArgumentValues.AddGenericArgumentValue(datatypes);
                string selectorObjectName = parserContext.ReaderContext.RegisterWithGeneratedName(selectorDef);

                RootObjectDefinition interceptorDef = new RootObjectDefinition();
                interceptorDef.ObjectTypeName = IntegrationNamespaceUtils.CHANNEL_INTERCEPTOR_PACKAGE + ".MessageSelectingInterceptor";
                interceptorDef.ConstructorArgumentValues.AddGenericArgumentValue(new RuntimeObjectReference(selectorObjectName));
                string interceptorObjectName = parserContext.ReaderContext.RegisterWithGeneratedName(interceptorDef);

                interceptors.Add(new RuntimeObjectReference(interceptorObjectName));
            }

            builder.AddPropertyValue("interceptors", interceptors);
            return(builder.ObjectDefinition);
        }