org.apache.manifoldcf.crawler.system
Class WorkerThread.VersionActivity

java.lang.Object
  extended by org.apache.manifoldcf.crawler.system.WorkerThread.VersionActivity
All Implemented Interfaces:
IAbortActivity, IEventActivity, IFingerprintActivity, IHistoryActivity, INamingActivity, IVersionActivity
Enclosing class:
WorkerThread

protected static class WorkerThread.VersionActivity
extends java.lang.Object
implements IVersionActivity

Version activity class wraps access to activity history.


Field Summary
protected  java.util.HashMap abortSet
           
protected  java.lang.String connectionName
           
protected  IRepositoryConnectionManager connMgr
           
protected  IIncrementalIngester ingester
           
protected  IJobDescription job
           
protected  java.lang.Long jobID
           
protected  IJobManager jobManager
           
 
Fields inherited from interface org.apache.manifoldcf.crawler.interfaces.IVersionActivity
_rcsid
 
Constructor Summary
WorkerThread.VersionActivity(java.lang.String connectionName, IRepositoryConnectionManager connMgr, IJobManager jobManager, IJobDescription job, IIncrementalIngester ingester, java.util.HashMap abortSet)
          Constructor.
 
Method Summary
 boolean beginEventSequence(java.lang.String eventName)
          Begin an event sequence.
 boolean checkDocumentIndexable(java.io.File localFile)
          Check whether a document is indexable by the currently specified output connector.
 void checkJobStillActive()
          Check whether current job is still active.
 boolean checkMimeTypeIndexable(java.lang.String mimeType)
          Check whether a mime type is indexable by the currently specified output connector.
 void completeEventSequence(java.lang.String eventName)
          Complete an event sequence.
 java.lang.String createConnectionSpecificString(java.lang.String simpleString)
          Create a connection-specific string from a simple string.
 java.lang.String createGlobalString(java.lang.String simpleString)
          Create a global string from a simple string.
 java.lang.String createJobSpecificString(java.lang.String simpleString)
          Create a job-based string from a simple string.
 void recordActivity(java.lang.Long startTime, java.lang.String activityType, java.lang.Long dataSize, java.lang.String entityIdentifier, java.lang.String resultCode, java.lang.String resultDescription, java.lang.String[] childIdentifiers)
          Record time-stamped information about the activity of the connector.
 java.lang.String[] retrieveParentData(java.lang.String localIdentifier, java.lang.String dataName)
          Retrieve data passed from parents to a specified child document.
 CharacterInput[] retrieveParentDataAsFiles(java.lang.String localIdentifier, java.lang.String dataName)
          Retrieve data passed from parents to a specified child document.
 void retryDocumentProcessing(java.lang.String localIdentifier)
          Abort processing a document (for sequencing reasons).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionName

protected java.lang.String connectionName

connMgr

protected IRepositoryConnectionManager connMgr

jobManager

protected IJobManager jobManager

jobID

protected java.lang.Long jobID

job

protected IJobDescription job

ingester

protected IIncrementalIngester ingester

abortSet

protected java.util.HashMap abortSet
Constructor Detail

WorkerThread.VersionActivity

public WorkerThread.VersionActivity(java.lang.String connectionName,
                                    IRepositoryConnectionManager connMgr,
                                    IJobManager jobManager,
                                    IJobDescription job,
                                    IIncrementalIngester ingester,
                                    java.util.HashMap abortSet)
Constructor.

Method Detail

checkMimeTypeIndexable

public boolean checkMimeTypeIndexable(java.lang.String mimeType)
                               throws ManifoldCFException,
                                      ServiceInterruption
Check whether a mime type is indexable by the currently specified output connector.

Specified by:
checkMimeTypeIndexable in interface IFingerprintActivity
Parameters:
mimeType - is the mime type to check, not including any character set specification.
Returns:
true if the mime type is indexable.
Throws:
ManifoldCFException
ServiceInterruption

checkDocumentIndexable

public boolean checkDocumentIndexable(java.io.File localFile)
                               throws ManifoldCFException,
                                      ServiceInterruption
Check whether a document is indexable by the currently specified output connector.

Specified by:
checkDocumentIndexable in interface IFingerprintActivity
Parameters:
localFile - is the local copy of the file to check.
Returns:
true if the document is indexable.
Throws:
ManifoldCFException
ServiceInterruption

recordActivity

public void recordActivity(java.lang.Long startTime,
                           java.lang.String activityType,
                           java.lang.Long dataSize,
                           java.lang.String entityIdentifier,
                           java.lang.String resultCode,
                           java.lang.String resultDescription,
                           java.lang.String[] childIdentifiers)
                    throws ManifoldCFException
Record time-stamped information about the activity of the connector.

Specified by:
recordActivity in interface IHistoryActivity
Parameters:
startTime - is either null or the time since the start of epoch in milliseconds (Jan 1, 1970). Every activity has an associated time; the startTime field records when the activity began. A null value indicates that the start time and the finishing time are the same.
activityType - is a string which is fully interpretable only in the context of the connector involved, which is used to categorize what kind of activity is being recorded. For example, a web connector might record a "fetch document" activity. Cannot be null.
dataSize - is the number of bytes of data involved in the activity, or null if not applicable.
entityIdentifier - is a (possibly long) string which identifies the object involved in the history record. The interpretation of this field will differ from connector to connector. May be null.
resultCode - contains a terse description of the result of the activity. The description is limited in size to 255 characters, and can be interpreted only in the context of the current connector. May be null.
resultDescription - is a (possibly long) human-readable string which adds detail, if required, to the result described in the resultCode field. This field is not meant to be queried on. May be null.
childIdentifiers - is a set of child entity identifiers associated with this activity. May be null.
Throws:
ManifoldCFException

retrieveParentData

public java.lang.String[] retrieveParentData(java.lang.String localIdentifier,
                                             java.lang.String dataName)
                                      throws ManifoldCFException
Retrieve data passed from parents to a specified child document.

Specified by:
retrieveParentData in interface IVersionActivity
Parameters:
localIdentifier - is the document identifier of the document we want the recorded data for.
dataName - is the name of the data items to retrieve.
Returns:
an array containing the unique data values passed from ALL parents. Note that these are in no particular order, and there will not be any duplicates.
Throws:
ManifoldCFException

retrieveParentDataAsFiles

public CharacterInput[] retrieveParentDataAsFiles(java.lang.String localIdentifier,
                                                  java.lang.String dataName)
                                           throws ManifoldCFException
Retrieve data passed from parents to a specified child document.

Specified by:
retrieveParentDataAsFiles in interface IVersionActivity
Parameters:
localIdentifier - is the document identifier of the document we want the recorded data for.
dataName - is the name of the data items to retrieve.
Returns:
an array containing the unique data values passed from ALL parents. Note that these are in no particular order, and there will not be any duplicates.
Throws:
ManifoldCFException

checkJobStillActive

public void checkJobStillActive()
                         throws ManifoldCFException,
                                ServiceInterruption
Check whether current job is still active. This method is provided to allow an individual connector that needs to wait on some long-term condition to give up waiting due to the job itself being aborted. If the connector should abort, this method will raise a properly-formed ServiceInterruption, which if thrown to the caller, will signal that the current versioning activity remains incomplete and must be retried when the job is resumed.

Specified by:
checkJobStillActive in interface IAbortActivity
Throws:
ManifoldCFException
ServiceInterruption

beginEventSequence

public boolean beginEventSequence(java.lang.String eventName)
                           throws ManifoldCFException
Begin an event sequence. This method should be called by a connector when a sequencing event should enter the "pending" state. If the event is already in that state, this method will return false, otherwise true. The connector has the responsibility of appropriately managing sequencing given the response status.

Specified by:
beginEventSequence in interface IEventActivity
Parameters:
eventName - is the event name.
Returns:
false if the event is already in the "pending" state.
Throws:
ManifoldCFException

completeEventSequence

public void completeEventSequence(java.lang.String eventName)
                           throws ManifoldCFException
Complete an event sequence. This method should be called to signal that an event is no longer in the "pending" state. This can mean that the prerequisite processing is completed, but it can also mean that prerequisite processing was aborted or cannot be completed. Note well: This method should not be called unless the connector is CERTAIN that an event is in progress, and that the current thread has the sole right to complete it. Otherwise, race conditions can develop which would be difficult to diagnose.

Specified by:
completeEventSequence in interface IEventActivity
Parameters:
eventName - is the event name.
Throws:
ManifoldCFException

retryDocumentProcessing

public void retryDocumentProcessing(java.lang.String localIdentifier)
                             throws ManifoldCFException
Abort processing a document (for sequencing reasons). This method should be called in order to cause the specified document to be requeued for later processing. While this is similar in some respects to the semantics of a ServiceInterruption, it is applicable to only one document at a time, and also does not specify any delay period, since it is presumed that the reason for the requeue is because of sequencing issues synchronized around an underlying event.

Specified by:
retryDocumentProcessing in interface IEventActivity
Parameters:
localIdentifier - is the document identifier to requeue
Throws:
ManifoldCFException

createGlobalString

public java.lang.String createGlobalString(java.lang.String simpleString)
Create a global string from a simple string.

Specified by:
createGlobalString in interface INamingActivity
Parameters:
simpleString - is the simple string.
Returns:
a global string.

createConnectionSpecificString

public java.lang.String createConnectionSpecificString(java.lang.String simpleString)
Create a connection-specific string from a simple string.

Specified by:
createConnectionSpecificString in interface INamingActivity
Parameters:
simpleString - is the simple string.
Returns:
a connection-specific string.

createJobSpecificString

public java.lang.String createJobSpecificString(java.lang.String simpleString)
Create a job-based string from a simple string.

Specified by:
createJobSpecificString in interface INamingActivity
Parameters:
simpleString - is the simple string.
Returns:
a job-specific string.