You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Mike Wilson <mi...@hotmail.com> on 2014/04/29 02:36:47 UTC

namespacehandler adding service reference

I'm trying out the Aries Blueprint namespace handler implementation 
with Karaf 3.0.1, writing my own custom namespace handler.

I'd like to know if the following is currently supported:
1) adding a service reference (<reference> element) to the target
   bundle during namespace processing
2) where the added service reference's interface type is not known 
   by the target bundle's classloader (thus using setRuntimeInterface 
   on the reference metadata)

In code:
public class MyNamespaceHandlerImpl implements NamespaceHandler {
    @Override
    public ComponentMetadata decorate(Node node, 
            ComponentMetadata component, ParserContext ctx) {
        ...
        MutableReferenceMetadata reference =
            ctx.createMetadata(MutableReferenceMetadata.class);
        reference.setRuntimeInterface(ClassUnknownToBundle.class);
        ctx.getComponentDefinitionRegistry()
            .registerComponentDefinition(reference);
        ...
    }
}

Thanks
Mike Wilson