Re: ComponentFactory

2019-03-25 Thread David Jencks
g
> >> 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é 
> >>> *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
> >>>  
> >>> <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: 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 <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é
> >>> jbono...@apache.org
> >>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> >>> Talend - http://www.talend.com <http://www.talend.com/>
> >> 
> >> -- 
> >> Jean-Baptiste Onofré
> >> jbono...@apache.org
> >> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> >> Talend - http://www.talend.com <http://www.talend.com/>
> > 
> > -- 
> > Jean-Baptiste Onofré
> > jbono...@apache.org
> > http://blog.nanthrax.net <http://blog.nanthrax.net/>
> > Talend - http://www.talend.com <http://www.talend.com/>
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>


Re: ComponentFactory

2019-03-25 Thread Jean-Baptiste Onofré
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

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 
>>  
>>
>> 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.
>> 
>>
>>
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: ComponentFactory

2019-03-25 Thread Tim Ward
Hi, 

If you are using Component Factories then you are not also using Managed 
Service Factories, the two are simply not possible to use together.

A component factory lets you supply custom configuration to programmatically 
create multiple instances of a component. These are combined with any static 
properties and any configuration provided to the *singleton* component factory 
via its pid.

Specifying a *required* configuration policy lets you use the configuration pid 
of a DS component as a factory pid. This, in turn, lets you use factory 
configurations to create multiple configured component instances at runtime. 
Importantly these instances are bound to the lifecycle of the factory 
configuration that they correspond to.

As you can see it is simply not possible to mix the two models as they have 
fundamentally different lifecycles. Component Factories are programmatic, 
Factory Configurations (Managed Service Factories) are declarative and bound to 
the lifecycle of the configuration object.

In general you probably don’t want to use a component factory with DS. Factory 
configurations are much less invasive to your code, and much simpler to manage.

Best Regards,

Tim

> On 25 Mar 2019, at 14: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
>  
> 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.leinweber 
> @ida-analytics.de 
>  
> Internet: 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. 


Re: ComponentFactory

2019-03-25 Thread Jean-Baptiste Onofré
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 
>  
> 
> 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.
> 
> 
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com