You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/12/07 02:56:16 UTC
svn commit: r1418164 - in
/manifoldcf/branches/CONNECTORS-578/connectors/livelink:
build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java
connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
Author: kwright
Date: Fri Dec 7 01:56:15 2012
New Revision: 1418164
URL: http://svn.apache.org/viewvc?rev=1418164&view=rev
Log:
Add ability to obtain version information.
Modified:
manifoldcf/branches/CONNECTORS-578/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java
manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
Modified: manifoldcf/branches/CONNECTORS-578/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-578/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java?rev=1418164&r1=1418163&r2=1418164&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-578/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java (original)
+++ manifoldcf/branches/CONNECTORS-578/connectors/livelink/build-stub/src/main/java/com/opentext/api/LAPI_DOCUMENTS.java Fri Dec 7 01:56:15 2012
@@ -47,6 +47,11 @@ public class LAPI_DOCUMENTS
{
return 0;
}
+
+ public int GetVersionInfo(int vol, int id, int revNumber, LLValue objinfo)
+ {
+ return 0;
+ }
public int GetObjectRights(int vol, int objID, LLValue objinfo)
{
Modified: manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1418164&r1=1418163&r2=1418164&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java Fri Dec 7 01:56:15 2012
@@ -4704,6 +4704,80 @@ public class LivelinkConnector extends o
}
}
+ /** This object represents a cache of version information.
+ * Initialize it with the volume ID and object ID and revision number (usually zero).
+ * Then, request the desired fields from it.
+ */
+ protected class VersionInformation
+ {
+ protected final int volumeID;
+ protected final int objectID;
+ protected final int revisionNumber;
+
+ protected LLValue versionValue = null;
+
+ public VersionInformation(int volumeID, int objectID, int revisionNumber)
+ {
+ this.volumeID = volumeID;
+ this.objectID = objectID;
+ this.revisionNumber = revisionNumber;
+ }
+
+ public boolean exists()
+ throws ServiceInterruption, ManifoldCFException
+ {
+ return getVersionValue() != null;
+ }
+
+ // MHL
+
+ protected LLValue getVersionValue()
+ throws ServiceInterruption, ManifoldCFException
+ {
+ if (versionValue == null)
+ {
+ int sanityRetryCount = FAILURE_RETRY_COUNT;
+ while (true)
+ {
+ GetVersionInfoThread t = new GetVersionInfoThread(volumeID,objectID,revisionNumber);
+ try
+ {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null)
+ {
+ if (thr instanceof RuntimeException)
+ throw (RuntimeException)thr;
+ else if (thr instanceof ServiceInterruption)
+ throw (ServiceInterruption)thr;
+ else if (thr instanceof ManifoldCFException)
+ {
+ sanityRetryCount = assessRetry(sanityRetryCount,(ManifoldCFException)thr);
+ continue;
+ }
+ else
+ throw (Error)thr;
+ }
+ versionValue = t.getResponse();
+ }
+ catch (InterruptedException e)
+ {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+ }
+ catch (RuntimeException e)
+ {
+ sanityRetryCount = handleLivelinkRuntimeException(e,sanityRetryCount,true);
+ continue;
+ }
+ }
+ }
+ return versionValue;
+ }
+
+ }
+
/** This object represents an object information cache.
* Initialize it with the volume ID and object ID, and then request
* the appropriate fields from it. Keep it around as long as needed; it functions as a cache
@@ -5048,6 +5122,73 @@ public class LivelinkConnector extends o
}
+ /** Thread we can abandon that gets version information for a volume and an id and a revision.
+ */
+ protected class GetVersionInfoThread extends Thread
+ {
+ protected int vol;
+ protected int id;
+ protected int revNumber;
+ protected Throwable exception = null;
+ protected LLValue rval = null;
+
+ public GetVersionInfoThread(int vol, int id, int revNumber)
+ {
+ super();
+ setDaemon(true);
+ this.vol = vol;
+ this.id = id;
+ this.revNumber = revNumber;
+ }
+
+ public void run()
+ {
+ try
+ {
+ LLValue versioninfo = new LLValue().setAssocNotSet();
+ int status = LLDocs.GetVersionInfo(vol,id,revNumber,versioninfo);
+
+ // Need to detect if object was deleted, and return null in this case!!!
+ if (Logging.connectors.isDebugEnabled())
+ {
+ Logging.connectors.debug("Livelink: Version status retrieved for "+Integer.toString(vol)+":"+Integer.toString(id)+", rev "+revNumber+": status="+Integer.toString(status));
+ }
+
+ // Treat both 103101 and 103102 as 'object not found'.
+ if (status == 103101 || status == 103102)
+ return;
+
+ // This error means we don't have permission to get the object's status, apparently
+ if (status < 0)
+ {
+ Logging.connectors.debug("Livelink: Version info inaccessable for object "+Integer.toString(vol)+":"+Integer.toString(id)+", rev "+revNumber+
+ " ("+llServer.getErrors()+")");
+ return;
+ }
+
+ if (status != 0)
+ {
+ throw new ManifoldCFException("Error retrieving document version "+Integer.toString(vol)+":"+Integer.toString(id)+", rev "+revNumber+": status="+Integer.toString(status)+" ("+llServer.getErrors()+")");
+ }
+ rval = versioninfo;
+ }
+ catch (Throwable e)
+ {
+ this.exception = e;
+ }
+ }
+
+ public Throwable getException()
+ {
+ return exception;
+ }
+
+ public LLValue getResponse()
+ {
+ return rval;
+ }
+ }
+
/** Thread we can abandon that gets object information for a volume and an id.
*/
protected class GetObjectInfoThread extends Thread