I don’t understand what you are trying to do. I don’t see any way that factory 
components would be relevant in any way to anything you mention.
Suppose you have two normal components implementing MyInterface, and supply 
factory configurations for them to create instances as needed, and have a 
multivalued reference of type MyInterface. What do you need that this doesn’t 
provide?

Thanks
David Jencks 

Sent from my iPhone

> On Mar 26, 2019, at 1:21 AM, Matthias Leinweber 
> <matthias.leinwe...@ida-analytics.de> wrote:
> 
> Hi JB,
> 
> yes but until i created one there is nothing to iterate/find.
> However, i think did not explain my problem very well so i try to explain  
> what i want to do.
> Maybe i took the wrong approach to solve my problem. So lets consider the 
> following classes:
> 
> @Component(
>     service = MyInterface.class,
>     configurationPid = "my.factory.prefix.A"
>     configurationPolicy=ConfigurationPolicy.REQUIRE,
>     property = {
>         "prop1=A",
>         "prop2=foo"})
> public class MyComponentA implements MyInterface {
> 
>     @Modified
>     public void modified(ComponentContext componentContext){
>       //change something in this component
>     }
>     public void dostuff(){}
> }
> 
> @Component(
>     service = MyInterface.class,
>     configurationPid = "my.factory.prefix.B"
>     configurationPolicy=ConfigurationPolicy.REQUIRE,
>     property = {
>         "prop1=B",
>         "prop2=bar"})
> public class MyComponentB implements MyInterface {
>     
>     @Modified
>     public void modified(ComponentContext componentContext){
>       //change something in this component
>     }
>     public void dostuff(){}
> }
> 
> public class MyFancyManager implements MyFancyInterface {
> 
>     public List<String> listAvailableComponentFactories(){
>         // how do i "iterate" over all factories without that i 
>         // have already created one? I don't  know which 
>         // factories are present in advance or bundles 
>         // dynamically add new components factories
>     }
> 
>     public void  changeConfig(String filter, Map<String, String> config){
>         // 
> configManager.listConfig(filter).stream().filter().any().update(config)
>     }
> 
>     public void  createSomething(String type, Map<String, String> config){
>       Configuration cfg = 
> configurationAdmin.createFactoryConfiguration("my.factory.prefix."+type, 
> null);
>       Hashtable<String, Object> prop = new Hashtable<>();
>       prop.put("prop3", "foobar");
>       cfg.update(testProp);
>     }
> }
> 
> And now i like to create some services from type A, some from type B and then 
> i like to change configurations of existing services. 
> 
> best regards,
> Matthias
> Von: Jean-Baptiste Onofré <j...@nanthrax.net>
> Gesendet: Dienstag, 26. März 2019 06:15:26
> An: user@karaf.apache.org
> Betreff: Re: AW: AW: AW: ComponentFactory
>  
> Hi Mathias,
> 
> The factoryPid doesn't change: it's com.foo.bar.
> The configurationPid is based on the factory PID: com.foo.bar.xxxx (in
> config:list).
> 
> So you can find "your" configurations based on your factoryPid. You can
> list all configuration for a given factoryPid:
> 
> config:list "(factoryPid=com.foo.bar)"
> 
> Regards
> JB
> 
> On 25/03/2019 20:01, Matthias Leinweber wrote:
> > ... i can iterate over "my" servicefactories.
> > 
> > ------------------------------------------------------------------------
> > *From:* Matthias Leinweber
> > *Sent:* Monday, March 25, 2019 8:00:25 PM
> > *To:* user@karaf.apache.org
> > *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é <j...@nanthrax.net>
> > *Sent:* Monday, March 25, 2019 7:33:52 PM
> > *To:* user@karaf.apache.org
> > *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é <j...@nanthrax.net>
> >> *Gesendet:* Montag, 25. März 2019 18:36:17
> >> *An:* user@karaf.apache.org
> >> *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é <j...@nanthrax.net>
> >>> *Gesendet:* Montag, 25. März 2019 16:57:59
> >>> *An:* user@karaf.apache.org
> >>> *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é <j...@nanthrax.net>
> >>>> *Gesendet:* Montag, 25. März 2019 15:42
> >>>> *An:* user@karaf.apache.org
> >>>> *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
> 
> apache/karaf
> github.com
> Mirror of Apache Karaf. Contribute to apache/karaf development by creating an 
> account on GitHub.
> 
> 
> >>>> 
> >>>> and the equivalent with 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
> >>>>> 
> >>>>> 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: matthias.leinwe...@ida-analytics.de 
> >>>>>>
> >>>>>> 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> 
> >>>>>>  
> >>>>>>
> >>>>>> 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>
> >>>>>>
> >>>>>>
> >>>>> 
> >>>> 
> >>>> -- 
> >>>> Jean-Baptiste Onofré
> >>>> jbono...@apache.org
> >>>> http://blog.nanthrax.net
> >>>> Talend - http://www.talend.com
> >>> 
> >>> -- 
> >>> Jean-Baptiste Onofré
> >>> jbono...@apache.org
> >>> http://blog.nanthrax.net
> >>> Talend - http://www.talend.com
> >> 
> >> -- 
> >> Jean-Baptiste Onofré
> >> jbono...@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
> > 
> > -- 
> > Jean-Baptiste Onofré
> > jbono...@apache.org
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply via email to