Search in sources :

Example 81 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project aries by apache.

the class Aries1503aNamespaceHandler method parse.

@Override
public Metadata parse(Element element, ParserContext context) {
    MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
    metadata.setProcessor(true);
    metadata.setId("aries-1503");
    metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
    metadata.addArgument(new PassThroughMetadata() {

        @Override
        public Object getObject() {
            return "ARIES-1503";
        }

        @Override
        public String getId() {
            return "aries-1503-arg";
        }

        @Override
        public int getActivation() {
            return 0;
        }

        @Override
        public List<String> getDependsOn() {
            return null;
        }
    }, null, 0);
    metadata.setRuntimeClass(String.class);
    return metadata;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) PassThroughMetadata(org.apache.aries.blueprint.PassThroughMetadata) List(java.util.List)

Example 82 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project aries by apache.

the class NSHandlerSeven method parse.

// process elements
public Metadata parse(Element element, ParserContext context) {
    Metadata retval = null;
    if (element.getLocalName().equals(ELT_NAME)) {
        final String id = element.getAttributeNS(NSURI, ATTRIB_ID);
        MutableBeanMetadata bm = context.createMetadata(MutableBeanMetadata.class);
        bm.setId(id);
        bm.setScope("PROTOTYPE");
        bm.setClassName(TestBean.class.getName());
        retval = bm;
    }
    return retval;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) Metadata(org.osgi.service.blueprint.reflect.Metadata) PassThroughMetadata(org.apache.aries.blueprint.PassThroughMetadata) BeanMetadata(org.osgi.service.blueprint.reflect.BeanMetadata) RefMetadata(org.osgi.service.blueprint.reflect.RefMetadata) ComponentMetadata(org.osgi.service.blueprint.reflect.ComponentMetadata) MutableRefMetadata(org.apache.aries.blueprint.mutable.MutableRefMetadata) MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata)

Example 83 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata 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)

Example 84 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project tomee by apache.

the class BusDefinitionParser method parse.

public Metadata parse(Element element, ParserContext context) {
    String bname = element.hasAttribute("bus") ? element.getAttribute("bus") : "cxf";
    String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
    MutableBeanMetadata cxfBean = getBus(context, bname);
    parseAttributes(element, context, cxfBean);
    parseChildElements(element, context, cxfBean);
    context.getComponentDefinitionRegistry().removeComponentDefinition(bname);
    if (!StringUtils.isEmpty(id)) {
        cxfBean.addProperty("id", createValue(context, id));
    }
    return cxfBean;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata)

Example 85 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project cxf by apache.

the class JettyServerEngineFactoryParser method parse.

public Metadata parse(Element element, ParserContext context) {
    // Endpoint definition
    MutableBeanMetadata ef = context.createMetadata(MutableBeanMetadata.class);
    if (!StringUtils.isEmpty(getIdOrName(element))) {
        ef.setId(getIdOrName(element));
    } else {
        ef.setId("jetty.engine.factory-holder-" + UUID.randomUUID().toString());
    }
    ef.setRuntimeClass(JettyHTTPServerEngineFactoryHolder.class);
    try {
        // Print the DOM node
        String xmlString = StaxUtils.toString(element);
        ef.addProperty("parsedElement", createValue(context, xmlString));
        ef.setInitMethod("init");
        ef.setActivation(ComponentMetadata.ACTIVATION_EAGER);
        ef.setDestroyMethod("destroy");
        // setup the EngineConnector
        List<Element> engines = DOMUtils.getChildrenWithName(element, HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT, "engine");
        ef.addProperty("connectorMap", parseEngineConnector(engines, ef, context));
        ef.addProperty("handlersMap", parseEngineHandlers(engines, ef, context));
        return ef;
    } catch (Exception e) {
        throw new RuntimeException("Could not process configuration.", e);
    }
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) Element(org.w3c.dom.Element)

Aggregations

MutableBeanMetadata (org.apache.aries.blueprint.mutable.MutableBeanMetadata)96 Element (org.w3c.dom.Element)23 Node (org.w3c.dom.Node)20 MutablePassThroughMetadata (org.apache.aries.blueprint.mutable.MutablePassThroughMetadata)19 Metadata (org.osgi.service.blueprint.reflect.Metadata)19 MutableRefMetadata (org.apache.aries.blueprint.mutable.MutableRefMetadata)18 ComponentDefinitionException (org.osgi.service.blueprint.container.ComponentDefinitionException)18 MutableCollectionMetadata (org.apache.aries.blueprint.mutable.MutableCollectionMetadata)17 BeanMetadata (org.osgi.service.blueprint.reflect.BeanMetadata)16 ComponentMetadata (org.osgi.service.blueprint.reflect.ComponentMetadata)15 MutableValueMetadata (org.apache.aries.blueprint.mutable.MutableValueMetadata)13 RefMetadata (org.osgi.service.blueprint.reflect.RefMetadata)12 NodeList (org.w3c.dom.NodeList)11 MutableMapMetadata (org.apache.aries.blueprint.mutable.MutableMapMetadata)10 PassThroughMetadata (org.apache.aries.blueprint.PassThroughMetadata)9 JAXBException (javax.xml.bind.JAXBException)8 CollectionMetadata (org.osgi.service.blueprint.reflect.CollectionMetadata)8 ValueMetadata (org.osgi.service.blueprint.reflect.ValueMetadata)8 ExpressionNode (org.apache.camel.model.ExpressionNode)7 Attr (org.w3c.dom.Attr)7