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 2010/07/19 08:15:51 UTC

svn commit: r965362 - in /incubator/lcf/trunk/modules: connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/ connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/ connectors/jcifs/connector/org/apache/lcf/crawler/con...

Author: kwright
Date: Mon Jul 19 06:15:50 2010
New Revision: 965362

URL: http://svn.apache.org/viewvc?rev=965362&view=rev
Log:
Flesh out connector-specific UI support methods at the API level, to the point where all UI methods available within each connector now have an API equivalent.

Modified:
    incubator/lcf/trunk/modules/connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/DCTM.java
    incubator/lcf/trunk/modules/connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/FilenetConnector.java
    incubator/lcf/trunk/modules/connectors/jcifs/connector/org/apache/lcf/crawler/connectors/sharedrive/SharedDriveConnector.java
    incubator/lcf/trunk/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java
    incubator/lcf/trunk/modules/connectors/memex/connector/org/apache/lcf/crawler/connectors/memex/MemexConnector.java
    incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java
    incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java
    incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java
    incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java
    incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/LCF.java
    incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/Logging.java
    incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
    incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
    incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/LCF.java
    incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/Logging.java

Modified: incubator/lcf/trunk/modules/connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/DCTM.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/DCTM.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/DCTM.java (original)
+++ incubator/lcf/trunk/modules/connectors/documentum/connector/org/apache/lcf/crawler/connectors/DCTM/DCTM.java Mon Jul 19 06:15:50 2010
@@ -23,6 +23,7 @@ import org.apache.lcf.core.interfaces.*;
 import org.apache.lcf.agents.interfaces.*;
 import org.apache.lcf.crawler.interfaces.*;
 import org.apache.lcf.crawler.system.Logging;
+import org.apache.lcf.crawler.system.LCF;
 import java.util.*;
 import java.io.*;
 import org.apache.lcf.crawler.common.DCTM.*;
@@ -843,6 +844,117 @@ public class DCTM extends org.apache.lcf
 
   }
 
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("contenttype/list"))
+    {
+      try
+      {
+        String[] contentTypes = getContentTypes();
+        int i = 0;
+        while (i < contentTypes.length)
+        {
+          String contentType = contentTypes[i++];
+          ConfigurationNode node = new ConfigurationNode("content_type");
+          node.setValue(contentType);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("objecttype/list"))
+    {
+      try
+      {
+        String[] objectTypes = getObjectTypes();
+        int i = 0;
+        while (i < objectTypes.length)
+        {
+          String objectType = objectTypes[i++];
+          ConfigurationNode node = new ConfigurationNode("object_type");
+          node.setValue(objectType);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("folder/list"))
+    {
+      String parentFolder = LCF.getRootArgument(input,"parent_folder");
+      try
+      {
+        String[] folders = getChildFolderNames(parentFolder);
+        int i = 0;
+        while (i < folders.length)
+        {
+          String folder = folders[i++];
+          ConfigurationNode node = new ConfigurationNode("folder");
+          node.setValue(folder);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("indexableattributes/list"))
+    {
+      String objectType = LCF.getRootArgument(input,"object_type");
+      if (objectType == null)
+        throw new LCFException("Missing required field 'object_type'");
+      try
+      {
+        String[] indexableAttributes = getIngestableAttributes(objectType);
+        int i = 0;
+        while (i < indexableAttributes.length)
+        {
+          String indexableAttribute = indexableAttributes[i++];
+          ConfigurationNode node = new ConfigurationNode("attribute");
+          node.setValue(indexableAttribute);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.
   *@param activities is the interface this method should use to perform whatever framework actions are desired.

Modified: incubator/lcf/trunk/modules/connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/FilenetConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/FilenetConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/FilenetConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/filenet/connector/org/apache/lcf/crawler/connectors/filenet/FilenetConnector.java Mon Jul 19 06:15:50 2010
@@ -23,6 +23,7 @@ import org.apache.lcf.core.interfaces.*;
 import org.apache.lcf.agents.interfaces.*;
 import org.apache.lcf.crawler.interfaces.*;
 import org.apache.lcf.crawler.system.Logging;
+import org.apache.lcf.crawler.system.LCF;
 import java.util.*;
 import java.io.*;
 import org.apache.lcf.crawler.common.filenet.*;
@@ -531,6 +532,105 @@ public class FilenetConnector extends or
     docURIPrefix = null;
   }
 
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("documentclass/metadatafields"))
+    {
+      String documentClass = LCF.getRootArgument(input,"document_class");
+      if (documentClass == null)
+        throw new LCFException("Missing required field 'document_class'");
+      try
+      {
+        MetadataFieldDefinition[] metaFields = getDocumentClassMetadataFieldsDetails(documentClass);
+        int i = 0;
+        while (i < metaFields.length)
+        {
+          MetadataFieldDefinition def = metaFields[i++];
+          ConfigurationNode node = new ConfigurationNode("metadata_field");
+          ConfigurationNode child;
+          child = new ConfigurationNode("display_name");
+          child.setValue(def.getDisplayName());
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("symbolic_name");
+          child.setValue(def.getSymbolicName());
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("documentclass/list"))
+    {
+      try
+      {
+        DocumentClassDefinition[] definitions = getDocumentClassesDetails();
+        int i = 0;
+        while (i < definitions.length)
+        {
+          DocumentClassDefinition def = definitions[i++];
+          ConfigurationNode node = new ConfigurationNode("document_class");
+          ConfigurationNode child;
+          child = new ConfigurationNode("display_name");
+          child.setValue(def.getDisplayName());
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("symbolic_name");
+          child.setValue(def.getSymbolicName());
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("mimetype/list"))
+    {
+      try
+      {
+        String[] mimeTypesArray = getMimeTypes();
+        int i = 0;
+        while (i < mimeTypesArray.length)
+        {
+          String mimeType = mimeTypesArray[i++];
+          ConfigurationNode node = new ConfigurationNode("mime_type");
+          node.setValue(mimeType);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.
   *@param activities is the interface this method should use to perform whatever framework actions are desired.

Modified: incubator/lcf/trunk/modules/connectors/jcifs/connector/org/apache/lcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/jcifs/connector/org/apache/lcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/jcifs/connector/org/apache/lcf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/jcifs/connector/org/apache/lcf/crawler/connectors/sharedrive/SharedDriveConnector.java Mon Jul 19 06:15:50 2010
@@ -48,6 +48,8 @@ import org.apache.lcf.core.interfaces.Co
 import org.apache.lcf.core.interfaces.LCFException;
 import org.apache.lcf.core.interfaces.IKeystoreManager;
 import org.apache.lcf.core.interfaces.KeystoreManagerFactory;
+import org.apache.lcf.core.interfaces.Configuration;
+import org.apache.lcf.core.interfaces.ConfigurationNode;
 import org.apache.lcf.crawler.interfaces.DocumentSpecification;
 import org.apache.lcf.crawler.interfaces.IDocumentIdentifierStream;
 import org.apache.lcf.crawler.interfaces.IProcessActivity;
@@ -55,6 +57,7 @@ import org.apache.lcf.crawler.interfaces
 import org.apache.lcf.core.interfaces.SpecificationNode;
 import org.apache.lcf.crawler.interfaces.IVersionActivity;
 import org.apache.lcf.crawler.system.Logging;
+import org.apache.lcf.crawler.system.LCF;
 
 /** This is the "repository connector" for a smb/cifs shared drive file system.  It's a relative of the share crawler, and should have
 * comparable basic functionality.
@@ -367,7 +370,66 @@ public class SharedDriveConnector extend
     }
   }
 
-
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("folder/list"))
+    {
+      String parentFolder = LCF.getRootArgument(input,"parent_folder");
+      if (parentFolder == null)
+        throw new LCFException("Missing required field 'parent_folder'");
+      
+      try
+      {
+        String[] folders = getChildFolderNames(parentFolder);
+        int i = 0;
+        while (i < folders.length)
+        {
+          String folder = folders[i++];
+          ConfigurationNode node = new ConfigurationNode("folder");
+          node.setValue(folder);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("folder/validate"))
+    {
+      String folder = LCF.getRootArgument(input,"folder");
+      if (folder == null)
+        throw new LCFException("Missing required field 'folder'");
+      
+      try
+      {
+        String canonicalFolder = validateFolderName(folder);
+        if (canonicalFolder != null)
+        {
+          ConfigurationNode node = new ConfigurationNode("folder");
+          node.setValue(canonicalFolder);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
+  
   /** Given a document specification, get either a list of starting document identifiers (seeds),
   * or a list of changes (deltas), depending on whether this is a "crawled" connector or not.
   * These document identifiers will be loaded into the job's queue at the beginning of the

Modified: incubator/lcf/trunk/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java Mon Jul 19 06:15:50 2010
@@ -707,7 +707,126 @@ public class LivelinkConnector extends o
     }
   }
 
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("workspace/list"))
+    {
+      try
+      {
+        String[] workspaces = getWorkspaceNames();
+        int i = 0;
+        while (i < workspaces.length)
+        {
+          String workspace = workspaces[i++];
+          ConfigurationNode node = new ConfigurationNode("workspace");
+          node.setValue(workspace);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("folder/list"))
+    {
+      String path = LCF.getRootArgument(input,"path");
+      if (path == null)
+        throw new LCFException("Missing required argument 'path'");
+      
+      try
+      {
+        String[] folders = getChildFolderNames(path);
+        int i = 0;
+        while (i < folders.length)
+        {
+          String folder = folders[i++];
+          ConfigurationNode node = new ConfigurationNode("folder");
+          node.setValue(folder);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("category/list"))
+    {
+      String path = LCF.getRootArgument(input,"path");
+      if (path == null)
+        throw new LCFException("Missing required argument 'path'");
+
+      try
+      {
+        String[] categories = getChildCategoryNames(path);
+        int i = 0;
+        while (i < categories.length)
+        {
+          String category = categories[i++];
+          ConfigurationNode node = new ConfigurationNode("category");
+          node.setValue(category);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+
+    }
+    else if (command.equals("categoryattributes/list"))
+    {
+      String path = LCF.getRootArgument(input,"path");
+      if (path == null)
+        throw new LCFException("Missing required argument 'path'");
 
+      try
+      {
+        String[] attributes = getCategoryAttributes(path);
+        int i = 0;
+        while (i < attributes.length)
+        {
+          String attribute = attributes[i++];
+          ConfigurationNode node = new ConfigurationNode("attribute");
+          node.setValue(attribute);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.
   *@param activities is the interface this method should use to perform whatever framework actions are desired.
@@ -2058,6 +2177,11 @@ public class LivelinkConnector extends o
           );
         }
       }
+      catch (ServiceInterruption e)
+      {
+        e.printStackTrace();
+        out.println(org.apache.lcf.ui.util.Encoder.bodyEscape(e.getMessage()));
+      }
       catch (LCFException e)
       {
         e.printStackTrace();
@@ -3458,7 +3582,7 @@ public class LivelinkConnector extends o
   *@return a list of workspace names.
   */
   public String[] getWorkspaceNames()
-    throws LCFException
+    throws LCFException, ServiceInterruption
   {
     return new String[]{CATEGORY_NAME,ENTWKSPACE_NAME};
   }
@@ -3468,17 +3592,10 @@ public class LivelinkConnector extends o
   *@return a list of folder and project names, in sorted order, or null if the path was invalid.
   */
   public String[] getChildFolderNames(String pathString)
-    throws LCFException
+    throws LCFException, ServiceInterruption
   {
-    try
-    {
-      getSession();
-      return getChildFolders(pathString);
-    }
-    catch (ServiceInterruption e)
-    {
-      throw new LCFException("Livelink server seems to be down: "+e.getMessage());
-    }
+    getSession();
+    return getChildFolders(pathString);
   }
 
 
@@ -3487,16 +3604,10 @@ public class LivelinkConnector extends o
   *@return a list of category names, in sorted order, or null if the path was invalid.
   */
   public String[] getChildCategoryNames(String pathString)
-    throws LCFException
+    throws LCFException, ServiceInterruption
   {
-    try
-    {
-      return getChildCategories(pathString);
-    }
-    catch (ServiceInterruption e)
-    {
-      throw new LCFException("Livelink server seems to be down: "+e.getMessage());
-    }
+    getSession();
+    return getChildCategories(pathString);
   }
 
   /** Given a category path, get a list of legal attribute names.

Modified: incubator/lcf/trunk/modules/connectors/memex/connector/org/apache/lcf/crawler/connectors/memex/MemexConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/memex/connector/org/apache/lcf/crawler/connectors/memex/MemexConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/memex/connector/org/apache/lcf/crawler/connectors/memex/MemexConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/memex/connector/org/apache/lcf/crawler/connectors/memex/MemexConnector.java Mon Jul 19 06:15:50 2010
@@ -297,7 +297,158 @@ public class MemexConnector extends org.
     super.disconnect();
   }
 
-
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("database/list"))
+    {
+      String virtualServer = LCF.getRootArgument(input,"virtual_server");
+      if (virtualServer == null)
+        throw new LCFException("Missing required argument 'virtual_server'");
+      
+      try
+      {
+        NameDescription[] databases = listDatabasesForVirtualServer(virtualServer);
+        int i = 0;
+        while (i < databases.length)
+        {
+          NameDescription database = databases[i++];
+          ConfigurationNode node = new ConfigurationNode("database");
+          ConfigurationNode child;
+          child = new ConfigurationNode("display_name");
+          child.setValue(database.getDisplayName());
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("symbolic_name");
+          child.setValue(database.getSymbolicName());
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("virtualserver/list"))
+    {
+      try
+      {
+        String[] virtualServers = listVirtualServers();
+        int i = 0;
+        while (i < virtualServers.length)
+        {
+          String virtualServer = virtualServers[i++];
+          ConfigurationNode node = new ConfigurationNode("virtual_server");
+          node.setValue(virtualServer);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("entitytype/list"))
+    {
+      try
+      {
+        NameDescription[] entityTypes = listEntityTypes();
+        int i = 0;
+        while (i < entityTypes.length)
+        {
+          NameDescription entityType = entityTypes[i++];
+          ConfigurationNode node = new ConfigurationNode("entity_type");
+          ConfigurationNode child;
+          child = new ConfigurationNode("display_name");
+          child.setValue(entityType.getDisplayName());
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("symbolic_name");
+          child.setValue(entityType.getSymbolicName());
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("field/list"))
+    {
+      String entityPrefix = LCF.getRootArgument(input,"entity_type_name");
+      if (entityPrefix == null)
+        throw new LCFException("Missing required argument 'entity_type_name'");
+      try
+      {
+        String[] fieldNames = listFieldNames(entityPrefix);
+        int i = 0;
+        while (i < fieldNames.length)
+        {
+          String fieldName = fieldNames[i++];
+          ConfigurationNode node = new ConfigurationNode("field_name");
+          node.setValue(fieldName);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("field/listmatchable"))
+    {
+      String entityPrefix = LCF.getRootArgument(input,"entity_type_name");
+      if (entityPrefix == null)
+        throw new LCFException("Missing required argument 'entity_type_name'");
+      try
+      {
+        String[] fieldNames = listMatchableFieldNames(entityPrefix);
+        int i = 0;
+        while (i < fieldNames.length)
+        {
+          String fieldName = fieldNames[i++];
+          ConfigurationNode node = new ConfigurationNode("field_name");
+          node.setValue(fieldName);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.
   *

Modified: incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java Mon Jul 19 06:15:50 2010
@@ -465,7 +465,117 @@ public class MeridioConnector extends or
     return 10;
   }
 
-
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("category/list"))
+    {
+      try
+      {
+        String[] categories = getMeridioCategories();
+        int i = 0;
+        while (i < categories.length)
+        {
+          String category = categories[i++];
+          ConfigurationNode node = new ConfigurationNode("category");
+          node.setValue(category);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("documentproperties/list"))
+    {
+      try
+      {
+        String[] properties = getMeridioDocumentProperties();
+        int i = 0;
+        while (i < properties.length)
+        {
+          String property = properties[i++];
+          ConfigurationNode node = new ConfigurationNode("document_property");
+          node.setValue(property);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("classorfolder/list"))
+    {
+      String classOrFolderIdString = LCF.getRootArgument(input,"class_or_folder_id");
+      if (classOrFolderIdString == null)
+        throw new LCFException("Missing required argument 'class_or_folder_id'");
+      int classOrFolderId;
+      try
+      {
+        classOrFolderId = Integer.parseInt(classOrFolderIdString);
+      }
+      catch (NumberFormatException e)
+      {
+        throw new LCFException("Argument 'class_or_folder_id' must be an integer: "+e.getMessage(),e);
+      }
+      try
+      {
+        MeridioClassContents[] contents = getClassOrFolderContents(classOrFolderId);
+        int i = 0;
+        while (i < contents.length)
+        {
+          MeridioClassContents content = contents[i++];
+          ConfigurationNode node = new ConfigurationNode("content");
+          ConfigurationNode child;
+          child = new ConfigurationNode("id");
+          child.setValue(Integer.toString(content.classOrFolderId));
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("name");
+          child.setValue(content.classOrFolderName);
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("type");
+          String typeString;
+          if (content.containerType == MeridioClassContents.CLASS)
+            typeString = "class";
+          else if (content.containerType == MeridioClassContents.FOLDER)
+            typeString = "folder";
+          else
+            typeString = "unknown";
+          child.setValue(typeString);
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
 
   /** Given a document specification, get either a list of starting document identifiers (seeds),
   * or a list of changes (deltas), depending on whether this is a "crawled" connector or not.

Modified: incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java Mon Jul 19 06:15:50 2010
@@ -321,6 +321,112 @@ public class SharePointRepository extend
       connectionManager.closeIdleConnections(60000L);
   }
 
+  /** Execute an arbitrary connector command.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
+  * queries.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
+  *@param command is the command, which is taken directly from the API request.
+  *@param input is the request object.
+  */
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
+  {
+    if (command.equals("field/list"))
+    {
+      String sitePath = LCF.getRootArgument(input,"site_path");
+      if (sitePath == null)
+        throw new LCFException("Missing required argument 'site_path'");
+      String library = LCF.getRootArgument(input,"library");
+      if (library == null)
+        throw new LCFException("Missing required argument 'library'");
+      
+      try
+      {
+        Map fieldSet = getFieldList(sitePath,library);
+        Iterator iter = fieldSet.keySet().iterator();
+        while (iter.hasNext())
+        {
+          String fieldName = (String)iter.next();
+          String displayName = (String)fieldSet.get(fieldName);
+          ConfigurationNode node = new ConfigurationNode("field");
+          ConfigurationNode child;
+          child = new ConfigurationNode("name");
+          child.setValue(fieldName);
+          node.addChild(node.getChildCount(),child);
+          child = new ConfigurationNode("display_name");
+          child.setValue(displayName);
+          node.addChild(node.getChildCount(),child);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("site/list"))
+    {
+      String sitePath = LCF.getRootArgument(input,"site_path");
+      if (sitePath == null)
+        throw new LCFException("Missing required argument 'site_path'");
+
+      try
+      {
+        ArrayList sites = getSites(sitePath);
+        int i = 0;
+        while (i < sites.size())
+        {
+          String site = (String)sites.get(i++);
+          ConfigurationNode node = new ConfigurationNode("site");
+          node.setValue(site);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else if (command.equals("library/list"))
+    {
+      String sitePath = LCF.getRootArgument(input,"site_path");
+      if (sitePath == null)
+        throw new LCFException("Missing required argument 'site_path'");
+
+      try
+      {
+        ArrayList libs = getDocLibsBySite(sitePath);
+        int i = 0;
+        while (i < libs.size())
+        {
+          String lib = (String)libs.get(i++);
+          ConfigurationNode node = new ConfigurationNode("library");
+          node.setValue(lib);
+          output.addChild(output.getChildCount(),node);
+        }
+      }
+      catch (ServiceInterruption e)
+      {
+        LCF.createServiceInterruptionNode(output,e);
+      }
+      catch (LCFException e)
+      {
+        LCF.createErrorNode(output,e);
+      }
+    }
+    else
+      super.executeCommand(output,command,input);
+  }
+  
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.
   *

Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java Mon Jul 19 06:15:50 2010
@@ -122,15 +122,13 @@ public interface IOutputConnector
   /** Execute an arbitrary connector command.
   * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
   * queries.
-  * Exceptions thrown by this method are handled specially at the API level, so that they result in specific kinds of responses that are
-  * distinct from the non-exception case.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
   *@param command is the command, which is taken directly from the API request.
-  *@param input is the optional and arbitrarily complex request object, which should contain whatever information the connector needs to perform the
-  *  command.
-  *@return the response, which can once again be an arbitrarily complex hierarchy.
+  *@param input is the request object.
   */
-  public ConfigurationNode executeCommand(String command, ConfigurationNode input)
-    throws LCFException, ServiceInterruption;
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException;
     
   /** Detect if a mime type is indexable or not.  This method is used by participating repository connectors to pre-filter the number of
   * unusable documents that will be passed to this output connector.

Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java Mon Jul 19 06:15:50 2010
@@ -146,15 +146,13 @@ public abstract class BaseOutputConnecto
   /** Execute an arbitrary connector command.
   * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
   * queries.
-  * Exceptions thrown by this method are handled specially at the API level, so that they result in specific kinds of responses that are
-  * distinct from the non-exception case.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
   *@param command is the command, which is taken directly from the API request.
-  *@param input is the optional and arbitrarily complex request object, which should contain whatever information the connector needs to perform the
-  *  command.
-  *@return the response, which can once again be an arbitrarily complex hierarchy.
+  *@param input is the request object.
   */
-  public ConfigurationNode executeCommand(String command, ConfigurationNode input)
-    throws LCFException, ServiceInterruption
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
   {
     // The base connector treats all requests as invalid commands, and throws an exception accordingly.
     throw new LCFException("Unrecognized output connector command '"+command+"'");

Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/LCF.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/LCF.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/LCF.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/LCF.java Mon Jul 19 06:15:50 2010
@@ -198,5 +198,58 @@ public class LCF extends org.apache.lcf.
     
   }
   
+  // Helper methods for API support.  These are made public so connectors can use them to implement the executeCommand method.
+  
+  // These are the universal node types.
+  
+  protected static final String API_ERRORNODE = "error";
+  protected static final String API_SERVICEINTERRUPTIONNODE = "service_interruption";
+  
+  /** Find a configuration node given a name */
+  public static ConfigurationNode findConfigurationNode(Configuration input, String argumentName)
+  {
+    // Look for argument among the children
+    int i = 0;
+    while (i < input.getChildCount())
+    {
+      ConfigurationNode cn = input.findChild(i++);
+      if (cn.getType().equals(argumentName))
+        return cn;
+    }
+    return null;
+
+  }
+  
+  /** Find a configuration value given a name */
+  public static String getRootArgument(Configuration input, String argumentName)
+  {
+    ConfigurationNode node = findConfigurationNode(input,argumentName);
+    if (node == null)
+      return null;
+    return node.getValue();
+  }
+  
+  /** Handle an exception, by converting it to an error node. */
+  public static void createErrorNode(Configuration output, LCFException e)
+    throws LCFException
+  {
+    if (e.getErrorCode() == LCFException.INTERRUPTED)
+      throw e;
+    Logging.api.error(e.getMessage(),e);
+    ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
+    error.setValue(e.getMessage());
+    output.addChild(output.getChildCount(),error);
+  }
+
+  /** Handle a service interruption, by converting it to a serviceinterruption node. */
+  public static void createServiceInterruptionNode(Configuration output, ServiceInterruption e)
+  {
+    Logging.api.warn(e.getMessage(),e);
+    ConfigurationNode error = new ConfigurationNode(API_SERVICEINTERRUPTIONNODE);
+    error.setValue(e.getMessage());
+    output.addChild(output.getChildCount(),error);
+  }
+
+
 }
 

Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/Logging.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/Logging.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/Logging.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/system/Logging.java Mon Jul 19 06:15:50 2010
@@ -33,6 +33,7 @@ public class Logging extends org.apache.
   // Public logger objects
   public static Logger agents = null;
   public static Logger ingest = null;
+  public static Logger api = null;
 
   /** Initialize logger setup.
   */
@@ -46,6 +47,7 @@ public class Logging extends org.apache.
     // package loggers
     agents = newLogger("org.apache.lcf.agents");
     ingest = newLogger("org.apache.lcf.ingest");
+    api = newLogger("org.apache.lcf.api");
 
   }
 

Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java Mon Jul 19 06:15:50 2010
@@ -198,15 +198,13 @@ public abstract class BaseRepositoryConn
   /** Execute an arbitrary connector command.
   * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
   * queries.
-  * Exceptions thrown by this method are handled specially at the API level, so that they result in specific kinds of responses that are
-  * distinct from the non-exception case.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
   *@param command is the command, which is taken directly from the API request.
-  *@param input is the optional and arbitrarily complex request object, which should contain whatever information the connector needs to perform the
-  *  command.
-  *@return the response, which can once again be an arbitrarily complex hierarchy.
+  *@param input is the request object.
   */
-  public ConfigurationNode executeCommand(String command, ConfigurationNode input)
-    throws LCFException, ServiceInterruption
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException
   {
     // By definition, the base connector has no commands.
     throw new LCFException("Unrecognized repository connector command '"+command+"'");

Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java Mon Jul 19 06:15:50 2010
@@ -182,15 +182,13 @@ public interface IRepositoryConnector
   /** Execute an arbitrary connector command.
   * This method is called directly from the API in order to allow API users to perform any one of several connector-specific actions or
   * queries.
-  * Exceptions thrown by this method are handled specially at the API level, so that they result in specific kinds of responses that are
-  * distinct from the non-exception case.
+  * Exceptions thrown by this method are considered to be usage errors, and cause a 400 response to be returned.
+  *@param output is the response object, to be filled in by this method.
   *@param command is the command, which is taken directly from the API request.
-  *@param input is the optional and arbitrarily complex request object, which should contain whatever information the connector needs to perform the
-  *  command.
-  *@return the response, which can once again be an arbitrarily complex hierarchy.
+  *@param input is the request object.
   */
-  public ConfigurationNode executeCommand(String command, ConfigurationNode input)
-    throws LCFException, ServiceInterruption;
+  public void executeCommand(Configuration output, String command, Configuration input)
+    throws LCFException;
 
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents
   * are seeded when this method calls appropriate methods in the passed in ISeedingActivity object.

Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/LCF.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/LCF.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/LCF.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/LCF.java Mon Jul 19 06:15:50 2010
@@ -986,8 +986,6 @@ public class LCF extends org.apache.lcf.
   
   // API support
   
-  protected static final String API_ERRORNODE = "error";
-  protected static final String API_SERVICEINTERRUPTIONNODE = "service_interruption";
   protected static final String API_JOBNODE = "job";
   protected static final String API_JOBSTATUSNODE = "jobstatus";
   protected static final String API_REPOSITORYCONNECTORNODE = "repositoryconnector";
@@ -999,7 +997,6 @@ public class LCF extends org.apache.lcf.
   protected static final String API_CHECKRESULTNODE = "check_result";
   protected static final String API_JOBIDNODE = "job_id";
   protected static final String API_CONNECTIONNAMENODE = "connection_name";
-  protected static final String API_ARGUMENTNODE = "argument";
   
   // Connector nodes
   protected static final String CONNECTORNODE_DESCRIPTION = "description";
@@ -1032,12 +1029,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("job/get"))
@@ -1064,12 +1056,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("job/save"))
@@ -1108,12 +1095,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("job/delete"))
@@ -1133,12 +1115,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/list"))
@@ -1157,12 +1134,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/get"))
@@ -1188,12 +1160,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/start"))
@@ -1213,12 +1180,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/abort"))
@@ -1238,12 +1200,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
 
     }
@@ -1264,12 +1221,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/pause"))
@@ -1289,12 +1241,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("jobstatus/resume"))
@@ -1314,12 +1261,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnector/list"))
@@ -1352,12 +1294,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("authorityconnector/list"))
@@ -1390,12 +1327,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("repositoryconnector/list"))
@@ -1428,12 +1360,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnection/list"))
@@ -1452,12 +1379,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnection/get"))
@@ -1484,12 +1406,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnection/save"))
@@ -1519,12 +1436,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnection/delete"))
@@ -1544,12 +1456,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("outputconnection/checkstatus"))
@@ -1591,12 +1498,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.startsWith("outputconnection/execute/"))
@@ -1611,7 +1513,7 @@ public class LCF extends org.apache.lcf.
       if (connectionName == null)
         throw new LCFException("Input argument must have '"+API_CONNECTIONNAMENODE+"' field");
 
-      ConfigurationNode argumentNode = findConfigurationNode(inputArgument,API_ARGUMENTNODE);
+      LCFException usageException = null;
       try
       {
         IOutputConnectionManager connectionManager = OutputConnectionManagerFactory.make(tc);
@@ -1623,30 +1525,23 @@ public class LCF extends org.apache.lcf.
         IOutputConnector connector = OutputConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
         try
         {
-          ConfigurationNode responseNode = connector.executeCommand(subcommand,argumentNode);
-          rval.addChild(rval.getChildCount(),responseNode);
+          connector.executeCommand(rval,subcommand,inputArgument);
+        }
+        catch (LCFException e)
+        {
+          usageException = e;
         }
         finally
         {
           OutputConnectorFactory.release(connector);
         }
       }
-      catch (ServiceInterruption e)
-      {
-        Logging.api.warn(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_SERVICEINTERRUPTIONNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
-      }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
+      if (usageException != null)
+        throw usageException;
     }
     else if (command.equals("repositoryconnection/list"))
     {
@@ -1664,12 +1559,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("repositoryconnection/get"))
@@ -1696,12 +1586,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("repositoryconnection/save"))
@@ -1731,12 +1616,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("repositoryconnection/delete"))
@@ -1756,12 +1636,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("repositoryconnection/checkstatus"))
@@ -1803,12 +1678,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.startsWith("repositoryconnection/execute/"))
@@ -1823,7 +1693,7 @@ public class LCF extends org.apache.lcf.
       if (connectionName == null)
         throw new LCFException("Input argument must have '"+API_CONNECTIONNAMENODE+"' field");
 
-      ConfigurationNode argumentNode = findConfigurationNode(inputArgument,API_ARGUMENTNODE);
+      LCFException usageException = null;
       try
       {
         IRepositoryConnectionManager connectionManager = RepositoryConnectionManagerFactory.make(tc);
@@ -1835,30 +1705,23 @@ public class LCF extends org.apache.lcf.
         IRepositoryConnector connector = RepositoryConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
         try
         {
-          ConfigurationNode responseNode = connector.executeCommand(subcommand,argumentNode);
-          rval.addChild(rval.getChildCount(),responseNode);
+          connector.executeCommand(rval,subcommand,inputArgument);
+        }
+        catch (LCFException e)
+        {
+          usageException = e;
         }
         finally
         {
           RepositoryConnectorFactory.release(connector);
         }
       }
-      catch (ServiceInterruption e)
-      {
-        Logging.api.warn(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_SERVICEINTERRUPTIONNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
-      }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
+      if (usageException != null)
+        throw usageException;
     }
     else if (command.equals("authorityconnection/list"))
     {
@@ -1876,12 +1739,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("authorityconnection/get"))
@@ -1908,12 +1766,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("authorityconnection/save"))
@@ -1943,12 +1796,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("authorityconnection/delete"))
@@ -1968,12 +1816,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("authorityconnection/checkstatus"))
@@ -2015,12 +1858,7 @@ public class LCF extends org.apache.lcf.
       }
       catch (LCFException e)
       {
-        if (e.getErrorCode() == LCFException.INTERRUPTED)
-          throw e;
-        Logging.api.error(e.getMessage(),e);
-        ConfigurationNode error = new ConfigurationNode(API_ERRORNODE);
-        error.setValue(e.getMessage());
-        rval.addChild(rval.getChildCount(),error);
+        createErrorNode(rval,e);
       }
     }
     else if (command.equals("report/documentstatus"))
@@ -3083,27 +2921,6 @@ public class LCF extends org.apache.lcf.
 
   // End of connection API code
   
-  protected static ConfigurationNode findConfigurationNode(Configuration input, String argumentName)
-  {
-    // Look for argument among the children
-    int i = 0;
-    while (i < input.getChildCount())
-    {
-      ConfigurationNode cn = input.findChild(i++);
-      if (cn.getType().equals(argumentName))
-        return cn;
-    }
-    return null;
-
-  }
-  
-  protected static String getRootArgument(Configuration input, String argumentName)
-  {
-    ConfigurationNode node = findConfigurationNode(input,argumentName);
-    if (node == null)
-      return null;
-    return node.getValue();
-  }
   
 }
 

Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/Logging.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/Logging.java?rev=965362&r1=965361&r2=965362&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/Logging.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/system/Logging.java Mon Jul 19 06:15:50 2010
@@ -37,7 +37,6 @@ public class Logging extends org.apache.
   public static Logger connectors = null;
   public static Logger hopcount = null;
   public static Logger scheduling = null;
-  public static Logger api = null;
 
   /** Initialize logger setup.
   */
@@ -54,7 +53,6 @@ public class Logging extends org.apache.
     connectors = newLogger("org.apache.lcf.connectors");
     hopcount = newLogger("org.apache.lcf.hopcount");
     scheduling = newLogger("org.apache.lcf.scheduling");
-    api = newLogger("org.apache.lcf.api");
   }