You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by co...@apache.org on 2010/03/09 14:18:00 UTC

[CONF] Lucene Connector Framework > How to Write an Output Connector

Space: Lucene Connector Framework (http://cwiki.apache.org/confluence/display/CONNECTORS)
Page: How to Write an Output Connector (http://cwiki.apache.org/confluence/display/CONNECTORS/How+to+Write+an+Output+Connector)

Added by Karl Wright:
---------------------------------------------------------------------
h1. Writing an Output Connector

An output connector furnishes the mechanism by which content that has been fetched from a repository gets handed to a back-end repository for processing.  It also furnishes a mechanism for removing previously-processed content from that back end repository.

As is the case with all connectors under the LCF umbrella, an output connector consists of two parts:

* A class implementing an interface (in this case, _org.apache.lcf.agents.interfaces.IOutputConnector_)
* A set of JSP's that implement the crawler UI for the connector

h3. Implementing the Output Connector class

A very good place to start is to read the javadoc for the output connector interface.  You will note that the javadoc describes the usage and pooling model for a connector class pretty thoroughly.  It is very important to understand the model thoroughly in order to write reliable connectors!  Use of static variables, for one thing, must be done in a very careful way, to avoid issues that would be hard to detect with a cursory test.

The second thing to do is to examine some of the provided output connector implementations.  The GTS connector, the SOLR connector, and the Null Output connector all are output connectors which demonstrate (to some degree) the sorts of techniques you will need for an effective implementation.  You will also note that all of these connectors extend a framework-provided output connector base class, found at _org.apache.lcf.agents.output.BaseOutputConnector_.  This base class furnishes some basic bookkeeping logic for managing the connector pool, as well as default implementations of some of the less typical functionality a connector may have.  For example, connectors are allowed to have database tables of their own, which are instantiated when the connector is registered, and are torn down when the connector is removed.  This is, however, not very typical, and the base implementation reflects that.

TODO: More implementation details

h3. Implementing a set of Output Connector JSPs

The output connector class you write provides, through one of its methods, a symbolic name where the crawler UI will look for output connector UI components.  Your components will therefore have the following path, relative to the crawler UI web application:

_output/<connector_symbolic_name>_

For an output connector, you need to furnish the following JSPs:

|| JSP name || Where it fits ||
| headerconfig.jsp | Called during the header section of output connector configuration editing page |
| editconfig.jsp | Called during the body section of the output connector configuration editing page |
| postconfig.jsp | Called when configuration editing page is posted, either on a repost or on a save |
| viewconfig.jsp | Called when the connection configuration is being viewed |
| headerspec.jsp | Called during the header section of a job definition editing page, for which this output connector has been selected |
| editspec.jsp | Called during the body section of a job definition editing page, for which this output connector has been selected |
| postspec.jsp | Called whenever a job definition that uses this output connector is posted, either for a repost or a save |
| viewspec.jsp | Called when a job definition that uses this output connector is viewed |

TODO: More implementation details


Change your notification preferences: http://cwiki.apache.org/confluence/users/viewnotifications.action