manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1647200 - /manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Date Sun, 21 Dec 2014 19:53:37 GMT
Author: kwright
Date: Sun Dec 21 19:53:37 2014
New Revision: 1647200

URL: http://svn.apache.org/r1647200
Log:
Add API support for notifications in jobs

Modified:
    manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Modified: manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1647200&r1=1647199&r2=1647200&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
(original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Sun Dec 21 19:53:37 2014
@@ -4232,6 +4232,7 @@ public class ManifoldCF extends org.apac
   protected static final String JOBNODE_STAGECONNECTIONNAME = "stage_connectionname";
   protected static final String JOBNODE_STAGEDESCRIPTION = "stage_description";
   protected static final String JOBNODE_STAGESPECIFICATION = "stage_specification";
+  protected static final String JOBNODE_NOTIFICATIONSTAGE = "notificationstage";
 
   /** Convert a node into a job description.
   *@param jobDescription is the job to be filled in.
@@ -4297,6 +4298,39 @@ public class ManifoldCF extends org.apac
         pipelineStages.put(stageID,new PipelineStage(stagePrerequisite,stageIsOutput.equals("true"),
           stageConnectionName,stageDescription,stageSpecification));
       }
+      else if (childType.equals(JOBNODE_NOTIFICATIONSTAGE))
+      {
+        String stageConnectionName = null;
+        String stageDescription = null;
+        ConfigurationNode stageSpecification = null;
+        for (int q = 0; q < child.getChildCount(); q++)
+        {
+          ConfigurationNode cn = child.findChild(q);
+          if (cn.getType().equals(JOBNODE_STAGECONNECTIONNAME))
+            stageConnectionName = cn.getValue();
+          else if (cn.getType().equals(JOBNODE_STAGEDESCRIPTION))
+            stageDescription = cn.getValue();
+          else if (cn.getType().equals(JOBNODE_STAGESPECIFICATION))
+          {
+            stageSpecification = cn;
+          }
+          else
+            throw new ManifoldCFException("Found an unexpected node type: '"+cn.getType()+"'");
+        }
+        if (stageConnectionName == null)
+          throw new ManifoldCFException("Missing required field: '"+JOBNODE_STAGECONNECTIONNAME+"'");
+        Specification os = jobDescription.addNotification(stageConnectionName,stageDescription);
+        os.clearChildren();
+        if (stageSpecification != null)
+        {
+          for (int j = 0; j < stageSpecification.getChildCount(); j++)
+          {
+            ConfigurationNode cn = stageSpecification.findChild(j);
+            os.addChild(os.getChildCount(),new SpecificationNode(cn));
+          }
+        }
+
+      }
       else if (childType.equals(JOBNODE_DOCUMENTSPECIFICATION))
       {
         // Get the job's document specification, clear out the children, and copy new ones
from the child.
@@ -4499,7 +4533,7 @@ public class ManifoldCF extends org.apac
     }
     
   }
-  
+
   /** Convert a job description into a ConfigurationNode.
   *@param jobNode is the node to be filled in.
   *@param job is the job description.
@@ -4574,6 +4608,34 @@ public class ManifoldCF extends org.apac
       stage = new ConfigurationNode(JOBNODE_STAGESPECIFICATION);
       for (int k = 0; k < spec.getChildCount(); k++)
       {
+        ConfigurationNode cn = spec.getChild(k);
+        stage.addChild(stage.getChildCount(),cn);
+      }
+      child.addChild(child.getChildCount(),stage);
+      jobNode.addChild(jobNode.getChildCount(),child);
+    }
+
+    for (int j = 0; j < job.countNotifications(); j++)
+    {
+      child = new ConfigurationNode(JOBNODE_NOTIFICATIONSTAGE);
+      ConfigurationNode stage;
+      stage = new ConfigurationNode(JOBNODE_STAGEID);
+      stage.setValue(Integer.toString(j));
+      child.addChild(child.getChildCount(),stage);
+      stage = new ConfigurationNode(JOBNODE_STAGECONNECTIONNAME);
+      stage.setValue(job.getNotificationConnectionName(j));
+      child.addChild(child.getChildCount(),stage);
+      String description = job.getNotificationDescription(j);
+      if (description != null)
+      {
+        stage = new ConfigurationNode(JOBNODE_STAGEDESCRIPTION);
+        stage.setValue(description);
+        child.addChild(child.getChildCount(),stage);
+      }
+      Specification spec = job.getNotificationSpecification(j);
+      stage = new ConfigurationNode(JOBNODE_STAGESPECIFICATION);
+      for (int k = 0; k < spec.getChildCount(); k++)
+      {
         ConfigurationNode cn = spec.getChild(k);
         stage.addChild(stage.getChildCount(),cn);
       }



Mime
View raw message