Search in sources :

Example 1 with SimpleBPBeanDefinitionParser

use of org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser in project cxf by apache.

the class CXFAPINamespaceHandler method parse.

@SuppressWarnings("deprecation")
public Metadata parse(Element element, ParserContext context) {
    String s = element.getLocalName();
    if ("bus".equals(s)) {
        // parse bus
        return new BusDefinitionParser().parse(element, context);
    } else if ("logging".equals(s)) {
        // logging feature
        return new SimpleBPBeanDefinitionParser(org.apache.cxf.feature.LoggingFeature.class).parse(element, context);
    } else if ("fastinfoset".equals(s)) {
        // fastinfosetfeature
        return new SimpleBPBeanDefinitionParser(FastInfosetFeature.class).parse(element, context);
    } else if ("workqueue".equals(s)) {
        return new SimpleBPBeanDefinitionParser(AutomaticWorkQueueImpl.class) {

            @Override
            public String getId(Element element, ParserContext context) {
                String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
                if (id == null) {
                    id = "cxf.workqueue.";
                    id += element.hasAttribute("name") ? element.getAttribute("name") : "def";
                }
                return id;
            }

            @Override
            protected void processNameAttribute(Element element, ParserContext ctx, MutableBeanMetadata bean, String val) {
                bean.addProperty("name", createValue(ctx, val));
            }
        }.parse(element, context);
    }
    return null;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) Element(org.w3c.dom.Element) ParserContext(org.apache.aries.blueprint.ParserContext) BusDefinitionParser(org.apache.cxf.bus.blueprint.BusDefinitionParser) SimpleBPBeanDefinitionParser(org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser) FastInfosetFeature(org.apache.cxf.feature.FastInfosetFeature)

Example 2 with SimpleBPBeanDefinitionParser

use of org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser in project tomee by apache.

the class CXFAPINamespaceHandler method parse.

@SuppressWarnings("deprecation")
public Metadata parse(Element element, ParserContext context) {
    String s = element.getLocalName();
    if ("bus".equals(s)) {
        // parse bus
        return new BusDefinitionParser().parse(element, context);
    } else if ("logging".equals(s)) {
        // logging feature
        return new SimpleBPBeanDefinitionParser(org.apache.cxf.feature.LoggingFeature.class).parse(element, context);
    } else if ("fastinfoset".equals(s)) {
        // fastinfosetfeature
        return new SimpleBPBeanDefinitionParser(FastInfosetFeature.class).parse(element, context);
    } else if ("workqueue".equals(s)) {
        return new SimpleBPBeanDefinitionParser(AutomaticWorkQueueImpl.class) {

            @Override
            public String getId(Element element, ParserContext context) {
                String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
                if (id == null) {
                    id = "cxf.workqueue.";
                    id += element.hasAttribute("name") ? element.getAttribute("name") : "def";
                }
                return id;
            }

            @Override
            protected void processNameAttribute(Element element, ParserContext ctx, MutableBeanMetadata bean, String val) {
                bean.addProperty("name", createValue(ctx, val));
            }
        }.parse(element, context);
    }
    return null;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) Element(org.w3c.dom.Element) ParserContext(org.apache.aries.blueprint.ParserContext) BusDefinitionParser(org.apache.cxf.bus.blueprint.BusDefinitionParser) SimpleBPBeanDefinitionParser(org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser) FastInfosetFeature(org.apache.cxf.feature.FastInfosetFeature)

Aggregations

ParserContext (org.apache.aries.blueprint.ParserContext)2 MutableBeanMetadata (org.apache.aries.blueprint.mutable.MutableBeanMetadata)2 BusDefinitionParser (org.apache.cxf.bus.blueprint.BusDefinitionParser)2 SimpleBPBeanDefinitionParser (org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser)2 FastInfosetFeature (org.apache.cxf.feature.FastInfosetFeature)2 Element (org.w3c.dom.Element)2