karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject karaf git commit: [KARAF-4505] Add dataSourceType option to jdbc:ds-create command
Date Mon, 22 Aug 2016 06:54:19 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 246dc58a1 -> e8f1b7a38


[KARAF-4505] Add dataSourceType option to jdbc:ds-create command


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e8f1b7a3
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e8f1b7a3
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e8f1b7a3

Branch: refs/heads/karaf-4.0.x
Commit: e8f1b7a388491554718900249c2b99427bc30246
Parents: 246dc58
Author: jpoth <jpoth@redhat.com>
Authored: Mon Apr 25 11:27:21 2016 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Mon Aug 22 08:48:07 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/karaf/jdbc/JdbcMBean.java    | 19 ++++++++++---------
 .../java/org/apache/karaf/jdbc/JdbcService.java  | 17 ++++++++++-------
 .../karaf/jdbc/command/ds/CreateCommand.java     |  5 ++++-
 .../karaf/jdbc/internal/JdbcMBeanImpl.java       |  4 ++--
 .../karaf/jdbc/internal/JdbcServiceImpl.java     |  3 ++-
 5 files changed, 28 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/e8f1b7a3/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
index 35a48cb..047230d 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
@@ -37,16 +37,17 @@ public interface JdbcMBean {
     /**
      * Create a JDBC datasource.
      *
-     * @param name the JDBC datasource name
-     * @param driverName org.osgi.driver.name of the DataSourceFactory to use
-     * @param driverClass org.osgi.driver.class of the DataSourceFactory to use
-     * @param databaseName name of the database to access
-     * @param url JDBC URL
-     * @param user Database username
-     * @param password Database password
-     * @throws MBeanException
+     * @param name The JDBC datasource name.
+     * @param driverName The {@code org.osgi.driver.name} of the DataSourceFactory to use.
+     * @param driverClass The {@code org.osgi.driver.class} of the DataSourceFactory to use.
+     * @param databaseName The name of the database to access.
+     * @param url The JDBC URL.
+     * @param user The database username.
+     * @param password The database password.
+     * @param databaseType The database type (ConnectionPoolDataSource, XADataSource or DataSource).
+     * @throws MBeanException In case of MBean failure.
      */
-    void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password) throws MBeanException;
+    void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password, String databaseType) throws MBeanException;
 
     /**
      * Delete a JDBC datasource.

http://git-wip-us.apache.org/repos/asf/karaf/blob/e8f1b7a3/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
index 1f4b27b..10c2bbc 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
@@ -27,14 +27,17 @@ public interface JdbcService {
     /**
      * Create a JDBC datasource configuration.
      *
-     * @param name Datasource name 
-     * @param driverName Backend database type (osgi.jdbc.driver.name of DataSourceFactory)
-     * @param url JDBC URL
-     * @param user Database user name
-     * @param password Database password
-     * @param password2 
+     * @param name The datasource name.
+     * @param driverName The backend database type (osgi.jdbc.driver.name of DataSourceFactory).
+     * @param driverClass The JDBC driver class.
+     * @param databaseName The database name.
+     * @param url The JDBC URL.
+     * @param user The database user name.
+     * @param password The database password.
+     * @param databaseType The database type (ConnectionPoolDataSource, XADataSource or DataSource).
+     * @throws Exception If the service fails.
      */
-    void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password) throws Exception;
+    void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password, String databaseType) throws Exception;
 
     /**
      * Delete a JDBC datasource identified by a name. Works only

http://git-wip-us.apache.org/repos/asf/karaf/blob/e8f1b7a3/jdbc/src/main/java/org/apache/karaf/jdbc/command/ds/CreateCommand.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/command/ds/CreateCommand.java b/jdbc/src/main/java/org/apache/karaf/jdbc/command/ds/CreateCommand.java
index 45ceadc..05afdfb 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/command/ds/CreateCommand.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/command/ds/CreateCommand.java
@@ -46,9 +46,12 @@ public class CreateCommand extends JdbcCommandSupport {
     @Option(name = "-p", aliases = { "--password" }, description = "The database password",
required = false, multiValued = false)
     String password;
 
+    @Option(name = "-dt", aliases = { "--databaseType" }, description = "The database type
(ConnectionPoolDataSource, XADataSource or DataSource)", required = false, multiValued = false)
+    String databaseType;
+
     @Override
     public Object execute() throws Exception {
-        this.getJdbcService().create(name, driverName, driverClass, databaseName, url, username,
password);
+        this.getJdbcService().create(name, driverName, driverClass, databaseName, url, username,
password, databaseType);
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/e8f1b7a3/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
index da33e60..90edf67 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
@@ -64,9 +64,9 @@ public class JdbcMBeanImpl implements JdbcMBean {
     }
 
     @Override
-    public void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password) throws MBeanException {
+    public void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password, String databaseType) throws MBeanException {
         try {
-            jdbcService.create(name, driverName, driverClass, databaseName, url, user, password);
+            jdbcService.create(name, driverName, driverClass, databaseName, url, user, password,
databaseType);
         } catch (Exception e) {
             throw new MBeanException(null, e.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/e8f1b7a3/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
index 922e4d4..fc6d5b5 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
@@ -54,7 +54,7 @@ public class JdbcServiceImpl implements JdbcService {
     private ConfigurationAdmin configAdmin;
     
     @Override
-    public void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password) throws Exception {
+    public void create(String name, String driverName, String driverClass, String databaseName,
String url, String user, String password, String databaseType) throws Exception {
         if (driverName == null && driverClass == null) {
             throw new IllegalStateException("No driverName or driverClass supplied");
         }
@@ -69,6 +69,7 @@ public class JdbcServiceImpl implements JdbcService {
         put(properties, DataSourceFactory.JDBC_URL, url);
         put(properties, DataSourceFactory.JDBC_USER, user);
         put(properties, DataSourceFactory.JDBC_PASSWORD, password);
+        put(properties, "dataSourceType", databaseType);
         Configuration config = configAdmin.createFactoryConfiguration("org.ops4j.datasource",
null);
         config.update(properties);
     }


Mime
View raw message