Hi Felix,
Thank you for your help.
If i understand well you said i don't need to implement the
ManagedService interface because ds
will grab configurations me.
In my use case i've:
1) n component factories each of these is responsible to create a
particular type of component
2) a deployer services that has the references on all component factories
3) Another bundle that take information somewhere ( a filesystem xml
file, or a relational db ) and use the
deployer service to dynamically create my components
What i want to achieve is to have a way to update the components that
i've create with the component factories
when some deploy information change.
For this reason i've take a look at ConfigurationAdmin Service and to
the ManagedService interface. At the moment
i'm still explore different ways to find the right way to do what i need.
Andrea
Felix Meschberger ha scritto:
Hi,
Andrea Zoppello schrieb:
Hi all,
I want to have a DS Component Factories that will be able to create
different instances of my
component.
My component class implement the EventHandler interface, so it will
receive event notification by
Event Admin Service.
An example of one of my component factory is this one:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="org.my.components.mycomponentFactory"
factory="my.mycomponent">
<implementation class="org.my.components.MyComponent"/>
<service>
<provide interface="org.osgi.service.cm.ManagedService"/>
<provide interface="org.osgi.service.event.EventHandler"/>
</service>
</scr:component>
First: You don't want to register your component as a ManagedService
because the Declarative Services implementation will grab configurations
on behalf of the component and provided the configuration to the components.
As i've learn an Event Handler could specify a topic filter with the
property: "event.topics or EventConstants.EVENT TOPIC"
My problem is that i want my components will subscribe to different
topics according to a value that i set in the
properties when i'll call ComponentFactory.newInstance.
For example if in my properties there a topic id i want my component
generatye with the factory to subscribe to something like:
BASE_TOPIC/TOPI_ID
It's enough to create the property "event.topics or EventConstants.EVENT
TOPIC" with the right value before calling the newInstance method
or i need additional step??.
Nothing more needed, I would say, because the properties you hand to the
newInstance method should also be used as service registration properties.
Regards
Felix
Thanks
Andrea Zoppello
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev