Author: kwright
Date: Tue Jun 3 18:50:59 2014
New Revision: 1599751
URL: http://svn.apache.org/r1599751
Log:
Flesh out interlock checks, but not done yet; registration/deregistration has
issues.
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java?rev=1599751&r1=1599750&r2=1599751&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
Tue Jun 3 18:50:59 2014
@@ -125,6 +125,13 @@ public interface IJobManager
public boolean checkIfOutputReference(String connectionName)
throws ManifoldCFException;
+ /** See if there's a reference to a transformation connection name.
+ *@param connectionName is the name of the connection.
+ *@return true if there is a reference, false otherwise.
+ */
+ public boolean checkIfTransformationReference(String connectionName)
+ throws ManifoldCFException;
+
/** Get the job IDs associated with a given connection name.
*@param connectionName is the name of the connection.
*@return the set of job id's associated with that connection.
@@ -955,6 +962,22 @@ public interface IJobManager
public void noteOutputConnectionChange(String connectionName)
throws ManifoldCFException;
+ /** Note the deregistration of a transformation connector used by the
specified connections.
+ * This method will be called when the connector is deregistered. Jobs that
use these connections
+ * must therefore enter appropriate states.
+ *@param connectionNames is the set of connection names.
+ */
+ public void noteTransformationConnectorDeregistration(String[]
connectionNames)
+ throws ManifoldCFException;
+
+ /** Note the registration of a transformation connector used by the
specified connections.
+ * This method will be called when a connector is registered, on which the
specified
+ * connections depend.
+ *@param connectionNames is the set of connection names.
+ */
+ public void noteTransformationConnectorRegistration(String[] connectionNames)
+ throws ManifoldCFException;
+
/** Delete jobs in need of being deleted (which are marked "ready for
delete").
* This method is meant to be called periodically to perform delete
processing on jobs.
*/
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1599751&r1=1599750&r2=1599751&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Tue Jun 3 18:50:59 2014
@@ -488,6 +488,32 @@ public class JobManager implements IJobM
}
}
+ /** Note the deregistration of a transformation connector used by the
specified connections.
+ * This method will be called when the connector is deregistered. Jobs that
use these connections
+ * must therefore enter appropriate states.
+ *@param connectionNames is the set of connection names.
+ */
+ @Override
+ public void noteTransformationConnectorDeregistration(String[]
connectionNames)
+ throws ManifoldCFException
+ {
+ // This is problematic; we need a different bit in the job state for every
transformation in the job pipeline
+ // MHL
+ }
+
+ /** Note the registration of a transformation connector used by the
specified connections.
+ * This method will be called when a connector is registered, on which the
specified
+ * connections depend.
+ *@param connectionNames is the set of connection names.
+ */
+ @Override
+ public void noteTransformationConnectorRegistration(String[] connectionNames)
+ throws ManifoldCFException
+ {
+ // This is problematic; we need a different bit in the job state for every
transformation in the job pipeline
+ // MHL
+ }
+
/** Note a change in output connection configuration.
* This method will be called whenever a connection's configuration is
modified, or when an external target config change
* is signalled.
@@ -632,6 +658,17 @@ public class JobManager implements IJobM
return jobs.checkIfOutputReference(connectionName);
}
+ /** See if there's a reference to a transformation connection name.
+ *@param connectionName is the name of the connection.
+ *@return true if there is a reference, false otherwise.
+ */
+ @Override
+ public boolean checkIfTransformationReference(String connectionName)
+ throws ManifoldCFException
+ {
+ return jobs.checkIfTransformationReference(connectionName);
+ }
+
/** Get the job IDs associated with a given connection name.
*@param connectionName is the name of the connection.
*@return the set of job id's associated with that connection.
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java?rev=1599751&r1=1599750&r2=1599751&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Tue Jun 3 18:50:59 2014
@@ -2821,6 +2821,21 @@ public class Jobs extends org.apache.man
return set.getRowCount() > 0;
}
+ /** See if there's a reference to a transformation connection name.
+ *@param connectionName is the name of the connection.
+ *@return true if there is a reference, false otherwise.
+ */
+ public boolean checkIfTransformationReference(String connectionName)
+ throws ManifoldCFException
+ {
+ ArrayList list = new ArrayList();
+ String query = buildConjunctionClause(list,new ClauseDescription[]{
+ new
UnitaryClause(pipelineManager.transformationNameField,connectionName)});
+ IResultSet set = performQuery("SELECT "+pipelineManager.ownerIDField+"
FROM "+pipelineManager.getTableName()+
+ " WHERE "+query,list,new StringSet(getJobsKey()),null);
+ return set.getRowCount() > 0;
+ }
+
/** Get the job IDs associated with a given connection name.
*@param connectionName is the name of the connection.
*@return the set of job id's associated with that connection.
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java?rev=1599751&r1=1599750&r2=1599751&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java
Tue Jun 3 18:50:59 2014
@@ -290,8 +290,9 @@ public class CrawlerAgent implements IAg
public boolean isTransformationConnectionInUse(IThreadContext threadContext,
String connName)
throws ManifoldCFException
{
- // MHL
- return false;
+ // Check with job manager.
+ IJobManager jobManager = JobManagerFactory.make(threadContext);
+ return jobManager.checkIfTransformationReference(connName);
}
/** Note the deregistration of a set of transformation connections.
@@ -301,7 +302,9 @@ public class CrawlerAgent implements IAg
public void noteTransformationConnectorDeregistration(IThreadContext
threadContext, String[] connectionNames)
throws ManifoldCFException
{
- // MHL
+ // Notify job manager
+ IJobManager jobManager = JobManagerFactory.make(threadContext);
+ jobManager.noteTransformationConnectorDeregistration(connectionNames);
}
/** Note the registration of a set of transformation connections.
@@ -311,7 +314,9 @@ public class CrawlerAgent implements IAg
public void noteTransformationConnectorRegistration(IThreadContext
threadContext, String[] connectionNames)
throws ManifoldCFException
{
- // MHL
+ // Notify job manager
+ IJobManager jobManager = JobManagerFactory.make(threadContext);
+ jobManager.noteTransformationConnectorRegistration(connectionNames);
}
/** Note a change in configuration for a transformation connection.