com.google.enterprise.adaptor
Class AbstractAdaptor

java.lang.Object
  extended by com.google.enterprise.adaptor.AbstractAdaptor
All Implemented Interfaces:
Adaptor
Direct Known Subclasses:
AdaptorTemplate, AdaptorWithCrawlTimeMetadataTemplate, CommandLineAdaptor, DbAdaptorTemplate, FileSystemAdaptor, FileSystemAdaptor, GroupDefinitionsFromCsv, GroupDefinitionsScaleTester, GroupDefinitionsWriter

public abstract class AbstractAdaptor
extends Object
implements Adaptor

Provides a reasonable default implementation for most Adaptor methods. Extending classes only need to implement Adaptor.getDocIds(com.google.enterprise.adaptor.DocIdPusher) and Adaptor.getDocContent(com.google.enterprise.adaptor.Request, com.google.enterprise.adaptor.Response).


Constructor Summary
AbstractAdaptor()
           
 
Method Summary
 void destroy()
          Shutdown and release resources of adaptor.
 void init(AdaptorContext context)
          Initialize adaptor with the current context.
 void initConfig(Config config)
          Provides the opportunity for the Adaptor to create new configuration values or override default values.
static Application main(Adaptor adaptor, String[] args)
          Standard main for all adaptors (including those not extending AbstractAdaptor).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.enterprise.adaptor.Adaptor
getDocContent, getDocIds
 

Constructor Detail

AbstractAdaptor

public AbstractAdaptor()
Method Detail

initConfig

public void initConfig(Config config)
Provides the opportunity for the Adaptor to create new configuration values or override default values. Only Config.addKey(java.lang.String, java.lang.String) should likely be called. The user's configuration will override any values set in this way. This method is called by main(com.google.enterprise.adaptor.Adaptor, java.lang.String[]) before Adaptor.init(com.google.enterprise.adaptor.AdaptorContext) is called.

This implementation does nothing.

Specified by:
initConfig in interface Adaptor

init

public void init(AdaptorContext context)
          throws Exception
Initialize adaptor with the current context. This is the ideal time to start any threads to do extra behind-the-scenes work. The context points to other useful objects that can be used at any time. For example, methods on DocIdPusher provided via AdaptorContext.getDocIdPusher() are allowed to be called whenever the Adaptor wishes. This allows doing event-based incremental pushes at any time.

The method is called at the end of GsaCommunicationHandler.start().

If you experience a fatal error during initialization, feel free to throw an Exception to cancel the startup process.

This implementation does nothing.

Specified by:
init in interface Adaptor
Throws:
Exception

destroy

public void destroy()
Shutdown and release resources of adaptor.

This implementation does nothing.

Specified by:
destroy in interface Adaptor

main

public static Application main(Adaptor adaptor,
                               String[] args)
Standard main for all adaptors (including those not extending AbstractAdaptor).

This method starts the HTTP server for serving doc contents, schedules sending DocIds on a schedule, and optionally sends DocIds on startup.