org.apache.manifoldcf.agents.output
Class BaseOutputConnector

java.lang.Object
  extended by org.apache.manifoldcf.core.connector.BaseConnector
      extended by org.apache.manifoldcf.agents.output.BaseOutputConnector
All Implemented Interfaces:
IOutputConnector, IConnector

public abstract class BaseOutputConnector
extends BaseConnector
implements IOutputConnector

This base class describes an instance of a connection between an output pipeline and the Connector Framework. 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 repository connectors 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(); Connectors 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.


Field Summary
static java.lang.String _rcsid
           
 
Fields inherited from class org.apache.manifoldcf.core.connector.BaseConnector
currentContext, params
 
Fields inherited from interface org.apache.manifoldcf.agents.interfaces.IOutputConnector
DOCUMENTSTATUS_ACCEPTED, DOCUMENTSTATUS_REJECTED
 
Constructor Summary
BaseOutputConnector()
           
 
Method Summary
 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 the list of activities that this connector supports (i.e.
 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.
 boolean requestInfo(Configuration output, java.lang.String command)
          Request arbitrary connector information.
 void viewSpecification(IHTTPOutput out, OutputSpecification os)
          View specification.
 
Methods inherited from class org.apache.manifoldcf.core.connector.BaseConnector
check, clearThreadContext, connect, deinstall, disconnect, getConfiguration, install, outputConfigurationBody, outputConfigurationHeader, poll, processConfigurationPost, setThreadContext, viewConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.manifoldcf.agents.interfaces.IOutputConnector
addOrReplaceDocument, getOutputDescription, removeDocument
 
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

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

BaseOutputConnector

public BaseOutputConnector()
Method Detail

getActivitiesList

public java.lang.String[] getActivitiesList()
Return the list of activities that this connector supports (i.e. writes into the log).

Specified by:
getActivitiesList in interface IOutputConnector
Returns:
the list.

requestInfo

public 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.

Specified by:
requestInfo in interface IOutputConnector
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

noteJobComplete

public 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.

Specified by:
noteJobComplete in interface IOutputConnector
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

checkMimeTypeIndexable

public 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.

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

checkDocumentIndexable

public 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.

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

outputSpecificationHeader

public 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.

Specified by:
outputSpecificationHeader in interface IOutputConnector
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

public 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".

Specified by:
outputSpecificationBody in interface IOutputConnector
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

public 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".

Specified by:
processSpecificationPost in interface IOutputConnector
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

public 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.

Specified by:
viewSpecification in interface IOutputConnector
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