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 2014/06/17 09:14:38 UTC
svn commit: r1603075 - in /manifoldcf/branches/CONNECTORS-962/framework:
crawler-ui/src/main/webapp/
pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/
pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/
Author: kwright
Date: Tue Jun 17 07:14:37 2014
New Revision: 1603075
URL: http://svn.apache.org/r1603075
Log:
Everything compiles except tests
Modified:
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/editjob.jsp
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/execute.jsp
manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
Modified: manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/editjob.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1603075&r1=1603074&r2=1603075&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/editjob.jsp (original)
+++ manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/editjob.jsp Tue Jun 17 07:14:37 2014
@@ -1063,14 +1063,14 @@
// A list of precedents to pick from, displayed at the end
List<Integer> precedents = new ArrayList<Integer>();
// Repository connection is always allowed
- precedents.add(new Integer(0));
+ precedents.add(new Integer(-1));
Set<String> alreadyPresent = new HashSet<String>();
for (int j = 0; j < pipelineConnectionNames.length; j++)
{
if (pipelineIsOutputs[j])
alreadyPresent.add(pipelineConnectionNames[j]);
else
- precedents.add(new Integer(j+1));
+ precedents.add(new Integer(j));
if (pipelinePrerequisites[j] != -1)
{
Integer thisOne = new Integer(pipelinePrerequisites[j]);
@@ -1791,12 +1791,6 @@
}
}
- if (outputPresent)
- {
-%>
- <input type="hidden" name="outputpresent" value="true"/>
-<%
- }
%>
<table class="displaytable">
<tr><td class="separator" colspan="4"><hr/></td></tr>
Modified: manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/execute.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1603075&r1=1603074&r2=1603075&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/execute.jsp (original)
+++ manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/execute.jsp Tue Jun 17 07:14:37 2014
@@ -884,16 +884,11 @@
// Figure out what got posted.
String x = variableContext.getParameter("connectionpresent");
boolean connectionPresent = (x != null && x.equals("true"));
- x = variableContext.getParameter("outputpresent");
- boolean outputPresent = (x != null && x.equals("true"));
// Gather the rest of the data.
x = variableContext.getParameter("description");
if (x != null)
job.setDescription(x);
- x = variableContext.getParameter("outputname");
- if (x != null)
- job.setOutputConnectionName(x);
x = variableContext.getParameter("connectionname");
if (x != null)
job.setConnectionName(x);
@@ -916,9 +911,11 @@
for (int j = 0; j < count; j++)
{
// Gather everything first; we'll look at edits later
+ int precedent = Integer.parseInt(variableContext.getParameter("pipeline_"+j+"_precedent"));
+ boolean isOutput = variableContext.getParameter("pipeline_"+j+"_isoutput").equals("true");
String connectionName = variableContext.getParameter("pipeline_"+j+"_connectionname");
String description = variableContext.getParameter("pipeline_"+j+"_description");
- job.addPipelineStage(j-1, false, connectionName, description);
+ job.addPipelineStage(precedent, isOutput, connectionName, description);
}
}
@@ -1165,9 +1162,6 @@
IRepositoryConnection connection = null;
if (job.getConnectionName() != null && job.getConnectionName().length() > 0)
connection = connManager.load(job.getConnectionName());
- IOutputConnection outputConnection = null;
- if (job.getOutputConnectionName() != null && job.getOutputConnectionName().length() > 0)
- outputConnection = outputManager.load(job.getOutputConnectionName());
if (connection != null)
{
@@ -1191,30 +1185,6 @@
}
}
- if (outputPresent && outputConnection != null)
- {
- IOutputConnector outputConnector = outputConnectorPool.grab(outputConnection);
- if (outputConnector != null)
- {
- try
- {
- String error = outputConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getOutputSpecification(),1+job.countPipelineStages());
- if (error != null)
- {
- variableContext.setParameter("text",error);
- variableContext.setParameter("target","listjobs.jsp");
-%>
- <jsp:forward page="error.jsp"/>
-<%
- }
- }
- finally
- {
- outputConnectorPool.release(outputConnection,outputConnector);
- }
- }
- }
-
if (connectionPresent && connection != null)
{
IRepositoryConnector repositoryConnector = repositoryConnectorPool.grab(connection);
@@ -1242,32 +1212,62 @@
// Process all pipeline stages
for (int j = 0; j < job.countPipelineStages(); j++)
{
- ITransformationConnection transformationConnection = transformationManager.load(job.getPipelineStageConnectionName(j));
- if (transformationConnection != null)
+ if (job.getPipelineStageIsOutputConnection(j))
{
- ITransformationConnector transformationConnector = transformationConnectorPool.grab(transformationConnection);
- if (transformationConnector != null)
+ IOutputConnection outputConnection = outputManager.load(job.getPipelineStageConnectionName(j));
+ if (outputConnection != null)
{
- try
+ IOutputConnector outputConnector = outputConnectorPool.grab(outputConnection);
+ if (outputConnector != null)
{
- String error = transformationConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getPipelineStageSpecification(j),1+j);
- if (error != null)
+ try
{
- variableContext.setParameter("text",error);
- variableContext.setParameter("target","listjobs.jsp");
+ String error = outputConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getPipelineStageSpecification(j),1+j);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
%>
<jsp:forward page="error.jsp"/>
<%
+ }
+ }
+ finally
+ {
+ outputConnectorPool.release(outputConnection,outputConnector);
}
}
- finally
+ }
+ }
+ else
+ {
+ ITransformationConnection transformationConnection = transformationManager.load(job.getPipelineStageConnectionName(j));
+ if (transformationConnection != null)
+ {
+ ITransformationConnector transformationConnector = transformationConnectorPool.grab(transformationConnection);
+ if (transformationConnector != null)
{
- transformationConnectorPool.release(transformationConnection,transformationConnector);
+ try
+ {
+ String error = transformationConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getPipelineStageSpecification(j),1+j);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
+%>
+ <jsp:forward page="error.jsp"/>
+<%
+ }
+ }
+ finally
+ {
+ transformationConnectorPool.release(transformationConnection,transformationConnector);
+ }
}
}
}
}
-
+
// Now, after gathering is complete, consider doing changes to the pipeline.
int currentStage = 0;
for (int j = 0; j < job.countPipelineStages(); j++)
@@ -1276,27 +1276,36 @@
x = variableContext.getParameter("pipeline_"+j+"_op");
if (x != null && x.equals("Delete"))
{
- // Delete this pipeline stage
+ // Delete this pipeline stage (and rewire other stages according to rules)
job.deletePipelineStage(currentStage);
}
- else if (x != null && x.equals("Insert"))
+ else if (x != null && x.equals("InsertTransformation"))
+ {
+ // Insert a new stage before this one
+ String connectionName = variableContext.getParameter("transformation_connectionname");
+ String description = variableContext.getParameter("transformation_description");
+ job.insertPipelineStage(currentStage,false,connectionName,description);
+ currentStage++;
+ }
+ else if (x != null && x.equals("InsertOutput"))
{
// Insert a new stage before this one
- String connectionName = variableContext.getParameter("pipeline_connectionname");
- String description = variableContext.getParameter("pipeline_description");
- job.insertPipelineStage(currentStage,currentStage-1,false,connectionName,description);
+ String connectionName = variableContext.getParameter("output_connectionname");
+ String description = variableContext.getParameter("output_description");
+ job.insertPipelineStage(currentStage,true,connectionName,description);
currentStage++;
}
else
currentStage++;
}
- x = variableContext.getParameter("pipeline_op");
+ x = variableContext.getParameter("output_op");
if (x != null && x.equals("Add"))
{
// Append a new stage at the end
- String connectionName = variableContext.getParameter("pipeline_connectionname");
- String description = variableContext.getParameter("pipeline_description");
- job.addPipelineStage(connectionName,description);
+ int precedent = Integer.parseInt(variableContext.getParameter("output_precedent"));
+ String connectionName = variableContext.getParameter("output_connectionname");
+ String description = variableContext.getParameter("output_description");
+ job.addPipelineStage(precedent,true,connectionName,description);
}
if (op.equals("Continue"))
Modified: manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java?rev=1603075&r1=1603074&r2=1603075&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java (original)
+++ manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java Tue Jun 17 07:14:37 2014
@@ -140,7 +140,7 @@ public interface IJobDescription
*@param pipelineStageDescription is the description.
*@return the newly-created output specification.
*/
- public OutputSpecification insertPipelineStage(int index, int prerequisiteStage, boolean isOutput, String pipelineStageConnectionName, String pipelineStageDescription);
+ public OutputSpecification insertPipelineStage(int index, boolean isOutput, String pipelineStageConnectionName, String pipelineStageDescription);
/** Set the job type.
*@param type is the type (as an integer).
Modified: manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java?rev=1603075&r1=1603074&r2=1603075&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java (original)
+++ manifoldcf/branches/CONNECTORS-962/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java Tue Jun 17 07:14:37 2014
@@ -267,17 +267,21 @@ public class JobDescription implements I
*@return the newly-created output specification.
*/
@Override
- public OutputSpecification insertPipelineStage(int index, int prerequisiteStage, boolean isOutput, String pipelineStageConnectionName, String pipelineStageDescription)
+ public OutputSpecification insertPipelineStage(int index, boolean isOutput, String pipelineStageConnectionName, String pipelineStageDescription)
{
if (readOnly)
throw new IllegalStateException("Attempt to change read-only object");
- PipelineStage ps = new PipelineStage(prerequisiteStage,isOutput,pipelineStageConnectionName,pipelineStageDescription);
+ // What we do here depends on the kind of stage we're inserting.
+ // Both kinds take the current stage's prerequisite as their own. But what happens to the current stage will
+ // differ as to whether its reference changes or not.
+ PipelineStage currentStage = pipelineStages.get(index);
+ PipelineStage ps = new PipelineStage(currentStage.getPrerequisiteStage(),isOutput,pipelineStageConnectionName,pipelineStageDescription);
pipelineStages.add(index,ps);
// Adjust stage back-references
int stage = index + 1;
while (stage < pipelineStages.size())
{
- pipelineStages.get(stage).adjustForInsert(index);
+ pipelineStages.get(stage).adjustForInsert(index,isOutput);
stage++;
}
return ps.getSpecification();
@@ -666,9 +670,9 @@ public class JobDescription implements I
this.specification = spec;
}
- public void adjustForInsert(int index)
+ public void adjustForInsert(int index, boolean isOutput)
{
- if (prerequisiteStage >= index)
+ if (prerequisiteStage > index || (prerequisiteStage == index && !isOutput))
prerequisiteStage++;
}