manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1855310 - in /manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf: crawler/connectors/csws/CswsConnector.java csws/CswsSession.java
Date Tue, 12 Mar 2019 11:31:51 GMT
Author: kwright
Date: Tue Mar 12 11:31:51 2019
New Revision: 1855310

URL: http://svn.apache.org/viewvc?rev=1855310&view=rev
Log:
More work

Modified:
    manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
    manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java

Modified: manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java?rev=1855310&r1=1855309&r2=1855310&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
Tue Mar 12 11:31:51 2019
@@ -30,7 +30,7 @@ import org.apache.manifoldcf.connectorco
 import org.apache.manifoldcf.core.common.DateParser;
 
 import javax.xml.datatype.XMLGregorianCalendar;
-import com.opentext.ecm.api.OTAuthentication;
+import com.opentext.livelink.service.core.PageHandle;
 import com.opentext.livelink.service.core.DataValue;
 import com.opentext.livelink.service.core.StringValue;
 import com.opentext.livelink.service.core.RealValue;
@@ -47,6 +47,7 @@ import com.opentext.livelink.service.doc
 import com.opentext.livelink.service.docman.NodeRights;
 import com.opentext.livelink.service.docman.NodeRight;
 import com.opentext.livelink.service.memberservice.User;
+import com.opentext.livelink.service.memberservice.Member;
 
 import org.apache.manifoldcf.csws.*;
 
@@ -956,18 +957,31 @@ public class CswsConnector extends org.a
         // Do ListUsers and enumerate the values.
         final ListUsersThread t = new ListUsersThread();
         t.start();
-        final long[] childrenDocs = t.finishUp();
+        final PageHandle resultPageHandle = t.finishUp();
+        
+        // Now walk through the results and add them
+        while (true) {
+          final GetUserResultsThread t = new GetUserResultsThread(resultPageHandle);
+          t.start();
+          final List<? extends Member> childrenDocs = t.finishUp();
+          if (childrenDocs == null) {
+            // We're done
+            break;
+          }
             
-        for (long childID : childrenDocs)
-        {
-          // Skip admin user
-          if (childID == 1000L || childID == 1001L)
-            continue;
-              
-          if (Logging.connectors.isDebugEnabled())
-            Logging.connectors.debug("Csws: Found a user: ID="+Integer.toString(childID));
+          for (final Member m : childrenDocs)
+          {
+            final long childID = m.getID();
+            
+            // Skip admin user
+            if (childID == 1000L || childID == 1001L)
+              continue;
+                
+            if (Logging.connectors.isDebugEnabled())
+              Logging.connectors.debug("Csws: Found a user: ID="+childID);
 
-          activities.addSeedDocument("F0:"+Integer.toString(childID));
+            activities.addSeedDocument("F0:"+childID);
+          }
         }
       }
       catch (InterruptedException e)
@@ -4168,7 +4182,7 @@ public class CswsConnector extends org.a
   */
   protected class ListUsersThread extends Thread
   {
-    protected int[] rval = null;
+    protected PageHandle rval = null;
     protected Throwable exception = null;
 
     public ListUsersThread()
@@ -4181,45 +4195,58 @@ public class CswsConnector extends org.a
     {
       try
       {
-        // MHL - TBD
-        /*
-        LLValue userList = new LLValue();
-        int status = LLUsers.ListUsers(userList);
+        rval = cswsSession.getAllUsers();
+      }
+      catch (Throwable e)
+      {
+        this.exception = e;
+      }
+    }
 
-        if (Logging.connectors.isDebugEnabled())
-        {
-          Logging.connectors.debug("Csws: User list retrieved: status="+Integer.toString(status));
-        }
+    public PageHandle finishUp()
+      throws ManifoldCFException, ServiceInterruption, InterruptedException
+    {
+      join();
+      Throwable thr = exception;
+      if (thr != null)
+      {
+	if (thr instanceof RuntimeException)
+	  throw (RuntimeException)thr;
+	else if (thr instanceof ManifoldCFException)
+	  throw (ManifoldCFException)thr;
+        else if (thr instanceof ServiceInterruption)
+          throw (ServiceInterruption) thr;
+	else if (thr instanceof Error)
+	  throw (Error)thr;
+	else
+	  throw new RuntimeException("Unrecognized exception type: "+thr.getClass().getName()+":
"+thr.getMessage(),thr);
+      }
+      return rval;
+    }
 
-        if (status < 0)
-        {
-          Logging.connectors.debug("Csws: User list inaccessable ("+llServer.getErrors()+")");
-          return;
-        }
+  }
 
-        if (status != 0)
-        {
-          throw new ManifoldCFException("Error retrieving user list: status="+Integer.toString(status)+"
("+llServer.getErrors()+")");
-        }
-        
-        if (userList != null)
-        {
-          int size = 0;
+  /** Thread we can abandon that lists all users (except admin).
+  */
+  protected class GetUserResultsThread extends Thread
+  {
+    protected final PageHandle pageHandle;
+    
+    protected List<? extends Member> rval = null;
+    protected Throwable exception = null;
 
-          if (userList.isRecord())
-            size = 1;
-          if (userList.isTable())
-            size = childrenDocs.size();
-
-          rval = new int[size];
-          // Do the scan
-          for (int j = 0; j < size; j++)
-          {
-            int childID = userList.toInteger(j, "ID");
-            rval[j] = childID;
-          }
-        }
-        */
+    public GetUserResultsThread(final PageHandle pageHandle)
+    {
+      super();
+      this.pageHandle = pageHandle;
+      setDaemon(true);
+    }
+
+    public void run()
+    {
+      try
+      {
+        rval = cswsSession.getNextUserSearchResults(pageHandle);
       }
       catch (Throwable e)
       {
@@ -4227,7 +4254,7 @@ public class CswsConnector extends org.a
       }
     }
 
-    public int[] finishUp()
+    public List<? extends Member> finishUp()
       throws ManifoldCFException, ServiceInterruption, InterruptedException
     {
       join();

Modified: manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java?rev=1855310&r1=1855309&r2=1855310&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
Tue Mar 12 11:31:51 2019
@@ -39,6 +39,7 @@ import javax.xml.ws.soap.SOAPFaultExcept
 import javax.xml.ws.BindingProvider;
 
 import com.opentext.ecm.api.OTAuthentication;
+import com.opentext.livelink.service.core.PageHandle;
 import com.opentext.livelink.service.core.Authentication;
 import com.opentext.livelink.service.core.Authentication_Service;
 import com.opentext.livelink.service.core.ContentService;
@@ -50,6 +51,8 @@ import com.opentext.livelink.service.doc
 import com.opentext.livelink.service.searchservices.SearchService;
 import com.opentext.livelink.service.searchservices.SearchService_Service;
 
+import com.opentext.livelink.service.memberservice.MemberSearchOptions;
+import com.opentext.livelink.service.memberservice.MemberSearchResults;
 import com.opentext.livelink.service.docman.AttributeGroup;
 import com.opentext.livelink.service.docman.CategoryInheritance;
 import com.opentext.livelink.service.docman.GetNodesInContainerOptions;
@@ -58,6 +61,7 @@ import com.opentext.livelink.service.doc
 import com.opentext.livelink.service.docman.Version;
 import com.opentext.livelink.service.docman.NodeRights;
 import com.opentext.livelink.service.memberservice.User;
+import com.opentext.livelink.service.memberservice.Member;
 
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
@@ -277,6 +281,36 @@ public class CswsSession
     } catch (SOAPFaultException e) {
       processSOAPFault(e);
     }
+  }
+  
+  public PageHandle getAllUsers() 
+    throws ManifoldCFException, ServiceInterruption {
+    final MemberSearchOptions srchMemOptions  = new MemberSearchOptions();
+    srchMemOptions.setFilter(SearchFilter.USER);
+    srchMemOptions.setScope(SearchScope.SYSTEM);
+    srchMemOptions.setSearch("");
+    try {
+      return getMemberServiceHandle().searchForMembers(srchMemOptions, getOTAuthentication());
+    } catch (SOAPFaultException e) {
+      processSOAPFault(e);
+    }
+  }
+
+  public List<? extends Member> getNextUserSearchResults(PageHandle pgHandle)
+    throws ManifoldCFException, ServiceInterruption {
+    try {
+      final MemberSearchResults msr = getMemberServiceHandle().getSearchResults(pgHandle,
getOTAuthentication());
+      if (msr == null) {
+        return null;
+      }
+      final List<? extends Member> rval = msr.getMembers();
+      if (rval == null || rval.size() == 0) {
+        return null;
+      }
+      return rval;
+    } catch (SOAPFaultException e) {
+      processSOAPFault(e);
+    }
   }
   
   // Construct authentication token argument, which must be passed as last argument for every
method



Mime
View raw message