use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project cxf by apache.
the class ServerFactoryBeanDefinitionParser method parse.
@Override
public Metadata parse(Element element, ParserContext context) {
MutableBeanMetadata bean = (MutableBeanMetadata) super.parse(element, context);
bean.setInitMethod("init");
bean.setDestroyMethod("destroy");
// We don't really want to delay the registration of our Server
bean.setActivation(ComponentMetadata.ACTIVATION_EAGER);
return bean;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project camel by apache.
the class CamelNamespaceHandler method parseRestContextNode.
private Metadata parseRestContextNode(Element element, ParserContext context) {
LOG.trace("Parsing RestContext {}", element);
// now parse the rests 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 CamelRestContextFactoryBean)) {
throw new ComponentDefinitionException("Expected an instance of " + CamelRestContextFactoryBean.class);
}
CamelRestContextFactoryBean rcfb = (CamelRestContextFactoryBean) 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("getRests");
// 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 RestContext done, returning {}", element, ctx);
return ctx;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project camel by apache.
the class CamelNamespaceHandler method parseKeyStoreParametersNode.
private Metadata parseKeyStoreParametersNode(Element element, ParserContext context) {
LOG.trace("Parsing KeyStoreParameters {}", element);
// now parse the key store parameters 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 KeyStoreParametersFactoryBean)) {
throw new ComponentDefinitionException("Expected an instance of " + KeyStoreParametersFactoryBean.class);
}
KeyStoreParametersFactoryBean kspfb = (KeyStoreParametersFactoryBean) value;
String id = kspfb.getId();
MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
factory.setId(".camelBlueprint.passThrough." + id);
factory.setObject(new PassThroughCallable<Object>(kspfb));
MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
factory2.setId(".camelBlueprint.factory." + id);
factory2.setFactoryComponent(factory);
factory2.setFactoryMethod("call");
factory2.setInitMethod("afterPropertiesSet");
factory2.setDestroyMethod("destroy");
factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
ctx.setId(id);
ctx.setRuntimeClass(KeyStoreParameters.class);
ctx.setFactoryComponent(factory2);
ctx.setFactoryMethod("getObject");
// must be lazy as we want CamelContext to be activated first
ctx.setActivation(ACTIVATION_LAZY);
LOG.trace("Parsing KeyStoreParameters done, returning {}", ctx);
return ctx;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project camel by apache.
the class CamelNamespaceHandler method registerBean.
protected void registerBean(ParserContext context, String contextId, AbstractCamelFactoryBean<?> fact) {
String id = fact.getId();
fact.setCamelContextId(contextId);
MutablePassThroughMetadata eff = context.createMetadata(MutablePassThroughMetadata.class);
eff.setId(".camelBlueprint.bean.passthrough." + id);
eff.setObject(new PassThroughCallable<Object>(fact));
MutableBeanMetadata ef = context.createMetadata(MutableBeanMetadata.class);
ef.setId(".camelBlueprint.bean.factory." + id);
ef.setFactoryComponent(eff);
ef.setFactoryMethod("call");
ef.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
ef.setInitMethod("afterPropertiesSet");
ef.setDestroyMethod("destroy");
MutableBeanMetadata e = context.createMetadata(MutableBeanMetadata.class);
e.setId(id);
e.setRuntimeClass(fact.getObjectType());
e.setFactoryComponent(ef);
e.setFactoryMethod("getObject");
e.addDependsOn(".camelBlueprint.processor.bean." + contextId);
context.getComponentDefinitionRegistry().registerComponentDefinition(e);
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata 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;
}
Aggregations