Search in sources :

Example 11 with MutablePassThroughMetadata

use of org.apache.aries.blueprint.mutable.MutablePassThroughMetadata in project camel by apache.

the class CamelNamespaceHandler method parseRouteContextNode.

private Metadata parseRouteContextNode(Element element, ParserContext context) {
    LOG.trace("Parsing RouteContext {}", element);
    // now parse the routes with JAXB
    Binder<Node> binder;
    try {
        binder = getJaxbContext().createBinder();
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
    }
    Object value = parseUsingJaxb(element, context, binder);
    if (!(value instanceof CamelRouteContextFactoryBean)) {
        throw new ComponentDefinitionException("Expected an instance of " + CamelRouteContextFactoryBean.class);
    }
    CamelRouteContextFactoryBean rcfb = (CamelRouteContextFactoryBean) value;
    String id = rcfb.getId();
    MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
    factory.setId(".camelBlueprint.passThrough." + id);
    factory.setObject(new PassThroughCallable<Object>(rcfb));
    MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
    factory2.setId(".camelBlueprint.factory." + id);
    factory2.setFactoryComponent(factory);
    factory2.setFactoryMethod("call");
    MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
    ctx.setId(id);
    ctx.setRuntimeClass(List.class);
    ctx.setFactoryComponent(factory2);
    ctx.setFactoryMethod("getRoutes");
    // must be lazy as we want CamelContext to be activated first
    ctx.setActivation(ACTIVATION_LAZY);
    // lets inject the namespaces into any namespace aware POJOs
    injectNamespaces(element, binder);
    LOG.trace("Parsing RouteContext done, returning {}", element, ctx);
    return ctx;
}
Also used : MutablePassThroughMetadata(org.apache.aries.blueprint.mutable.MutablePassThroughMetadata) MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException) CamelRouteContextFactoryBean(org.apache.camel.blueprint.CamelRouteContextFactoryBean) ExpressionNode(org.apache.camel.model.ExpressionNode) Node(org.w3c.dom.Node) JAXBException(javax.xml.bind.JAXBException)

Example 12 with MutablePassThroughMetadata

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

the class AuthorizationNsHandler method passThrough.

private MutablePassThroughMetadata passThrough(ParserContext pc, Object o) {
    MutablePassThroughMetadata meta = pc.createMetadata(MutablePassThroughMetadata.class);
    meta.setObject(o);
    return meta;
}
Also used : MutablePassThroughMetadata(org.apache.aries.blueprint.mutable.MutablePassThroughMetadata)

Example 13 with MutablePassThroughMetadata

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

the class BlueprintNamespaceHandler method createPassThrough.

private ComponentMetadata createPassThrough(ParserContext parserContext, String id, Object o) {
    MutablePassThroughMetadata pt = parserContext.createMetadata(MutablePassThroughMetadata.class);
    pt.setId(id);
    pt.setObject(o);
    return pt;
}
Also used : MutablePassThroughMetadata(org.apache.aries.blueprint.mutable.MutablePassThroughMetadata)

Example 14 with MutablePassThroughMetadata

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

the class TxNamespaceHandler method passThrough.

private MutablePassThroughMetadata passThrough(ParserContext pc, Object o) {
    MutablePassThroughMetadata meta = pc.createMetadata(MutablePassThroughMetadata.class);
    meta.setObject(o);
    return meta;
}
Also used : MutablePassThroughMetadata(org.apache.aries.blueprint.mutable.MutablePassThroughMetadata)

Aggregations

MutablePassThroughMetadata (org.apache.aries.blueprint.mutable.MutablePassThroughMetadata)14 MutableBeanMetadata (org.apache.aries.blueprint.mutable.MutableBeanMetadata)10 JAXBException (javax.xml.bind.JAXBException)7 ExpressionNode (org.apache.camel.model.ExpressionNode)7 ComponentDefinitionException (org.osgi.service.blueprint.container.ComponentDefinitionException)7 Node (org.w3c.dom.Node)7 UserResource (org.apache.cxf.jaxrs.model.UserResource)2 Metadata (org.osgi.service.blueprint.reflect.Metadata)2 Attr (org.w3c.dom.Attr)2 Element (org.w3c.dom.Element)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 CamelContextFactoryBean (org.apache.camel.blueprint.CamelContextFactoryBean)1 CamelEndpointFactoryBean (org.apache.camel.blueprint.CamelEndpointFactoryBean)1 CamelRestContextFactoryBean (org.apache.camel.blueprint.CamelRestContextFactoryBean)1 CamelRouteContextFactoryBean (org.apache.camel.blueprint.CamelRouteContextFactoryBean)1 DefaultCamelContextNameStrategy (org.apache.camel.impl.DefaultCamelContextNameStrategy)1 CamelContextNameStrategy (org.apache.camel.spi.CamelContextNameStrategy)1 KeyStoreParametersFactoryBean (org.apache.camel.util.blueprint.KeyStoreParametersFactoryBean)1 SSLContextParametersFactoryBean (org.apache.camel.util.blueprint.SSLContextParametersFactoryBean)1 SecureRandomParametersFactoryBean (org.apache.camel.util.blueprint.SecureRandomParametersFactoryBean)1