org.apache.manifoldcf.agents.interfaces
Interface IOutputConnector

All Superinterfaces:
IConnector
All Known Implementing Classes:
BaseOutputConnector

public interface IOutputConnector
extends IConnector

This interface describes an instance of a connection between an engine that needs to output documents, and an output connector. Each instance of this interface is used in only one thread at a time. Connection Pooling on these kinds of objects is performed by the factory which instantiates connector objects from symbolic names and config parameters, and is pooled by these parameters. That is, a pooled connector handle is used only if all the connection parameters for the handle match. Implementers of this interface should provide a default constructor which has this signature: xxx(); Connector instances are either configured or not. If configured, they will persist in a pool, and be reused multiple times. Certain methods of a connector may be called before the connector is configured. This includes basically all methods that permit inspection of the connector's capabilities. The complete list is: The purpose of the output connector is to allow documents to be sent to their final destination (as far as Connector Framework is concerned).


Field Summary
static java.lang.String _rcsid
           
static int DOCUMENTSTATUS_ACCEPTED
          Document accepted
static int DOCUMENTSTATUS_REJECTED
          Document permanently rejected
 
Method Summary
 int addOrReplaceDocument(java.lang.String documentURI, java.lang.String outputDescription, RepositoryDocument document, java.lang.String authorityNameString, IOutputAddActivity activities)
          Add (or replace) a document in the output data store using the connector.
 boolean checkDocumentIndexable(java.io.File localFile)
          Pre-determine whether a document (passed here as a File object) is indexable by this connector.
 boolean checkMimeTypeIndexable(java.lang.String mimeType)
          Detect if a mime type is indexable or not.
 java.lang.String[] getActivitiesList()
          Return a list of activities that this connector generates.
 java.lang.String getOutputDescription(OutputSpecification spec)
          Get an output version string, given an output specification.
 void noteJobComplete(IOutputNotifyActivity activities)
          Notify the connector of a completed job.
 void outputSpecificationBody(IHTTPOutput out, OutputSpecification os, java.lang.String tabName)
          Output the specification body section.
 void outputSpecificationHeader(IHTTPOutput out, OutputSpecification os, java.util.ArrayList tabsArray)
          Output the specification header section.
 java.lang.String processSpecificationPost(IPostParameters variableContext, OutputSpecification os)
          Process a specification post.
 void removeDocument(java.lang.String documentURI, java.lang.String outputDescription, IOutputRemoveActivity activities)
          Remove a document using the connector.
 boolean requestInfo(Configuration output, java.lang.String command)
          Request arbitrary connector information.
 void viewSpecification(IHTTPOutput out, OutputSpecification os)
          View specification.
 
Methods inherited from interface org.apache.manifoldcf.core.interfaces.IConnector
check, clearThreadContext, connect, deinstall, disconnect, getConfiguration, install, outputConfigurationBody, outputConfigurationHeader, poll, processConfigurationPost, setThreadContext, viewConfiguration
 

Field Detail

_rcsid

static final java.lang.String _rcsid
See Also:
Constant Field Values

DOCUMENTSTATUS_ACCEPTED

static final int DOCUMENTSTATUS_ACCEPTED
Document accepted

See Also:
Constant Field Values

DOCUMENTSTATUS_REJECTED

static final int DOCUMENTSTATUS_REJECTED
Document permanently rejected

See Also:
Constant Field Values
Method Detail

getActivitiesList

java.lang.String[] getActivitiesList()
Return a list of activities that this connector generates. The connector does NOT need to be connected before this method is called.

Returns:
the set of activities.

requestInfo

boolean requestInfo(Configuration output,
                    java.lang.String command)
                    throws ManifoldCFException
Request arbitrary connector information. This method is called directly from the API in order to allow API users to perform any one of several connector-specific queries.

Parameters:
output - is the response object, to be filled in by this method.
command - is the command, which is taken directly from the API request.
Returns:
true if the resource is found, false if not. In either case, output may be filled in.
Throws:
ManifoldCFException

checkMimeTypeIndexable

boolean checkMimeTypeIndexable(java.lang.String mimeType)
                               throws ManifoldCFException,
                                      ServiceInterruption
Detect if a mime type is indexable or not. This method is used by participating repository connectors to pre-filter the number of unusable documents that will be passed to this output connector.

Parameters:
mimeType - is the mime type of the document.
Returns:
true if the mime type is indexable by this connector.
Throws:
ManifoldCFException
ServiceInterruption

checkDocumentIndexable

boolean checkDocumentIndexable(java.io.File localFile)
                               throws ManifoldCFException,
                                      ServiceInterruption
Pre-determine whether a document (passed here as a File object) is indexable by this connector. This method is used by participating repository connectors to help reduce the number of unmanageable documents that are passed to this output connector in advance of an actual transfer. This hook is provided mainly to support search engines that only handle a small set of accepted file types.

Parameters:
localFile - is the local file to check.
Returns:
true if the file is indexable.
Throws:
ManifoldCFException
ServiceInterruption

getOutputDescription

java.lang.String getOutputDescription(OutputSpecification spec)
                                      throws ManifoldCFException
Get an output version string, given an output specification. The output version string is used to uniquely describe the pertinent details of the output specification and the configuration, to allow the Connector Framework to determine whether a document will need to be output again. Note that the contents of the document cannot be considered by this method, and that a different version string (defined in IRepositoryConnector) is used to describe the version of the actual document. This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be necessary.

Parameters:
spec - is the current output specification for the job that is doing the crawling.
Returns:
a string, of unlimited length, which uniquely describes output configuration and specification in such a way that if two such strings are equal, the document will not need to be sent again to the output data store.
Throws:
ManifoldCFException

addOrReplaceDocument

int addOrReplaceDocument(java.lang.String documentURI,
                         java.lang.String outputDescription,
                         RepositoryDocument document,
                         java.lang.String authorityNameString,
                         IOutputAddActivity activities)
                         throws ManifoldCFException,
                                ServiceInterruption
Add (or replace) a document in the output data store using the connector. This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be necessary. The OutputSpecification is *not* provided to this method, because the goal is consistency, and if output is done it must be consistent with the output description, since that was what was partly used to determine if output should be taking place. So it may be necessary for this method to decode an output description string in order to determine what should be done.

Parameters:
documentURI - is the URI of the document. The URI is presumed to be the unique identifier which the output data store will use to process and serve the document. This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.
outputDescription - is the description string that was constructed for this document by the getOutputDescription() method.
document - is the document data to be processed (handed to the output data store).
authorityNameString - is the name of the authority responsible for authorizing any access tokens passed in with the repository document. May be null.
activities - is the handle to an object that the implementer of an output connector may use to perform operations, such as logging processing activity.
Returns:
the document status (accepted or permanently rejected).
Throws:
ManifoldCFException
ServiceInterruption

removeDocument

void removeDocument(java.lang.String documentURI,
                    java.lang.String outputDescription,
                    IOutputRemoveActivity activities)
                    throws ManifoldCFException,
                           ServiceInterruption
Remove a document using the connector. Note that the last outputDescription is included, since it may be necessary for the connector to use such information to know how to properly remove the document.

Parameters:
documentURI - is the URI of the document. The URI is presumed to be the unique identifier which the output data store will use to process and serve the document. This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.
outputDescription - is the last description string that was constructed for this document by the getOutputDescription() method above.
activities - is the handle to an object that the implementer of an output connector may use to perform operations, such as logging processing activity.
Throws:
ManifoldCFException
ServiceInterruption

noteJobComplete

void noteJobComplete(IOutputNotifyActivity activities)
                     throws ManifoldCFException,
                            ServiceInterruption
Notify the connector of a completed job. This is meant to allow the connector to flush any internal data structures it has been keeping around, or to tell the output repository that this is a good time to synchronize things. It is called whenever a job is either completed or aborted.

Parameters:
activities - is the handle to an object that the implementer of an output connector may use to perform operations, such as logging processing activity.
Throws:
ManifoldCFException
ServiceInterruption

outputSpecificationHeader

void outputSpecificationHeader(IHTTPOutput out,
                               OutputSpecification os,
                               java.util.ArrayList tabsArray)
                               throws ManifoldCFException,
                                      java.io.IOException
Output the specification header section. This method is called in the head section of a job page which has selected an output connection of the current type. Its purpose is to add the required tabs to the list, and to output any javascript methods that might be needed by the job editing HTML.

Parameters:
out - is the output to which any HTML should be sent.
os - is the current output specification for this job.
tabsArray - is an array of tab names. Add to this array any tab names that are specific to the connector.
Throws:
ManifoldCFException
java.io.IOException

outputSpecificationBody

void outputSpecificationBody(IHTTPOutput out,
                             OutputSpecification os,
                             java.lang.String tabName)
                             throws ManifoldCFException,
                                    java.io.IOException
Output the specification body section. This method is called in the body section of a job page which has selected an output connection of the current type. Its purpose is to present the required form elements for editing. The coder can presume that the HTML that is output from this configuration will be within appropriate , , and
tags. The name of the form is "editjob".

Parameters:
out - is the output to which any HTML should be sent.
os - is the current output specification for this job.
tabName - is the current tab name.
Throws:
ManifoldCFException
java.io.IOException

processSpecificationPost

java.lang.String processSpecificationPost(IPostParameters variableContext,
                                          OutputSpecification os)
                                          throws ManifoldCFException
Process a specification post. This method is called at the start of job's edit or view page, whenever there is a possibility that form data for a connection has been posted. Its purpose is to gather form information and modify the output specification accordingly. The name of the posted form is "editjob".

Parameters:
variableContext - contains the post data, including binary file-upload information.
os - is the current output specification for this job.
Returns:
null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page).
Throws:
ManifoldCFException

viewSpecification

void viewSpecification(IHTTPOutput out,
                       OutputSpecification os)
                       throws ManifoldCFException,
                              java.io.IOException
View specification. This method is called in the body section of a job's view page. Its purpose is to present the output specification information to the user. The coder can presume that the HTML that is output from this configuration will be within appropriate and tags.

Parameters:
out - is the output to which any HTML should be sent.
os - is the current output specification for this job.
Throws:
ManifoldCFException
java.io.IOException