Search in sources :

Example 56 with MutableBeanMetadata

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

the class OpendaylightNamespaceHandler method parseRpcImplementation.

private static Metadata parseRpcImplementation(final Element element, final ParserContext context) {
    registerRpcRegistryServiceRefBean(context);
    MutableBeanMetadata metadata = createBeanMetadata(context, context.generateId(), RpcImplementationBean.class, true, true);
    addBlueprintBundleRefProperty(context, metadata);
    metadata.addProperty("rpcRegistry", createRef(context, RPC_REGISTRY_NAME));
    metadata.addProperty("implementation", createRef(context, element.getAttribute(REF_ATTR)));
    if (element.hasAttribute(INTERFACE)) {
        metadata.addProperty("interfaceName", createValue(context, element.getAttribute(INTERFACE)));
    }
    LOG.debug("parseRpcImplementation returning {}", metadata);
    return metadata;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata)

Example 57 with MutableBeanMetadata

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

the class OpendaylightNamespaceHandler method createBeanMetadata.

private static MutableBeanMetadata createBeanMetadata(final ParserContext context, final String id, final Class<?> runtimeClass, final boolean initMethod, final boolean destroyMethod) {
    MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
    metadata.setId(id);
    metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
    metadata.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
    metadata.setRuntimeClass(runtimeClass);
    if (initMethod) {
        metadata.setInitMethod("init");
    }
    if (destroyMethod) {
        metadata.setDestroyMethod("destroy");
    }
    return metadata;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata)

Example 58 with MutableBeanMetadata

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

the class OpendaylightNamespaceHandler method registerRoutedRpcRegistrationConverter.

private static void registerRoutedRpcRegistrationConverter(final ParserContext context) {
    ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
    if (registry.getComponentDefinition(ROUTED_RPC_REG_CONVERTER_NAME) == null) {
        MutableBeanMetadata metadata = createBeanMetadata(context, ROUTED_RPC_REG_CONVERTER_NAME, RoutedRpcRegistrationConverter.class, false, false);
        metadata.setActivation(ReferenceMetadata.ACTIVATION_LAZY);
        registry.registerTypeConverter(metadata);
    }
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) ComponentDefinitionRegistry(org.apache.aries.blueprint.ComponentDefinitionRegistry)

Example 59 with MutableBeanMetadata

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

the class OpendaylightNamespaceHandler method enableComponentProcessorProperty.

private static ComponentMetadata enableComponentProcessorProperty(final Attr attr, final ComponentMetadata component, final ParserContext context, final String propertyName) {
    if (component != null) {
        throw new ComponentDefinitionException("Attribute " + attr.getNodeName() + " can only be used on the root <blueprint> element");
    }
    LOG.debug("{}: {}", propertyName, attr.getValue());
    if (!Boolean.parseBoolean(attr.getValue())) {
        return component;
    }
    MutableBeanMetadata metadata = registerComponentProcessor(context);
    metadata.addProperty(propertyName, createValue(context, "true"));
    return component;
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException)

Example 60 with MutableBeanMetadata

use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project service-proxy by membrane.

the class BlueprintElementParser method handleChildElement.

protected void handleChildElement(Element ele, ParserContext context, MutableBeanMetadata mcm, BlueprintParser globalParser) {
    Metadata m = globalParser.parse(globalParser, ele, context);
    Class<?> clazz = null;
    if (m instanceof MutableBeanMetadata) {
        clazz = ((MutableBeanMetadata) m).getRuntimeClass();
    } else {
        throw new RuntimeException("Don't know how to get bean class from " + m.getClass() + ": " + ele.getNodeName());
    }
    handleChildObject(ele, context, mcm, clazz, m);
}
Also used : MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) Metadata(org.osgi.service.blueprint.reflect.Metadata) MutablePassThroughMetadata(org.apache.aries.blueprint.mutable.MutablePassThroughMetadata) BeanMetadata(org.osgi.service.blueprint.reflect.BeanMetadata) MutableRefMetadata(org.apache.aries.blueprint.mutable.MutableRefMetadata) MutableCollectionMetadata(org.apache.aries.blueprint.mutable.MutableCollectionMetadata) MutableBeanMetadata(org.apache.aries.blueprint.mutable.MutableBeanMetadata) MutableValueMetadata(org.apache.aries.blueprint.mutable.MutableValueMetadata)

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