manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1603066 - /manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
Date Tue, 17 Jun 2014 06:19:38 GMT
Author: kwright
Date: Tue Jun 17 06:19:37 2014
New Revision: 1603066

URL: http://svn.apache.org/r1603066
Log:
Install safety interlocks so jobs cannot lose output connections or have duplicates

Modified:
    manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java

Modified: manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java?rev=1603066&r1=1603065&r2=1603066&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
(original)
+++ manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
Tue Jun 17 06:19:37 2014
@@ -238,6 +238,18 @@ public class PipelineManager extends org
   public boolean compareRows(Long ownerID, IJobDescription job)
     throws ManifoldCFException
   {
+    // Compute a set of the outputs
+    Set<String> outputSet = new HashSet<String>();
+    for (int i = 0; i < job.countPipelineStages(); i++)
+    {
+      if (job.getPipelineStageIsOutputConnection(i))
+      {
+        String outputName = job.getPipelineStageConnectionName(i);
+        if (outputSet.contains(outputName))
+          throw new ManifoldCFException("Output name '"+outputName+"' is duplicated within
job; not allowed");
+        outputSet.add(outputName);
+      }
+    }
     ArrayList params = new ArrayList();
     String query = buildConjunctionClause(params,new ClauseDescription[]{
       new UnitaryClause(ownerIDField,ownerID)});
@@ -249,6 +261,8 @@ public class PipelineManager extends org
     {
       IResultRow row = set.getRow(i);
       String outputConnectionName = (String)row.getValue(outputNameField);
+      if (!outputSet.contains(outputConnectionName))
+        throw new ManifoldCFException("Output name '"+outputConnectionName+"' removed from
job; not allowed");
       String transformationConnectionName = (String)row.getValue(transformationNameField);
       Long prerequisite = (Long)row.getValue(prerequisiteField);
       String spec = (String)row.getValue(connectionSpecField);



Mime
View raw message