manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1527183 [1/2] - in /manifoldcf/trunk: ./ connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/ connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/ connectors/jdbc/connecto...
Date Sat, 28 Sep 2013 13:18:42 GMT
Author: kwright
Date: Sat Sep 28 13:18:40 2013
New Revision: 1527183

URL: http://svn.apache.org/r1527183
Log:
Refactor how properties are obtained.  Part of CONNECTORS-13.

Added:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
      - copied unchanged from r1527182, manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
Removed:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCFConfiguration.java
Modified:
    manifoldcf/trunk/   (props changed)
    manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
    manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
    manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnectionFactory.java
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java
    manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
    manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java
    manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java
    manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java
    manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java
    manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java
    manifoldcf/trunk/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java
    manifoldcf/trunk/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java
    manifoldcf/trunk/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/DBInterfaceFactory.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java
    manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java
    manifoldcf/trunk/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java
    manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
    manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineRepositoryConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DeleteJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DeleteRepositoryConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/FindJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/GetJobSchedule.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/InitializeAndRegister.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ListJobStatuses.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ListJobs.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/PauseJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RestartJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunDocumentStatus.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunMaxActivityHistory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunMaxBandwidthHistory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunQueueStatus.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunResultHistory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunSimpleHistory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/StartJob.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/TransactionalCrawlerInitializationCommand.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitForJobDeleted.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitForJobInactive.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitJobPaused.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseDerby.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseHSQLDB.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseHSQLDBext.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseMySQL.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BasePostgresql.java

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
  Merged /manifoldcf/branches/CONNECTORS-13:r1525862-1527182

Modified: manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java (original)
+++ manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java Sat Sep 28 13:18:40 2013
@@ -114,7 +114,7 @@ public class GTSConnector extends org.ap
       String userID = params.getParameter(GTSConfig.PARAM_USERID);
       String password = params.getObfuscatedParameter(GTSConfig.PARAM_PASSWORD);
       String realm = params.getParameter(GTSConfig.PARAM_REALM);
-      poster = new HttpPoster(realm,userID,password,ingestURI);
+      poster = new HttpPoster(currentContext,realm,userID,password,ingestURI);
     }
   }
 

Modified: manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java (original)
+++ manifoldcf/trunk/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java Sat Sep 28 13:18:40 2013
@@ -63,14 +63,16 @@ public class HttpPoster
   private int port = 80;
   private String protocol = null;
 
-  private int buffersize = 32768;  // default buffer size
-  double sizeCoefficient = 0.0005;    // 20 ms additional timeout per 2000 bytes, pulled out of my butt
+  /** Default buffer size */
+  private final int buffersize;
+  /** Size coefficient */
+  private static double sizeCoefficient = 0.0005;    // 20 ms additional timeout per 2000 bytes, pulled out of my butt
   /** the number of times we should poll for the response */
-  int responseRetries = 9000;         // Long basic wait: 3 minutes.  This will also be added to by a term based on the size of the request.
+  private final int responseRetries;
   /** how long we should wait before checking for a new stream */
-  long responseRetryWait = 20L;
+  private final long responseRetryWait;
   /** How long to wait before retrying a failed ingestion */
-  long interruptionRetryTime = 60000L;
+  private final long interruptionRetryTime;
 
   /** This is the secure socket factory we will use.  I'm presuming it's thread-safe, but
   * if not, synchronization blocks are in order when it's used. */
@@ -95,7 +97,7 @@ public class HttpPoster
   * @param password is the unencoded password, or null.
   * @param postURI the uri to post the request to
   */
-  public HttpPoster(String realm, String userID, String password, String postURI)
+  public HttpPoster(IThreadContext threadContext, String realm, String userID, String password, String postURI)
     throws ManifoldCFException
   {
     if (userID != null && userID.length() > 0 && password != null)
@@ -136,18 +138,10 @@ public class HttpPoster
         port = 80;
     }
 
-    String x = ManifoldCF.getProperty(ingestBufferSizeProperty);
-    if (x != null && x.length() > 0)
-      buffersize = new Integer(x).intValue();
-    x = ManifoldCF.getProperty(ingestResponseRetryCount);
-    if (x != null && x.length() > 0)
-      responseRetries = new Integer(x).intValue();
-    x = ManifoldCF.getProperty(ingestResponseRetryInterval);
-    if (x != null && x.length() > 0)
-      responseRetryWait = new Long(x).longValue();
-    x = ManifoldCF.getProperty(ingestRescheduleInterval);
-    if (x != null && x.length() > 0)
-      interruptionRetryTime = new Long(x).longValue();
+    buffersize = LockManagerFactory.getIntProperty(threadContext,ingestBufferSizeProperty,32768);
+    responseRetries = LockManagerFactory.getIntProperty(threadContext,ingestResponseRetryCount,9000);
+    responseRetryWait = LockManagerFactory.getIntProperty(threadContext,ingestResponseRetryInterval,20);
+    interruptionRetryTime = LockManagerFactory.getIntProperty(threadContext,ingestRescheduleInterval,60000);
   }
 
   /**

Modified: manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ manifoldcf/trunk/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java Sat Sep 28 13:18:40 2013
@@ -54,6 +54,7 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.KeystoreManagerFactory;
 import org.apache.manifoldcf.core.interfaces.Configuration;
 import org.apache.manifoldcf.core.interfaces.ConfigurationNode;
+import org.apache.manifoldcf.core.interfaces.LockManagerFactory;
 import org.apache.manifoldcf.crawler.interfaces.DocumentSpecification;
 import org.apache.manifoldcf.crawler.interfaces.IDocumentIdentifierStream;
 import org.apache.manifoldcf.crawler.interfaces.IProcessActivity;
@@ -120,7 +121,7 @@ public class SharedDriveConnector extend
   private boolean useSIDs = true;
 
   private NtlmPasswordAuthentication pa;
-
+  
   /** Deny access token for default authority */
   private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
 
@@ -128,9 +129,19 @@ public class SharedDriveConnector extend
   */
   public SharedDriveConnector()
   {
-    // We need to know whether to operate in NTLMv2 mode, or in NTLM mode.
-    String value = ManifoldCF.getProperty(PROPERTY_JCIFS_USE_NTLM_V1);
-    if (value == null || value.toLowerCase().equals("false"))
+  }
+
+  /** Set thread context.
+  * Use the opportunity to set the system properties we'll need.
+  */
+  @Override
+  public void setThreadContext(IThreadContext threadContext)
+    throws ManifoldCFException
+  {
+    super.setThreadContext(threadContext);
+    // We need to know whether to operate in NTLMv2 mode, or in NTLM mode.  We do this before jcifs called the first time.
+    boolean useV1 = LockManagerFactory.getBooleanProperty(threadContext, PROPERTY_JCIFS_USE_NTLM_V1, false);
+    if (!useV1)
     {
       System.setProperty("jcifs.smb.lmCompatibility","3");
       System.setProperty("jcifs.smb.client.useExtendedSecurity","true");
@@ -141,13 +152,14 @@ public class SharedDriveConnector extend
       System.setProperty("jcifs.smb.client.useExtendedSecurity","false");
     }
   }
-
+  
   /** Establish a "session".  In the case of the jcifs connector, this just builds the appropriate smbconnectionPath string, and does the necessary checks. */
   protected void getSession()
     throws ManifoldCFException
   {
     if (smbconnectionPath == null)
     {
+      
       // Get the server
       if (server == null || server.length() == 0)
         throw new ManifoldCFException("Missing parameter '"+SharedDriveParameters.server+"'");

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnectionFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnectionFactory.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnectionFactory.java (original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jdbc/JDBCConnectionFactory.java Sat Sep 28 13:18:40 2013
@@ -50,7 +50,7 @@ public class JDBCConnectionFactory
     driverMap.put("mysql:","com.mysql.jdbc.Driver");
     try
     {
-      _pool = new ConnectionPoolManager(120);
+      _pool = new ConnectionPoolManager(120,false);
     }
     catch (Exception e)
     {

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java Sat Sep 28 13:18:40 2013
@@ -32,8 +32,8 @@ public abstract class BaseAgentsInitiali
 {
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
     IThreadContext tc = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(tc);
     doExecute(tc);
   }
 

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java Sat Sep 28 13:18:40 2013
@@ -51,8 +51,8 @@ public class DefineOutputConnection
 
                 try
                 {
-                        ManifoldCF.initializeEnvironment();
                         IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
                         IOutputConnectionManager mgr = OutputConnectionManagerFactory.make(tc);
                         IOutputConnection conn = mgr.create();
                         conn.setName(connectionName);

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java Sat Sep 28 13:18:40 2013
@@ -46,8 +46,8 @@ public class DeleteOutputConnection
                 String connectionName = args[0];
                 try
                 {
-                        ManifoldCF.initializeEnvironment();
                         IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
                         IOutputConnectionManager mgr = OutputConnectionManagerFactory.make(tc);
                         mgr.delete(connectionName);
 

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java Sat Sep 28 13:18:40 2013
@@ -30,8 +30,8 @@ public abstract class TransactionalAgent
 {
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
     IThreadContext tc = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(tc);
     IDBInterface database = DBInterfaceFactory.make(tc,
       org.apache.manifoldcf.agents.system.ManifoldCF.getMasterDatabaseName(),
       org.apache.manifoldcf.agents.system.ManifoldCF.getMasterDatabaseUsername(),

Modified: manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java Sat Sep 28 13:18:40 2013
@@ -37,30 +37,30 @@ public class ManifoldCF extends org.apac
   
   /** Initialize environment.
   */
-  public static void initializeEnvironment()
+  public static void initializeEnvironment(IThreadContext threadContext)
     throws ManifoldCFException
   {
     synchronized (initializeFlagLock)
     {
       // Do core initialization
-      org.apache.manifoldcf.core.system.ManifoldCF.initializeEnvironment();
+      org.apache.manifoldcf.core.system.ManifoldCF.initializeEnvironment(threadContext);
       // Local initialization
-      org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+      org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(threadContext);
     }
   }
 
   /** Clean up environment.
   */
-  public static void cleanUpEnvironment()
+  public static void cleanUpEnvironment(IThreadContext threadContext)
   {
     synchronized (initializeFlagLock)
     {
-      org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
-      org.apache.manifoldcf.core.system.ManifoldCF.cleanUpEnvironment();
+      org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(threadContext);
+      org.apache.manifoldcf.core.system.ManifoldCF.cleanUpEnvironment(threadContext);
     }
   }
   
-  public static void localInitialize()
+  public static void localInitialize(IThreadContext threadContext)
     throws ManifoldCFException
   {
     synchronized (initializeFlagLock)
@@ -73,22 +73,22 @@ public class ManifoldCF extends org.apac
       
       // Initialize the local loggers
       Logging.initializeLoggers();
-      Logging.setLogLevels();
+      Logging.setLogLevels(threadContext);
       agentsInitialized = true;
     }
   }
 
-  public static void localCleanup()
+  public static void localCleanup(IThreadContext threadContext)
   {
   }
   
   /** Reset the environment.
   */
-  public static void resetEnvironment()
+  public static void resetEnvironment(IThreadContext threadContext)
   {
     synchronized (initializeFlagLock)
     {
-      org.apache.manifoldcf.core.system.ManifoldCF.resetEnvironment();
+      org.apache.manifoldcf.core.system.ManifoldCF.resetEnvironment(threadContext);
       synchronized (runningHash)
       {
         stopAgentsRun = false;

Modified: manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java (original)
+++ manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java Sat Sep 28 13:18:40 2013
@@ -111,13 +111,13 @@ public class BaseDerby extends org.apach
     throws Exception
   {
     super.initializeSystem();
-    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(ThreadContextFactory.make());
   }
   
   protected void cleanupSystem()
     throws Exception
   {
-    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(ThreadContextFactory.make());
     super.cleanupSystem();
   }
 

Modified: manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java (original)
+++ manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java Sat Sep 28 13:18:40 2013
@@ -111,13 +111,13 @@ public class BaseHSQLDB extends org.apac
     throws Exception
   {
     super.initializeSystem();
-    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(ThreadContextFactory.make());
   }
   
   protected void cleanupSystem()
     throws Exception
   {
-    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(ThreadContextFactory.make());
     super.cleanupSystem();
   }
 

Modified: manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java (original)
+++ manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java Sat Sep 28 13:18:40 2013
@@ -114,13 +114,13 @@ public class BaseHSQLDBext extends org.a
     throws Exception
   {
     super.initializeSystem();
-    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(ThreadContextFactory.make());
   }
   
   protected void cleanupSystem()
     throws Exception
   {
-    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(ThreadContextFactory.make());
     super.cleanupSystem();
   }
   

Modified: manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java (original)
+++ manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java Sat Sep 28 13:18:40 2013
@@ -111,13 +111,13 @@ public class BaseMySQL extends org.apach
     throws Exception
   {
     super.initializeSystem();
-    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(ThreadContextFactory.make());
   }
   
   protected void cleanupSystem()
     throws Exception
   {
-    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(ThreadContextFactory.make());
     super.cleanupSystem();
   }
 

Modified: manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java (original)
+++ manifoldcf/trunk/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java Sat Sep 28 13:18:40 2013
@@ -111,13 +111,13 @@ public class BasePostgresql extends org.
     throws Exception
   {
     super.initializeSystem();
-    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localInitialize(ThreadContextFactory.make());
   }
   
   protected void cleanupSystem()
     throws Exception
   {
-    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup();
+    org.apache.manifoldcf.agents.system.ManifoldCF.localCleanup(ThreadContextFactory.make());
     super.cleanupSystem();
   }
 

Modified: manifoldcf/trunk/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java (original)
+++ manifoldcf/trunk/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java Sat Sep 28 13:18:40 2013
@@ -33,7 +33,7 @@ public class ServletListener implements 
   {
     try
     {
-      ManifoldCF.initializeEnvironment();
+      ManifoldCF.initializeEnvironment(ThreadContextFactory.make());
     }
     catch (ManifoldCFException e)
     {
@@ -43,7 +43,7 @@ public class ServletListener implements 
   
   public void contextDestroyed(ServletContextEvent sce)
   {
-    ManifoldCF.cleanUpEnvironment();
+    ManifoldCF.cleanUpEnvironment(ThreadContextFactory.make());
   }
 
 }

Modified: manifoldcf/trunk/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java (original)
+++ manifoldcf/trunk/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java Sat Sep 28 13:18:40 2013
@@ -33,7 +33,7 @@ public class ServletListener implements 
   {
     try
     {
-      ManifoldCF.initializeEnvironment();
+      ManifoldCF.initializeEnvironment(ThreadContextFactory.make());
     }
     catch (ManifoldCFException e)
     {
@@ -43,7 +43,7 @@ public class ServletListener implements 
   
   public void contextDestroyed(ServletContextEvent sce)
   {
-    ManifoldCF.cleanUpEnvironment();
+    ManifoldCF.cleanUpEnvironment(ThreadContextFactory.make());
   }
 
 }

Modified: manifoldcf/trunk/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java (original)
+++ manifoldcf/trunk/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java Sat Sep 28 13:18:40 2013
@@ -36,9 +36,8 @@ public class ServletListener implements 
   {
     try
     {
-      ManifoldCF.initializeEnvironment();
-
       IThreadContext tc = ThreadContextFactory.make();
+      ManifoldCF.initializeEnvironment(tc);
 
       ManifoldCF.createSystemDatabase(tc);
       ManifoldCF.installTables(tc);
@@ -55,16 +54,16 @@ public class ServletListener implements 
   
   public void contextDestroyed(ServletContextEvent sce)
   {
+    IThreadContext tc = ThreadContextFactory.make();
     try
     {
-      IThreadContext tc = ThreadContextFactory.make();
       ManifoldCF.stopAgents(tc);
     }
     catch (ManifoldCFException e)
     {
       throw new RuntimeException("Cannot shutdown servlet cleanly; "+e.getMessage(),e);
     }
-    ManifoldCF.cleanUpEnvironment();
+    ManifoldCF.cleanUpEnvironment(tc);
   }
 
 }

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java Sat Sep 28 13:18:40 2013
@@ -49,8 +49,8 @@ public abstract class DBInitializationCo
 
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
     IThreadContext tc = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(tc);
     doExecute(tc);
   }
 

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java Sat Sep 28 13:18:40 2013
@@ -38,7 +38,7 @@ public class LockClean implements Initia
    */
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
+    ManifoldCF.initializeEnvironment(ThreadContextFactory.make());
     String synchDir = ManifoldCF.getFileProperty(org.apache.manifoldcf.core.lockmanager.LockManager.synchDirectoryProperty).toString();
     if (synchDir != null)
     {

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/ConnectionFactory.java Sat Sep 28 13:18:40 2013
@@ -35,9 +35,6 @@ public class ConnectionFactory
 {
   public static final String _rcsid = "@(#)$Id: ConnectionFactory.java 988245 2010-08-23 18:39:35Z kwright $";
 
-  // This default is designed to avoid strange errors with people using postgresql out of the box, where the maximum connection count is set to 100.
-  private static final int defaultMaxDBConnections = 50;
-  private static final int defaultTimeoutValue = 86400;
 
   private static HashMap checkedOutConnections = new HashMap();
 
@@ -47,7 +44,8 @@ public class ConnectionFactory
   {
   }
 
-  public static WrappedConnection getConnection(String jdbcUrl, String jdbcDriver, String database, String userName, String password)
+  public static WrappedConnection getConnection(String jdbcUrl, String jdbcDriver, String database, String userName, String password,
+    int maxDBConnections, boolean debug)
     throws ManifoldCFException
   {
     // Make sure database driver is registered
@@ -59,8 +57,8 @@ public class ConnectionFactory
     {
       throw new ManifoldCFException("Unable to load database driver: "+e.getMessage(),e,ManifoldCFException.SETUP_ERROR);
     }
-
-    ConnectionPoolManager cpm = poolManager.createPoolManager();
+    
+    ConnectionPoolManager cpm = poolManager.createPoolManager(debug);
     
     try
     {
@@ -76,18 +74,6 @@ public class ConnectionFactory
       }
       if (cp == null)
       {
-        String handleMax = ManifoldCF.getProperty(ManifoldCF.databaseHandleMaxcountProperty);
-        int maxDBConnections = defaultMaxDBConnections;
-        if (handleMax != null && handleMax.length() > 0)
-          maxDBConnections = Integer.parseInt(handleMax);
-        //String timeoutValueString = ManifoldCF.getProperty(ManifoldCF.databaseHandleTimeoutProperty);
-        //int timeoutValue = defaultTimeoutValue;
-        //if (timeoutValueString != null && timeoutValueString.length() > 0)
-        //  timeoutValue = Integer.parseInt(timeoutValueString);
-
-        // Logging.db.debug("adding pool alias [" + database + "]");
-        // I had to up the timeout from one hour to 3 due to the webconnector keeping some connections open a very long time...
-	//System.out.println("jdbcUrl = '"+jdbcUrl+"', userName='"+userName+"', password='"+password+"'");
         cpm.addAlias(database, jdbcDriver, jdbcUrl,
           userName, password,
           maxDBConnections, 300000L);
@@ -173,19 +159,19 @@ public class ConnectionFactory
   {
     private Integer poolExistenceLock = new Integer(0);
     private ConnectionPoolManager _pool = null;
-
+    
     private PoolManager()
     {
     }
 
-    public ConnectionPoolManager createPoolManager()
+    public ConnectionPoolManager createPoolManager(boolean debug)
       throws ManifoldCFException
     {
       synchronized (poolExistenceLock)
       {
         if (_pool != null)
           return _pool;
-        _pool = new ConnectionPoolManager(100);
+        _pool = new ConnectionPoolManager(100, debug);
         return _pool;
       }
     }

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java Sat Sep 28 13:18:40 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/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java Sat Sep 28 13:18:40 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/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java Sat Sep 28 13:18:40 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/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Sat Sep 28 13:18:40 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

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java Sat Sep 28 13:18:40 2013
@@ -38,11 +38,11 @@ public abstract class Database
 {
   public static final String _rcsid = "@(#)$Id: Database.java 988245 2010-08-23 18:39:35Z kwright $";
 
-  protected ICacheManager cacheManager;
-  protected IThreadContext context;
-  protected String jdbcUrl;
-  protected String jdbcDriverClass;
-  protected String databaseName;
+  protected final ICacheManager cacheManager;
+  protected final IThreadContext context;
+  protected final String jdbcUrl;
+  protected final String jdbcDriverClass;
+  protected final String databaseName;
   protected String userName;
   protected String password;
   protected TransactionHandle th = null;
@@ -52,7 +52,9 @@ public abstract class Database
   protected int delayedTransactionDepth = 0;
   protected Map<String,Modifications> modificationsSet = new HashMap<String,Modifications>();
 
-  protected long maxQueryTime;
+  protected final long maxQueryTime;
+  protected final boolean debug;
+  protected final int maxDBConnections;
   
   protected static Random random = new Random();
 
@@ -68,7 +70,10 @@ public abstract class Database
     this.userName = userName;
     this.password = password;
     
-    this.maxQueryTime = ((long)ManifoldCF.getIntProperty(ManifoldCF.databaseQueryMaxTimeProperty,60)) * 1000L;
+    this.maxQueryTime = ((long)LockManagerFactory.getIntProperty(context, ManifoldCF.databaseQueryMaxTimeProperty,60)) * 1000L;
+    this.debug = LockManagerFactory.getBooleanProperty(context, ManifoldCF.databaseConnectionTrackingProperty, false);
+    this.maxDBConnections = LockManagerFactory.getIntProperty(context, ManifoldCF.databaseHandleMaxcountProperty, 50);
+
     this.cacheManager = CacheManagerFactory.make(context);
   }
 
@@ -247,7 +252,8 @@ public abstract class Database
     // Get a semipermanent connection
     if (connection == null)
     {
-      connection = ConnectionFactory.getConnection(jdbcUrl,jdbcDriverClass,databaseName,userName,password);
+      connection = ConnectionFactory.getConnection(jdbcUrl,jdbcDriverClass,databaseName,userName,password,
+        maxDBConnections,debug);
       try
       {
         // Initialize the connection (for HSQLDB)
@@ -755,7 +761,8 @@ public abstract class Database
     else
     {
       // Grab a connection
-      WrappedConnection tempConnection = ConnectionFactory.getConnection(jdbcUrl,jdbcDriverClass,databaseName,userName,password);
+      WrappedConnection tempConnection = ConnectionFactory.getConnection(jdbcUrl,jdbcDriverClass,databaseName,userName,password,
+        maxDBConnections,debug);
       try
       {
         // Initialize the connection (for HSQLDB)

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/DBInterfaceFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/DBInterfaceFactory.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/DBInterfaceFactory.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/DBInterfaceFactory.java Sat Sep 28 13:18:40 2013
@@ -40,9 +40,8 @@ public class DBInterfaceFactory
     Object x = context.get(dbName);
     if (x == null || !(x instanceof IDBInterface))
     {
-      String implementationClass = ManifoldCF.getProperty(ManifoldCF.databaseImplementation);
-      if (implementationClass == null)
-        implementationClass = "org.apache.manifoldcf.core.database.DBInterfacePostgreSQL";
+      String implementationClass = LockManagerFactory.getStringProperty(context, ManifoldCF.databaseImplementation,
+        "org.apache.manifoldcf.core.database.DBInterfacePostgreSQL");
       try
       {
         Class c = Class.forName(implementationClass);

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java Sat Sep 28 13:18:40 2013
@@ -19,13 +19,21 @@
 package org.apache.manifoldcf.core.interfaces;
 
 
-/** The lock manager manages locks across all threads and JVMs and cluster members.  It also
-* manages shared data, which is not necessarily atomic and should be protected by locks.
+/** The lock manager manages locks and shared data across all threads and JVMs and cluster members.  It also
+* manages transient shared data, which is not necessarily atomic and should be protected by locks.
 */
 public interface ILockManager
 {
   public static final String _rcsid = "@(#)$Id: ILockManager.java 988245 2010-08-23 18:39:35Z kwright $";
 
+  /** Get the current shared configuration.  This configuration is available in common among all nodes,
+  * and thus must not be accessed through here for the purpose of finding configuration data that is specific to any one
+  * specific node.
+  *@param configurationData is the globally-shared configuration information.
+  */
+  public ManifoldCFConfiguration getSharedConfiguration()
+    throws ManifoldCFException;
+
   /** Raise a flag.  Use this method to assert a condition, or send a global signal.  The flag will be reset when the
   * entire system is restarted.
   *@param flagName is the name of the flag to set.

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java Sat Sep 28 13:18:40 2013
@@ -40,9 +40,8 @@ public class LockManagerFactory
     Object x = context.get(lockManager);
     if (x == null || !(x instanceof ILockManager))
     {
-      String implementationClass = ManifoldCF.getProperty(ManifoldCF.lockManagerImplementation);
-      if (implementationClass == null)
-        implementationClass = "org.apache.manifoldcf.core.lockmanager.LockManager";
+      String implementationClass = ManifoldCF.getStringProperty(ManifoldCF.lockManagerImplementation,
+        "org.apache.manifoldcf.core.lockmanager.LockManager");
       try
       {
         Class c = Class.forName(implementationClass);
@@ -75,5 +74,35 @@ public class LockManagerFactory
     return (ILockManager)x;
   }
 
+  public static String getProperty(IThreadContext tc, String s)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getProperty(s);
+  }
+  
+  public static String getStringProperty(IThreadContext tc, String s, String defaultValue)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getStringProperty(s, defaultValue);
+  }
+  
+  public static int getIntProperty(IThreadContext tc, String s, int defaultValue)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getIntProperty(s, defaultValue);
+  }
+  
+  public static double getDoubleProperty(IThreadContext tc, String s, double defaultValue)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getDoubleProperty(s, defaultValue);
+  }
+  
+  public static boolean getBooleanProperty(IThreadContext tc, String s, boolean defaultValue)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getBooleanProperty(s, defaultValue);
+  }
+  
 }
 

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java Sat Sep 28 13:18:40 2013
@@ -24,6 +24,7 @@ import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.LockManagerFactory;
 import org.apache.manifoldcf.core.system.ManifoldCF;
 
 /** An instance of this class manages a number of (independent) connection pools.
@@ -37,10 +38,10 @@ public class ConnectionPoolManager
   protected volatile AtomicBoolean shuttingDown = new AtomicBoolean(false);
   protected final boolean debug;
   
-  public ConnectionPoolManager(int count)
+  public ConnectionPoolManager(int count, boolean debug)
     throws ManifoldCFException
   {
-    debug = ManifoldCF.getBooleanProperty(ManifoldCF.databaseConnectionTrackingProperty, false);
+    this.debug = debug;
     poolMap = new HashMap<String,ConnectionPool>(count);
     connectionCloserThread = new ConnectionCloserThread();
     connectionCloserThread.start();

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java Sat Sep 28 13:18:40 2013
@@ -73,6 +73,18 @@ public class LockManager implements ILoc
   /** Global flag information.  This is used only when all of ManifoldCF is run within one process. */
   protected static HashMap globalFlags = new HashMap();
   
+  /** Get the current shared configuration.  This configuration is available in common among all nodes,
+  * and thus must not be accessed through here for the purpose of finding configuration data that is specific to any one
+  * specific node.
+  *@param configurationData is the globally-shared configuration information.
+  */
+  public ManifoldCFConfiguration getSharedConfiguration()
+    throws ManifoldCFException
+  {
+    // Local implementation vectors through to system property file, which is shared in this case
+    return ManifoldCF.getConfiguration();
+  }
+
   /** Raise a flag.  Use this method to assert a condition, or send a global signal.  The flag will be reset when the
   * entire system is restarted.
   *@param flagName is the name of the flag to set.

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java Sat Sep 28 13:18:40 2013
@@ -96,7 +96,8 @@ public class Logging
 
   /** Reset all loggers
   */
-  public static void setLogLevels()
+  public static void setLogLevels(IThreadContext threadContext)
+    throws ManifoldCFException
   {
     // System.out.println("Setting log levels @ " + new Date().toString());
     Iterator it = loggerTable.entrySet().iterator();
@@ -109,7 +110,7 @@ public class Logging
       String loggername = (String)e.getKey();
 
       // logger level
-      String level = ManifoldCF.getProperty(loggername);
+      String level = LockManagerFactory.getProperty(threadContext, loggername);
 
       Level loglevel = null;
       if (level != null && level.length() > 0)

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Sat Sep 28 13:18:40 2013
@@ -28,9 +28,6 @@ public class ManifoldCF
   public static final String _rcsid = "@(#)$Id: ManifoldCF.java 988245 2010-08-23 18:39:35Z kwright $";
 
   // Configuration XML node names and attribute names
-  public static final String NODE_PROPERTY = "property";
-  public static final String ATTRIBUTE_NAME = "name";
-  public static final String ATTRIBUTE_VALUE = "value";
   public static final String NODE_LIBDIR = "libdir";
   public static final String ATTRIBUTE_PATH = "path";
   
@@ -87,7 +84,6 @@ public class ManifoldCF
   protected static String masterDatabaseUsername = null;
   protected static String masterDatabasePassword = null;
   protected static ManifoldCFConfiguration localConfiguration = null;
-  protected static Map localProperties = null;
   protected static long propertyFilelastMod = -1L;
   protected static String propertyFilePath = null;
 
@@ -140,23 +136,31 @@ public class ManifoldCF
   /** File to look for to block access to UI during database maintenance */
   public static final String maintenanceFileSignalProperty = "org.apache.manifoldcf.database.maintenanceflag";
 
-  /** Reset environment.
+  /** Reset environment, minting a thread context for convenience and backwards
+  * compatibility.
   */
+  @Deprecated
   public static void resetEnvironment()
   {
+    resetEnvironment(ThreadContextFactory.make());
+  }
+  
+  /** Reset environment.
+  */
+  public static void resetEnvironment(IThreadContext threadContext)
+  {
     synchronized (initializeFlagLock)
     {
       if (initializeLevel > 0)
       {
         // Clean up the system doing the same thing the shutdown thread would have if the process was killed
-        cleanUpEnvironment();
+        cleanUpEnvironment(threadContext);
         loginUserName = null;
         loginPassword = null;
         masterDatabaseName = null;
         masterDatabaseUsername = null;
         masterDatabasePassword = null;
         localConfiguration = null;
-        localProperties = null;
         propertyFilelastMod = -1L;
         propertyFilePath = null;
         alreadyClosed = false;
@@ -166,11 +170,20 @@ public class ManifoldCF
     }
   }
   
-  /** Initialize environment.
+  /** Initialize environment, minting a thread context for backwards compatibility.
   */
+  @Deprecated
   public static void initializeEnvironment()
     throws ManifoldCFException
   {
+    initializeEnvironment(ThreadContextFactory.make());
+  }
+  
+  /** Initialize environment.
+  */
+  public static void initializeEnvironment(IThreadContext threadContext)
+    throws ManifoldCFException
+  {
     synchronized (initializeFlagLock)
     {
       if (initializeLevel == 0)
@@ -199,10 +212,10 @@ public class ManifoldCF
           resourceLoader = new ManifoldCFResourceLoader(Thread.currentThread().getContextClassLoader());
           
           // Read configuration!
-          localConfiguration = new ManifoldCFConfiguration();
-          localProperties = new HashMap();
+          localConfiguration = new OverrideableManifoldCFConfiguration();
           checkProperties();
 
+          // Log file is always local
           File logConfigFile = getFileProperty(logConfigFileProperty);
           if (logConfigFile == null)
           {
@@ -216,24 +229,14 @@ public class ManifoldCF
 
           // Set up local loggers
           Logging.initializeLoggers();
-          Logging.setLogLevels();
+          Logging.setLogLevels(threadContext);
+
+          loginUserName = LockManagerFactory.getStringProperty(threadContext,loginUserNameProperty,"admin");
+          loginPassword = LockManagerFactory.getStringProperty(threadContext,loginPasswordProperty,"admin");
 
-          loginUserName = getProperty(loginUserNameProperty);
-          if (loginUserName == null)
-            loginUserName = "admin";
-          loginPassword = getProperty(loginPasswordProperty);
-          if (loginPassword == null)
-            loginPassword = "admin";
-
-          masterDatabaseName = getProperty(masterDatabaseNameProperty);
-          if (masterDatabaseName == null)
-            masterDatabaseName = "dbname";
-          masterDatabaseUsername = getProperty(masterDatabaseUsernameProperty);
-          if (masterDatabaseUsername == null)
-            masterDatabaseUsername = "manifoldcf";
-          masterDatabasePassword = getProperty(masterDatabasePasswordProperty);
-          if (masterDatabasePassword == null)
-            masterDatabasePassword = "local_pg_passwd";
+          masterDatabaseName = LockManagerFactory.getStringProperty(threadContext,masterDatabaseNameProperty,"dbname");
+          masterDatabaseUsername = LockManagerFactory.getStringProperty(threadContext,masterDatabaseUsernameProperty,"manifoldcf");
+          masterDatabasePassword = LockManagerFactory.getStringProperty(threadContext,masterDatabasePasswordProperty,"local_pg_passwd");
 
           // Register the file tracker for cleanup on shutdown
           tracker = new FileTrack();
@@ -242,8 +245,7 @@ public class ManifoldCF
           addShutdownHook(new DatabaseShutdown());
 
           // Open the database.  Done once per JVM.
-          IThreadContext threadcontext = ThreadContextFactory.make();
-          DBInterfaceFactory.make(threadcontext,masterDatabaseName,masterDatabaseUsername,masterDatabasePassword).openDatabase();
+          DBInterfaceFactory.make(threadContext,masterDatabaseName,masterDatabaseUsername,masterDatabasePassword).openDatabase();
         }
         catch (ManifoldCFException e)
         {
@@ -254,7 +256,34 @@ public class ManifoldCF
     }
 
   }
+  
+  /** For local properties (not shared!!), this class allows them to be overridden directly from the command line.
+  */
+  protected static class OverrideableManifoldCFConfiguration extends ManifoldCFConfiguration
+  {
+    public OverrideableManifoldCFConfiguration()
+    {
+      super();
+    }
+    
+    @Override
+    public String getProperty(String s)
+    {
+      String rval = System.getProperty(s);
+      if (rval == null)
+        rval = super.getProperty(s);
+      return rval;
+    }
+    
+  }
 
+  /** Get current properties.  Makes no attempt to reread or interpret them.
+  */
+  public static final ManifoldCFConfiguration getConfiguration()
+  {
+    return localConfiguration;
+  }
+  
   /** Reloads properties as needed.
   */
   public static final void checkProperties()
@@ -288,23 +317,13 @@ public class ManifoldCF
       throw new ManifoldCFException("Could not read configuration file '"+f.toString()+"'",e);
     }
     
-    // For convenience, post-process all "property" nodes so that we have a semblance of the earlier name/value pairs available, by default.
-    // e.g. <property name= value=/>
-    localProperties.clear();
+    // For convenience, post-process all "lib" nodes.
     ArrayList libDirs = new ArrayList();
     int i = 0;
     while (i < localConfiguration.getChildCount())
     {
       ConfigurationNode cn = localConfiguration.findChild(i++);
-      if (cn.getType().equals(NODE_PROPERTY))
-      {
-        String name = cn.getAttributeValue(ATTRIBUTE_NAME);
-        String value = cn.getAttributeValue(ATTRIBUTE_VALUE);
-        if (name == null)
-          throw new ManifoldCFException("Node type '"+NODE_PROPERTY+"' requires a '"+ATTRIBUTE_NAME+"' attribute");
-        localProperties.put(name,value);
-      }
-      else if (cn.getType().equals(NODE_LIBDIR))
+      if (cn.getType().equals(NODE_LIBDIR))
       {
         String path = cn.getAttributeValue(ATTRIBUTE_PATH);
         if (path == null)
@@ -334,10 +353,7 @@ public class ManifoldCF
   */
   public static String getProperty(String s)
   {
-    String rval = System.getProperty(s);
-    if (rval == null)
-      rval = (String)localProperties.get(s);
-    return rval;
+    return localConfiguration.getProperty(s);
   }
 
   /** Read a File property, either from the system properties, or from the local configuration file.
@@ -350,38 +366,39 @@ public class ManifoldCF
       return null;
     return resolvePath(value);
   }
-  
+
+  /** Read a (string) property, either from the system properties, or from the local configuration file.
+  *@param s is the property name.
+  *@param defaultValue is the default value for the property.
+  *@return the property value, as a string.
+  */
+  public static String getStringProperty(String s, String defaultValue)
+  {
+    return localConfiguration.getStringProperty(s, defaultValue);
+  }
+
   /** Read a boolean property
   */
   public static boolean getBooleanProperty(String s, boolean defaultValue)
     throws ManifoldCFException
   {
-    String value = getProperty(s);
-    if (value == null)
-      return defaultValue;
-    if (value.equals("true") || value.equals("yes"))
-      return true;
-    if (value.equals("false") || value.equals("no"))
-      return false;
-    throw new ManifoldCFException("Illegal property value for boolean property '"+s+"': '"+value+"'");
+    return localConfiguration.getBooleanProperty(s, defaultValue);
   }
   
-  /** Read an integer propert, either from the system properties, or from the local configuration file.
+  /** Read an integer property, either from the system properties, or from the local configuration file.
   */
   public static int getIntProperty(String s, int defaultValue)
     throws ManifoldCFException
   {
-    String value = getProperty(s);
-    if (value == null)
-      return defaultValue;
-    try
-    {
-      return Integer.parseInt(value);
-    }
-    catch (NumberFormatException e)
-    {
-      throw new ManifoldCFException("Illegal property value for integer property '"+s+"': '"+value+"': "+e.getMessage(),e,ManifoldCFException.SETUP_ERROR);
-    }
+    return localConfiguration.getIntProperty(s, defaultValue);
+  }
+
+  /** Read a float property, either from the system properties, or from the local configuration file.
+  */
+  public static double getDoubleProperty(String s, double defaultValue)
+    throws ManifoldCFException
+  {
+    return localConfiguration.getDoubleProperty(s, defaultValue);
   }
   
   /** Attempt to make sure a path is a folder
@@ -806,6 +823,7 @@ public class ManifoldCF
   */
   public static boolean checkMaintenanceUnderway()
   {
+    // File check is always local; this whole bit of logic needs to be rethought though.
     String fileToCheck = getProperty(maintenanceFileSignalProperty);
     if (fileToCheck != null && fileToCheck.length() > 0)
     {
@@ -820,6 +838,7 @@ public class ManifoldCF
   public static void noteConfigurationChange()
     throws ManifoldCFException
   {
+    // Always a local file.  This needs to be rethought how it should operate in a clustered world.
     String configChangeSignalCommand = getProperty(configSignalCommandProperty);
     if (configChangeSignalCommand == null || configChangeSignalCommand.length() == 0)
       return;
@@ -1229,9 +1248,16 @@ public class ManifoldCF
     return resourceLoader.findClass(cname);
   }
   
-  /** Perform system shutdown, using the registered shutdown hooks. */
+  /** Perform system shutdown, minting thread context for backwards compatibility */
+  @Deprecated
   public static void cleanUpEnvironment()
   {
+    cleanUpEnvironment(ThreadContextFactory.make());
+  }
+  
+  /** Perform system shutdown, using the registered shutdown hooks. */
+  public static void cleanUpEnvironment(IThreadContext threadContext)
+  {
     synchronized (initializeFlagLock)
     {
       initializeLevel--;
@@ -1402,7 +1428,7 @@ public class ManifoldCF
     public void run()
     {
       // This thread is run at shutdown time.
-      cleanUpEnvironment();
+      cleanUpEnvironment(ThreadContextFactory.make());
     }
   }
 

Modified: manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java (original)
+++ manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java Sat Sep 28 13:18:40 2013
@@ -184,7 +184,7 @@ public class Base
     writeConnectorsXML(connectorsXMLContents);
     writeFile(connectorFile,connectorsXMLContents.toString());
 
-    ManifoldCF.initializeEnvironment();
+    ManifoldCF.initializeEnvironment(ThreadContextFactory.make());
   }
   
   protected void localSetUp()
@@ -223,9 +223,10 @@ public class Base
       loggingFile.delete();
       connectorFile.delete();
       
-      ManifoldCF.cleanUpEnvironment();
+      IThreadContext threadContext = ThreadContextFactory.make();
+      ManifoldCF.cleanUpEnvironment(threadContext);
       // Just in case we're not synchronized...
-      ManifoldCF.resetEnvironment();
+      ManifoldCF.resetEnvironment(threadContext);
     }
   }
   

Modified: manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java (original)
+++ manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java Sat Sep 28 13:18:40 2013
@@ -28,11 +28,10 @@ public class UILockSpinner
   public static void main(String[] argv)
     throws Exception
   {
-    ManifoldCF.initializeEnvironment();
-
+    IThreadContext threadContext = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(threadContext);
 
     // Create a thread context object.
-    IThreadContext threadContext = ThreadContextFactory.make();
     ILockManager lockManager = LockManagerFactory.make(threadContext);
 
     System.out.println("Starting test");

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java Sat Sep 28 13:18:40 2013
@@ -33,7 +33,7 @@ public class ServletListener implements 
   {
     try
     {
-      ManifoldCF.initializeEnvironment();
+      ManifoldCF.initializeEnvironment(ThreadContextFactory.make());
     }
     catch (ManifoldCFException e)
     {
@@ -43,7 +43,7 @@ public class ServletListener implements 
   
   public void contextDestroyed(ServletContextEvent sce)
   {
-    ManifoldCF.cleanUpEnvironment();
+    ManifoldCF.cleanUpEnvironment(ThreadContextFactory.make());
   }
 
 }

Modified: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java (original)
+++ manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java Sat Sep 28 13:18:40 2013
@@ -133,8 +133,8 @@ public class ManifoldCFCombinedJettyRunn
     	System.setProperty(ManifoldCF.lcfConfigFileProperty,"./properties.xml");
     try
     {
-      ManifoldCF.initializeEnvironment();
       IThreadContext tc = ThreadContextFactory.make();
+      ManifoldCF.initializeEnvironment(tc);
 
       // Grab the parameters which locate the wars and describe how we work with Jetty
       File combinedWarPath = ManifoldCF.getFileProperty(combinedWarPathProperty);

Modified: manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java (original)
+++ manifoldcf/trunk/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java Sat Sep 28 13:18:40 2013
@@ -177,10 +177,10 @@ public class ManifoldCFJettyRunner
     	System.setProperty(ManifoldCF.lcfConfigFileProperty,"./properties.xml");
     try
     {
-      ManifoldCF.initializeEnvironment();
       IThreadContext tc = ThreadContextFactory.make();
+      ManifoldCF.initializeEnvironment(tc);
 
-      // Grab the parameters which locate the wars and describe how we work with Jetty
+      // Grab the parameters which locate the wars and describe how we work with Jetty.  These are not shared.
       File crawlerWarPath = ManifoldCF.getFileProperty(crawlerUIWarPathProperty);
       File authorityserviceWarPath = ManifoldCF.getFileProperty(authorityServiceWarPathProperty);
       File apiWarPath = ManifoldCF.getFileProperty(apiServiceWarPathProperty);

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java Sat Sep 28 13:18:40 2013
@@ -34,8 +34,8 @@ public abstract class BaseAuthoritiesIni
 {
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
     IThreadContext tc = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(tc);
     IAuthorityConnectorManager mgr = AuthorityConnectorManagerFactory.make(tc);
 
     doExecute(mgr);

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java Sat Sep 28 13:18:40 2013
@@ -34,8 +34,8 @@ public abstract class BaseMappersInitial
 {
   public void execute() throws ManifoldCFException
   {
-    ManifoldCF.initializeEnvironment();
     IThreadContext tc = ThreadContextFactory.make();
+    ManifoldCF.initializeEnvironment(tc);
     IMappingConnectorManager mgr = MappingConnectorManagerFactory.make(tc);
 
     doExecute(mgr);

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java Sat Sep 28 13:18:40 2013
@@ -48,8 +48,8 @@ public class ChangeAuthSpec
 
                 try
                 {
-                        ManifoldCF.initializeEnvironment();
                         IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
                         IAuthorityConnectionManager connManager = AuthorityConnectionManagerFactory.make(tc);
                         IAuthorityConnection conn = connManager.load(connectionName);
                         if (conn == null)

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java Sat Sep 28 13:18:40 2013
@@ -44,8 +44,8 @@ public class CheckAll
 
     try
     {
-      ManifoldCF.initializeEnvironment();
       IThreadContext tc = ThreadContextFactory.make();
+      ManifoldCF.initializeEnvironment(tc);
       // Now, get a list of the authority connections
       IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
       IAuthorityConnection[] connections = mgr.getAllConnections();

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java?rev=1527183&r1=1527182&r2=1527183&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java Sat Sep 28 13:18:40 2013
@@ -44,8 +44,8 @@ public class CheckConfigured
 
                 try
                 {
-                        ManifoldCF.initializeEnvironment();
                         IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
                         // Now, get a list of the authority connections
                         IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
                         if (mgr.getAllConnections().length > 0)



Mime
View raw message