activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [3/4] activemq-artemis git commit: ARTEMIS-999 Add support for Oracle12C
Date Mon, 27 Feb 2017 03:24:29 GMT
ARTEMIS-999 Add support for Oracle12C


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7b344a92
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7b344a92
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7b344a92

Branch: refs/heads/master
Commit: 7b344a92fd534e62d793acab865544437f81ca4f
Parents: a3c852e
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Sun Feb 26 20:10:18 2017 +0000
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Sun Feb 26 21:10:03 2017 +0000

----------------------------------------------------------------------
 .../artemis/jdbc/store/drivers/JDBCUtils.java   |  7 +++
 .../drivers/oracle/Oracle12CSQLProvider.java    | 61 ++++++++++++++++++++
 2 files changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7b344a92/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java
index 2d85b29..802d856 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCUtils.java
@@ -20,6 +20,7 @@ import java.sql.SQLException;
 
 import org.apache.activemq.artemis.jdbc.store.drivers.derby.DerbySQLProvider;
 import org.apache.activemq.artemis.jdbc.store.drivers.mysql.MySQLSQLProvider;
+import org.apache.activemq.artemis.jdbc.store.drivers.oracle.Oracle12CSQLProvider;
 import org.apache.activemq.artemis.jdbc.store.drivers.postgres.PostgresSQLProvider;
 import org.apache.activemq.artemis.jdbc.store.sql.GenericSQLProvider;
 import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
@@ -40,6 +41,9 @@ public class JDBCUtils {
       } else if (url.contains("mysql")) {
          logger.tracef("getSQLProvider Returning mysql SQL provider for url::%s", url);
          factory = new MySQLSQLProvider.Factory();
+      } else if (url.contains("oracle")) {
+         logger.tracef("getSQLProvider Returning Oracle12C SQL provider for url::%s", url);
+         factory = new Oracle12CSQLProvider.Factory();
       } else {
          logger.tracef("getSQLProvider Returning generic SQL provider for url::%s", url);
          factory = new GenericSQLProvider.Factory();
@@ -58,6 +62,9 @@ public class JDBCUtils {
       } else if (driverClass.contains("mysql")) {
          logger.tracef("getSQLProvider Returning mysql SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          factory = new MySQLSQLProvider.Factory();
+      } else if (driverClass.contains("oracle")) {
+         logger.tracef("getSQLProvider Returning Oracle12C SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
+         factory = new Oracle12CSQLProvider.Factory();
       } else {
          logger.tracef("getSQLProvider Returning generic SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          factory = new GenericSQLProvider.Factory();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7b344a92/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/oracle/Oracle12CSQLProvider.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/oracle/Oracle12CSQLProvider.java
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/oracle/Oracle12CSQLProvider.java
new file mode 100644
index 0000000..accddfd
--- /dev/null
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/oracle/Oracle12CSQLProvider.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jdbc.store.drivers.oracle;
+
+import org.apache.activemq.artemis.jdbc.store.sql.GenericSQLProvider;
+import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
+
+public class Oracle12CSQLProvider extends GenericSQLProvider {
+
+   /**
+   create-file-table.oracle=CREATE TABLE %s(ID NUMBER(19) GENERATED BY DEFAULT ON NULL AS
IDENTITY, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID))
+   create-journal-table.oracle=CREATE TABLE %s(id NUMBER(19) GENERATED BY DEFAULT ON NULL
AS IDENTITY,recordType NUMBER(5),compactCount NUMBER(5),txId NUMBER(19),userRecordType NUMBER(5),variableSize
NUMBER(10),record BLOB,txDataSize NUMBER(10),txData BLOB,txCheckNoRecords NUMBER(10),seq NUMBER(19))
+   max-blob-size.oracle=4294967296 **/
+
+   private final String createFileTableSQL = "CREATE TABLE " + tableName + " (ID NUMBER(19)
GENERATED BY DEFAULT ON NULL AS IDENTITY, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA
BLOB, PRIMARY KEY(ID))";
+
+   private final String createJournalTableSQL = "CREATE TABLE " + tableName + " (id NUMBER(19)
GENERATED BY DEFAULT ON NULL AS IDENTITY,recordType NUMBER(5),compactCount NUMBER(5),txId
NUMBER(19),userRecordType NUMBER(5),variableSize NUMBER(10),record BLOB,txDataSize NUMBER(10),txData
BLOB,txCheckNoRecords NUMBER(10),seq NUMBER(19))";
+
+   private static final long MAX_BLOB_SIZE = 4294967296L; //4GB
+
+   protected Oracle12CSQLProvider(String tableName) {
+      super(tableName);
+   }
+
+   @Override
+   public long getMaxBlobSize() {
+      return MAX_BLOB_SIZE;
+   }
+
+   @Override
+   public String getCreateFileTableSQL() {
+      return createFileTableSQL;
+   }
+
+   @Override
+   public String[] getCreateJournalTableSQL() {
+      return new String[] {createJournalTableSQL};
+   }
+
+   public static class Factory implements SQLProvider.Factory {
+
+      @Override
+      public SQLProvider create(String tableName) {
+         return new Oracle12CSQLProvider(tableName);
+      }
+   }
+}


Mime
View raw message