Author: kwright
Date: Wed Apr  1 11:02:00 2015
New Revision: 1670614

URL: http://svn.apache.org/r1670614
Log:
Fix for CONNECTORS-1177, CONNECTORS-1178.

Added:
    
manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/APIProfile.java
      - copied unchanged from r1670613, 
manifoldcf/branches/CONNECTORS-1177/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/beans/APIProfile.java
Modified:
    manifoldcf/trunk/   (props changed)
    
manifoldcf/trunk/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
    manifoldcf/trunk/framework/api-service/src/main/webapp/WEB-INF/web.xml
    
manifoldcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
    
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    
manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
    
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
    
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
    
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
    manifoldcf/trunk/framework/script-example/file-crawl-example.mcf
    
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml
    
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml
    
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml
    
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml
    
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/how-to-build-and-deploy.xml
    
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/programmatic-operation.xml

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr  1 11:02:00 2015
@@ -50,6 +50,7 @@
 /manifoldcf/branches/CONNECTORS-1134:1649449-1649604
 /manifoldcf/branches/CONNECTORS-1160:1663182-1666294
 /manifoldcf/branches/CONNECTORS-1168:1666253-1668311
+/manifoldcf/branches/CONNECTORS-1177:1670213-1670613
 
/manifoldcf/branches/CONNECTORS-120:1406712-1407974,1407982-1411043,1411049-1416451
 /manifoldcf/branches/CONNECTORS-120-1:1416450-1417056
 /manifoldcf/branches/CONNECTORS-13:1525862-1527182,1539324-1541634

Modified: 
manifoldcf/trunk/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
 (original)
+++ 
manifoldcf/trunk/connectors/filesystem/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/filesystem/tests/APISanityTester.java
 Wed Apr  1 11:02:00 2015
@@ -63,7 +63,9 @@ public class APISanityTester
     ConfigurationNode child;
     Configuration requestObject;
     Configuration result;
-      
+
+    instance.loginAPI("","");
+    
     connectionObject = new ConfigurationNode("repositoryconnection");
     
     child = new ConfigurationNode("name");

Modified: manifoldcf/trunk/framework/api-service/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/api-service/src/main/webapp/WEB-INF/web.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- manifoldcf/trunk/framework/api-service/src/main/webapp/WEB-INF/web.xml 
(original)
+++ manifoldcf/trunk/framework/api-service/src/main/webapp/WEB-INF/web.xml Wed 
Apr  1 11:02:00 2015
@@ -34,7 +34,7 @@
   </servlet-mapping>
 
   <session-config>
-    <session-timeout>5</session-timeout>
+    <session-timeout>30</session-timeout>
   </session-config>
 
   <listener>

Modified: 
manifoldcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
 (original)
+++ 
manifoldcf/trunk/framework/api-servlet/src/main/java/org/apache/manifoldcf/apiservlet/APIServlet.java
 Wed Apr  1 11:02:00 2015
@@ -24,6 +24,9 @@ import org.apache.manifoldcf.crawler.int
 import org.apache.manifoldcf.crawler.system.ManifoldCF;
 import org.apache.manifoldcf.crawler.system.Logging;
 import org.apache.manifoldcf.core.util.URLDecoder;
+
+import org.apache.manifoldcf.ui.beans.APIProfile;
+
 import java.io.*;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
@@ -53,6 +56,20 @@ public class APIServlet extends HttpServ
     super.destroy();
   }
 
+  protected APIProfile getAPISession(IThreadContext tc, HttpServletRequest 
request)
+  {
+    Object x = request.getSession().getAttribute("apiprofile");
+    if (x == null || !(x instanceof APIProfile))
+    {
+      // Basic login
+      APIProfile ap = new APIProfile();
+      request.getSession().setAttribute("apiprofile",ap);
+      ap.login(tc,"","");
+      return ap;
+    }
+    return (APIProfile)x;
+  }
+  
   /** The get method.
   */
   protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
@@ -74,8 +91,10 @@ public class APIServlet extends HttpServ
         return;
       }
 
+      // Verify session
+      APIProfile ap = getAPISession(tc,request);
       // Perform the get
-      executeRead(tc,response,pathInfo,queryString);
+      executeRead(tc,response,pathInfo,queryString,ap);
     }
     catch (ManifoldCFException e)
     {
@@ -104,12 +123,14 @@ public class APIServlet extends HttpServ
         return;
       }
 
+      // Verify session
+      APIProfile ap = getAPISession(tc,request);
       // Get the content being 'put'
       InputStream content = request.getInputStream();
       try
       {
        // Do the put.
-       executeWrite(tc,response,pathInfo,content);
+       executeWrite(tc,response,pathInfo,content,ap);
       }
       finally
       {
@@ -144,12 +165,14 @@ public class APIServlet extends HttpServ
         return;
       }
 
+      // Verify session
+      APIProfile ap = getAPISession(tc,request);
       // Get the content being posted
       InputStream content = request.getInputStream();
       try
       {
        // Do the put.
-       executePost(tc,response,pathInfo,content);
+       executePost(tc,response,pathInfo,content,ap);
       }
       finally
       {
@@ -184,8 +207,10 @@ public class APIServlet extends HttpServ
         return;
       }
 
+      // Verify session
+      APIProfile ap = getAPISession(tc,request);
       // Perform the deletion
-      executeDelete(tc,response,pathInfo);
+      executeDelete(tc,response,pathInfo,ap);
       
     }
     catch (ManifoldCFException e)
@@ -197,12 +222,47 @@ public class APIServlet extends HttpServ
   }
 
   // Protected methods
+
+  protected static void sendUnauthorizedResponse(HttpServletResponse response)
+    throws IOException
+  {
+    response.setStatus(response.SC_UNAUTHORIZED);
+    sendNullJSON(response);
+  }
+  
+  protected static void sendNullJSON(HttpServletResponse response)
+    throws IOException
+  {
+    String loutputText = "{}";
+    byte[] lresponseValue = loutputText.getBytes(StandardCharsets.UTF_8);
+
+    // Set response mime type
+    response.setContentType("text/plain; charset=utf-8");
+    response.setIntHeader("Content-Length", (int)lresponseValue.length);
+    ServletOutputStream out = response.getOutputStream();
+    try
+    {
+      out.write(lresponseValue,0,lresponseValue.length);
+      out.flush();
+    }
+    finally
+    {
+      out.close();
+    }
+  }
   
   /** Perform a general "read" operation.
   */
-  protected static void executeRead(IThreadContext tc, HttpServletResponse 
response, String pathInfo, String queryString)
+  protected static void executeRead(IThreadContext tc, HttpServletResponse 
response, String pathInfo, String queryString, APIProfile ap)
     throws ManifoldCFException, IOException
   {
+    if (!ap.getLoggedOn())
+    {
+      // Login failed
+      sendUnauthorizedResponse(response);
+      return;
+    }
+
     // Strip off leading "/"
     if (pathInfo.startsWith("/"))
       pathInfo = pathInfo.substring(1);
@@ -280,9 +340,16 @@ public class APIServlet extends HttpServ
   
   /** Perform a general "write" operation.
   */
-  protected static void executeWrite(IThreadContext tc, HttpServletResponse 
response, String pathInfo, InputStream data)
+  protected static void executeWrite(IThreadContext tc, HttpServletResponse 
response, String pathInfo, InputStream data, APIProfile ap)
     throws ManifoldCFException, IOException
   {
+    if (!ap.getLoggedOn())
+    {
+      // Login failed
+      sendUnauthorizedResponse(response);
+      return;
+    }
+
     // Strip off leading "/"
     if (pathInfo.startsWith("/"))
       pathInfo = pathInfo.substring(1);
@@ -394,7 +461,7 @@ public class APIServlet extends HttpServ
 
   /** Perform a general "post" operation.
   */
-  protected static void executePost(IThreadContext tc, HttpServletResponse 
response, String pathInfo, InputStream data)
+  protected static void executePost(IThreadContext tc, HttpServletResponse 
response, String pathInfo, InputStream data, APIProfile ap)
     throws ManifoldCFException, IOException
   {
     // Strip off leading "/"
@@ -415,6 +482,57 @@ public class APIServlet extends HttpServ
       command = pathInfo.substring(index+1);
     }
 
+    // Security check.  If the protocol is JSON and the command is LOGIN, we 
do the login now.  But to
+    // prevent denial of service attacks, we don't accept more than a limited 
amount of login JSON.
+    if (protocol.equals("json") && command.equals("LOGIN")) {
+      // Do the login!
+      // Parse the json login packet
+      char[] lbuffer = new char[65536];
+      StringBuilder lsb = new StringBuilder();
+      Reader lr = new InputStreamReader(data,StandardCharsets.UTF_8);
+      while (true)
+      {
+        int amt = lr.read(lbuffer);
+        if (amt == -1)
+          break;
+        if (lsb.length() + amt > 65536)
+          break;
+        lsb.append(lbuffer,0,amt);
+      }
+      
+      Configuration loginInput = new Configuration();
+      loginInput.fromJSON(lsb.toString());
+
+      String userID = "";
+      String password = "";
+      for (int i = 0; i < loginInput.getChildCount(); i++)
+      {
+        ConfigurationNode cn = loginInput.findChild(i);
+        if (cn.getType().equals("userID"))
+          userID = cn.getValue();
+        else if (cn.getType().equals("password"))
+          password = cn.getValue();
+      }
+      ap.login(tc,userID,password);
+      if (!ap.getLoggedOn())
+      {
+        sendUnauthorizedResponse(response);
+        return;
+      }
+      else
+      {
+        sendNullJSON(response);
+        return;
+      }
+    }
+
+    if (!ap.getLoggedOn())
+    {
+      // Login failed
+      sendUnauthorizedResponse(response);
+      return;
+    }
+
     // We presume the data is utf-8
     StringBuilder sb = new StringBuilder();
     char[] buffer = new char[65536];
@@ -448,6 +566,7 @@ public class APIServlet extends HttpServ
     }
     
     // Execute the request.
+
     
     Configuration output = new Configuration();
     int writeResult = ManifoldCF.executePostCommand(tc,output,command,input);
@@ -505,9 +624,16 @@ public class APIServlet extends HttpServ
   
   /** Perform a general "delete" operation.
   */
-  protected static void executeDelete(IThreadContext tc, HttpServletResponse 
response, String pathInfo)
+  protected static void executeDelete(IThreadContext tc, HttpServletResponse 
response, String pathInfo, APIProfile ap)
     throws ManifoldCFException, IOException
   {
+    if (!ap.getLoggedOn())
+    {
+      // Login failed
+      sendUnauthorizedResponse(response);
+      return;
+    }
+
     // Strip off leading "/"
     if (pathInfo.startsWith("/"))
       pathInfo = pathInfo.substring(1);

Modified: 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
 (original)
+++ 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
 Wed Apr  1 11:02:00 2015
@@ -108,6 +108,8 @@ public class ManifoldCF
   // Local member variables
   protected static String loginUserName = null;
   protected static String loginPassword = null;
+  protected static String apiLoginUserName = null;
+  protected static String apiLoginPassword = null;
   protected static String masterDatabaseName = null;
   protected static String masterDatabaseUsername = null;
   protected static String masterDatabasePassword = null;
@@ -131,7 +133,12 @@ public class ManifoldCF
   public static final String loginUserNameProperty = 
"org.apache.manifoldcf.login.name";
   /** UI login password */
   public static final String loginPasswordProperty = 
"org.apache.manifoldcf.login.password";
-  
+
+  /** API login user name */
+  public static final String apiLoginUserNameProperty = 
"org.apache.manifoldcf.apilogin.name";
+  /** API login password */
+  public static final String apiLoginPasswordProperty = 
"org.apache.manifoldcf.apilogin.password";
+
   // Database access properties
   /** Database name property */
   public static final String masterDatabaseNameProperty = 
"org.apache.manifoldcf.database.name";
@@ -193,6 +200,8 @@ public class ManifoldCF
         processID = null;
         loginUserName = null;
         loginPassword = null;
+        apiLoginUserName = null;
+        apiLoginPassword = null;
         masterDatabaseName = null;
         masterDatabaseUsername = null;
         masterDatabasePassword = null;
@@ -286,6 +295,9 @@ public class ManifoldCF
           loginUserName = 
LockManagerFactory.getStringProperty(threadContext,loginUserNameProperty,"admin");
           loginPassword = 
LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,loginPasswordProperty,"admin");
 
+          apiLoginUserName = 
LockManagerFactory.getStringProperty(threadContext,apiLoginUserNameProperty,"");
+          apiLoginPassword = 
LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,apiLoginPasswordProperty,"");
+
           masterDatabaseName = 
LockManagerFactory.getStringProperty(threadContext,masterDatabaseNameProperty,"dbname");
           masterDatabaseUsername = 
LockManagerFactory.getStringProperty(threadContext,masterDatabaseUsernameProperty,"manifoldcf");
           masterDatabasePassword = 
LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,masterDatabasePasswordProperty,"local_pg_passwd");
@@ -695,6 +707,25 @@ public class ManifoldCF
     }
   }
 
+  /** Verify API login.
+  */
+  public static boolean verifyAPILogin(IThreadContext threadContext, String 
userID, String userPassword)
+    throws ManifoldCFException
+  {
+    if (userID != null && userPassword != null)
+    {
+      /*
+      IDBInterface database = DBInterfaceFactory.make(threadContext,
+        ManifoldCF.getMasterDatabaseName(),
+        ManifoldCF.getMasterDatabaseUsername(),
+        ManifoldCF.getMasterDatabasePassword());
+      */
+      // MHL to use a database table, when we get that sophisticated
+      return userID.equals(apiLoginUserName) &&  
userPassword.equals(apiLoginPassword);
+    }
+    return false;
+  }
+
   /** Verify login.
   */
   public static boolean verifyLogin(IThreadContext threadContext, String 
userID, String userPassword)

Modified: 
manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
 (original)
+++ 
manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
 Wed Apr  1 11:02:00 2015
@@ -197,6 +197,19 @@ public class ManifoldCFInstance
   
   // These methods allow communication with the ManifoldCF api webapp, via the 
locally-instantiated jetty
   
+  public void loginAPI(String userID, String password)
+    throws Exception
+  {
+    Configuration requestObject = new Configuration();
+    ConfigurationNode cn = new ConfigurationNode("userID");
+    cn.setValue(userID);
+    requestObject.addChild(requestObject.getChildCount(),cn);
+    cn = new ConfigurationNode("password");
+    cn.setValue(password);
+    requestObject.addChild(requestObject.getChildCount(),cn);
+    performAPIPostOperationViaNodes("LOGIN",200,requestObject);
+  }
+  
   public void startJobAPI(String jobIDString)
     throws Exception
   {

Modified: 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
 (original)
+++ 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/Variable.java
 Wed Apr  1 11:02:00 2015
@@ -52,6 +52,8 @@ public interface Variable
   public static String ATTRIBUTE_NOTFOUNDSTATUS = "__NOTFOUND__";
   /** CREATED status attribute */
   public static String ATTRIBUTE_CREATEDSTATUS = "__CREATED__";
+  /** UNAUTHORIZED status attribute */
+  public static String ATTRIBUTE_UNAUTHORIZEDSTATUS = "__UNAUTHORIZED__";
   
   /** Check if the variable has a string value */
   public boolean hasStringValue()

Modified: 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
 (original)
+++ 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfiguration.java
 Wed Apr  1 11:02:00 2015
@@ -41,13 +41,16 @@ public class VariableConfiguration exten
     throws ScriptException
   {
     configuration = new Configuration();
-    try
+    if (json != null && json.length() > 0)
     {
-      configuration.fromJSON(json);
-    }
-    catch (ManifoldCFException e)
-    {
-      throw new ScriptException(e.getMessage(),e);
+      try
+      {
+        configuration.fromJSON(json);
+      }
+      catch (ManifoldCFException e)
+      {
+        throw new ScriptException("Invalid json: '"+json+"': 
"+e.getMessage(),e);
+      }
     }
   }
   

Modified: 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
 (original)
+++ 
manifoldcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableResult.java
 Wed Apr  1 11:02:00 2015
@@ -77,6 +77,8 @@ public class VariableResult extends Vari
       return new VariableBoolean(resultCode == 201);
     else if (attributeName.equals(ATTRIBUTE_NOTFOUNDSTATUS))
       return new VariableBoolean(resultCode == 404);
+    else if (attributeName.equals(ATTRIBUTE_UNAUTHORIZEDSTATUS))
+      return new VariableBoolean(resultCode == 401);
     else if (attributeName.equals(ATTRIBUTE_VALUE))
       return result;
     else

Modified: manifoldcf/trunk/framework/script-example/file-crawl-example.mcf
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/script-example/file-crawl-example.mcf?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- manifoldcf/trunk/framework/script-example/file-crawl-example.mcf (original)
+++ manifoldcf/trunk/framework/script-example/file-crawl-example.mcf Wed Apr  1 
11:02:00 2015
@@ -17,14 +17,22 @@
 # Argument: the base path of the API service, e.g. 
"http://localhost:8345/mcf-api-service";.
 
 # Decode the argument, if any
-if __args__.__size__ > 2 || __args__.__size__ < 1 then
-  error "Usage: file-crawl-example <file_path> [<url_path>]";
+if __args__.__size__ > 4 || __args__.__size__ < 1 || __args__.__size__ == 3 
then
+  error "Usage: file-crawl-example <file_path> [ <url_path> [ <user_name> 
<password> ] ]";
 ;
 if __args__.__size__ == 1 then
   set basepath = "http://localhost:8345/mcf-api-service";;
 else
   set basepath = __args__[1];
 ;
+if __args__.__size__ == 4 then
+  set username = __args__[2];
+  set password = __args__[3];
+else
+  set username = "";
+  set password = "";
+;
+
 set baseurl = (new url basepath) + "json";
 
 # Define all the connection names, job names, etc.
@@ -35,6 +43,17 @@ set repositoryConnectionDescription = "F
 set fileCrawlPath = __args__[0];
 set fileCrawlJobName = "File system crawl of "+fileCrawlPath;
 
+# First, login
+POST result = {
+  << "userID" : username :  :  >>,
+  << "password" : password : : >> }
+  to baseurl + "LOGIN";
+if result.__OK__ then
+  print "Login successful";
+else
+  error "Login failed";
+;
+
 # Now, create the null output connection, unless it's already there.
 PUT result = {
   << "outputconnection" : "" :  :
@@ -73,14 +92,17 @@ POST result = {
     << "recrawl_interval" : "86400000" :  :  >>,
     << "run_mode" : "scan once" :  :  >>,
     << "hopcount_mode" : "never delete" :  :  >>,
-    << "output_specification" : "" :  :  >>,
     << "description" : fileCrawlJobName :  :  >>,
+    << "repository_connection" : "File System" :  :  >>,
     << "document_specification" : "" :  :
       << "startpoint" : "" : "path"=fileCrawlPath : 
         << "include" : "" : "match"="*", "type"="file" :  >>,
         << "include" : "" : "match"="*", "type"="directory" :  >> >> >>,
-    << "output_connection" : "Null Output" :  :  >>,
-    << "repository_connection" : "File System" :  :  >>,
+    << "pipelinestage" : "" :  :
+      << "stage_id" : 0 :  :  >>,
+      << "stage_isoutput": "true" :  :  >>,
+      << "stage_specification" : "" :  :  >>,
+      << "stage_connectionname" : "Null Output" :  :  >> >>,
     << "priority" : "5" :  :  >>,
     << "expiration_interval" : "infinite" :  :  >> >> }
   to baseurl + "jobs";

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/how-to-build-and-deploy.xml
 Wed Apr  1 11:02:00 2015
@@ -1040,6 +1040,9 @@ start[.bat|.sh]
             
<tr><td>org.apache.manifoldcf.login.name</td><td>No</td><td>Crawler UI login 
user ID (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password</td><td>No</td><td>Crawler UI 
login user password (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password.obfuscated</td><td>No</td><td>Obfuscated
 crawler UI login user password (defaults to "admin")</td></tr>
+            <tr><td>org.apache.manifoldcf.login.apiname</td><td>No</td><td>API 
login user ID (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword</td><td>No</td><td>API login 
user password (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword.obfuscated</td><td>No</td><td>Obfuscated
 API login user password (defaults to "")</td></tr>
             <tr><td>org.apache.manifoldcf.crawleruiwarpath</td><td>Yes, for 
Jetty</td><td>Location of Crawler UI war</td></tr>
             <tr><td>org.apache.manifoldcf.authorityservicewarpath</td><td>Yes, 
for Jetty</td><td>Location of Authority Service war</td></tr>
             <tr><td>org.apache.manifoldcf.apiservicewarpath</td><td>Yes, for 
Jetty</td><td>Location of API Service war</td></tr>

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml
 Wed Apr  1 11:02:00 2015
@@ -48,8 +48,8 @@
           
<p>http[s]://<em>&lt;server_and_port&gt;</em>/mcf-api-service/json/<em>&lt;resource&gt;</em></p>
           <p></p>
           <p>The servlet ignores request data, except when the PUT or POST 
verb is used.  In that case, the request data is presumed to be a JSON object.  
The servlet
-            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), or
-            404 (NOT FOUND) response code along with a response JSON 
object.</p>
+            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), 
+            401 (UNAUTHORIZED), or 404 (NOT FOUND) response code along with a 
response JSON object.</p>
           <p></p>
         </section>
         <section>
@@ -79,6 +79,7 @@
           <p></p>
           <table>
             <tr><th>Resource</th><th>Verb</th><th>What it does</th><th>Input 
format/query args</th><th>Output format</th></tr>
+            <tr><td>LOGIN</td><td>POST</td><td>Log in the specified 
user</td><td>{"userID":<em>&lt;user_name&gt;</em>, 
"password":<em>&lt;password&gt;</em>}</td><td>{}</td></tr>
             <tr><td>authorizationdomains</td><td>GET</td><td>List all 
registered authorization 
domains</td><td>N/A</td><td>{"authorizationdomain":[<em>&lt;list_of_authorization_domain_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>outputconnectors</td><td>GET</td><td>List all registered 
output 
connectors</td><td>N/A</td><td>{"outputconnector":[<em>&lt;list_of_output_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>transformationconnectors</td><td>GET</td><td>List all 
registered transformation 
connectors</td><td>N/A</td><td>{"transformationconnector":[<em>&lt;list_of_transformation_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/how-to-build-and-deploy.xml
 Wed Apr  1 11:02:00 2015
@@ -161,7 +161,7 @@
           <title>Building and testing the Alfresco Webscript connector</title>
           <p></p>
           <p>The Alfresco Webscript connector is built against an open-source 
Alfresco Indexer client, which requires a corresponding Alfresco Indexer plugin
-                to be installed on your Alfresco instance.  This Alfresco 
Indexer plugin is currently available for download.  Installation of the plugin 
should follow the
+                to be installed on your Alfresco instance.  This Alfresco 
Indexer plugin is included with ManifoldCF distributions.  Installation of the 
plugin should follow the
                 standard Alfresco installation steps, as described <a 
href="http://docs.alfresco.com/4.1/tasks/amp-install.html";>here</a>.
                 See <a href="https://github.com/maoo/alfresco-indexer";>this 
page</a> for configuration details, and for the plugin itself.</p>
           <p></p>
@@ -1040,6 +1040,9 @@ start[.bat|.sh]
             
<tr><td>org.apache.manifoldcf.login.name</td><td>No</td><td>Crawler UI login 
user ID (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password</td><td>No</td><td>Crawler UI 
login user password (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password.obfuscated</td><td>No</td><td>Obfuscated
 crawler UI login user password (defaults to "admin")</td></tr>
+            <tr><td>org.apache.manifoldcf.login.apiname</td><td>No</td><td>API 
login user ID (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword</td><td>No</td><td>API login 
user password (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword.obfuscated</td><td>No</td><td>Obfuscated
 API login user password (defaults to "")</td></tr>
             <tr><td>org.apache.manifoldcf.crawleruiwarpath</td><td>Yes, for 
Jetty</td><td>Location of Crawler UI war</td></tr>
             <tr><td>org.apache.manifoldcf.authorityservicewarpath</td><td>Yes, 
for Jetty</td><td>Location of Authority Service war</td></tr>
             <tr><td>org.apache.manifoldcf.apiservicewarpath</td><td>Yes, for 
Jetty</td><td>Location of API Service war</td></tr>

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml
 Wed Apr  1 11:02:00 2015
@@ -48,8 +48,8 @@
           
<p>http[s]://<em>&lt;server_and_port&gt;</em>/mcf-api-service/json/<em>&lt;resource&gt;</em></p>
           <p></p>
           <p>The servlet ignores request data, except when the PUT or POST 
verb is used.  In that case, the request data is presumed to be a JSON object.  
The servlet
-            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), or
-            404 (NOT FOUND) response code along with a response JSON 
object.</p>
+            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), 
+            401 (UNAUTHORIZED), or 404 (NOT FOUND) response code along with a 
response JSON object.</p>
           <p></p>
         </section>
         <section>
@@ -79,6 +79,7 @@
           <p></p>
           <table>
             <tr><th>Resource</th><th>Verb</th><th>What it does</th><th>Input 
format/query args</th><th>Output format</th></tr>
+            <tr><td>LOGIN</td><td>POST</td><td>Log in the specified 
user</td><td>{"userID":<em>&lt;user_name&gt;</em>, 
"password":<em>&lt;password&gt;</em>}</td><td>{}</td></tr>
             <tr><td>authorizationdomains</td><td>GET</td><td>List all 
registered authorization 
domains</td><td>N/A</td><td>{"authorizationdomain":[<em>&lt;list_of_authorization_domain_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>outputconnectors</td><td>GET</td><td>List all registered 
output 
connectors</td><td>N/A</td><td>{"outputconnector":[<em>&lt;list_of_output_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>transformationconnectors</td><td>GET</td><td>List all 
registered transformation 
connectors</td><td>N/A</td><td>{"transformationconnector":[<em>&lt;list_of_transformation_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/how-to-build-and-deploy.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/how-to-build-and-deploy.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/how-to-build-and-deploy.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/how-to-build-and-deploy.xml
 Wed Apr  1 11:02:00 2015
@@ -161,7 +161,7 @@
           <title>Building and testing the Alfresco Webscript connector</title>
           <p></p>
           <p>The Alfresco Webscript connector is built against an open-source 
Alfresco Indexer client, which requires a corresponding Alfresco Indexer plugin
-                to be installed on your Alfresco instance.  This Alfresco 
Indexer plugin is currently available for download.  Installation of the plugin 
should follow the
+                to be installed on your Alfresco instance.  This Alfresco 
Indexer plugin is included with ManifoldCF distributions.  Installation of the 
plugin should follow the
                 standard Alfresco installation steps, as described <a 
href="http://docs.alfresco.com/4.1/tasks/amp-install.html";>here</a>.
                 See <a href="https://github.com/maoo/alfresco-indexer";>this 
page</a> for configuration details, and for the plugin itself.</p>
           <p></p>
@@ -1040,6 +1040,9 @@ start[.bat|.sh]
             
<tr><td>org.apache.manifoldcf.login.name</td><td>No</td><td>Crawler UI login 
user ID (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password</td><td>No</td><td>Crawler UI 
login user password (defaults to "admin")</td></tr>
             
<tr><td>org.apache.manifoldcf.login.password.obfuscated</td><td>No</td><td>Obfuscated
 crawler UI login user password (defaults to "admin")</td></tr>
+            <tr><td>org.apache.manifoldcf.login.apiname</td><td>No</td><td>API 
login user ID (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword</td><td>No</td><td>API login 
user password (defaults to "")</td></tr>
+            
<tr><td>org.apache.manifoldcf.login.apipassword.obfuscated</td><td>No</td><td>Obfuscated
 API login user password (defaults to "")</td></tr>
             <tr><td>org.apache.manifoldcf.crawleruiwarpath</td><td>Yes, for 
Jetty</td><td>Location of Crawler UI war</td></tr>
             <tr><td>org.apache.manifoldcf.authorityservicewarpath</td><td>Yes, 
for Jetty</td><td>Location of Authority Service war</td></tr>
             <tr><td>org.apache.manifoldcf.apiservicewarpath</td><td>Yes, for 
Jetty</td><td>Location of API Service war</td></tr>

Modified: 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/programmatic-operation.xml
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/programmatic-operation.xml?rev=1670614&r1=1670613&r2=1670614&view=diff
==============================================================================
--- 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/programmatic-operation.xml
 (original)
+++ 
manifoldcf/trunk/site/src/documentation/content/xdocs/zh_CN/programmatic-operation.xml
 Wed Apr  1 11:02:00 2015
@@ -48,8 +48,8 @@
           
<p>http[s]://<em>&lt;server_and_port&gt;</em>/mcf-api-service/json/<em>&lt;resource&gt;</em></p>
           <p></p>
           <p>The servlet ignores request data, except when the PUT or POST 
verb is used.  In that case, the request data is presumed to be a JSON object.  
The servlet
-            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), or
-            404 (NOT FOUND) response code along with a response JSON 
object.</p>
+            responds either with an error response code (either 400 or 500) 
with an appropriate explanatory message, or with a 200 (OK), 201 (CREATED), 
+            401 (UNAUTHORIZED), or 404 (NOT FOUND) response code along with a 
response JSON object.</p>
           <p></p>
         </section>
         <section>
@@ -79,6 +79,7 @@
           <p></p>
           <table>
             <tr><th>Resource</th><th>Verb</th><th>What it does</th><th>Input 
format/query args</th><th>Output format</th></tr>
+            <tr><td>LOGIN</td><td>POST</td><td>Log in the specified 
user</td><td>{"userID":<em>&lt;user_name&gt;</em>, 
"password":<em>&lt;password&gt;</em>}</td><td>{}</td></tr>
             <tr><td>authorizationdomains</td><td>GET</td><td>List all 
registered authorization 
domains</td><td>N/A</td><td>{"authorizationdomain":[<em>&lt;list_of_authorization_domain_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>outputconnectors</td><td>GET</td><td>List all registered 
output 
connectors</td><td>N/A</td><td>{"outputconnector":[<em>&lt;list_of_output_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>
             <tr><td>transformationconnectors</td><td>GET</td><td>List all 
registered transformation 
connectors</td><td>N/A</td><td>{"transformationconnector":[<em>&lt;list_of_transformation_connector_objects&gt;</em>]}
 <strong>OR</strong> {"error":<em>&lt;error_text&gt;</em>}</td></tr>


Reply via email to