You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/09/28 15:14:49 UTC
svn commit: r1527182 [1/2] - in /manifoldcf/branches/CONNECTORS-13:
connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/
connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/
framework/...
Author: kwright
Date: Sat Sep 28 13:14:47 2013
New Revision: 1527182
URL: http://svn.apache.org/r1527182
Log:
Finish with changes related to getting shared properties
Modified:
manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
manifoldcf/branches/CONNECTORS-13/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java
manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java
manifoldcf/branches/CONNECTORS-13/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java
manifoldcf/branches/CONNECTORS-13/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java
manifoldcf/branches/CONNECTORS-13/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java
manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java
manifoldcf/branches/CONNECTORS-13/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java
manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineRepositoryConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DeleteJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DeleteRepositoryConnection.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/FindJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/GetJobSchedule.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/InitializeAndRegister.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ListJobStatuses.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ListJobs.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/PauseJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RestartJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunDocumentStatus.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunMaxActivityHistory.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunMaxBandwidthHistory.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunQueueStatus.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunResultHistory.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/RunSimpleHistory.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/StartJob.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/TransactionalCrawlerInitializationCommand.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitForJobDeleted.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitForJobInactive.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/WaitJobPaused.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseDerby.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseHSQLDB.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseHSQLDBext.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BaseMySQL.java
manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/BasePostgresql.java
Modified: manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/GTSConnector.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java (original)
+++ manifoldcf/branches/CONNECTORS-13/connectors/gts/connector/src/main/java/org/apache/manifoldcf/agents/output/gts/HttpPoster.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-13/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/BaseAgentsInitializationCommand.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineOutputConnection.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteOutputConnection.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/TransactionalAgentsInitializationCommand.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/ManifoldCF.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseDerby.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDB.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseHSQLDBext.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BaseMySQL.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/agents/src/test/java/org/apache/manifoldcf/agents/tests/BasePostgresql.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/api-service/src/main/java/org/apache/manifoldcf/apiservice/ServletListener.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/authority-service/src/main/java/org/apache/manifoldcf/authorityservice/ServletListener.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/combined-service/src/main/java/org/apache/manifoldcf/combinedservice/ServletListener.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/DBInitializationCommand.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/LockClean.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/Logging.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Sat Sep 28 13:14:47 2013
@@ -136,16 +136,25 @@ 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;
@@ -161,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)
@@ -197,6 +215,7 @@ public class ManifoldCF
localConfiguration = new OverrideableManifoldCFConfiguration();
checkProperties();
+ // Log file is always local
File logConfigFile = getFileProperty(logConfigFileProperty);
if (logConfigFile == null)
{
@@ -210,24 +229,14 @@ public class ManifoldCF
// Set up local loggers
Logging.initializeLoggers();
- Logging.setLogLevels();
+ Logging.setLogLevels(threadContext);
- 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";
+ loginUserName = LockManagerFactory.getStringProperty(threadContext,loginUserNameProperty,"admin");
+ loginPassword = LockManagerFactory.getStringProperty(threadContext,loginPasswordProperty,"admin");
+
+ 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();
@@ -236,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)
{
@@ -815,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)
{
@@ -829,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;
@@ -1238,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--;
@@ -1411,7 +1428,7 @@ public class ManifoldCF
public void run()
{
// This thread is run at shutdown time.
- cleanUpEnvironment();
+ cleanUpEnvironment(ThreadContextFactory.make());
}
}
Modified: manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/Base.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/core/src/test/java/org/apache/manifoldcf/core/tests/UILockSpinner.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/crawler-ui/src/main/java/org/apache/manifoldcf/crawlerui/ServletListener.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFCombinedJettyRunner.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/jetty-runner/src/main/java/org/apache/manifoldcf/jettyrunner/ManifoldCFJettyRunner.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseAuthoritiesInitializationCommand.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/ChangeAuthSpec.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckAll.java Sat Sep 28 13:14:47 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/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/CheckConfigured.java Sat Sep 28 13:14:47 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)
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java Sat Sep 28 13:14:47 2013
@@ -51,8 +51,8 @@ public class DefineAuthorityConnection
try
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
IAuthorityConnection conn = mgr.create();
conn.setName(connectionName);
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java Sat Sep 28 13:14:47 2013
@@ -51,8 +51,8 @@ public class DefineMappingConnection
try
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
IMappingConnectionManager mgr = MappingConnectionManagerFactory.make(tc);
IMappingConnection conn = mgr.create();
conn.setName(connectionName);
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java Sat Sep 28 13:14:47 2013
@@ -46,8 +46,8 @@ public class DeleteAuthorityConnection
String connectionName = args[0];
try
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
mgr.delete(connectionName);
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java Sat Sep 28 13:14:47 2013
@@ -46,8 +46,8 @@ public class DeleteMappingConnection
String connectionName = args[0];
try
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
IMappingConnectionManager mgr = MappingConnectionManagerFactory.make(tc);
mgr.delete(connectionName);
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java Sat Sep 28 13:14:47 2013
@@ -48,26 +48,26 @@ public class ManifoldCF extends org.apac
/** Initialize environment.
*/
- public static void initializeEnvironment()
+ public static void initializeEnvironment(IThreadContext tc)
throws ManifoldCFException
{
synchronized (initializeFlagLock)
{
- org.apache.manifoldcf.core.system.ManifoldCF.initializeEnvironment();
- org.apache.manifoldcf.authorities.system.ManifoldCF.localInitialize();
+ org.apache.manifoldcf.core.system.ManifoldCF.initializeEnvironment(tc);
+ org.apache.manifoldcf.authorities.system.ManifoldCF.localInitialize(tc);
}
}
- public static void cleanUpEnvironment()
+ public static void cleanUpEnvironment(IThreadContext tc)
{
synchronized (initializeFlagLock)
{
- org.apache.manifoldcf.authorities.system.ManifoldCF.localCleanup();
- org.apache.manifoldcf.core.system.ManifoldCF.cleanUpEnvironment();
+ org.apache.manifoldcf.authorities.system.ManifoldCF.localCleanup(tc);
+ org.apache.manifoldcf.core.system.ManifoldCF.cleanUpEnvironment(tc);
}
}
- public static void localInitialize()
+ public static void localInitialize(IThreadContext tc)
throws ManifoldCFException
{
synchronized (initializeFlagLock)
@@ -76,12 +76,12 @@ public class ManifoldCF extends org.apac
return;
Logging.initializeLoggers();
- Logging.setLogLevels();
+ Logging.setLogLevels(tc);
authoritiesInitialized = true;
}
}
- public static void localCleanup()
+ public static void localCleanup(IThreadContext tc)
{
}
@@ -177,17 +177,11 @@ public class ManifoldCF extends org.apac
throws ManifoldCFException
{
// Read any parameters
- String maxThreads = getProperty(authCheckThreadCountProperty);
- if (maxThreads == null)
- maxThreads = "10";
- numAuthCheckThreads = new Integer(maxThreads).intValue();
+ numAuthCheckThreads = LockManagerFactory.getIntProperty(threadContext, authCheckThreadCountProperty, 10);
if (numAuthCheckThreads < 1 || numAuthCheckThreads > 100)
throw new ManifoldCFException("Illegal value for the number of auth check threads");
- String maxMappingThreads = getProperty(mappingThreadCountProperty);
- if (maxMappingThreads == null)
- maxMappingThreads = "10";
- numMappingThreads = new Integer(maxMappingThreads).intValue();
+ numMappingThreads = LockManagerFactory.getIntProperty(threadContext, mappingThreadCountProperty, 10);
if (numMappingThreads < 1 || numMappingThreads > 100)
throw new ManifoldCFException("Illegal value for the number of mapping threads");
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AbortJob.java Sat Sep 28 13:14:47 2013
@@ -28,38 +28,38 @@ import java.util.*;
*/
public class AbortJob
{
- public static final String _rcsid = "@(#)$Id: AbortJob.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: AbortJob.java 988245 2010-08-23 18:39:35Z kwright $";
- private AbortJob()
- {
- }
-
- // Add: throttle, priority, recrawl interval
-
- public static void main(String[] args)
- {
- if (args.length != 1)
- {
- System.err.println("Usage: AbortJob <jobid>");
- System.exit(1);
- }
-
- String jobID = args[0];
-
-
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IJobManager jobManager = JobManagerFactory.make(tc);
- jobManager.manualAbort(new Long(jobID));
- System.err.println("Job aborting");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(2);
- }
- }
-
+ private AbortJob()
+ {
+ }
+
+ // Add: throttle, priority, recrawl interval
+
+ public static void main(String[] args)
+ {
+ if (args.length != 1)
+ {
+ System.err.println("Usage: AbortJob <jobid>");
+ System.exit(1);
+ }
+
+ String jobID = args[0];
+
+
+ try
+ {
+ IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
+ IJobManager jobManager = JobManagerFactory.make(tc);
+ jobManager.manualAbort(new Long(jobID));
+ System.err.println("Job aborting");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(2);
+ }
+ }
+
}
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/AddScheduledTime.java Sat Sep 28 13:14:47 2013
@@ -69,8 +69,8 @@ public class AddScheduledTime
try
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
IJobManager jobManager = JobManagerFactory.make(tc);
IJobDescription desc = jobManager.load(new Long(jobID));
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/BaseCrawlerInitializationCommand.java Sat Sep 28 13:14:47 2013
@@ -32,8 +32,8 @@ public abstract class BaseCrawlerInitial
{
public void execute() throws ManifoldCFException
{
- ManifoldCF.initializeEnvironment();
IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
doExecute(tc);
}
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/ChangeJobDocSpec.java Sat Sep 28 13:14:47 2013
@@ -28,46 +28,46 @@ import java.util.*;
*/
public class ChangeJobDocSpec
{
- public static final String _rcsid = "@(#)$Id: ChangeJobDocSpec.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: ChangeJobDocSpec.java 988245 2010-08-23 18:39:35Z kwright $";
- private ChangeJobDocSpec()
- {
- }
-
- public static void main(String[] args)
- {
- if (args.length != 2)
- {
- System.err.println("Usage: ChangeJobDocSpec <jobid> <filespec_xml>");
- System.exit(1);
- }
-
- String jobID = args[0];
- String filespecXML = args[1];
-
-
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IJobManager jobManager = JobManagerFactory.make(tc);
- IJobDescription desc = jobManager.load(new Long(jobID));
- if (desc == null)
- {
- System.err.println("No such job: "+jobID);
- System.exit(3);
- }
- desc.getSpecification().fromXML(filespecXML);
-
- // Now, save
- jobManager.save(desc);
- System.err.println("Job doc spec has been changed");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(2);
- }
- }
-
+ private ChangeJobDocSpec()
+ {
+ }
+
+ public static void main(String[] args)
+ {
+ if (args.length != 2)
+ {
+ System.err.println("Usage: ChangeJobDocSpec <jobid> <filespec_xml>");
+ System.exit(1);
+ }
+
+ String jobID = args[0];
+ String filespecXML = args[1];
+
+
+ try
+ {
+ IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
+ IJobManager jobManager = JobManagerFactory.make(tc);
+ IJobDescription desc = jobManager.load(new Long(jobID));
+ if (desc == null)
+ {
+ System.err.println("No such job: "+jobID);
+ System.exit(3);
+ }
+ desc.getSpecification().fromXML(filespecXML);
+
+ // Now, save
+ jobManager.save(desc);
+ System.err.println("Job doc spec has been changed");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(2);
+ }
+ }
+
}
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/CheckConfigured.java Sat Sep 28 13:14:47 2013
@@ -28,37 +28,37 @@ import java.util.*;
*/
public class CheckConfigured
{
- public static final String _rcsid = "@(#)$Id: CheckConfigured.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: CheckConfigured.java 988245 2010-08-23 18:39:35Z kwright $";
- private CheckConfigured()
- {
- }
+ private CheckConfigured()
+ {
+ }
- // Add: throttle, priority, recrawl interval
+ // Add: throttle, priority, recrawl interval
- public static void main(String[] args)
- {
- if (args.length != 0)
- {
- System.err.println("Usage: CheckConfigured");
- System.exit(1);
- }
+ public static void main(String[] args)
+ {
+ if (args.length != 0)
+ {
+ System.err.println("Usage: CheckConfigured");
+ System.exit(1);
+ }
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc);
- if (connManager.getAllConnections().length > 0)
- UTF8Stdout.println("CONFIGURED");
- else
- UTF8Stdout.println("OK");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(2);
- }
- }
-
+ try
+ {
+ IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
+ IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc);
+ if (connManager.getAllConnections().length > 0)
+ UTF8Stdout.println("CONFIGURED");
+ else
+ UTF8Stdout.println("OK");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(2);
+ }
+ }
+
}
Modified: manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java?rev=1527182&r1=1527181&r2=1527182&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java (original)
+++ manifoldcf/branches/CONNECTORS-13/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/DefineJob.java Sat Sep 28 13:14:47 2013
@@ -28,117 +28,115 @@ import java.util.*;
*/
public class DefineJob
{
- public static final String _rcsid = "@(#)$Id: DefineJob.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: DefineJob.java 988245 2010-08-23 18:39:35Z kwright $";
- private DefineJob()
+ private DefineJob()
+ {
+ }
+
+ public static void main(String[] args)
+ {
+ if (args.length != 13)
+ {
+ System.err.println("Usage: DefineJob <description> <connection_name> <output_name> <type> <start_method> <hopcount_method> <recrawl_interval> <expiration_interval> <reseed_interval> <job_priority> <hop_filters> <filespec_xml> <outputspec_xml>");
+ System.err.println("<type> is one of: continuous or specified");
+ System.err.println("<start_method> is one of: windowbegin, windowinside, disable");
+ System.err.println("<hopcount_method> is one of: accurate, nodelete, neverdelete");
+ System.err.println("<recrawl_interval> is the default document recrawl interval in minutes");
+ System.err.println("<expiration_interval> is the default document expiration interval in minutes");
+ System.err.println("<reseed_interval> is the default document reseed interval in minutes");
+ System.err.println("<job_priority> is the job priority (and integer between 0 and 10)");
+ System.err.println("<hop_filters> is a comma-separated list of tuples, of the form 'linktype=maxhops'");
+ System.err.println("<filespec_xml> is the document specification XML, its form dependent on the connection type");
+ System.err.println("<outputspec_xml> is the output specification XML, its form dependent on the output connection type");
+ System.exit(-1);
+ }
+
+ String description = args[0];
+ String connectionName = args[1];
+ String outputConnectionName = args[2];
+ String typeString = args[3];
+ String startString = args[4];
+ String hopcountString = args[5];
+ String recrawlInterval = args[6];
+ String expirationInterval = args[7];
+ String reseedInterval = args[8];
+ String jobPriority = args[9];
+ String hopFilters = args[10];
+ String filespecXML = args[11];
+ String outputspecXML = args[12];
+
+ try
+ {
+ IThreadContext tc = ThreadContextFactory.make();
+ ManifoldCF.initializeEnvironment(tc);
+ IJobManager jobManager = JobManagerFactory.make(tc);
+ IJobDescription desc = jobManager.createJob();
+
+ desc.setDescription(description);
+ desc.setConnectionName(connectionName);
+ desc.setOutputConnectionName(outputConnectionName);
+
+ if (typeString.equals("continuous"))
+ desc.setType(IJobDescription.TYPE_CONTINUOUS);
+ else if (typeString.equals("specified"))
+ desc.setType(IJobDescription.TYPE_SPECIFIED);
+ else
+ throw new ManifoldCFException("Unknown type: '"+typeString+"'");
+ if (startString.equals("windowbegin"))
+ desc.setStartMethod(IJobDescription.START_WINDOWBEGIN);
+ else if (startString.equals("windowinside"))
+ desc.setStartMethod(IJobDescription.START_WINDOWINSIDE);
+ else if (startString.equals("disable"))
+ desc.setStartMethod(IJobDescription.START_DISABLE);
+ else
+ throw new ManifoldCFException("Unknown start method: '"+startString+"'");
+
+ if (hopcountString.equals("accurate"))
+ desc.setHopcountMode(IJobDescription.HOPCOUNT_ACCURATE);
+ else if (hopcountString.equals("nodelete"))
+ desc.setHopcountMode(IJobDescription.HOPCOUNT_NODELETE);
+ else if (hopcountString.equals("neverdelete"))
+ desc.setHopcountMode(IJobDescription.HOPCOUNT_NEVERDELETE);
+ else
+ throw new ManifoldCFException("Unknown hopcount mode: '"+hopcountString+"'");
+
+ if (recrawlInterval.length() > 0)
+ desc.setInterval(new Long(recrawlInterval));
+ if (expirationInterval.length() > 0)
+ desc.setExpiration(new Long(expirationInterval));
+ if (reseedInterval.length() > 0)
+ desc.setReseedInterval(new Long(reseedInterval));
+ desc.setPriority(Integer.parseInt(jobPriority));
+
+ String[] hopFilterSet = hopFilters.split(",");
+ int i = 0;
+ while (i < hopFilterSet.length)
+ {
+ String hopFilter = hopFilterSet[i++];
+ if (hopFilter != null && hopFilter.length() > 0)
{
+ String[] stuff = hopFilter.trim().split("=");
+ if (stuff != null && stuff.length == 2)
+ desc.addHopCountFilter(stuff[0],((stuff[1].length()>0)?new Long(stuff[1]):null));
}
-
- public static void main(String[] args)
- {
- if (args.length != 13)
- {
- System.err.println("Usage: DefineJob <description> <connection_name> <output_name> <type> <start_method> <hopcount_method> <recrawl_interval> <expiration_interval> <reseed_interval> <job_priority> <hop_filters> <filespec_xml> <outputspec_xml>");
- System.err.println("<type> is one of: continuous or specified");
- System.err.println("<start_method> is one of: windowbegin, windowinside, disable");
- System.err.println("<hopcount_method> is one of: accurate, nodelete, neverdelete");
- System.err.println("<recrawl_interval> is the default document recrawl interval in minutes");
- System.err.println("<expiration_interval> is the default document expiration interval in minutes");
- System.err.println("<reseed_interval> is the default document reseed interval in minutes");
- System.err.println("<job_priority> is the job priority (and integer between 0 and 10)");
- System.err.println("<hop_filters> is a comma-separated list of tuples, of the form 'linktype=maxhops'");
- System.err.println("<filespec_xml> is the document specification XML, its form dependent on the connection type");
- System.err.println("<outputspec_xml> is the output specification XML, its form dependent on the output connection type");
- System.exit(-1);
- }
-
- String description = args[0];
- String connectionName = args[1];
- String outputConnectionName = args[2];
- String typeString = args[3];
- String startString = args[4];
- String hopcountString = args[5];
- String recrawlInterval = args[6];
- String expirationInterval = args[7];
- String reseedInterval = args[8];
- String jobPriority = args[9];
- String hopFilters = args[10];
- String filespecXML = args[11];
- String outputspecXML = args[12];
-
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IJobManager jobManager = JobManagerFactory.make(tc);
- IJobDescription desc = jobManager.createJob();
-
- desc.setDescription(description);
- desc.setConnectionName(connectionName);
- desc.setOutputConnectionName(outputConnectionName);
-
- if (typeString.equals("continuous"))
- desc.setType(IJobDescription.TYPE_CONTINUOUS);
- else if (typeString.equals("specified"))
- desc.setType(IJobDescription.TYPE_SPECIFIED);
- else
- throw new ManifoldCFException("Unknown type: '"+typeString+"'");
- if (startString.equals("windowbegin"))
- desc.setStartMethod(IJobDescription.START_WINDOWBEGIN);
- else if (startString.equals("windowinside"))
- desc.setStartMethod(IJobDescription.START_WINDOWINSIDE);
- else if (startString.equals("disable"))
- desc.setStartMethod(IJobDescription.START_DISABLE);
- else
- throw new ManifoldCFException("Unknown start method: '"+startString+"'");
-
- if (hopcountString.equals("accurate"))
- desc.setHopcountMode(IJobDescription.HOPCOUNT_ACCURATE);
- else if (hopcountString.equals("nodelete"))
- desc.setHopcountMode(IJobDescription.HOPCOUNT_NODELETE);
- else if (hopcountString.equals("neverdelete"))
- desc.setHopcountMode(IJobDescription.HOPCOUNT_NEVERDELETE);
- else
- throw new ManifoldCFException("Unknown hopcount mode: '"+hopcountString+"'");
-
- if (recrawlInterval.length() > 0)
- desc.setInterval(new Long(recrawlInterval));
- if (expirationInterval.length() > 0)
- desc.setExpiration(new Long(expirationInterval));
- if (reseedInterval.length() > 0)
- desc.setReseedInterval(new Long(reseedInterval));
- desc.setPriority(Integer.parseInt(jobPriority));
-
- String[] hopFilterSet = hopFilters.split(",");
- int i = 0;
- while (i < hopFilterSet.length)
- {
- String hopFilter = hopFilterSet[i++];
- if (hopFilter != null && hopFilter.length() > 0)
- {
- String[] stuff = hopFilter.trim().split("=");
- if (stuff != null && stuff.length == 2)
- desc.addHopCountFilter(stuff[0],((stuff[1].length()>0)?new Long(stuff[1]):null));
- }
- }
-
- desc.getSpecification().fromXML(filespecXML);
- if (outputspecXML.length() > 0)
- desc.getOutputSpecification().fromXML(outputspecXML);
-
- // Now, save
- jobManager.save(desc);
-
- System.out.print(desc.getID().toString());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-2);
- }
- }
-
+ }
+
+ desc.getSpecification().fromXML(filespecXML);
+ if (outputspecXML.length() > 0)
+ desc.getOutputSpecification().fromXML(outputspecXML);
+
+ // Now, save
+ jobManager.save(desc);
+
+ System.out.print(desc.getID().toString());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-2);
+ }
+ }
-
}