Re: Datasource selection

2020-12-15 Thread Nicola Cisternino
Il 12/15/20 6:34 PM, Eric Norman ha scritto: For simplicity, you could probably let the framework do a bit more work for you and remove the need for the BundleContext field by using the reference bind method technique that sends you the service instance + the properties. For example, something

Re: Datasource selection

2020-12-15 Thread Eric Norman
For simplicity, you could probably let the framework do a bit more work for you and remove the need for the BundleContext field by using the reference bind method technique that sends you the service instance + the properties. For example, something like this: private Map dataSources = new

Re: Datasource selection

2020-12-15 Thread Bertrand Delacretaz
On Tue, Dec 15, 2020 at 4:58 PM Robert Munteanu wrote: > ...This way you get the datasources injected and via SCR and you get to > use the datasource.name as a key... sounds good and it's certainly more efficient than what I suggested. -Bertrand

Re: Datasource selection

2020-12-15 Thread Robert Munteanu
On Tue, 2020-12-15 at 14:35 +0100, Nicola Cisternino wrote: > Hi Robert. > Declarative services are best way ... but i need to use different > datasources starting from a (request) payload attribute received from > a > servlet ... > So I decided to migrate (in a bundle service)  the custom pool

Re: Datasource selection

2020-12-15 Thread Bertrand Delacretaz
Hi, On Fri, Dec 11, 2020 at 4:16 PM Nicola Cisternino wrote: > ...I can select single datasource using DS annotations: > @Reference(target = > "(&(objectclass=javax.sql.DataSource)(datasource.name=*source1*))") > private DataSource dataSource; > > But ... how can I select single datasource

Re: Datasource selection

2020-12-15 Thread Nicola Cisternino
Hi Robert. Declarative services are best way ... but i need to use different datasources starting from a (request) payload attribute received from a servlet ... So I decided to migrate (in a bundle service)  the custom pool engine that we used in the old webapp. Thanks. Nicola. Il 12/14/20