Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3034

Automatically create data sources from configuration files

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 3.0.1
    • 3.0.2, 2.3.6, 4.0.0.M3
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            cschneider Christian Schneider
            cschneider Christian Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: