felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Annotation Decorated Service
Date Tue, 10 Apr 2012 15:56:48 GMT
You should define as much of the metadata as possible in the public 
interface. Then it can be used regardless of the implementation.
If an implementation defines additional annotations then these 
annotations will bind you to that implementation.

In practice you will probably have a mix of that where most annotations 
are defined in the interface and you will still have some exotic stuff 
that is impl specific.
Quite like in jpa where most annotations are defined at the jpa level 
but some special annotations are e.g. hibernate specific.

This is not really osgi specific btw. Having a separate interface is 
already good practice outside of osgi. What really makes OSGi shine is 
that a service impl can initialize itself using an Activator or a 
blueprint. So the user of the service does not have to know how to 
initialize the service. Outside of OSGi you always have the problem of 
how to initialize the impl behind the interface and how the user of the 
service finds the service ... most of these solutions are ugly.

Christian

Am 10.04.2012 17:15, schrieb Quecas:
> Hello everyone,
>
> One of the big paradigms of OSGI is to define a public API/SPI as an
> interface while keeping the implementation(s) private. Having said that and
> if the various implementations of a specific service each define meta-data
> using annotations, how would one get to this information without shifting
> from the paradigm or "bending" the rules.
>
> Thanks,
> Jorge


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message