Thanks for your quick response, Felix.

I'm not sure I understand you. Are you saying I should expose another
component that implements the MetaTypeProvider interface as a service?
But would that be picked up? Just implementing that interface on the
main component at least didn't make a difference. And a test exposing a
MetaTypeProvider as a service wasn't successful.

OSGi 4.1 Compendium says in 105.5 (page 115):

The Meta Type Service provides unified access to Meta Type information
that is associated with a Bundle. It can get this information through the 
following
means:
• Meta Type Resource - ..... (i.e. OSGI-INF/metatype/metatype.xml)
• ManagedService[Factory] objects - ....ManagedService and ManagedServiceFactory
service objects can optionally implement the MetaTypeProvider
interface......

It doesn't say anything that the Meta Type Service searches for
MetaTypeProvider services. So I'm not surprise that my test didn't work.

So what you could confirm is that implementing the MetaTypeProvider
interface on the main component itself isn't suitable for exposing meta
type information. SCR won't pick that up and expose that as part of the
ManagedService[Factory]. That matches what I found and it leaves me with
only the metatype.xml approach as I suspected.

Thanks again.

On 13.03.2009 20:41:40 Felix Meschberger wrote:
> Hi,
> 
> Jeremias Maerki schrieb:
> > Am I right that it is not possible to associate a MetaTypeProvider
> > interface with a ManagedService(Factory) generated through Declarative
> > Services and only the approach with OSGI-INF/metatype/metatype.xml is
> > possible?
> 
> Point is, that a Declarative Services component does not register itself
>  as a ManagedService[Factory]. It is the Declarative Services runtime
> which takes care to aquire the configuration on behalf of the components.
> 
> On the other hand I would say, that it is perfectly ok for Declarative
> Services component to declare themselves as being MetaTypeProvider
> services instead of just relying on metatype.xml.
> 
> > 
> > I've written an annotation-based meta type provider for myself which
> > works fine for self-written ManagedService(Factory) implementations but
> > it seems I can't use that together with Declarative Service. Unless I
> > missed something, of course.
> 
> Why can't you use it with Declarative Services ? As I said, the
> component would just be declared as a MetaTypeProvider (but not a
> ManagedService[Factory]) and it should work.
> 
> Unless, I myself am missing something.
> 
> Regards
> Felix
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to