Author: kwright
Date: Tue Jun 3 14:15:13 2014
New Revision: 1599557
URL: http://svn.apache.org/r1599557
Log:
Hook up execute.jsp code for managing pipeline
Modified:
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
Modified:
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1599557&r1=1599556&r2=1599557&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
Tue Jun 3 14:15:13 2014
@@ -950,7 +950,9 @@
<td class="boxcell" colspan="3">
<table class="formtable">
<tr class="formheaderrow">
- <td
class="formcolumnheader"></td>
+ <td
class="formcolumnheader">
+ <input
name="pipeline_count" type="hidden" value="<%=transformationNames.length%>"/>
+ </td>
<td
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.StageNumber")%></nobr></td>
<td
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.StageDescription")%></nobr></td>
<td
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.StageConnectionName")%></nobr></td>
@@ -1122,6 +1124,18 @@
%>
<input type="hidden" name="outputname"
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(outputName)%>'/>
<input type="hidden" name="connectionname"
value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(connectionName)%>'/>
+ <input type="hidden" name="pipeline_count"
value="<%=transformationNames.length%>"/>
+<%
+ for (int j = 0; j < transformationNames.length; j++)
+ {
+ String transformationName = transformationNames[j];
+ String transformationDescription =
transformationDescriptions[j];
+%>
+ <input type="hidden" name="pipeline_<%=j%>_connectionname"
value="<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(transformationName)%>"/>
+ <input type="hidden" name="pipeline_<%=j%>_description"
value="<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(transformationDescription)%>"/>
+<%
+ }
+%>
<input type="hidden" name="priority" value='<%=priority%>'/>
<input type="hidden" name="startmethod"
value='<%=startMethod%>'/>
<%
Modified:
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1599557&r1=1599556&r2=1599557&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
Tue Jun 3 14:15:13 2014
@@ -750,7 +750,7 @@
<%
}
}
- else if (type != null && op != null && type.equals("output"))
+ else if (type != null && op != null &&
type.equals("transformation"))
{
// -- Output connection editing operations --
if (op.equals("Save") || op.equals("Continue"))
@@ -906,6 +906,21 @@
x =
variableContext.getParameter("hopcountmode");
if (x != null)
job.setHopcountMode(Integer.parseInt(x));
+ x =
variableContext.getParameter("pipeline_count");
+ if (x != null)
+ {
+ // Do we need to keep the old
specifications around, or can we destroy them?
+ // Not clear that retention is
required., so I'm not wasting time trying to implement that.
+ int count = Integer.parseInt(x);
+ job.clearPipeline();
+ for (int j = 0; j < count; j++)
+ {
+ // Gather everything
first; we'll look at edits later
+ String connectionName =
variableContext.getParameter("pipeline_"+j+"_connectionname");
+ String description =
variableContext.getParameter("pipeline_"+j+"_description");
+
job.addPipelineStage(connectionName, description);
+ }
+ }
x =
variableContext.getParameter("schedulerecords");
String[] y;
@@ -1183,7 +1198,7 @@
{
try
{
- String error =
outputConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getOutputSpecification(),1);
+ String error =
outputConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getOutputSpecification(),1+job.countPipelineStages());
if (error !=
null)
{
variableContext.setParameter("text",error);
@@ -1224,6 +1239,65 @@
}
}
+ // Process all pipeline stages
+ for (int j = 0; j <
job.countPipelineStages(); j++)
+ {
+ ITransformationConnection
transformationConnection =
transformationManager.load(job.getPipelineStageConnectionName(j));
+ if (transformationConnection !=
null)
+ {
+
ITransformationConnector transformationConnector =
transformationConnectorPool.grab(transformationConnection);
+ if
(transformationConnector != null)
+ {
+ 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++)
+ {
+ // Look at the operation
+ x =
variableContext.getParameter("pipeline_"+j+"_op");
+ if (x != null &&
x.equals("Delete"))
+ {
+ // Delete this pipeline
stage
+
job.deletePipelineStage(currentStage);
+ }
+ else if (x != null &&
x.equals("Insert"))
+ {
+ // Insert a new stage
before this one
+ String connectionName =
variableContext.getParameter("pipeline_connectionname");
+ String description =
variableContext.getParameter("pipeline_description");
+
job.insertPipelineStage(currentStage++,connectionName,description);
+ }
+ else
+ currentStage++;
+ }
+ x =
variableContext.getParameter("pipeline_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);
+ }
+
if (op.equals("Continue"))
{
threadContext.save("JobObject",job);
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java?rev=1599557&r1=1599556&r2=1599557&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobDescription.java
Tue Jun 3 14:15:13 2014
@@ -130,7 +130,14 @@ public interface IJobDescription
*/
public void deletePipelineStage(int index);
-
+ /** Insert a new pipeline stage.
+ *@param index is the index to insert pipeline stage before
+ *@param pipelineStageConnectionName is the connection name.
+ *@param pipelineStageDescription is the description.
+ *@return the newly-created output specification.
+ */
+ public OutputSpecification insertPipelineStage(int index, String
pipelineStageConnectionName, String pipelineStageDescription);
+
/** Set the job type.
*@param type is the type (as an integer).
*/
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java?rev=1599557&r1=1599556&r2=1599557&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
Tue Jun 3 14:15:13 2014
@@ -278,6 +278,21 @@ public class JobDescription implements I
return pipelineStages.size();
}
+ /** Insert a new pipeline stage.
+ *@param index is the index to insert pipeline stage before
+ *@param pipelineStageConnectionName is the connection name.
+ *@param pipelineStageDescription is the description.
+ *@return the newly-created output specification.
+ */
+ public OutputSpecification insertPipelineStage(int index, String
pipelineStageConnectionName, String pipelineStageDescription)
+ {
+ if (readOnly)
+ throw new IllegalStateException("Attempt to change read-only object");
+ PipelineStage ps = new
PipelineStage(pipelineStageConnectionName,pipelineStageDescription);
+ pipelineStages.add(index,ps);
+ return ps.getSpecification();
+ }
+
/** Get a specific pipeline connection name.
*@param index is the index of the pipeline stage whose connection name to
get.
*@return the name of the connection.