manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1526909 - in /manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database: DBInterfaceDerby.java DBInterfaceHSQLDB.java DBInterfaceMySQL.java DBInterfacePostgreSQL.java
Date Fri, 27 Sep 2013 14:06:23 GMT
Author: kwright
Date: Fri Sep 27 14:06:23 2013
New Revision: 1526909

URL: http://svn.apache.org/r1526909
Log:
Hook up shared configuration for database drivers.

Modified:
    manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
    manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
    manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java

Modified: manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1526909&r1=1526908&r2=1526909&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
(original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
Fri Sep 27 14:06:23 2013
@@ -91,6 +91,7 @@ public class DBInterfaceDerby extends Da
   protected static String getFullDatabasePath(String databaseName)
     throws ManifoldCFException
   {
+    // Derby is local file based so it cannot currently be used in zookeeper mode
     File path = ManifoldCF.getFileProperty(databasePathProperty);
     if (path == null)
       throw new ManifoldCFException("Derby database requires '"+databasePathProperty+"' property,
containing a relative path");
@@ -1245,7 +1246,7 @@ public class DBInterfaceDerby extends Da
       if (threshold == null)
       {
         // Look for this parameter; if we don't find it, use a default value.
-        reindexThreshold = ManifoldCF.getIntProperty("org.apache.manifoldcf.db.derby.reindex."+tableName,250000);
+        reindexThreshold = lockManager.getSharedConfiguration().getIntProperty("org.apache.manifoldcf.db.derby.reindex."+tableName,250000);
         reindexThresholds.put(tableName,new Integer(reindexThreshold));
       }
       else
@@ -1302,7 +1303,7 @@ public class DBInterfaceDerby extends Da
       if (threshold == null)
       {
         // Look for this parameter; if we don't find it, use a default value.
-        analyzeThreshold = ManifoldCF.getIntProperty("org.apache.manifoldcf.db.derby.analyze."+tableName,5000);
+        analyzeThreshold = lockManager.getSharedConfiguration().getIntProperty("org.apache.manifoldcf.db.derby.analyze."+tableName,5000);
         analyzeThresholds.put(tableName,new Integer(analyzeThreshold));
       }
       else

Modified: manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1526909&r1=1526908&r2=1526909&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
(original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Fri Sep 27 14:06:23 2013
@@ -58,9 +58,9 @@ public class DBInterfaceHSQLDB extends D
   public DBInterfaceHSQLDB(IThreadContext tc, String databaseName, String userName, String
password)
     throws ManifoldCFException
   {
-    super(tc,getJDBCString(databaseName),_driver,getDatabaseString(databaseName),userName,password);
+    super(tc,getJDBCString(tc,databaseName),_driver,getDatabaseString(tc,databaseName),userName,password);
     cacheKey = CacheKeyFactory.makeDatabaseKey(this.databaseName);
-    this.isRemote = ManifoldCF.getProperty(databaseProtocolProperty) != null;
+    this.isRemote = LockManagerFactory.getProperty(tc,databaseProtocolProperty) != null;
     this.userName = userName;
     this.password = password;
     if (this.isRemote)
@@ -69,34 +69,34 @@ public class DBInterfaceHSQLDB extends D
       schemaNameForQueries = "PUBLIC";
   }
 
-  protected static String getJDBCString(String databaseName)
+  protected static String getJDBCString(IThreadContext tc, String databaseName)
     throws ManifoldCFException
   {
     // For local, we use the database name as the name of the database files.
     // For remote, we connect to an instance specified by a different property, and use the
database name as the schema name.
-    String protocol = ManifoldCF.getProperty(databaseProtocolProperty);
+    String protocol = LockManagerFactory.getProperty(tc,databaseProtocolProperty);
     if (protocol == null)
       return _localUrl+getFullDatabasePath(databaseName);
     
     // Remote instance.  Build the URL.
     if (legalProtocolValues.get(protocol) == null)
       throw new ManifoldCFException("The value of the '"+databaseProtocolProperty+"' property
was illegal; try hsql, http, or https");
-    String server = ManifoldCF.getProperty(databaseServerProperty);
+    String server = LockManagerFactory.getProperty(tc,databaseServerProperty);
     if (server == null)
       throw new ManifoldCFException("HSQLDB remote mode requires '"+databaseServerProperty+"'
property, containing a server name or IP address");
-    String port = ManifoldCF.getProperty(databasePortProperty);
+    String port = LockManagerFactory.getProperty(tc,databasePortProperty);
     if (port != null && port.length() > 0)
       server += ":"+port;
-    String instanceName = ManifoldCF.getProperty(databaseInstanceProperty);
+    String instanceName = LockManagerFactory.getProperty(tc,databaseInstanceProperty);
     if (instanceName != null && instanceName.length() > 0)
       server += "/" + instanceName;
     return _remoteUrl + protocol + "://" + server;
   }
   
-  protected static String getDatabaseString(String databaseName)
+  protected static String getDatabaseString(IThreadContext tc, String databaseName)
     throws ManifoldCFException
   {
-    String protocol = ManifoldCF.getProperty(databaseProtocolProperty);
+    String protocol = LockManagerFactory.getProperty(tc,databaseProtocolProperty);
     if (protocol == null)
       return getFullDatabasePath(databaseName);
     return databaseName;

Modified: manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1526909&r1=1526908&r2=1526909&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
(original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
Fri Sep 27 14:06:23 2013
@@ -62,14 +62,15 @@ public class DBInterfaceMySQL extends Da
   public DBInterfaceMySQL(IThreadContext tc, String databaseName, String userName, String
password)
     throws ManifoldCFException
   {
-    super(tc,getJdbcUrl(databaseName),_driver,databaseName,userName,password);
+    super(tc,getJdbcUrl(tc,databaseName),_driver,databaseName,userName,password);
     cacheKey = CacheKeyFactory.makeDatabaseKey(this.databaseName);
     lockManager = LockManagerFactory.make(tc);
   }
 
-  private static String getJdbcUrl(String theDatabaseName)
+  private static String getJdbcUrl(IThreadContext tc, String theDatabaseName)
+    throws ManifoldCFException
   {
-    String server =  ManifoldCF.getProperty(mysqlServerProperty);
+    String server =  LockManagerFactory.getProperty(tc,mysqlServerProperty);
     if (server == null || server.length() == 0)
       server = "localhost";
     return "jdbc:mysql://"+server+"/"+theDatabaseName+"?useUnicode=true&characterEncoding=utf8";
@@ -615,7 +616,7 @@ public class DBInterfaceMySQL extends Da
     throws ManifoldCFException
   {
     // Get the client property
-    String client =  ManifoldCF.getProperty(mysqlClientProperty);
+    String client =  lockManager.getSharedConfiguration().getProperty(mysqlClientProperty);
     if (client == null || client.length() == 0)
       client = "localhost";
 
@@ -1278,7 +1279,7 @@ public class DBInterfaceMySQL extends Da
       if (threshold == null)
       {
         // Look for this parameter; if we don't find it, use a default value.
-        analyzeThreshold = ManifoldCF.getIntProperty("org.apache.manifoldcf.db.mysql.analyze."+tableName,10000);
+        analyzeThreshold = lockManager.getSharedConfiguration().getIntProperty("org.apache.manifoldcf.db.mysql.analyze."+tableName,10000);
         analyzeThresholds.put(tableName,new Integer(analyzeThreshold));
       }
       else

Modified: manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1526909&r1=1526908&r2=1526909&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
(original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Fri Sep 27 14:06:23 2013
@@ -38,10 +38,10 @@ public class DBInterfacePostgreSQL exten
   private static final String _driver = "org.postgresql.Driver";
 
   /** A lock manager handle. */
-  protected ILockManager lockManager;
+  protected final ILockManager lockManager;
   
   // Database cache key
-  protected String cacheKey;
+  protected final String cacheKey;
 	
   // Postgresql serializable transactions are broken in that transactions that occur within
them do not in fact work properly.
   // So, once we enter the serializable realm, STOP any additional transactions from doing
anything at all.
@@ -78,17 +78,18 @@ public class DBInterfacePostgreSQL exten
   public DBInterfacePostgreSQL(IThreadContext tc, String databaseName, String userName, String
password)
     throws ManifoldCFException
   {
-    super(tc,getJdbcUrl(databaseName),_driver,databaseName,userName,password);
+    super(tc,getJdbcUrl(tc,databaseName),_driver,databaseName,userName,password);
     cacheKey = CacheKeyFactory.makeDatabaseKey(this.databaseName);
     lockManager = LockManagerFactory.make(tc);
   }
   
-  private static String getJdbcUrl(final String databaseName)
+  private static String getJdbcUrl(final IThreadContext tc, final String databaseName)
+    throws ManifoldCFException
   {
     String jdbcUrl = _defaultUrl + databaseName;
-    final String hostname = ManifoldCF.getProperty(postgresqlHostnameProperty);
-    final String ssl = ManifoldCF.getProperty(postgresqlSslProperty);
-    final String port = ManifoldCF.getProperty(postgresqlPortProperty);
+    final String hostname = LockManagerFactory.getProperty(tc,postgresqlHostnameProperty);
+    final String ssl = LockManagerFactory.getProperty(tc,postgresqlSslProperty);
+    final String port = LockManagerFactory.getProperty(tc,postgresqlPortProperty);
     if (hostname != null && hostname.length() > 0)
     {
       jdbcUrl = "jdbc:postgresql://" + hostname;
@@ -1420,7 +1421,7 @@ public class DBInterfacePostgreSQL exten
       if (threshold == null)
       {
         // Look for this parameter; if we don't find it, use a default value.
-        reindexThreshold = ManifoldCF.getIntProperty("org.apache.manifoldcf.db.postgres.reindex."+tableName,250000);
+        reindexThreshold = lockManager.getSharedConfiguration().getIntProperty("org.apache.manifoldcf.db.postgres.reindex."+tableName,250000);
         reindexThresholds.put(tableName,new Integer(reindexThreshold));
       }
       else
@@ -1477,7 +1478,7 @@ public class DBInterfacePostgreSQL exten
       if (threshold == null)
       {
         // Look for this parameter; if we don't find it, use a default value.
-        analyzeThreshold = ManifoldCF.getIntProperty("org.apache.manifoldcf.db.postgres.analyze."+tableName,2000);
+        analyzeThreshold = lockManager.getSharedConfiguration().getIntProperty("org.apache.manifoldcf.db.postgres.analyze."+tableName,2000);
         analyzeThresholds.put(tableName,new Integer(analyzeThreshold));
       }
       else



Mime
View raw message