/// <summary>The do parse.</summary>
        /// <param name="element">The element.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <param name="builder">The builder.</param>
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            var parser = new ObjectDefinitionParserHelper(parserContext);
            var map    = parser.ParseMapElement(element, builder.RawObjectDefinition);

            builder.AddPropertyValue("SourceDictionary", map);
        }
Ejemplo n.º 2
0
        /// <summary>The do parse.</summary>
        /// <param name="element">The element.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <param name="builder">The builder.</param>
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            if (!NamespaceUtils.IsAttributeDefined(element, "name") && !NamespaceUtils.IsAttributeDefined(element, ID_ATTRIBUTE))
            {
                parserContext.ReaderContext.ReportFatalException(element, "Queue must have either id or name (or both)");
            }

            NamespaceUtils.AddConstructorArgValueIfAttributeDefined(builder, element, "name");

            if (!NamespaceUtils.IsAttributeDefined(element, "name"))
            {
                if (this.AttributeHasIllegalOverride(element, DURABLE_ATTRIBUTE, "false") ||
                    this.AttributeHasIllegalOverride(element, EXCLUSIVE_ATTRIBUTE, "true") ||
                    this.AttributeHasIllegalOverride(element, AUTO_DELETE_ATTRIBUTE, "true"))
                {
                    parserContext.ReaderContext.ReportFatalException(element, "Anonymous queue cannot specify durable='true', exclusive='false' or auto-delete='false'");
                    return;
                }
            }
            else
            {
                NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, DURABLE_ATTRIBUTE, false);
                NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, EXCLUSIVE_ATTRIBUTE, false);
                NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, AUTO_DELETE_ATTRIBUTE, false);
            }

            var queueArguments   = element.GetAttribute(ARGUMENTS);
            var argumentsElement = element.SelectChildElementByTagName(ARGUMENTS);

            if (argumentsElement != null)
            {
                var parser = new ObjectDefinitionParserHelper(parserContext);
                if (!string.IsNullOrWhiteSpace(queueArguments))
                {
                    parserContext.ReaderContext.ReportFatalException(element, "Queue may have either a queue-attributes attribute or element, but not both");
                }

                var map = parser.ParseMapElement(argumentsElement, builder.RawObjectDefinition);
                builder.AddConstructorArg(map);
            }

            if (!string.IsNullOrWhiteSpace(queueArguments))
            {
                builder.AddConstructorArgReference(queueArguments);
            }
        }
Ejemplo n.º 3
0
        /// <summary>The do parse.</summary>
        /// <param name="element">The element.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <param name="builder">The builder.</param>
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            var exchangeName = element.GetAttribute("name");

            builder.AddConstructorArg(new TypedStringValue(exchangeName));
            this.ParseBindings(element, parserContext, builder, exchangeName);

            NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, DURABLE_ATTRIBUTE, true);
            NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, AUTO_DELETE_ATTRIBUTE, false);

            var argumentsElement = element.SelectChildElementByTagName(ARGUMENTS_ELEMENT);

            if (argumentsElement != null)
            {
                var parser = new ObjectDefinitionParserHelper(parserContext);
                var map    = parser.ParseMapElementToTypedDictionary(argumentsElement, builder.RawObjectDefinition);

                builder.AddConstructorArg(map);
            }
        }