felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clement Escoffier <clement.escoff...@gmail.com>
Subject Re: Creating annotated components programmatically with iPojo API
Date Fri, 09 Nov 2012 08:16:17 GMT
Hi,

Unfortunately, when you're using the API and the PrimitiveComponentType it creates an empty
component type that you need to describe by yourself. If your class is already using annotations,
you just have to use the published Factory. Each (public) component type is accessible using
a Factory service. By default the service.pid is the class name of the class (except if the
'name' is configured).

You will find details on http://felix.apache.org/site/how-to-use-ipojo-factories.html.

Regards,

Clement

On 8 nov. 2012, at 18:04, Simon Chemouil <schemouil@gmail.com> wrote:

> Hi,
> 
> I'm trying to define iPojo components programmatically using the API,
> and have the component class use iPojo annotations (I am trying to
> bridge another extension mechanism so I can keep using iPojo semantics
> there).
> 
> I'm defining my component this way:
> 
> PrimitiveComponentType type = new PrimitiveComponentType()
> .setBundleContext(origContext)
> .setClassName(componentClassName).setImmediate(true);
> 
> 
> type.start();
> try {
>         ComponentInstance instance = type.createInstance();
>         return ((InstanceManager) instance).getPojoObject();
> } catch (...) { }
> 
> 
> However so far annotations are ignored. I know they're class
> retention, but I think the manipulator should be able to see them in
> the bytecode anyway.
> For instance I don't use .addDependency(), a field annotated with
> @Requires will not get injected. I'm also interested in getting this
> to work with custom handlers processing custom annotations!
> 
> Is there any way to get this working? Pointers will be much appreciated!
> 
> Thanks,
> 
> -- 
> Simon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message