Hello

We are using Managed Service Factory in Declarative Services to create one
component for every configuration. This works perfectly if the component we
want to register is exactly of the class specified in the <implementation
class="..."/>.
But sometimes we need a factory to create the component of different
implementation type. For example we want to register componend that is of
the java.security.cert.Certificate subtype according to the configuration
properties like:
- certificate type (eg. X509) (this defines the real type)
- certificate (in PEM format)
- security provider name

There may be multiple certificates registered - every with the different
properties. We can't do <implementation
class="java.security.cert.Certificate"/>
because this class can't configure itself from the properties. Also the real
implementation can be sun.security.x509.X509CertImpl or different class
according to the "certificate type" configuration property.

We checked the usage of Component Factory (factory="...") and Service
Factory (servicefactory="...") but none seems to solve our problem. One
solution is to use delegator design pattern, but it is too cumbersome. Is
there some transparent way to achieve our needs using Declarative Services
so that consumer component will only use <reference
interface="java.security.cert.Certificate" bind="setCertificate"
target="..."/> ?

Thanks in advance
Best regards
-- 
Ing. Martin Ždila
tel:+421-908-363-848
mailto:[email protected]
http://www.zdila.sk/
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to