karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [49/50] [abbrv] karaf git commit: [KARAF-4505] Add dataSourceType option to jdbc:ds-create command
Date Mon, 22 Aug 2016 09:30:47 GMT
[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/f7dbe7b1
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f7dbe7b1
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f7dbe7b1

Branch: refs/heads/master
Commit: f7dbe7b1a7bbe56fb9ed0c8c2acdf600f118ae4d
Parents: e61a826
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 11:29:22 2016 +0200

----------------------------------------------------------------------
 jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java         | 3 ++-
 jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java       | 3 ++-
 .../java/org/apache/karaf/jdbc/command/ds/CreateCommand.java    | 5 ++++-
 .../main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java | 4 ++--
 .../java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java    | 3 ++-
 5 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f7dbe7b1/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 19c1226..fb3cb26 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
@@ -44,9 +44,10 @@ public interface JdbcMBean {
      * @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/f7dbe7b1/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 a3f1724..5c245e2 100644
--- a/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
+++ b/jdbc/src/main/java/org/apache/karaf/jdbc/JdbcService.java
@@ -34,9 +34,10 @@ public interface JdbcService {
      * @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/f7dbe7b1/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/f7dbe7b1/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/f7dbe7b1/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