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 2013/02/24 15:55:04 UTC

svn commit: r1449488 - /manifoldcf/branches/CONNECTORS-63/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Author: kwright
Date: Sun Feb 24 14:55:04 2013
New Revision: 1449488

URL: http://svn.apache.org/r1449488
Log:
Add ability to query repository connection activities through the API

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

Modified: manifoldcf/branches/CONNECTORS-63/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-63/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1449488&r1=1449487&r2=1449488&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-63/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-63/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java Sun Feb 24 14:55:04 2013
@@ -1651,6 +1651,7 @@ public class ManifoldCF extends org.apac
   protected final static String API_RESULTSETNODE = "resultset";
   protected final static String API_ROWNODE = "row";
   protected final static String API_COLUMNNODE = "column";
+  protected final static String API_ACTIVITYNODE = "activity";
   
   // Connector nodes
   protected static final String CONNECTORNODE_DESCRIPTION = "description";
@@ -2631,6 +2632,25 @@ public class ManifoldCF extends org.apac
     return READRESULT_FOUND;
   }
   
+  /** Read the activity list for a given connection name. */
+  protected static int apiReadRepositoryConnectionActivities(IThreadContext tc, Configuration output, String connectionName)
+    throws ManifoldCFException
+  {
+    String[] activities = getActivitiesList(tc,connectionName);
+    if (activities == null)
+    {
+      createErrorNode(output,"Connection '"+connectionName+"' does not exist.");
+      return READRESULT_NOTFOUND;
+    }
+    for (String activity : activities)
+    {
+      ConfigurationNode node = new ConfigurationNode(API_ACTIVITYNODE);
+      node.setValue(activity);
+      output.addChild(output.getChildCount(),node);
+    }
+    return READRESULT_FOUND;
+  }
+  
   /** Execute specified read command.
   *@param tc is the thread context.
   *@param output is the output object, to be filled in.
@@ -2649,6 +2669,12 @@ public class ManifoldCF extends org.apac
       Long jobID = new Long(path.substring("jobs/".length()));
       return apiReadJob(tc,output,jobID);
     }
+    else if (path.startsWith("repositoryconnectionactivities/"))
+    {
+      int firstSeparator = "repositoryconnectionactivities/".length();
+      String connectionName = decodeAPIPathElement(path.substring(firstSeparator));
+      return apiReadRepositoryConnectionActivities(tc,output,connectionName);
+    }
     else if (path.startsWith("repositoryconnectionhistory/"))
     {
       int firstSeparator = "repositoryconnectionhistory/".length();