yes sounds best to combine the two. Afaik there is only Aries capable of handling Container Managed Transactions. Though I heard but never used the Amdatu project should provide something similar. Another thing that is still work in progress is the Pax CDI project in Combination with Deltaspike it's supposed to do the same.
If you have "consuming" bundles anything will do so IPOJO might be a good work there or DS. regards, Achim 2014-12-02 9:17 GMT+01:00 matthjes <[email protected]>: > Ok, I do not want to implement an alternative if a similar function is > already present. > > I'll look at karaf jdbc and Pax-JDBC. I'm obviously not familiar with the > eco-system, yet. The last days I was struggeling deciding between Aries > blueprint, iPOJO and DS...and this alone is confusing (iPOJO looks good, > but there seems to be no simple way to use JPA with it; Aries does this, > however, the documentation is lacking and outdated; I did not look much > into DS, how does this compare? I've tried combining iPOJO with Aries > (Aries for JPA, iPOJO for everything else), but it > feels...wrong...somehow). > > Thank you both for the hints! > > On Tue, Dec 2, 2014 at 8:43 AM, jbonofre [via Karaf] < > [email protected]> wrote: > > > Hi, > > > > ok, so you want to implement your own alternate to the Karaf jdbc > > feature, and the pax-jdbc feature. > > > > I don't see the relation between the service and the configuration in > > your case: > > 1/ you retrieve the datasource using a service and just inject it > > or > > 2/ you retrieve the configuration with a simple cm:properties (with the > > current persistent-id) > > > > IMHO, a service is the best approach. > > > > Maybe I'm missing something. > > > > Regards > > JB > > > > On 12/02/2014 08:35 AM, matthjes wrote: > > > > > Hi, > > > > > > I'm currently experimenting with Karaf / Aries blueprint to find out if > > > there are suitable ways to provide some functions for my application. > > One > > > of this is to dynamically create DataSources (and then Providers) based > > on > > > properties stored in a file. So the use case would be: > > > 1. Create a property file with, e.g., the database driver, url, > password > > > etc. and Aries JNDI specifier > > > 2. Drop this file into karaf/etc > > > 3. A new DataSource service is created with the service property " > > > osgi.jndi.service.name" set to the value specified in the property > > file. > > > 4. In the persistence.xml the appropriate data source is used (it also > > has > > > a configurable unit name) > > > 5. A provider is created based on the persistence.xml > > > > > > So basically I have an "applications" running in the container that use > > JPA > > > to write/read data to a database. A new application (with a new data > > > source) is initialized when a new configuration file is dropped into > the > > > karaf/etc folder. > > > > > > Furthermore, it is somehow difficult to find a good documentation about > > > blueprint (e.g. property-placeholder, cm:properties, cm:config). Do you > > > know a good reference? > > > > > > On Tue, Dec 2, 2014 at 7:16 AM, jbonofre [via Karaf] < > > > [hidden email] <http:// > /user/SendEmail.jtp?type=node&node=4036842&i=0>> > > wrote: > > > > > >> Hi, > > >> > > >> why do you need managed service factory ? > > >> > > >> A simple cm:config is not enough (it can be provided by a feature) ? > > >> > > >> Just to understand your use case. > > >> > > >> Regards > > >> JB > > >> > > >> On 12/02/2014 06:24 AM, matthjes wrote: > > >> > > >>> Hi, > > >>> > > >>> I have the following managed-service-factory: > > >>> > > >>> <cm:managed-service-factory factory-pid="DataSource" > > >>> interface="javax.sql.DataSource"> > > >>> <service-properties> > > >>> <entry key="osgi.jndi.service.name" > value="${dbname}"/> > > >>> </service-properties> > > >>> <cm:managed-component > > >>> class="org.apache.commons.dbcp.BasicDataSource" > > destroy-method="close"> > > >>> <property name="driverClassName" value=""/> > > >>> <property name="url" value=""/> > > >>> <property name="username" value=""/> > > >>> <property name="password" value=""/> > > >>> </cm:managed-component> > > >>> </cm:managed-service-factory> > > >>> > > >>> Now I'd like to set ${dbname} to a value specified in a configuration > > >> file > > >>> so that every time I put a new config file into karaf/etc a new > > >> DataSource > > >>> service with a specific osgi.jndi.service.name is created. > > >>> > > >>> I've tried using property-placeholder, however, this did not work. > The > > >> only > > >>> method that currently works ist the following: > > >>> > > >>> <cm:managed-service-factory factory-pid="DataSource" > > >>> interface="javax.sql.DataSource"> > > >>> <service-properties> > > >>> <cm:cm-properties persistent-id="DataSource"/> > > >>> </service-properties> > > >>> <cm:managed-component > > >>> class="org.apache.commons.dbcp.BasicDataSource" > > destroy-method="close"> > > >>> <property name="driverClassName" value=""/> > > >>> <property name="url" value=""/> > > >>> <property name="username" value=""/> > > >>> <property name="password" value=""/> > > >>> </cm:managed-component> > > >>> </cm:managed-service-factory> > > >>> > > >>> So using cm-properties inside the service-properties element. > However, > > >> this > > >>> uses *all* properties defined in the config file for the > > >> service-properties, > > >>> which is not intended. > > >>> > > >>> Is there some way to have a config file with several properties but > > only > > >> use > > >>> one of them as a service property for a managed service? > > >>> > > >>> > > >>> > > >>> -- > > >>> View this message in context: > > >> > > > http://karaf.922171.n3.nabble.com/managed-service-factory-how-to-set-service-properties-from-config-file-tp4036836.html > > >>> Sent from the Karaf - User mailing list archive at Nabble.com. > > >>> > > >> > > >> -- > > >> Jean-Baptiste Onofré > > >> [hidden email] <http:// > /user/SendEmail.jtp?type=node&node=4036837&i=0> > > >> http://blog.nanthrax.net > > >> Talend - http://www.talend.com > > >> > > >> > > >> ------------------------------ > > >> If you reply to this email, your message will be added to the > > discussion > > >> below: > > >> > > >> > > > http://karaf.922171.n3.nabble.com/managed-service-factory-how-to-set-service-properties-from-config-file-tp4036836p4036837.html > > >> To unsubscribe from managed-service-factory: how to set > > >> service-properties from config file, click here > > >> < > > >> . > > >> NAML > > >> < > > > http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > >> > > > > > > > > > > > > > > > -- > > > View this message in context: > > > http://karaf.922171.n3.nabble.com/managed-service-factory-how-to-set-service-properties-from-config-file-tp4036836p4036840.html > > > Sent from the Karaf - User mailing list archive at Nabble.com. > > > > > > > -- > > Jean-Baptiste Onofré > > [hidden email] <http:///user/SendEmail.jtp?type=node&node=4036842&i=1> > > http://blog.nanthrax.net > > Talend - http://www.talend.com > > > > > > ------------------------------ > > If you reply to this email, your message will be added to the discussion > > below: > > > > > http://karaf.922171.n3.nabble.com/managed-service-factory-how-to-set-service-properties-from-config-file-tp4036836p4036842.html > > To unsubscribe from managed-service-factory: how to set > > service-properties from config file, click here > > < > http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4036836&code=bWF0dGhqZXNAZ21haWwuY29tfDQwMzY4MzZ8LTk5NjI4MTMwNQ== > > > > . > > NAML > > < > http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/managed-service-factory-how-to-set-service-properties-from-config-file-tp4036836p4036843.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- Apache Member Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead blog <http://notizblog.nierbeck.de/> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> Software Architect / Project Manager / Scrum Master
