[ 
https://issues.apache.org/jira/browse/KARAF-3034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14029126#comment-14029126
 ] 

Jean-Baptiste Onofré commented on KARAF-3034:
---------------------------------------------

As discussed on IRC, it sounds good to me. Especially, it means that we can 
leverage ConfigAdmin layer (config:* commands, MBeans, etc), we still provide 
the jdbc:* commands and MBean for convenience. It also means that features like 
<config/> or <configfile/> in features XML can provision the datasource, and 
even Cellar can sync the datasources configuration in a cluster.

> Automatically create data sources from configuration files
> ----------------------------------------------------------
>
>                 Key: KARAF-3034
>                 URL: https://issues.apache.org/jira/browse/KARAF-3034
>             Project: Karaf
>          Issue Type: New Feature
>    Affects Versions: 3.0.1
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 4.0.0, 3.0.2, 2.3.6
>
>
> We already support creation of data sources using the jdbc:create command. 
> There we create a blueprint file in the deploy folder.
> This has some drawbacks though:
> 1. It requires blueprint which is bad for karaf 4
> 2. The deploy folder often creates race conditions so it is rather not good 
> for production usage
> 3. The create command needs to support each database type and the configs in 
> the resulting blueprint can not be changed using config admin
> So what I have in mind is to create a module that watches for configs in 
> config admin that match a certain filter like 
> org.apache.karaf.datasource.*.cfg or even datasource.*.cfg.
> Each such config contains properties defined in DataSourceFactory like url, 
> user, password, ...
> The DataSourceFactory is chosen by a driver property.
> So such a config (datasource.test.cfg) could look like this for derby:
> driver=org.apache.derby.jdbc.EmbeddedDriver
> databaseName=memory:TEST;create=true
> So the new module would do the following:
> - pick up the config
> - find the matching DataSourceFactory (e.g. provided by pax jdbc)
> - create a new DataSource with the rest of the properties
> - publish the DataSource as an OSGi service and with a jndi name suitable for 
> aries jndi
> So the user would install:
> - derby
> - pax jdbc derby
> - the new module
> - config in etc
> The result would be a data source that is ready to use for aries jdbc or any 
> other use case.
> This solution would work much better for production deployments than the 
> current blueprint solution.
> We could then adapt the jdbc:create command to work on the config files to 
> make it even easier to create data sources than with pure configs.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to