You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by bl...@apache.org on 2013/11/07 08:07:31 UTC

git commit: TAJO-297: Rename JDBC variables in CatalogConstants to be more generic. (jaehwa)

Updated Branches:
  refs/heads/master 5dbdd26d7 -> f4672e104


TAJO-297: Rename JDBC variables in CatalogConstants to be more generic. (jaehwa)


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

Branch: refs/heads/master
Commit: f4672e10466b361f020c26bad752ca12dc0adf3a
Parents: 5dbdd26
Author: blrunner <jh...@gruter.com>
Authored: Thu Nov 7 16:00:15 2013 +0900
Committer: blrunner <jh...@gruter.com>
Committed: Thu Nov 7 16:00:15 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../apache/tajo/catalog/CatalogConstants.java   |  6 ++---
 .../org/apache/tajo/catalog/CatalogServer.java  |  4 +--
 .../tajo/catalog/store/AbstractDBStore.java     | 26 ++++++++++----------
 .../apache/tajo/catalog/store/DerbyStore.java   | 12 ++++-----
 .../apache/tajo/catalog/store/MySQLStore.java   | 10 ++++----
 .../org/apache/tajo/catalog/TestCatalog.java    |  4 +--
 .../org/apache/tajo/catalog/TestDBStore.java    |  4 +--
 .../src/main/resources/catalog-default.xml      |  4 +--
 .../org/apache/tajo/TajoTestingCluster.java     |  8 +++---
 10 files changed, 41 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 309ee32..ec1c228 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -61,6 +61,8 @@ Release 0.2.0 - unreleased
 
   IMPROVEMENTS
 
+    TAJO-297: Rename JDBC variables in CatalogConstants to be more generic. (jaehwa)
+
     TAJO-287: Improve Fragment to be more generic. (hyunsik)
 
     TAJO-274: Maintaining connectivity to Tajo master regardless of the restart

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
index d43efbf..b9e6d61 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogConstants.java
@@ -21,10 +21,10 @@ package org.apache.tajo.catalog;
 public class CatalogConstants {
   public static final String STORE_CLASS="tajo.catalog.store.class";
 
-  public static final String CONNECTION_ID = "tajo.catalog.jdbc.connection.id";
-  public static final String CONNECTION_PASSWORD = "tajo.catalog.jdbc.connection.password";
+  public static final String CONNECTION_ID = "tajo.catalog.connection.id";
+  public static final String CONNECTION_PASSWORD = "tajo.catalog.connection.password";
 
-  public static final String JDBC_URI="tajo.catalog.jdbc.uri";
+  public static final String CATALOG_URI="tajo.catalog.uri";
   public static final String TB_META = "META";
   public static final String TB_TABLES = "TABLES";
   public static final String TB_COLUMNS = "COLUMNS";

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index d8b2004..21ccfaf 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -125,8 +125,8 @@ public class CatalogServer extends AbstractService {
   }
 
   public String getCatalogServerName() {
-    return bindAddressStr + ", store=" + this.store.getClass().getSimpleName() + ", jdbc="
-        + conf.get(CatalogConstants.JDBC_URI);
+    return bindAddressStr + ", store=" + this.store.getClass().getSimpleName() + ", catalogUri="
+        + conf.get(CatalogConstants.CATALOG_URI);
   }
 
   private void initBuiltinFunctions(List<FunctionDesc> functions)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index 9e0762f..a1e8d0d 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
@@ -43,12 +43,12 @@ import java.util.Map.Entry;
 public abstract class AbstractDBStore extends CatalogConstants implements CatalogStore {
   protected final Log LOG = LogFactory.getLog(getClass());
   protected Configuration conf;
-  protected String jdbcUri;
+  protected String catalogUri;
   private Connection conn;
 
   protected static final int VERSION = 1;
 
-  protected abstract String getJDBCDriverName();
+  protected abstract String getCatalogDriverName();
 
   protected abstract Connection createConnection(final Configuration conf) throws SQLException;
 
@@ -60,21 +60,21 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       throws InternalException {
 
     this.conf = conf;
-    this.jdbcUri = conf.get(JDBC_URI);
-    String jdbcDriver = getJDBCDriverName();
+    this.catalogUri = conf.get(CATALOG_URI);
+    String catalogDriver = getCatalogDriverName();
     try {
-      Class.forName(getJDBCDriverName()).newInstance();
-      LOG.info("Loaded the JDBC driver (" + jdbcDriver + ")");
+      Class.forName(getCatalogDriverName()).newInstance();
+      LOG.info("Loaded the Catalog driver (" + catalogDriver + ")");
     } catch (Exception e) {
-      throw new InternalException("Cannot load JDBC driver " + jdbcDriver, e);
+      throw new InternalException("Cannot load Catalog driver " + catalogDriver, e);
     }
 
     try {
-      LOG.info("Trying to connect database (" + jdbcUri + ")");
+      LOG.info("Trying to connect database (" + catalogUri + ")");
       conn = createConnection(conf);
-      LOG.info("Connected to database (" + jdbcUri + ")");
+      LOG.info("Connected to database (" + catalogUri + ")");
     } catch (SQLException e) {
-      throw new InternalException("Cannot connect to database (" + jdbcUri
+      throw new InternalException("Cannot connect to database (" + catalogUri
           + ")", e);
     }
 
@@ -109,8 +109,8 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 //    }
   }
 
-  protected String getJDBCUri(){
-    return jdbcUri;
+  protected String getCatalogUri(){
+    return catalogUri;
   }
 
   public Connection getConnection() throws SQLException{
@@ -740,6 +740,6 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
   @Override
   public void close() {
     CatalogUtil.closeSQLWrapper(conn);
-    LOG.info("Shutdown database (" + jdbcUri + ")");
+    LOG.info("Shutdown database (" + catalogUri + ")");
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/DerbyStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/DerbyStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/DerbyStore.java
index e1fea50..6fee78b 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/DerbyStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/DerbyStore.java
@@ -43,12 +43,12 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 public class DerbyStore extends AbstractDBStore {
-  private static final String JDBC_DRIVER="org.apache.derby.jdbc.EmbeddedDriver";
+  private static final String CATALOG_DRIVER="org.apache.derby.jdbc.EmbeddedDriver";
   protected Lock rlock;
   protected Lock wlock;
 
-  protected String getJDBCDriverName(){
-    return JDBC_DRIVER;
+  protected String getCatalogDriverName(){
+    return CATALOG_DRIVER;
   }
   
   public DerbyStore(final Configuration conf)
@@ -58,7 +58,7 @@ public class DerbyStore extends AbstractDBStore {
   }
 
   protected Connection createConnection(Configuration conf) throws SQLException {
-    return DriverManager.getConnection(getJDBCUri());
+    return DriverManager.getConnection(getCatalogUri());
   }
 
   // TODO - DDL and index statements should be renamed
@@ -875,7 +875,7 @@ public class DerbyStore extends AbstractDBStore {
       //LOG.error(e.getMessage(), e);
     }
     
-    LOG.info("Shutdown database (" + jdbcUri + ")");
+    LOG.info("Shutdown database (" + catalogUri + ")");
   }
   
   
@@ -883,4 +883,4 @@ public class DerbyStore extends AbstractDBStore {
     @SuppressWarnings("unused")
     DerbyStore store = new DerbyStore(new TajoConf());
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MySQLStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MySQLStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MySQLStore.java
index 25e5674..6c379f1 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MySQLStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/MySQLStore.java
@@ -32,9 +32,9 @@ import java.util.List;
 
 public class MySQLStore extends AbstractDBStore  {
 
-  private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
-  protected String getJDBCDriverName(){
-    return JDBC_DRIVER;
+  private static final String CATALOG_DRIVER = "com.mysql.jdbc.Driver";
+  protected String getCatalogDriverName(){
+    return CATALOG_DRIVER;
   }
 
   public MySQLStore(Configuration conf) throws InternalException {
@@ -42,7 +42,7 @@ public class MySQLStore extends AbstractDBStore  {
   }
 
   protected Connection createConnection(Configuration conf) throws SQLException {
-    Connection con = DriverManager.getConnection(getJDBCUri(), conf.get(CONNECTION_ID), conf.get(CONNECTION_PASSWORD));
+    Connection con = DriverManager.getConnection(getCatalogUri(), conf.get(CONNECTION_ID), conf.get(CONNECTION_PASSWORD));
     //TODO con.setAutoCommit(false);
     return con;
   }
@@ -181,4 +181,4 @@ public class MySQLStore extends AbstractDBStore  {
     // TODO - not implemented yet
     return null;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index b644e69..b824756 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@ -49,7 +49,7 @@ public class TestCatalog {
 	public static void setUp() throws Exception {
     TajoConf conf = new TajoConf();
 
-    conf.set(CatalogConstants.JDBC_URI, "jdbc:derby:target/test-data/TestCatalog/db;create=true");
+    conf.set(CatalogConstants.CATALOG_URI, "jdbc:derby:target/test-data/TestCatalog/db;create=true");
     conf.setVar(TajoConf.ConfVars.CATALOG_ADDRESS, "127.0.0.1:0");
 
 	  server = new CatalogServer();
@@ -197,4 +197,4 @@ public class TestCatalog {
     catalog.createFunction(overload);
     assertTrue(catalog.containFunction("test3", CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB)));
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestDBStore.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestDBStore.java
index 12e175c..4ae4d5d 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestDBStore.java
@@ -48,8 +48,8 @@ public class TestDBStore {
     conf = new TajoConf();
     Path testDir = CommonTestingUtil.getTestDir("target/test-data/TestDBSTore");
     File absolutePath = new File(testDir.toUri());
-    conf.set(CatalogConstants.JDBC_URI, "jdbc:derby:"+absolutePath.getAbsolutePath()+"/db;create=true");
-    LOG.info("derby repository is set to "+conf.get(CatalogConstants.JDBC_URI));
+    conf.set(CatalogConstants.CATALOG_URI, "jdbc:derby:"+absolutePath.getAbsolutePath()+"/db;create=true");
+    LOG.info("derby repository is set to "+conf.get(CatalogConstants.CATALOG_URI));
     store = new DerbyStore(conf);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-core/tajo-core-backend/src/main/resources/catalog-default.xml
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/resources/catalog-default.xml b/tajo-core/tajo-core-backend/src/main/resources/catalog-default.xml
index 52f204a..7d37dff 100644
--- a/tajo-core/tajo-core-backend/src/main/resources/catalog-default.xml
+++ b/tajo-core/tajo-core-backend/src/main/resources/catalog-default.xml
@@ -26,7 +26,7 @@
   </property>
 
   <property>
-    <name>tajo.catalog.jdbc.uri</name>
+    <name>tajo.catalog.uri</name>
     <value>jdbc:derby:/tmp/tajo-catalog-${user.name}/db;create=true</value>
   </property>
-</configuration>
\ No newline at end of file
+</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/f4672e10/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/TajoTestingCluster.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/TajoTestingCluster.java
index 116e282..9ea07de 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@ -234,8 +234,8 @@ public class TajoTestingCluster {
     }
 
     conf.set(CatalogConstants.STORE_CLASS, "org.apache.tajo.catalog.store.MemStore");
-    conf.set(CatalogConstants.JDBC_URI, "jdbc:derby:" + clusterTestBuildDir.getAbsolutePath() + "/db");
-    LOG.info("Apache Derby repository is set to "+conf.get(CatalogConstants.JDBC_URI));
+    conf.set(CatalogConstants.CATALOG_URI, "jdbc:derby:" + clusterTestBuildDir.getAbsolutePath() + "/db");
+    LOG.info("Apache Derby repository is set to "+conf.get(CatalogConstants.CATALOG_URI));
     conf.setVar(ConfVars.CATALOG_ADDRESS, "localhost:0");
 
     catalogServer = new MiniCatalogServer(conf);
@@ -266,10 +266,10 @@ public class TajoTestingCluster {
     c.setVar(ConfVars.WORKER_PEER_RPC_ADDRESS, "localhost:0");
     c.setVar(ConfVars.CATALOG_ADDRESS, "localhost:0");
     c.set(CatalogConstants.STORE_CLASS, "org.apache.tajo.catalog.store.MemStore");
-    c.set(CatalogConstants.JDBC_URI, "jdbc:derby:" + testBuildDir.getAbsolutePath() + "/db");
+    c.set(CatalogConstants.CATALOG_URI, "jdbc:derby:" + testBuildDir.getAbsolutePath() + "/db");
     c.setVar(ConfVars.WORKER_TEMPORAL_DIR, "file://" + testBuildDir.getAbsolutePath() + "/tajo-localdir");
 
-    LOG.info("derby repository is set to "+conf.get(CatalogConstants.JDBC_URI));
+    LOG.info("derby repository is set to "+conf.get(CatalogConstants.CATALOG_URI));
 
     if (!local) {
       c.setVar(ConfVars.ROOT_DIR,