I’m not sure I understand what you are trying to do, since you keep mentioning 
ManagedServiceFactory but I don’t see any such in your code, and they don’t 
play well with DS.  I think you want to have a factory component (i.e. 
ComponentFactory) where the newInstances are registered with DS as components 
accepting factory configurations, so you won’t actually get a component 
instance until a configuration is supplied for one of the “newInstance” 
components. This isn’t possible and can’t really be done since newInstance 
essentially returns the single instance, and you want multiple instances.

Since it’s all the same component code, why are different factoryPids useful 
rather than some other configuration element?

thanks
david jencks

> On Mar 25, 2019, at 12:01 PM, Matthias Leinweber 
> <[email protected]> wrote:
> 
> ... i can iterate over "my" servicefactories.
> 
> From: Matthias Leinweber
> Sent: Monday, March 25, 2019 8:00:25 PM
> To: [email protected]
> Subject: Re: AW: AW: AW: ComponentFactory
>  
> Mhm OK.
> 
> I will try to explain what i want to achieve.
> 
> My Plan was to create several ManagedserviceFactories all with different 
> factorypids but all with the same prefix. So that i
> From: Jean-Baptiste Onofré <[email protected]>
> Sent: Monday, March 25, 2019 7:33:52 PM
> To: [email protected]
> Subject: Re: AW: AW: AW: ComponentFactory
>  
> Not sure I follow you.
> 
> What's the issue ?
> 
> You have the factory and the configurations for the factory.
> 
> Regards
> JB
> 
> On 25/03/2019 18:54, Matthias Leinweber wrote:
> > Yes,
> > 
> > 
> > but i see "this"
> > 
> > Pid:            com.ida.moira.operator.factory.Input.Kafka
> > Collector.8e589bdc-0e72-49dd-b7c5-78234be1b8ba
> > FactoryPid:     com.ida.moira.operator.factory.Input.Kafka Collector
> > BundleLocation: null
> > Properties:
> >    com.ida.moira.operator.name = foo
> >    com.ida.moira.operator.namespace = hallo
> >    service.factoryPid = com.ida.moira.operator.factory.Input.Kafka Collector
> >    service.pid = com.ida.moira.operator.factory.Input.Kafka
> > Collector.8e589bdc-0e72-49dd-b7c5-78234be1b8ba
> > 
> > ..after Configuration but what i need is a lookup which factoryPids are
> > avaiable...
> > 
> > best regards,
> > Matthias
> > 
> > ------------------------------------------------------------------------
> > *Von:* Jean-Baptiste Onofré <[email protected]>
> > *Gesendet:* Montag, 25. März 2019 18:36:17
> > *An:* [email protected]
> > *Betreff:* Re: AW: AW: ComponentFactory
> >  
> > Hi,
> > 
> > you should have a config with FactoryPid as property right ?
> > 
> > For instance, when I do config:list, I can see the factory for fileinstall:
> > 
> > Pid:
> > org.apache.felix.fileinstall.d10ae13a-7909-4881-8014-d0901748a832
> > 
> > 
> >                                           FactoryPid:
> > org.apache.felix.fileinstall
> > 
> > 
> >                                           BundleLocation: ?
> > 
> > Regards
> > JB
> > 
> > On 25/03/2019 18:30, Matthias Leinweber wrote:
> >> Hi JB,
> >> 
> >> 
> >> still a small problem...
> >> 
> >> @Component(
> >>     service = EventOperator.class,
> >>     immediate = true,
> >>     configurationPid = EventOperator.PROP_FACTORY_PREFIX +
> >> Category.INPUT + "." + KafkaOperator.TYPE,
> >>     configurationPolicy=ConfigurationPolicy.REQUIRE,
> >>     property = {
> >>         EventOperator.PROP_CATEGORY + "=" + Category.INPUT,
> >>         EventOperator.PROP_TYPE + "=" + KafkaOperator.TYPE})
> >> public class KafkaOperator extends  AbstractEventOperator {
> >> 
> >> Does not result in a managed service factory which is visible via
> >> config:list ..
> >> After createFactoryConfiguration the configuration object (config:list)
> >> and the service (service:list) are present. But the factory is not.
> >> 
> >> I think i am still missing a basic concept?
> >> 
> >> regards,
> >> Matthias
> >> 
> >> ------------------------------------------------------------------------
> >> *Von:* Jean-Baptiste Onofré <[email protected]>
> >> *Gesendet:* Montag, 25. März 2019 16:57:59
> >> *An:* [email protected]
> >> *Betreff:* Re: AW: ComponentFactory
> >>  
> >> Hi Matthias,
> >> 
> >> as always, happy to help ;)
> >> 
> >> config:list command/service is able to list the configuration (including
> >> the factories).
> >> 
> >> Regards
> >> JB
> >> 
> >> On 25/03/2019 16:07, Matthias Leinweber wrote:
> >>> Thank you very much.
> >>> 
> >>> Thanks for the explanation, Tim. I simply thought that it is possible to
> >>> access the (newInstance) components with their configurationPid but it
> >>> makes totally sense that this makes no sense ;)
> >>> 
> >>> Also thank you for the decanter link, exactly what i was looking for.
> >>> And my example is working now.
> >>> 
> >>> But an additional Question:
> >>> Is there a way to list available factoryPids (before creating a
> >>> configuration)?
> >>> 
> >>> best regards,
> >>> Matthias
> >>> 
> >>> 
> >>> 
> >>> 
> >>> ------------------------------------------------------------------------
> >>> *Von:* Jean-Baptiste Onofré <[email protected]>
> >>> *Gesendet:* Montag, 25. März 2019 15:42
> >>> *An:* [email protected]
> >>> *Betreff:* Re: ComponentFactory
> >>>  
> >>> By the way, you also have a "core" example here:
> >>> 
> >>> https://github.com/apache/karaf/tree/master/examples/karaf-config-example/karaf-config-example-managed-factory
> >>>  
> >>> <https://github.com/apache/karaf/tree/master/examples/karaf-config-example/karaf-config-example-managed-factory>
> >>> 
> >>> and the equivalent with SCR:
> >>> 
> >>> https://github.com/apache/karaf/tree/master/examples/karaf-config-example/karaf-config-example-scr
> >>>  
> >>> <https://github.com/apache/karaf/tree/master/examples/karaf-config-example/karaf-config-example-scr>
> >>> 
> >>> Regards
> >>> JB
> >>> 
> >>> On 25/03/2019 15:39, Jean-Baptiste Onofré wrote:
> >>>> Hi Matthias,
> >>>> 
> >>>> What about creating a new service instance with a 
> >>>> ManagedServiceFactories ?
> >>>> 
> >>>> If you use SCR, it's pretty easy. It's the way it's implemented in
> >>>> Decanter for instance.
> >>>> 
> >>>> For instance, a new TailerListenerAdapter service will be registered for
> >>>> each etc/org.apache.karaf.decanter.collector.file-foo.cfg file created:
> >>>> 
> >>>> https://github.com/apache/karaf-decanter/blob/master/collector/file/src/main/java/org/apache/karaf/decanter/collector/file/DecanterTailerListener.java
> >>>>  
> >>>> <https://github.com/apache/karaf-decanter/blob/master/collector/file/src/main/java/org/apache/karaf/decanter/collector/file/DecanterTailerListener.java>
> >>>> 
> >>>> Is it what you are looking for ?
> >>>> 
> >>>> Regards
> >>>> JB
> >>>> 
> >>>> On 25/03/2019 15:32, Matthias Leinweber wrote:
> >>>>> Hello Karaf Team, 
> >>>>>
> >>>>>
> >>>>> i don't know if it is the correct mailing list, because its just
> >>>>> possibly related to karaf specific implementation.
> >>>>>
> >>>>>
> >>>>> I try to configure multiple services which are created by a component
> >>>>> factory (newInstance). But i don't find a way how i can give a
> >>>>> unique pid to a created service instance. 
> >>>>>
> >>>>> Did i understand something wrong an do i have to use
> >>>>> ManagedServiceFactories?
> >>>>>
> >>>>> regards,
> >>>>> Matthias
> >>>>>
> >>>>>
> >>>>> Matthias Leinweber 
> >>>>>
> >>>>> Managing Director & Chief Analytics Officer
> >>>>>
> >>>>>  1491765456561_darkwtext.resized.png
> >>>>>
> >>>>> Intelligent Data Analytics GmbH & Co. KG 
> >>>>>
> >>>>>  
> >>>>>
> >>>>> c/o TechQuartier 
> >>>>>
> >>>>> Platz der Einheit 2 
> >>>>> 60327 Frankfurt 
> >>>>>
> >>>>> Mobil: 0151/73006079 
> >>>>>
> >>>>> Telefon: 06421/4805274  
> >>>>> Telefax: 06421/4805275  
> >>>>> E-Mail: [email protected] 
> >>>>>
> >>>>> Internet: www.ida-analytics.de <http://www.ida-analytics.de/> 
> >>>>> <http://www.ida-analytics.de <http://www.ida-analytics.de/>>
> > <http://www.ida-analytics.de <http://www.ida-analytics.de/>>
> >> <http://www.ida-analytics.de <http://www.ida-analytics.de/>> 
> >>>>>  
> >>>>>
> >>>>> Unternehmenssitz: Frankfurt am Main | Handelsregister
> >>>>> beim Amtsgericht: Frankfurt am Main, Registernummer: HRA 49357 | USt.
> >>>>> ID-Nr.: DE310205810 | Finanzamt: Frankfurt am Main 
> >>>>>
> >>>>> Persönlich haftende Gesellschafterin: IDA Intelligent Data Analytics
> >>>>> GmbH | Sitz: Frankfurt am Main | Handelsregister
> >>>>> beim Amtsgericht: Frankfurt am Main | Handelsregister-Nummer: HRB
> >>>>> 106805 | Geschäftsführer: Mohamed Ayadi, Nils Björn Krugmann, Dipl.-Inf.
> >>>>> Matthias Leinweber, Dipl.-Inf. Marc Seidemann 
> >>>>>
> >>>>>   
> >>>>>
> >>>>> If you are not the addressee, please inform us immediately that you have
> >>>>> received this e-mail by mistake, and delete it. We thank you for your
> >>>>> support. 
> >>>>>
> >>>>>
> >>>>>  
> >>>>>
> >>>>> Besuchen Sie uns vom 01.-05. April auf der HANNOVER MESSE. Sie finden
> >>>>> uns auf dem hessischen Gemeinschaftsstand in Halle 6 Stand A24. Weitere
> >>>>> Informationen finden Sie hier.
> >>>>> <https://www.digitalstrategie-hessen.de/hannovermesse 
> >>>>> <https://www.digitalstrategie-hessen.de/hannovermesse>>
> >>>>>
> >>>>>
> >>>> 
> >>> 
> >>> -- 
> >>> Jean-Baptiste Onofré
> >>> [email protected]
> >>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> >>> Talend - http://www.talend.com <http://www.talend.com/>
> >> 
> >> -- 
> >> Jean-Baptiste Onofré
> >> [email protected]
> >> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> >> Talend - http://www.talend.com <http://www.talend.com/>
> > 
> > -- 
> > Jean-Baptiste Onofré
> > [email protected]
> > http://blog.nanthrax.net <http://blog.nanthrax.net/>
> > Talend - http://www.talend.com <http://www.talend.com/>
> 
> -- 
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>

Reply via email to