manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r996524 [1/2] - in /incubator/lcf/trunk/modules: connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/ connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/ connectors/jcifs/co...
Date Mon, 13 Sep 2010 13:38:02 GMT
Author: kwright
Date: Mon Sep 13 13:38:01 2010
New Revision: 996524

URL: http://svn.apache.org/viewvc?rev=996524&view=rev
Log:
Rewrite API to be more RESTful.  Part of CONNECTORS-98.  The wiki API document will obviously also need to be updated accordingly.

Modified:
    incubator/lcf/trunk/modules/connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/DCTM.java
    incubator/lcf/trunk/modules/connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/FilenetConnector.java
    incubator/lcf/trunk/modules/connectors/jcifs/connector/src/main/java/org/apache/acf/crawler/connectors/sharedrive/SharedDriveConnector.java
    incubator/lcf/trunk/modules/connectors/livelink/connector/src/main/java/org/apache/acf/crawler/connectors/livelink/LivelinkConnector.java
    incubator/lcf/trunk/modules/connectors/memex/connector/src/main/java/org/apache/acf/crawler/connectors/memex/MemexConnector.java
    incubator/lcf/trunk/modules/connectors/meridio/connector/src/main/java/org/apache/acf/crawler/connectors/meridio/MeridioConnector.java
    incubator/lcf/trunk/modules/connectors/sharepoint/connector/src/main/java/org/apache/acf/crawler/connectors/sharepoint/SharePointRepository.java
    incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnectionManager.java
    incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnector.java
    incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/output/BaseOutputConnector.java
    incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/outputconnection/OutputConnectionManager.java
    incubator/lcf/trunk/modules/framework/api-servlet/src/main/java/org/apache/acf/api/APIServlet.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/authority/AuthorityConnectionManager.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/interfaces/IAuthorityConnectionManager.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/connectors/BaseRepositoryConnector.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnectionManager.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnector.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/repository/RepositoryConnectionManager.java
    incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/system/ACF.java
    incubator/lcf/trunk/modules/tests/filesystem/org/apache/acf/filesystem_tests/APISanity.java
    incubator/lcf/trunk/modules/tests/filesystem/org/apache/acf/filesystem_tests/TestBase.java

Modified: incubator/lcf/trunk/modules/connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/DCTM.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/DCTM.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/DCTM.java (original)
+++ incubator/lcf/trunk/modules/connectors/documentum/connector/src/main/java/org/apache/acf/crawler/connectors/DCTM/DCTM.java Mon Sep 13 13:38:01 2010
@@ -844,18 +844,17 @@ public class DCTM extends org.apache.acf
 
   }
 
-  /** 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("contenttype/list"))
+    if (command.equals("contenttypes"))
     {
       try
       {
@@ -878,7 +877,7 @@ public class DCTM extends org.apache.acf
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("objecttype/list"))
+    else if (command.equals("objecttypes"))
     {
       try
       {
@@ -901,9 +900,10 @@ public class DCTM extends org.apache.acf
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("folder/list"))
+    else if (command.startsWith("folders/"))
     {
-      String parentFolder = ACF.getRootArgument(input,"parent_folder");
+      // I hope folder names in Documentum cannot have "/" characters in them.
+      String parentFolder = command.substring("folders/".length());
       try
       {
         String[] folders = getChildFolderNames(parentFolder);
@@ -925,11 +925,10 @@ public class DCTM extends org.apache.acf
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("indexableattributes/list"))
+    else if (command.startsWith("indexableattributes/"))
     {
-      String objectType = ACF.getRootArgument(input,"object_type");
-      if (objectType == null)
-        throw new ACFException("Missing required field 'object_type'");
+      // I hope object types can't have "/" characters
+      String objectType = command.substring("indexableattributes/".length());
       try
       {
         String[] indexableAttributes = getIngestableAttributes(objectType);
@@ -952,7 +951,8 @@ public class DCTM extends org.apache.acf
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/FilenetConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/FilenetConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/FilenetConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/filenet/connector/src/main/java/org/apache/acf/crawler/connectors/filenet/FilenetConnector.java Mon Sep 13 13:38:01 2010
@@ -532,22 +532,19 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("documentclass/metadatafields"))
+    if (command.startsWith("metadatafields/"))
     {
-      String documentClass = ACF.getRootArgument(input,"document_class");
-      if (documentClass == null)
-        throw new ACFException("Missing required field 'document_class'");
+      String documentClass = command.substring("metadatafields/".length());
       try
       {
         MetadataFieldDefinition[] metaFields = getDocumentClassMetadataFieldsDetails(documentClass);
@@ -575,7 +572,7 @@ public class FilenetConnector extends or
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("documentclass/list"))
+    else if (command.equals("documentclasses"))
     {
       try
       {
@@ -604,7 +601,7 @@ public class FilenetConnector extends or
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("mimetype/list"))
+    else if (command.equals("mimetypes"))
     {
       try
       {
@@ -628,7 +625,8 @@ public class FilenetConnector extends or
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/connectors/jcifs/connector/src/main/java/org/apache/acf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/jcifs/connector/src/main/java/org/apache/acf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/jcifs/connector/src/main/java/org/apache/acf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/jcifs/connector/src/main/java/org/apache/acf/crawler/connectors/sharedrive/SharedDriveConnector.java Mon Sep 13 13:38:01 2010
@@ -370,23 +370,19 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("folder/list"))
+    if (command.startsWith("folders/"))
     {
-      String parentFolder = ACF.getRootArgument(input,"parent_folder");
-      if (parentFolder == null)
-        throw new ACFException("Missing required field 'parent_folder'");
-      
+      String parentFolder = command.substring("folders/".length());
       try
       {
         String[] folders = getChildFolderNames(parentFolder);
@@ -404,12 +400,9 @@ public class SharedDriveConnector extend
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("folder/validate"))
+    else if (command.startsWith("folder/"))
     {
-      String folder = ACF.getRootArgument(input,"folder");
-      if (folder == null)
-        throw new ACFException("Missing required field 'folder'");
-      
+      String folder = command.substring("folder/".length());
       try
       {
         String canonicalFolder = validateFolderName(folder);
@@ -426,7 +419,8 @@ public class SharedDriveConnector extend
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   

Modified: incubator/lcf/trunk/modules/connectors/livelink/connector/src/main/java/org/apache/acf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/livelink/connector/src/main/java/org/apache/acf/crawler/connectors/livelink/LivelinkConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/livelink/connector/src/main/java/org/apache/acf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/livelink/connector/src/main/java/org/apache/acf/crawler/connectors/livelink/LivelinkConnector.java Mon Sep 13 13:38:01 2010
@@ -707,18 +707,17 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("workspace/list"))
+    if (command.equals("workspaces"))
     {
       try
       {
@@ -741,11 +740,9 @@ public class LivelinkConnector extends o
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("folder/list"))
+    else if (command.startsWith("folders/"))
     {
-      String path = ACF.getRootArgument(input,"path");
-      if (path == null)
-        throw new ACFException("Missing required argument 'path'");
+      String path = command.substring("folders/".length());
       
       try
       {
@@ -768,11 +765,9 @@ public class LivelinkConnector extends o
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("category/list"))
+    else if (command.startsWith("categories/"))
     {
-      String path = ACF.getRootArgument(input,"path");
-      if (path == null)
-        throw new ACFException("Missing required argument 'path'");
+      String path = command.substring("categories/".length());
 
       try
       {
@@ -796,11 +791,9 @@ public class LivelinkConnector extends o
       }
 
     }
-    else if (command.equals("categoryattributes/list"))
+    else if (command.startsWith("categoryattributes/"))
     {
-      String path = ACF.getRootArgument(input,"path");
-      if (path == null)
-        throw new ACFException("Missing required argument 'path'");
+      String path = command.substring("categoryattributes/".length());
 
       try
       {
@@ -824,7 +817,8 @@ public class LivelinkConnector extends o
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/connectors/memex/connector/src/main/java/org/apache/acf/crawler/connectors/memex/MemexConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/memex/connector/src/main/java/org/apache/acf/crawler/connectors/memex/MemexConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/memex/connector/src/main/java/org/apache/acf/crawler/connectors/memex/MemexConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/memex/connector/src/main/java/org/apache/acf/crawler/connectors/memex/MemexConnector.java Mon Sep 13 13:38:01 2010
@@ -297,22 +297,19 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("database/list"))
+    if (command.startsWith("databases/"))
     {
-      String virtualServer = ACF.getRootArgument(input,"virtual_server");
-      if (virtualServer == null)
-        throw new ACFException("Missing required argument 'virtual_server'");
+      String virtualServer = command.substring("databases/".length());
       
       try
       {
@@ -341,7 +338,7 @@ public class MemexConnector extends org.
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("virtualserver/list"))
+    else if (command.equals("virtualservers"))
     {
       try
       {
@@ -364,7 +361,7 @@ public class MemexConnector extends org.
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("entitytype/list"))
+    else if (command.equals("entitytypes"))
     {
       try
       {
@@ -393,11 +390,9 @@ public class MemexConnector extends org.
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("field/list"))
+    else if (command.startsWith("fields/"))
     {
-      String entityPrefix = ACF.getRootArgument(input,"entity_type_name");
-      if (entityPrefix == null)
-        throw new ACFException("Missing required argument 'entity_type_name'");
+      String entityPrefix = command.substring("fields/".length());
       try
       {
         String[] fieldNames = listFieldNames(entityPrefix);
@@ -419,11 +414,9 @@ public class MemexConnector extends org.
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("field/listmatchable"))
+    else if (command.equals("matchablefields/"))
     {
-      String entityPrefix = ACF.getRootArgument(input,"entity_type_name");
-      if (entityPrefix == null)
-        throw new ACFException("Missing required argument 'entity_type_name'");
+      String entityPrefix = command.substring("matchablefields/".length());
       try
       {
         String[] fieldNames = listMatchableFieldNames(entityPrefix);
@@ -446,7 +439,8 @@ public class MemexConnector extends org.
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/connectors/meridio/connector/src/main/java/org/apache/acf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/meridio/connector/src/main/java/org/apache/acf/crawler/connectors/meridio/MeridioConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/meridio/connector/src/main/java/org/apache/acf/crawler/connectors/meridio/MeridioConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/meridio/connector/src/main/java/org/apache/acf/crawler/connectors/meridio/MeridioConnector.java Mon Sep 13 13:38:01 2010
@@ -465,18 +465,17 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("category/list"))
+    if (command.equals("categories"))
     {
       try
       {
@@ -499,7 +498,7 @@ public class MeridioConnector extends or
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("documentproperties/list"))
+    else if (command.equals("documentproperties"))
     {
       try
       {
@@ -522,11 +521,9 @@ public class MeridioConnector extends or
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("classorfolder/list"))
+    else if (command.startsWith("classorfolder/"))
     {
-      String classOrFolderIdString = ACF.getRootArgument(input,"class_or_folder_id");
-      if (classOrFolderIdString == null)
-        throw new ACFException("Missing required argument 'class_or_folder_id'");
+      String classOrFolderIdString = command.substring("classorfolder/".length());
       int classOrFolderId;
       try
       {
@@ -534,7 +531,8 @@ public class MeridioConnector extends or
       }
       catch (NumberFormatException e)
       {
-        throw new ACFException("Argument 'class_or_folder_id' must be an integer: "+e.getMessage(),e);
+        ACF.createErrorNode(output,new ACFException(e.getMessage(),e));
+	return false;
       }
       try
       {
@@ -574,7 +572,8 @@ public class MeridioConnector extends or
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
 
   /** Given a document specification, get either a list of starting document identifiers (seeds),

Modified: incubator/lcf/trunk/modules/connectors/sharepoint/connector/src/main/java/org/apache/acf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/sharepoint/connector/src/main/java/org/apache/acf/crawler/connectors/sharepoint/SharePointRepository.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/sharepoint/connector/src/main/java/org/apache/acf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ incubator/lcf/trunk/modules/connectors/sharepoint/connector/src/main/java/org/apache/acf/crawler/connectors/sharepoint/SharePointRepository.java Mon Sep 13 13:38:01 2010
@@ -321,28 +321,37 @@ 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    if (command.equals("field/list"))
+    if (command.startsWith("fields/"))
     {
-      String sitePath = ACF.getRootArgument(input,"site_path");
-      if (sitePath == null)
-        throw new ACFException("Missing required argument 'site_path'");
-      String library = ACF.getRootArgument(input,"library");
-      if (library == null)
-        throw new ACFException("Missing required argument 'library'");
+      String library;
+      String sitePath;
+      
+      String remainder = command.substring("fields/".length());
       
       try
       {
+        int index = remainder.indexOf("/");
+        if (index == -1)
+        {
+          library = remainder;
+          sitePath = "";
+        }
+        else
+        {
+          library = remainder.substring(0,index);
+          sitePath = remainder.substring(index+1);
+        }
+        
         Map fieldSet = getFieldList(sitePath,library);
         Iterator iter = fieldSet.keySet().iterator();
         while (iter.hasNext())
@@ -369,14 +378,11 @@ public class SharePointRepository extend
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("site/list"))
+    else if (command.startsWith("sites/"))
     {
-      String sitePath = ACF.getRootArgument(input,"site_path");
-      if (sitePath == null)
-        throw new ACFException("Missing required argument 'site_path'");
-
       try
       {
+        String sitePath = command.substring("sites/".length());
         ArrayList sites = getSites(sitePath);
         int i = 0;
         while (i < sites.size())
@@ -396,14 +402,11 @@ public class SharePointRepository extend
         ACF.createErrorNode(output,e);
       }
     }
-    else if (command.equals("library/list"))
+    else if (command.startsWith("libraries/"))
     {
-      String sitePath = ACF.getRootArgument(input,"site_path");
-      if (sitePath == null)
-        throw new ACFException("Missing required argument 'site_path'");
-
       try
       {
+        String sitePath = command.substring("libraries/".length());
         ArrayList libs = getDocLibsBySite(sitePath);
         int i = 0;
         while (i < libs.size())
@@ -424,7 +427,8 @@ public class SharePointRepository extend
       }
     }
     else
-      super.executeCommand(output,command,input);
+      return super.requestInfo(output,command);
+    return true;
   }
   
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -73,8 +73,9 @@ public interface IOutputConnectionManage
 
   /** Save an output connection object.
   *@param object is the object to save.
+  *@return true if the object was created, false otherwise.
   */
-  public void save(IOutputConnection object)
+  public boolean save(IOutputConnection object)
     throws ACFException;
 
   /** Delete an output connection.

Modified: incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/interfaces/IOutputConnector.java Mon Sep 13 13:38:01 2010
@@ -63,15 +63,14 @@ public interface IOutputConnector extend
   */
   public String[] getActivitiesList();
 
-  /** 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException;
     
   /** Detect if a mime type is indexable or not.  This method is used by participating repository connectors to pre-filter the number of

Modified: incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/output/BaseOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/output/BaseOutputConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/output/BaseOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/output/BaseOutputConnector.java Mon Sep 13 13:38:01 2010
@@ -54,19 +54,17 @@ public abstract class BaseOutputConnecto
     return new String[0];
   }
 
-  /** 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    // The base connector treats all requests as invalid commands, and throws an exception accordingly.
-    throw new ACFException("Unrecognized output connector command '"+command+"'");
+    return false;
   }
 
   /** Notify the connector of a completed job.

Modified: incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/outputconnection/OutputConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/outputconnection/OutputConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/outputconnection/OutputConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/src/main/java/org/apache/acf/agents/outputconnection/OutputConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -233,8 +233,9 @@ public class OutputConnectionManager ext
 
   /** Save an output connection object.
   *@param object is the object to save.
+  *@return true if the object is being created, false otherwise.
   */
-  public void save(IOutputConnection object)
+  public boolean save(IOutputConnection object)
     throws ACFException
   {
     StringSetBuffer ssb = new StringSetBuffer();
@@ -262,9 +263,11 @@ public class OutputConnectionManager ext
         String configXML = object.getConfigParams().toXML();
         values.put(configField,configXML);
         boolean notificationNeeded = false;
-
+        boolean isCreated;
+        
         if (set.getRowCount() > 0)
         {
+          isCreated = false;
           IResultRow row = set.getRow(0);
           String oldXML = (String)row.getValue(configField);
           if (oldXML == null || !oldXML.equals(configXML))
@@ -277,6 +280,7 @@ public class OutputConnectionManager ext
         }
         else
         {
+          isCreated = true;
           // Insert
           values.put(nameField,object.getName());
           // We only need the general key because this is new.
@@ -288,6 +292,7 @@ public class OutputConnectionManager ext
           AgentManagerFactory.noteOutputConnectionChange(threadContext,object.getName());
 
         cacheManager.invalidateKeys(ch);
+        return isCreated;
       }
       catch (ACFException e)
       {

Modified: incubator/lcf/trunk/modules/framework/api-servlet/src/main/java/org/apache/acf/api/APIServlet.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/api-servlet/src/main/java/org/apache/acf/api/APIServlet.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/api-servlet/src/main/java/org/apache/acf/api/APIServlet.java (original)
+++ incubator/lcf/trunk/modules/framework/api-servlet/src/main/java/org/apache/acf/api/APIServlet.java Mon Sep 13 13:38:01 2010
@@ -90,93 +90,132 @@ public class APIServlet extends HttpServ
       // Get the path info string.  This will furnish the command.
       String pathInfo = request.getPathInfo();
       
-      // The first field of the pathInfo string is the protocol.  Someday this will be a dispatcher using reflection.  Right now, we only support json, so a quick check is fine.
       if (pathInfo == null)
       {
-        response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol");
+        response.sendError(response.SC_BAD_REQUEST,"No path info found");
         return;
       }
+
+      // Perform the deletion
+      executeRead(tc,response,pathInfo);
+      
+    }
+    catch (ACFException e)
+    {
+      // We should only see this error if there's an API problem, not if there's an actual problem with the method being called.
+      response.sendError(response.SC_BAD_REQUEST,e.getMessage());
+    }
+  }
+
+  /** The PUT method.
+  */
+  protected void doPut(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+  {
+    try
+    {
+      // Set up the environment
+      ACF.initializeEnvironment();
+
+      // Mint a thread context
+      IThreadContext tc = ThreadContextFactory.make();
+      
+      // Get the path info string.  This will furnish the command.
+      String pathInfo = request.getPathInfo();
       
-      // Strip off leading "/"
-      if (pathInfo.startsWith("/"))
-        pathInfo = pathInfo.substring(1);
-      
-      int index = pathInfo.indexOf("/");
-      String protocol;
-      String command;
-      if (index == -1)
+      if (pathInfo == null)
       {
-        protocol = pathInfo;
-        command = "";
+        response.sendError(response.SC_BAD_REQUEST,"No path info found");
+        return;
       }
-      else
+
+      // Get the content being 'put'
+      InputStream content = request.getInputStream();
+      try
       {
-        protocol = pathInfo.substring(0,index);
-        command = pathInfo.substring(index+1);
+	// Do the put.
+	executeWrite(tc,response,pathInfo,content);
       }
-        
-      // Handle multipart forms
-      IPostParameters parameters = new org.apache.acf.ui.multipart.MultipartWrapper(request);
-        
-      // Input
-      String argument = parameters.getParameter("object");
-      // Output
-      String outputText = null;
-
-      if (protocol.equals("json"))
-      {
-        // Parse the input argument, if it is present
-        Configuration input;
-        if (argument != null)
-        {
-          input = new Configuration();
-          input.fromJSON(argument);
-        }
-        else
-          input = null;
-          
-        Configuration output = ACF.executeCommand(tc,command,input);
-          
-        // Format the response
-        try
-        {
-          outputText = output.toJSON();
-        }
-        catch (ACFException e)
-        {
-          // Log it
-          Logging.api.error("Error forming JSON response: "+e.getMessage(),e);
-          // Internal server error
-          response.sendError(response.SC_INTERNAL_SERVER_ERROR);
-          return;
-        }
+      finally
+      {
+	content.close();
       }
-      else
+    }
+    catch (ACFException e)
+    {
+      // We should only see this error if there's an API problem, not if there's an actual problem with the method being called.
+      response.sendError(response.SC_BAD_REQUEST,e.getMessage());
+    }
+  }
+
+ 
+  /** The POST method.
+  */
+  protected void doPost(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+  {
+    try
+    {
+      // Set up the environment
+      ACF.initializeEnvironment();
+
+      // Mint a thread context
+      IThreadContext tc = ThreadContextFactory.make();
+      
+      // Get the path info string.  This will furnish the command.
+      String pathInfo = request.getPathInfo();
+      
+      if (pathInfo == null)
       {
-        response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+        response.sendError(response.SC_BAD_REQUEST,"No path info found");
         return;
       }
-        
-      byte[] responseValue = outputText.getBytes("utf-8");
 
-      // Set response mime type
-      response.setContentType("text/plain; charset=utf-8");
-      response.setIntHeader("Content-Length", (int)responseValue.length);
-      ServletOutputStream out = response.getOutputStream();
+      // Get the content being posted
+      InputStream content = request.getInputStream();
       try
       {
-        out.write(responseValue,0,responseValue.length);
-        out.flush();
+	// Do the put.
+	executePost(tc,response,pathInfo,content);
       }
       finally
       {
-        out.close();
+	content.close();
       }
+      
     }
-    catch (java.io.UnsupportedEncodingException e)
+    catch (ACFException e)
     {
-      //Logging.authorityService.error("Unsupported encoding: "+e.getMessage(),e);
-      throw new ServletException("Fatal error occurred: "+e.getMessage(),e);
+      // We should only see this error if there's an API problem, not if there's an actual problem with the method being called.
+      response.sendError(response.SC_BAD_REQUEST,e.getMessage());
+    }
+  }
+
+  /** The DELETE method.
+  */
+  protected void doDelete(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException
+  {
+    try
+    {
+      // Set up the environment
+      ACF.initializeEnvironment();
+
+      // Mint a thread context
+      IThreadContext tc = ThreadContextFactory.make();
+      
+      // Get the path info string.  This will furnish the command.
+      String pathInfo = request.getPathInfo();
+      
+      if (pathInfo == null)
+      {
+        response.sendError(response.SC_BAD_REQUEST,"No path info found");
+        return;
+      }
+
+      // Perform the deletion
+      executeDelete(tc,response,pathInfo);
+      
     }
     catch (ACFException e)
     {
@@ -185,4 +224,385 @@ public class APIServlet extends HttpServ
     }
   }
 
+  // Protected methods
+  
+  /** Perform a general "read" operation.
+  */
+  protected static void executeRead(IThreadContext tc, HttpServletResponse response, String pathInfo)
+    throws ACFException, IOException
+  {
+    // Strip off leading "/"
+    if (pathInfo.startsWith("/"))
+      pathInfo = pathInfo.substring(1);
+      
+    int index = pathInfo.indexOf("/");
+    String protocol;
+    String command;
+    if (index == -1)
+    {
+      protocol = pathInfo;
+      command = "";
+    }
+    else
+    {
+      protocol = pathInfo.substring(0,index);
+      command = pathInfo.substring(index+1);
+    }
+
+    // Execute the request.
+    // Since there are no input arguments, we can do this before we look at the protocol.
+    
+    // There the only response distinction we have here is between exception and no exception.
+    Configuration output = new Configuration();
+    boolean exists = ACF.executeReadCommand(tc,output,command);
+    
+    // Output
+    
+    String outputText = null;
+
+    if (protocol.equals("json"))
+    {
+      // Format the response
+      try
+      {
+	outputText = output.toJSON();
+      }
+      catch (ACFException e)
+      {
+	// Log it
+	Logging.api.error("Error forming JSON response: "+e.getMessage(),e);
+	// Internal server error
+	response.sendError(response.SC_INTERNAL_SERVER_ERROR);
+	return;
+      }
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+    
+    if (!exists)
+      response.setStatus(response.SC_NOT_FOUND);
+        
+    byte[] responseValue = outputText.getBytes("utf-8");
+
+    // Set response mime type
+    response.setContentType("text/plain; charset=utf-8");
+    response.setIntHeader("Content-Length", (int)responseValue.length);
+    ServletOutputStream out = response.getOutputStream();
+    try
+    {
+      out.write(responseValue,0,responseValue.length);
+      out.flush();
+    }
+    finally
+    {
+      out.close();
+    }
+
+  }
+  
+  /** Perform a general "write" operation.
+  */
+  protected static void executeWrite(IThreadContext tc, HttpServletResponse response, String pathInfo, InputStream data)
+    throws ACFException, IOException
+  {
+    // Strip off leading "/"
+    if (pathInfo.startsWith("/"))
+      pathInfo = pathInfo.substring(1);
+      
+    int index = pathInfo.indexOf("/");
+    String protocol;
+    String command;
+    if (index == -1)
+    {
+      protocol = pathInfo;
+      command = "";
+    }
+    else
+    {
+      protocol = pathInfo.substring(0,index);
+      command = pathInfo.substring(index+1);
+    }
+
+    // We presume the data is utf-8
+    StringBuffer sb = new StringBuffer();
+    char[] buffer = new char[65536];
+    Reader r = new InputStreamReader(data,"utf-8");
+    while (true)
+    {
+      int amt = r.read(buffer);
+      if (amt == -1)
+	break;
+      sb.append(buffer,0,amt);
+    }
+    String argument = sb.toString();
+    
+    // Parse the input
+    Configuration input;
+    
+    if (protocol.equals("json"))
+    {
+      if (argument.length() != 0)
+      {
+	input = new Configuration();
+	input.fromJSON(argument);
+      }
+      else
+	input = null;
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+    
+    // Execute the request.
+    
+    // We need the following distinctions:
+    // Exception vs. no exception
+    // OK vs CREATE (both with json response packets)
+    Configuration output = new Configuration();
+    int writeResult = ACF.executeWriteCommand(tc,output,command,input);
+    
+    // Output
+    
+    
+    String outputText = null;
+
+    if (protocol.equals("json"))
+    {
+      // Format the response
+      try
+      {
+	outputText = output.toJSON();
+      }
+      catch (ACFException e)
+      {
+	// Log it
+	Logging.api.error("Error forming JSON response: "+e.getMessage(),e);
+	// Internal server error
+	response.sendError(response.SC_INTERNAL_SERVER_ERROR);
+	return;
+      }
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+
+    // This should return either 200 or SC_CREATED
+    if (writeResult == ACF.WRITERESULT_CREATED)
+      response.setStatus(response.SC_CREATED);
+    else if (writeResult == ACF.WRITERESULT_NOTFOUND)
+      response.setStatus(response.SC_NOT_FOUND);
+    
+    byte[] responseValue = outputText.getBytes("utf-8");
+
+    // Set response mime type
+    response.setContentType("text/plain; charset=utf-8");
+    response.setIntHeader("Content-Length", (int)responseValue.length);
+    ServletOutputStream out = response.getOutputStream();
+    try
+    {
+      out.write(responseValue,0,responseValue.length);
+      out.flush();
+    }
+    finally
+    {
+      out.close();
+    }
+
+  }
+
+  /** Perform a general "post" operation.
+  */
+  protected static void executePost(IThreadContext tc, HttpServletResponse response, String pathInfo, InputStream data)
+    throws ACFException, IOException
+  {
+    // Strip off leading "/"
+    if (pathInfo.startsWith("/"))
+      pathInfo = pathInfo.substring(1);
+      
+    int index = pathInfo.indexOf("/");
+    String protocol;
+    String command;
+    if (index == -1)
+    {
+      protocol = pathInfo;
+      command = "";
+    }
+    else
+    {
+      protocol = pathInfo.substring(0,index);
+      command = pathInfo.substring(index+1);
+    }
+
+    // We presume the data is utf-8
+    StringBuffer sb = new StringBuffer();
+    char[] buffer = new char[65536];
+    Reader r = new InputStreamReader(data,"utf-8");
+    while (true)
+    {
+      int amt = r.read(buffer);
+      if (amt == -1)
+	break;
+      sb.append(buffer,0,amt);
+    }
+    String argument = sb.toString();
+    
+    // Parse the input
+    Configuration input;
+    
+    if (protocol.equals("json"))
+    {
+      if (argument.length() != 0)
+      {
+	input = new Configuration();
+	input.fromJSON(argument);
+      }
+      else
+	input = null;
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+    
+    // Execute the request.
+    
+    Configuration output = new Configuration();
+    int writeResult = ACF.executePostCommand(tc,output,command,input);
+    
+    // Output
+    
+    
+    String outputText = null;
+
+    if (protocol.equals("json"))
+    {
+      // Format the response
+      try
+      {
+	outputText = output.toJSON();
+      }
+      catch (ACFException e)
+      {
+	// Log it
+	Logging.api.error("Error forming JSON response: "+e.getMessage(),e);
+	// Internal server error
+	response.sendError(response.SC_INTERNAL_SERVER_ERROR);
+	return;
+      }
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+
+    // This should return either 200 or SC_CREATED
+    if (writeResult == ACF.WRITERESULT_CREATED)
+      response.setStatus(response.SC_CREATED);
+    else if (writeResult == ACF.WRITERESULT_NOTFOUND)
+      response.setStatus(response.SC_NOT_FOUND);
+    
+    byte[] responseValue = outputText.getBytes("utf-8");
+
+    // Set response mime type
+    response.setContentType("text/plain; charset=utf-8");
+    response.setIntHeader("Content-Length", (int)responseValue.length);
+    ServletOutputStream out = response.getOutputStream();
+    try
+    {
+      out.write(responseValue,0,responseValue.length);
+      out.flush();
+    }
+    finally
+    {
+      out.close();
+    }
+
+  }
+  
+  /** Perform a general "delete" operation.
+  */
+  protected static void executeDelete(IThreadContext tc, HttpServletResponse response, String pathInfo)
+    throws ACFException, IOException
+  {
+    // Strip off leading "/"
+    if (pathInfo.startsWith("/"))
+      pathInfo = pathInfo.substring(1);
+      
+    int index = pathInfo.indexOf("/");
+    String protocol;
+    String command;
+    if (index == -1)
+    {
+      protocol = pathInfo;
+      command = "";
+    }
+    else
+    {
+      protocol = pathInfo.substring(0,index);
+      command = pathInfo.substring(index+1);
+    }
+
+    // Execute the request.
+    // Since there are no input arguments, we can do this before we look at the protocol.
+    
+    // There the only response distinction we have here is between exception and no exception.
+    Configuration output = new Configuration();
+    boolean exists = ACF.executeDeleteCommand(tc,output,command);
+    
+    // Output
+    String outputText = null;
+
+    if (protocol.equals("json"))
+    {
+      // Format the response
+      try
+      {
+	outputText = output.toJSON();
+      }
+      catch (ACFException e)
+      {
+	// Log it
+	Logging.api.error("Error forming JSON response: "+e.getMessage(),e);
+	// Internal server error
+	response.sendError(response.SC_INTERNAL_SERVER_ERROR);
+	return;
+      }
+    }
+    else
+    {
+      response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol);
+      return;
+    }
+    
+    if (!exists)
+      response.setStatus(response.SC_NOT_FOUND);
+    
+    byte[] responseValue = outputText.getBytes("utf-8");
+
+    // Set response mime type
+    response.setContentType("text/plain; charset=utf-8");
+    response.setIntHeader("Content-Length", (int)responseValue.length);
+    ServletOutputStream out = response.getOutputStream();
+    try
+    {
+      out.write(responseValue,0,responseValue.length);
+      out.flush();
+    }
+    finally
+    {
+      out.close();
+    }
+
+    // return code 200 assumed!
+  }
+  
 }

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/authority/AuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/authority/AuthorityConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/authority/AuthorityConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/authority/AuthorityConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -231,8 +231,9 @@ public class AuthorityConnectionManager 
 
   /** Save a repository connection object.
   *@param object is the object to save.
+  *@return true if the object is created, false otherwise.
   */
-  public void save(IAuthorityConnection object)
+  public boolean save(IAuthorityConnection object)
     throws ACFException
   {
     StringSetBuffer ssb = new StringSetBuffer();
@@ -258,8 +259,11 @@ public class AuthorityConnectionManager 
         values.put(maxCountField,new Long((long)object.getMaxConnections()));
         values.put(configField,object.getConfigParams().toXML());
 
+        boolean isCreated;
+        
         if (set.getRowCount() > 0)
         {
+          isCreated = false;
           // Update
           params.clear();
           params.add(object.getName());
@@ -267,6 +271,7 @@ public class AuthorityConnectionManager 
         }
         else
         {
+          isCreated = true;
           // Insert
           values.put(nameField,object.getName());
           // We only need the general key because this is new.
@@ -274,6 +279,7 @@ public class AuthorityConnectionManager 
         }
 
         cacheManager.invalidateKeys(ch);
+        return isCreated;
       }
       catch (ACFException e)
       {

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/interfaces/IAuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/interfaces/IAuthorityConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/interfaces/IAuthorityConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/authorities/interfaces/IAuthorityConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -66,8 +66,9 @@ public interface IAuthorityConnectionMan
 
   /** Save an authority connection object.
   *@param object is the object to save.
+  *@return true if the object was created, false otherwise.
   */
-  public void save(IAuthorityConnection object)
+  public boolean save(IAuthorityConnection object)
     throws ACFException;
 
   /** Delete an authority connection.

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/connectors/BaseRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/connectors/BaseRepositoryConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/connectors/BaseRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/connectors/BaseRepositoryConnector.java Mon Sep 13 13:38:01 2010
@@ -104,19 +104,17 @@ public abstract class BaseRepositoryConn
     return new String[]{""};
   }
 
-  /** 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException
   {
-    // By definition, the base connector has no commands.
-    throw new ACFException("Unrecognized repository connector command '"+command+"'");
+    return false;
   }
 
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -73,8 +73,9 @@ public interface IRepositoryConnectionMa
 
   /** Save a repository connection object.
   *@param object is the object to save.
+  *@return true if the object is created, false otherwise.
   */
-  public void save(IRepositoryConnection object)
+  public boolean save(IRepositoryConnection object)
     throws ACFException;
 
   /** Delete a repository connection.

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnector.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/interfaces/IRepositoryConnector.java Mon Sep 13 13:38:01 2010
@@ -121,15 +121,14 @@ public interface IRepositoryConnector ex
   */
   public String[] getBinNames(String documentIdentifier);
 
-  /** 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
+  /** Request arbitrary connector information.
+  * This method is called directly from the API in order to allow API users to perform any one of several connector-specific
   * 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.
+  *@return true if the resource is found, false if not.  In either case, output may be filled in.
   */
-  public void executeCommand(Configuration output, String command, Configuration input)
+  public boolean requestInfo(Configuration output, String command)
     throws ACFException;
 
   /** Queue "seed" documents.  Seed documents are the starting places for crawling activity.  Documents

Modified: incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/repository/RepositoryConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/repository/RepositoryConnectionManager.java?rev=996524&r1=996523&r2=996524&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/repository/RepositoryConnectionManager.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/src/main/java/org/apache/acf/crawler/repository/RepositoryConnectionManager.java Mon Sep 13 13:38:01 2010
@@ -291,8 +291,9 @@ public class RepositoryConnectionManager
 
   /** Save a repository connection object.
   *@param object is the object to save.
+  *@return true if the object was created, false otherwise.
   */
-  public void save(IRepositoryConnection object)
+  public boolean save(IRepositoryConnection object)
     throws ACFException
   {
     StringSetBuffer ssb = new StringSetBuffer();
@@ -321,9 +322,11 @@ public class RepositoryConnectionManager
         String configXML = object.getConfigParams().toXML();
         values.put(configField,configXML);
         boolean notificationNeeded = false;
+        boolean isCreated;
         
         if (set.getRowCount() > 0)
         {
+          isCreated = false;
           IResultRow row = set.getRow(0);
           String oldXML = (String)row.getValue(configField);
           if (oldXML == null || !oldXML.equals(configXML))
@@ -337,6 +340,7 @@ public class RepositoryConnectionManager
         }
         else
         {
+          isCreated = true;
           // Insert
           values.put(nameField,object.getName());
           // We only need the general key because this is new.
@@ -354,6 +358,7 @@ public class RepositoryConnectionManager
         }
 
         cacheManager.invalidateKeys(ch);
+        return isCreated;
       }
       catch (ACFException e)
       {



Mime
View raw message