manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1484124 - in /manifoldcf/trunk: ./ connectors/livelink/build-stub/src/main/java/com/opentext/api/ connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/ connectors/livelink/connector/src/main/native2...
Date Sat, 18 May 2013 14:45:36 GMT
Author: kwright
Date: Sat May 18 14:45:36 2013
New Revision: 1484124

URL: http://svn.apache.org/r1484124
Log:
Fix for CONNECTORS-689

Added:
    manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValueEnumeration.java
      - copied unchanged from r1484123, manifoldcf/branches/CONNECTORS-689/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValueEnumeration.java
Modified:
    manifoldcf/trunk/   (props changed)
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_USERS.java
    manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValue.java
    manifoldcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
    manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties
    manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
  Merged /manifoldcf/branches/CONNECTORS-689:r1482853-1484123

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Sat May 18 14:45:36 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-689: Add ability to crawl user workspaces in LiveLink
+connector.
+(David Morana, Karl Wright)
 
 ======================= Release 1.2 =====================
 

Modified: manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_USERS.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_USERS.java?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_USERS.java
(original)
+++ manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_USERS.java
Sat May 18 14:45:36 2013
@@ -45,5 +45,9 @@ public class LAPI_USERS
     return 0;
   }
   
+  public int ListUsers(LLValue rval)
+  {
+    return 0;
+  }
 }
 

Modified: manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValue.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValue.java?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValue.java
(original)
+++ manifoldcf/trunk/connectors/livelink/build-stub/src/main/java/com/opentext/api/LLValue.java
Sat May 18 14:45:36 2013
@@ -91,7 +91,7 @@ public class LLValue
     return false;
   }
   
-  public Enumeration enumerateValues()
+  public LLValueEnumeration enumerateValues()
   {
     return null;
   }

Modified: manifoldcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
(original)
+++ manifoldcf/trunk/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
Sat May 18 14:45:36 2013
@@ -922,8 +922,8 @@ public class LivelinkConnector extends o
 
     // Walk the specification for the "startpoint" types.  Amalgamate these into a list of
strings.
     // Presume that all roots are startpoint nodes
-    int i = 0;
-    while (i < spec.getChildCount())
+    boolean doUserWorkspaces = false;
+    for (int i = 0; i < spec.getChildCount(); i++)
     {
       SpecificationNode n = spec.getChild(i);
       if (n.getType().equals("startpoint"))
@@ -948,7 +948,77 @@ public class LivelinkConnector extends o
             path,"NOT FOUND",null,null);
         }
       }
-      i++;
+      else if (n.getType().equals("userworkspace"))
+      {
+        if (n.getAttributeValue("value").equals("true"))
+          doUserWorkspaces = true;
+        else if (n.getAttributeValue("value").equals("false"))
+          doUserWorkspaces = false;
+      }
+      
+      if (doUserWorkspaces)
+      {
+        // Do ListUsers and enumerate the values.
+        int sanityRetryCount = FAILURE_RETRY_COUNT;
+        while (true)
+        {
+          ListUsersThread t = new ListUsersThread();
+          try
+          {
+            t.start();
+            t.join();
+            Throwable thr = t.getException();
+            if (thr != null)
+            {
+              if (thr instanceof RuntimeException)
+                throw (RuntimeException)thr;
+              else if (thr instanceof ManifoldCFException)
+              {
+                sanityRetryCount = assessRetry(sanityRetryCount,(ManifoldCFException)thr);
+                continue;
+              }
+              else
+                throw (Error)thr;
+            }
+
+            LLValue childrenDocs = t.getResponse();
+
+            int size = 0;
+
+            if (childrenDocs.isRecord())
+              size = 1;
+            if (childrenDocs.isTable())
+              size = childrenDocs.size();
+
+            // Do the scan
+            for (int j = 0; j < size; j++)
+            {
+              int childID = childrenDocs.toInteger(j, "ID");
+              
+              // Skip admin user
+              if (childID == 1000 || childID == 1001)
+                continue;
+              
+              if (Logging.connectors.isDebugEnabled())
+                Logging.connectors.debug("Livelink: Found a user: ID="+Integer.toString(childID));
+
+              activities.addSeedDocument("F0:"+Integer.toString(childID));
+            }
+            break;
+          }
+          catch (InterruptedException e)
+          {
+            t.interrupt();
+            throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+          }
+          catch (RuntimeException e)
+          {
+            sanityRetryCount = handleLivelinkRuntimeException(e,sanityRetryCount,true);
+            continue;
+          }
+        }
+      }
+      
     }
 
   }
@@ -2409,10 +2479,32 @@ public class LivelinkConnector extends o
     int k;
 
     // Paths tab
+    boolean userWorkspaces = false;
+    i = 0;
+    while (i < ds.getChildCount())
+    {
+      SpecificationNode sn = ds.getChild(i++);
+      if (sn.getType().equals("userworkspace"))
+      {
+        String value = sn.getAttributeValue("value");
+        if (value != null && value.equals("true"))
+          userWorkspaces = true;
+      }
+    }
     if (tabName.equals(Messages.getString(locale,"LivelinkConnector.Paths")))
     {
       out.print(
 "<table class=\"displaytable\">\n"+
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
+"  <tr>\n"+
+"    <td class=\"description\">\n"+
+"      <nobr>"+Messages.getBodyString(locale,"LivelinkConnector.CrawlUserWorkspaces")+"</nobr>\n"+
+"    </td>\n"+
+"    <td class=\"value\">\n"+
+"      <input type=\"checkbox\" name=\"userworkspace\" value=\"true\""+(userWorkspaces?"
checked=\"true\"":"")+"/>\n"+
+"      <input type=\"hidden\" name=\"userworkspace_present\" value=\"true\"/>\n"+
+"    </td>\n"+
+"  </tr>\n"+
 "  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
       );
       // Now, loop through paths
@@ -2544,7 +2636,9 @@ public class LivelinkConnector extends o
         }
       }
       out.print(
-"<input type=\"hidden\" name=\"pathcount\" value=\""+Integer.toString(k)+"\"/>\n"
+"<input type=\"hidden\" name=\"pathcount\" value=\""+Integer.toString(k)+"\"/>\n"+
+"<input type=\"hidden\" name=\"userworkspace\" value=\""+(userWorkspaces?"true":"false")+"\"/>\n"+
+"<input type=\"hidden\" name=\"userworkspace_present\" value=\"true\"/>\n"
       );
     }
 
@@ -3137,6 +3231,24 @@ public class LivelinkConnector extends o
   public String processSpecificationPost(IPostParameters variableContext, Locale locale,
DocumentSpecification ds)
     throws ManifoldCFException
   {
+    String userWorkspacesPresent = variableContext.getParameter("userworkspace_present");
+    if (userWorkspacesPresent != null)
+    {
+      String value = variableContext.getParameter("userworkspace");
+      int i = 0;
+      while (i < ds.getChildCount())
+      {
+        SpecificationNode sn = ds.getChild(i);
+        if (sn.getType().equals("userworkspace"))
+          ds.removeChild(i);
+        else
+          i++;
+      }
+      SpecificationNode sn = new SpecificationNode("userworkspace");
+      sn.setAttribute("value",value);
+      ds.addChild(ds.getChildCount(),sn);
+    }
+    
     String xc = variableContext.getParameter("pathcount");
     if (xc != null)
     {
@@ -3632,6 +3744,35 @@ public class LivelinkConnector extends o
 "  <tr>\n"
     );
     int i = 0;
+    boolean userWorkspaces = false;
+    while (i < ds.getChildCount())
+    {
+      SpecificationNode sn = ds.getChild(i++);
+      if (sn.getType().equals("userworkspace"))
+      {
+        String value = sn.getAttributeValue("value");
+        if (value != null && value.equals("true"))
+          userWorkspaces = true;
+      }
+    }
+
+    out.print(
+"    <td class=\"description\"/>\n"+
+"      <nobr>"+Messages.getBodyString(locale,"LivelinkConnector.CrawlUserWorkspaces")+"</nobr>\n"+
+"    </td>\n"+
+"    <td class=\"value\"/>\n"+
+"      "+(userWorkspaces?Messages.getBodyString(locale,"LivelinkConnector.Yes"):Messages.getBodyString(locale,"LivelinkConnector.No"))+"\n"+
+"    </td>\n"+
+"  </tr>"
+    );
+    out.print(
+"  <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+    );
+    out.print(
+"  <tr>"
+    );
+
+    i = 0;
     boolean seenAny = false;
     while (i < ds.getChildCount())
     {
@@ -4734,7 +4875,7 @@ public class LivelinkConnector extends o
           return null;
 
         String[] rval = new String[children.size()];
-        Enumeration en = children.enumerateValues();
+        LLValueEnumeration en = children.enumerateValues();
 
         int j = 0;
         while (en.hasMoreElements())
@@ -4955,7 +5096,7 @@ public class LivelinkConnector extends o
         if (children == null)
           return null;
         String[] rval = new String[children.size()];
-        Enumeration en = children.enumerateValues();
+        LLValueEnumeration en = children.enumerateValues();
 
         int j = 0;
         while (en.hasMoreElements())
@@ -5823,7 +5964,61 @@ public class LivelinkConnector extends o
     }
   }
 
-  
+  /** Thread we can abandon that lists all users (except admin).
+  */
+  protected class ListUsersThread extends Thread
+  {
+    protected LLValue rval = null;
+    protected Throwable exception = null;
+
+    public ListUsersThread()
+    {
+      super();
+      setDaemon(true);
+    }
+
+    public void run()
+    {
+      try
+      {
+        LLValue userList = new LLValue();
+        int status = LLUsers.ListUsers(userList);
+
+        if (Logging.connectors.isDebugEnabled())
+        {
+          Logging.connectors.debug("Livelink: User list retrieved: status="+Integer.toString(status));
+        }
+
+        if (status < 0)
+        {
+          Logging.connectors.debug("Livelink: User list inaccessable ("+llServer.getErrors()+")");
+          return;
+        }
+
+        if (status != 0)
+        {
+          throw new ManifoldCFException("Error retrieving user list: status="+Integer.toString(status)+"
("+llServer.getErrors()+")");
+        }
+        
+        rval = userList;
+      }
+      catch (Throwable e)
+      {
+        this.exception = e;
+      }
+    }
+
+    public Throwable getException()
+    {
+      return exception;
+    }
+
+    public LLValue getResponse()
+    {
+      return rval;
+    }
+  }
+
   /** Thread we can abandon that gets user information for a userID.
   */
   protected class GetUserInfoThread extends Thread

Modified: manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties
(original)
+++ manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_en_US.properties
Sat May 18 14:45:36 2013
@@ -88,7 +88,7 @@ LivelinkConnector.AddFileSpecification=A
 LivelinkConnector.Include=Include
 LivelinkConnector.Exclude=Exclude
 LivelinkConnector.SecurityColon=Security:
-LivelinkConnector.Enabled=Enabled&nbsp;
+LivelinkConnector.Enabled=Enabled
 LivelinkConnector.Disabled=Disabled
 LivelinkConnector.DeleteToken=Delete token #
 LivelinkConnector.AddAccessToken=Add access token
@@ -143,3 +143,4 @@ LivelinkConnector.EnterTheServerCgiPathT
 LivelinkConnector.TheServerCgiPathMustBeginWithACharacter=The server CGI path must begin
with a '/' character
 LivelinkConnector.Delete=Delete
 LivelinkConnector.Add=Add
+LivelinkConnector.CrawlUserWorkspaces=Crawl user workspaces?

Modified: manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties?rev=1484124&r1=1484123&r2=1484124&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties
(original)
+++ manifoldcf/trunk/connectors/livelink/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/livelink/common_ja_JP.properties
Sat May 18 14:45:36 2013
@@ -143,3 +143,4 @@ LivelinkConnector.EnterTheServerCgiPathT
 LivelinkConnector.TheServerCgiPathMustBeginWithACharacter=The server CGI path must begin
with a '/' character
 LivelinkConnector.Delete=削除
 LivelinkConnector.Add=追加
+LivelinkConnector.CrawlUserWorkspaces=Crawl user workspaces?



Mime
View raw message