manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1601383 - in /manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs: JobManager.java Jobs.java PipelineManager.java
Date Mon, 09 Jun 2014 13:49:17 GMT
Author: kwright
Date: Mon Jun  9 13:49:16 2014
New Revision: 1601383

URL: http://svn.apache.org/r1601383
Log:
Completed everything except job upgrade

Modified:
    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/jobs/PipelineManager.java

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=1601383&r1=1601382&r2=1601383&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
Mon Jun  9 13:49:16 2014
@@ -46,6 +46,11 @@ public class JobManager implements IJobM
   protected final IOutputConnectionManager outputMgr;
   protected final IRepositoryConnectionManager connectionMgr;
   protected final ITransformationConnectionManager transformationMgr;
+  
+  protected final IOutputConnectorManager outputConnectorMgr;
+  protected final IConnectorManager connectorMgr;
+  protected final ITransformationConnectorManager transformationConnectorMgr;
+  
   protected final IRepositoryConnectorPool repositoryConnectorPool;
   protected final ILockManager lockManager;
   protected final IThreadContext threadContext;
@@ -75,6 +80,9 @@ public class JobManager implements IJobM
     outputMgr = OutputConnectionManagerFactory.make(threadContext);
     connectionMgr = RepositoryConnectionManagerFactory.make(threadContext);
     transformationMgr = TransformationConnectionManagerFactory.make(threadContext);
+    outputConnectorMgr = OutputConnectorManagerFactory.make(threadContext);
+    connectorMgr = ConnectorManagerFactory.make(threadContext);
+    transformationConnectorMgr = TransformationConnectorManagerFactory.make(threadContext);
     repositoryConnectorPool = RepositoryConnectorPoolFactory.make(threadContext);
     lockManager = LockManagerFactory.make(threadContext);
   }
@@ -656,7 +664,31 @@ public class JobManager implements IJobM
   public void assessMarkedJobs()
     throws ManifoldCFException
   {
-    // MHL
+    database.beginTransaction();
+    try
+    {
+      // Query for all jobs marked "ASSESSMENT_UNKNOWN".
+      jobs.assessMarkedJobs();
+    }
+    catch (ManifoldCFException e)
+    {
+      database.signalRollback();
+      throw e;
+    }
+    catch (RuntimeException e)
+    {
+      database.signalRollback();
+      throw e;
+    }
+    catch (Error e)
+    {
+      database.signalRollback();
+      throw e;
+    }
+    finally
+    {
+      database.endTransaction();
+    }
   }
 
   /** Load a sorted list of job descriptions.
@@ -709,9 +741,7 @@ public class JobManager implements IJobM
       IResultRow row = set.getRow(0);
       int status = jobs.stringToStatus(row.getValue(jobs.statusField).toString());
       if (status == jobs.STATUS_ACTIVE || status == jobs.STATUS_ACTIVESEEDING ||
-        status == jobs.STATUS_ACTIVE_UNINSTALLED || status == jobs.STATUS_ACTIVESEEDING_UNINSTALLED
||
-        status == jobs.STATUS_ACTIVE_NOOUTPUT || status == jobs.STATUS_ACTIVESEEDING_NOOUTPUT
||
-        status == jobs.STATUS_ACTIVE_NEITHER || status == jobs.STATUS_ACTIVESEEDING_NEITHER)
+        status == jobs.STATUS_ACTIVE_UNINSTALLED || status == jobs.STATUS_ACTIVESEEDING_UNINSTALLED)
       throw new ManifoldCFException("Job "+id+" is active; you must shut it down before deleting
it");
       if (status != jobs.STATUS_INACTIVE)
         throw new ManifoldCFException("Job "+id+" is busy; you must wait and/or shut it down
before deleting it");
@@ -724,6 +754,11 @@ public class JobManager implements IJobM
       database.signalRollback();
       throw e;
     }
+    catch (RuntimeException e)
+    {
+      database.signalRollback();
+      throw e;
+    }
     catch (Error e)
     {
       database.signalRollback();
@@ -2107,11 +2142,7 @@ public class JobManager implements IJobM
           Jobs.statusToString(Jobs.STATUS_ACTIVE),
           Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING),
           Jobs.statusToString(Jobs.STATUS_ACTIVE_UNINSTALLED),
-          Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_UNINSTALLED),
-          Jobs.statusToString(Jobs.STATUS_ACTIVE_NOOUTPUT),
-          Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_NOOUTPUT),
-          Jobs.statusToString(Jobs.STATUS_ACTIVE_NEITHER),
-          Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_NEITHER)
+          Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_UNINSTALLED)
           }),
         new JoinClause("t1."+jobs.idField,"t0."+jobQueue.jobIDField)}))
       .append(") ");
@@ -5809,10 +5840,6 @@ public class JobManager implements IJobM
             jobs.statusToString(jobs.STATUS_ACTIVESEEDING),
             jobs.statusToString(jobs.STATUS_ACTIVE_UNINSTALLED),
             jobs.statusToString(jobs.STATUS_ACTIVESEEDING_UNINSTALLED),
-            jobs.statusToString(jobs.STATUS_ACTIVE_NOOUTPUT),
-            jobs.statusToString(jobs.STATUS_ACTIVESEEDING_NOOUTPUT),
-            jobs.statusToString(jobs.STATUS_ACTIVE_NEITHER),
-            jobs.statusToString(jobs.STATUS_ACTIVESEEDING_NEITHER),
             jobs.statusToString(jobs.STATUS_PAUSED),
             jobs.statusToString(jobs.STATUS_PAUSEDSEEDING)})})).append(" AND ")
         .append(jobs.windowEndField).append("<? FOR UPDATE");
@@ -5836,8 +5863,6 @@ public class JobManager implements IJobM
         {
         case Jobs.STATUS_ACTIVE:
         case Jobs.STATUS_ACTIVE_UNINSTALLED:
-        case Jobs.STATUS_ACTIVE_NOOUTPUT:
-        case Jobs.STATUS_ACTIVE_NEITHER:
           jobs.waitJob(jobID,Jobs.STATUS_ACTIVEWAITING);
           if (Logging.jobs.isDebugEnabled())
           {
@@ -5846,8 +5871,6 @@ public class JobManager implements IJobM
           break;
         case Jobs.STATUS_ACTIVESEEDING:
         case Jobs.STATUS_ACTIVESEEDING_UNINSTALLED:
-        case Jobs.STATUS_ACTIVESEEDING_NOOUTPUT:
-        case Jobs.STATUS_ACTIVESEEDING_NEITHER:
           jobs.waitJob(jobID,Jobs.STATUS_ACTIVEWAITINGSEEDING);
           if (Logging.jobs.isDebugEnabled())
           {
@@ -7332,20 +7355,6 @@ public class JobManager implements IJobM
           // Set the state of the job back to "Active"
           jobs.writePermanentStatus(jobID,jobs.STATUS_ACTIVE_UNINSTALLED);
           break;
-        case Jobs.STATUS_ACTIVESEEDING_NOOUTPUT:
-          if (Logging.jobs.isDebugEnabled())
-            Logging.jobs.debug("Setting job "+jobID+" back to 'Active_NoOutput' state");
-
-          // Set the state of the job back to "Active"
-          jobs.writePermanentStatus(jobID,jobs.STATUS_ACTIVE_NOOUTPUT);
-          break;
-        case Jobs.STATUS_ACTIVESEEDING_NEITHER:
-          if (Logging.jobs.isDebugEnabled())
-            Logging.jobs.debug("Setting job "+jobID+" back to 'Active_Neither' state");
-
-          // Set the state of the job back to "Active"
-          jobs.writePermanentStatus(jobID,jobs.STATUS_ACTIVE_NEITHER);
-          break;
         case Jobs.STATUS_ACTIVESEEDING:
           if (Logging.jobs.isDebugEnabled())
             Logging.jobs.debug("Setting job "+jobID+" back to 'Active' state");
@@ -7396,8 +7405,6 @@ public class JobManager implements IJobM
         case Jobs.STATUS_ABORTINGFORRESTARTMINIMAL:
         case Jobs.STATUS_ACTIVE:
         case Jobs.STATUS_ACTIVE_UNINSTALLED:
-        case Jobs.STATUS_ACTIVE_NOOUTPUT:
-        case Jobs.STATUS_ACTIVE_NEITHER:
         case Jobs.STATUS_PAUSED:
         case Jobs.STATUS_ACTIVEWAIT:
         case Jobs.STATUS_PAUSEDWAIT:
@@ -7574,9 +7581,7 @@ public class JobManager implements IJobM
             new MultiClause(jobs.statusField,new Object[]{
               jobs.statusToString(jobs.STATUS_ACTIVE),
               jobs.statusToString(jobs.STATUS_ACTIVEWAIT),
-              jobs.statusToString(jobs.STATUS_ACTIVE_UNINSTALLED),
-              jobs.statusToString(jobs.STATUS_ACTIVE_NOOUTPUT),
-              jobs.statusToString(jobs.STATUS_ACTIVE_NEITHER)})}))
+              jobs.statusToString(jobs.STATUS_ACTIVE_UNINSTALLED)})}))
           .append(" FOR UPDATE");
         
         IResultSet set = database.performQuery(sb.toString(),list,null,null);
@@ -8105,10 +8110,6 @@ public class JobManager implements IJobM
         Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING),
         Jobs.statusToString(Jobs.STATUS_ACTIVE_UNINSTALLED),
         Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_UNINSTALLED),
-        Jobs.statusToString(Jobs.STATUS_ACTIVE_NOOUTPUT),
-        Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_NOOUTPUT),
-        Jobs.statusToString(Jobs.STATUS_ACTIVE_NEITHER),
-        Jobs.statusToString(Jobs.STATUS_ACTIVESEEDING_NEITHER),
         Jobs.statusToString(Jobs.STATUS_PAUSED),
         Jobs.statusToString(Jobs.STATUS_PAUSEDSEEDING),
         Jobs.statusToString(Jobs.STATUS_ACTIVEWAIT),
@@ -8241,10 +8242,6 @@ public class JobManager implements IJobM
         break;
       case Jobs.STATUS_ACTIVE_UNINSTALLED:
       case Jobs.STATUS_ACTIVESEEDING_UNINSTALLED:
-      case Jobs.STATUS_ACTIVE_NOOUTPUT:
-      case Jobs.STATUS_ACTIVESEEDING_NOOUTPUT:
-      case Jobs.STATUS_ACTIVE_NEITHER:
-      case Jobs.STATUS_ACTIVESEEDING_NEITHER:
         rstatus = JobStatus.JOBSTATUS_RUNNING_UNINSTALLED;
         break;
       case Jobs.STATUS_ACTIVE:

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=1601383&r1=1601382&r2=1601383&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
Mon Jun  9 13:49:16 2014
@@ -1312,14 +1312,13 @@ public class Jobs extends org.apache.man
     performUpdate(map,"WHERE "+query,list,null);
   }
 
-  /** Invalidate current state with respect to installed connectors.
+  /** Invalidate current state with respect to installed connectors, as a result of registration.
   */
-  public void invalidateCurrentState(Long jobID, int oldStatusValue)
+  public void invalidateCurrentUnregisteredState(Long jobID, int oldStatusValue)
     throws ManifoldCFException
   {
     // If we are in a state that cares about the connector state, then we have to signal
we need an assessment.
-    if (oldStatusValue == STATUS_ACTIVE || oldStatusValue == STATUS_ACTIVESEEDING ||
-      oldStatusValue == STATUS_ACTIVE_UNINSTALLED || oldStatusValue == STATUS_ACTIVESEEDING_UNINSTALLED)
+    if (oldStatusValue == STATUS_ACTIVE_UNINSTALLED || oldStatusValue == STATUS_ACTIVESEEDING_UNINSTALLED
|| oldStatusValue == STATUS_DELETING_NOOUTPUT)
     {
       // Assessment state is not cached, so no cache invalidation needed
       ArrayList list = new ArrayList();
@@ -1378,7 +1377,7 @@ public class Jobs extends org.apache.man
   public void noteTransformationConnectorRegistration(Long jobID, int oldStatusValue)
     throws ManifoldCFException
   {
-    invalidateCurrentState(jobID,oldStatusValue);
+    invalidateCurrentUnregisteredState(jobID,oldStatusValue);
   }
 
   /** Signal to a job that its underlying output connector has gone away.
@@ -1431,7 +1430,22 @@ public class Jobs extends org.apache.man
   public void noteOutputConnectorRegistration(Long jobID, int oldStatusValue)
     throws ManifoldCFException
   {
-    invalidateCurrentState(jobID,oldStatusValue);
+    if (oldStatusValue == STATUS_DELETING_NOOUTPUT)
+    {
+      // We can do the state transition now.
+      StringSet invKey = new StringSet(getJobStatusKey());
+
+      HashMap newValues = new HashMap();
+      newValues.put(statusField,statusToString(STATUS_DELETING));
+      newValues.put(assessmentStateField,assessmentStateToString(ASSESSMENT_KNOWN));
+      ArrayList list = new ArrayList();
+      String query = buildConjunctionClause(list,new ClauseDescription[]{
+        new UnitaryClause(idField,jobID)});
+      performUpdate(newValues,"WHERE "+query,list,invKey);
+      return;
+    }
+    // Otherwise, we don't know the state, and can't do the work now because we'd deadlock
+    invalidateCurrentUnregisteredState(jobID,oldStatusValue);
   }
   
   /*
@@ -1520,7 +1534,7 @@ public class Jobs extends org.apache.man
   public void noteConnectorRegistration(Long jobID, int oldStatusValue)
     throws ManifoldCFException
   {
-    invalidateCurrentState(jobID,oldStatusValue);
+    invalidateCurrentUnregisteredState(jobID,oldStatusValue);
   }
   
   /*
@@ -1988,6 +2002,67 @@ public class Jobs extends org.apache.man
     performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
   }
 
+  /** Assess all marked jobs to determine if they can be reactivated.
+  */
+  public void assessMarkedJobs()
+    throws ManifoldCFException
+  {
+    ArrayList newList = new ArrayList();
+    String query = buildConjunctionClause(newList,new ClauseDescription[]{
+      new UnitaryClause(assessmentStateField,assessmentStateToString(ASSESSMENT_UNKNOWN))});
+    // Query for the matching jobs, and then for each job potentially adjust the state based
on the connector status
+    IResultSet set = performQuery("SELECT "+idField+","+statusField+","+connectionNameField+","+outputNameField+"
FROM "+
+      getTableName()+" WHERE "+query+" FOR UPDATE",
+      newList,null,null);
+    for (int i = 0; i < set.getRowCount(); i++)
+    {
+      IResultRow row = set.getRow(i);
+      Long jobID = (Long)row.getValue(idField);
+      String outputName = (String)row.getValue(outputNameField);
+      String connectionName = (String)row.getValue(connectionNameField);
+      String[] transformationNames = pipelineManager.getConnectionNames(jobID);
+      int statusValue = stringToStatus((String)row.getValue(statusField));
+      int newValue;
+      
+      // Based on status value, see what we need to know to determine if the state can be
switched
+      switch (statusValue)
+      {
+      case STATUS_DELETING_NOOUTPUT:
+        if (outputMgr.checkConnectorExists(outputName))
+          newValue = STATUS_DELETING;
+        else
+          return;
+        break;
+      case STATUS_ACTIVE_UNINSTALLED:
+        if (outputMgr.checkConnectorExists(outputName) &&
+          connectionMgr.checkConnectorExists(connectionName) &&
+          checkTransformationsInstalled(transformationNames))
+          newValue = STATUS_ACTIVE;
+        else
+          return;
+        break;
+      case STATUS_ACTIVESEEDING_UNINSTALLED:
+        if (outputMgr.checkConnectorExists(outputName) &&
+          connectionMgr.checkConnectorExists(connectionName) &&
+          checkTransformationsInstalled(transformationNames))
+          newValue = STATUS_ACTIVESEEDING;
+        else
+          return;
+        break;
+      default:
+        return;
+      }
+      
+      ArrayList list = new ArrayList();
+      query = buildConjunctionClause(list,new ClauseDescription[]{
+        new UnitaryClause(idField,jobID)});
+      HashMap map = new HashMap();
+      map.put(assessmentStateField,assessmentStateToString(ASSESSMENT_KNOWN));
+      performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
+    }
+
+  }
+  
   /** Put job back into active state, from the shutting-down state.
   *@param jobID is the job identifier.
   */
@@ -2004,26 +2079,24 @@ public class Jobs extends org.apache.man
         query+" FOR UPDATE",list,null,null);
       if (set.getRowCount() == 0)
         throw new ManifoldCFException("Can't find job "+jobID.toString());
+      
       IResultRow row = set.getRow(0);
+      
       int status = stringToStatus((String)row.getValue(statusField));
       int newStatus;
       switch (status)
       {
       case STATUS_SHUTTINGDOWN:
-        if (connectionMgr.checkConnectorExists((String)row.getValue(connectionNameField)))
-        {
-          if (outputMgr.checkConnectorExists((String)row.getValue(outputNameField)))
-            newStatus = STATUS_ACTIVE;
-          else
-            newStatus = STATUS_ACTIVE_NOOUTPUT;
-        }
+        String[] transformationConnectionNames = pipelineManager.getConnectionNames(jobID);
+        String connectionName = (String)row.getValue(connectionNameField);
+        String outputName = (String)row.getValue(outputNameField);
+        // Want either STATUS_ACTIVE, or STATUS_ACTIVE_UNINSTALLED
+        if (!checkTransformationsInstalled(transformationConnectionNames) ||
+          !connectionMgr.checkConnectorExists(connectionName) ||
+          !outputMgr.checkConnectorExists(outputName))
+          newStatus = STATUS_ACTIVE_UNINSTALLED;
         else
-        {
-          if (outputMgr.checkConnectorExists((String)row.getValue(outputNameField)))
-            newStatus = STATUS_ACTIVE_UNINSTALLED;
-          else
-            newStatus = STATUS_ACTIVE_NEITHER;
-        }
+          newStatus = STATUS_ACTIVE;
         break;
       default:
         // Complain!
@@ -2055,6 +2128,17 @@ public class Jobs extends org.apache.man
       endTransaction();
     }
   }
+
+  protected boolean checkTransformationsInstalled(String[] transformationNames)
+    throws ManifoldCFException
+  {
+    for (String transformationName : transformationNames)
+    {
+      if (!transMgr.checkConnectorExists(transformationName))
+        return false;
+    }
+    return true;
+  }
   
   /** Put job into "deleting" state, and set the start time field.
   *@param jobID is the job identifier.
@@ -2137,26 +2221,24 @@ public class Jobs extends org.apache.man
       if (set.getRowCount() == 0)
         throw new ManifoldCFException("Can't find job "+jobID.toString());
       IResultRow row = set.getRow(0);
+      
       int status = stringToStatus((String)row.getValue(statusField));
       int newStatus;
       switch (status)
       {
       case STATUS_STARTINGUP:
       case STATUS_STARTINGUPMINIMAL:
-        if (connectionMgr.checkConnectorExists((String)row.getValue(connectionNameField)))
-        {
-          if (outputMgr.checkConnectorExists((String)row.getValue(outputNameField)))
-            newStatus = STATUS_ACTIVE;
-          else
-            newStatus = STATUS_ACTIVE_NOOUTPUT;
-        }
+        String[] transformationConnectionNames = pipelineManager.getConnectionNames(jobID);
+        String connectionName = (String)row.getValue(connectionNameField);
+        String outputName = (String)row.getValue(outputNameField);
+
+        // Need to set either STATUS_ACTIVE, or STATUS_ACTIVE_UNINSTALLED
+        if (!checkTransformationsInstalled(transformationConnectionNames) ||
+          !connectionMgr.checkConnectorExists(connectionName) ||
+          !outputMgr.checkConnectorExists(outputName))
+          newStatus = STATUS_ACTIVE_UNINSTALLED;
         else
-        {
-          if (outputMgr.checkConnectorExists((String)row.getValue(outputNameField)))
-            newStatus = STATUS_ACTIVE_UNINSTALLED;
-          else
-            newStatus = STATUS_ACTIVE_NEITHER;
-        }
+          newStatus = STATUS_ACTIVE;
         break;
       case STATUS_ABORTINGSTARTINGUPFORRESTART:
         newStatus = STATUS_ABORTINGFORRESTART;
@@ -2327,6 +2409,7 @@ public class Jobs extends org.apache.man
       new UnitaryClause(idField,jobID)});
     HashMap map = new HashMap();
     map.put(statusField,statusToString(newStatus));
+    map.put(assessmentStateField,assessmentStateToString(ASSESSMENT_KNOWN));
     map.put(windowEndField,null);
     performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
   }
@@ -2733,6 +2816,7 @@ public class Jobs extends org.apache.man
         throw new ManifoldCFException("Job does not exist: "+jobID);
       IResultRow row = set.getRow(0);
       int status = stringToStatus(row.getValue(statusField).toString());
+      String[] transformationConnectionNames = pipelineManager.getConnectionNames(jobID);
       String connectionName = (String)row.getValue(connectionNameField);
       String outputName = (String)row.getValue(outputNameField);
       int newStatus;
@@ -2740,37 +2824,23 @@ public class Jobs extends org.apache.man
       switch (status)
       {
       case STATUS_RESUMING:
-        if (connectionMgr.checkConnectorExists(connectionName))
-        {
-          if (outputMgr.checkConnectorExists(outputName))
-            newStatus = STATUS_ACTIVE;
-          else
-            newStatus = STATUS_ACTIVE_NOOUTPUT;
-        }
+        // Want either STATUS_ACTIVE or STATUS_ACTIVE_UNINSTALLED
+        if (!checkTransformationsInstalled(transformationConnectionNames) ||
+          !connectionMgr.checkConnectorExists(connectionName) ||
+          !outputMgr.checkConnectorExists(outputName))
+          newStatus = STATUS_ACTIVE_UNINSTALLED;
         else
-        {
-          if (outputMgr.checkConnectorExists(outputName))
-            newStatus = STATUS_ACTIVE_UNINSTALLED;
-          else
-            newStatus = STATUS_ACTIVE_NEITHER;
-        }
+          newStatus = STATUS_ACTIVE;
         map.put(statusField,statusToString(newStatus));
         break;
       case STATUS_RESUMINGSEEDING:
-        if (connectionMgr.checkConnectorExists(connectionName))
-        {
-          if (outputMgr.checkConnectorExists(outputName))
-            newStatus = STATUS_ACTIVESEEDING;
-          else
-            newStatus = STATUS_ACTIVESEEDING_NOOUTPUT;
-        }
+        // Want either STATUS_ACTIVESEEDING or STATUS_ACTIVESEEDING_UNINSTALLED
+        if (!checkTransformationsInstalled(transformationConnectionNames) ||
+          !connectionMgr.checkConnectorExists(connectionName) ||
+          !outputMgr.checkConnectorExists(outputName))
+          newStatus = STATUS_ACTIVESEEDING_UNINSTALLED;
         else
-        {
-          if (outputMgr.checkConnectorExists(outputName))
-            newStatus = STATUS_ACTIVESEEDING_UNINSTALLED;
-          else
-            newStatus = STATUS_ACTIVESEEDING_NEITHER;
-        }
+          newStatus = STATUS_ACTIVESEEDING;
         map.put(statusField,statusToString(newStatus));
         break;
       default:

Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java?rev=1601383&r1=1601382&r2=1601383&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
(original)
+++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
Mon Jun  9 13:49:16 2014
@@ -133,6 +133,28 @@ public class PipelineManager extends org
       new MultiClause(transformationNameField,connectionNames)}));
   }
   
+  /** Get all the transformation connection names for a job.
+  *@param ownerID is the job ID.
+  *@return the set of connection names.
+  */
+  public String[] getConnectionNames(Long ownerID)
+    throws ManifoldCFException
+  {
+    ArrayList newList = new ArrayList();
+    StringBuilder query = new StringBuilder("SELECT ");
+    query.append(transformationNameField).append(" FROM ").append(getTableName()).append("
WHERE ");
+    query.append(buildConjunctionClause(newList,new ClauseDescription[]{
+      new UnitaryClause(ownerIDField,ownerID)}));
+    IResultSet set = performQuery(query.toString(),newList,null,null);
+    String[] rval = new String[set.getRowCount()];
+    for (int i = 0; i < set.getRowCount(); i++)
+    {
+      IResultRow row = set.getRow(i);
+      rval[i] = (String)row.getValue(transformationNameField);
+    }
+    return rval;
+  }
+  
   /** Fill in a set of pipelines corresponding to a set of owner id's.
   *@param returnValues is a map keyed by ownerID, with value of JobDescription.
   *@param ownerIDList is the list of owner id's.



Mime
View raw message