com.google.enterprise.adaptor
Class GsaCommunicationHandler

java.lang.Object
  extended by com.google.enterprise.adaptor.GsaCommunicationHandler

public final class GsaCommunicationHandler
extends Object

This class handles the communications with GSA.


Constructor Summary
GsaCommunicationHandler(Adaptor adaptor, Config config)
           
 
Method Summary
 boolean checkAndScheduleImmediatePushOfDocIds()
          Ensure there is a push running right now.
 boolean checkAndScheduleIncrementalPushOfDocIds()
          Perform an push of incremental changes.
 Adaptor getAdaptor()
          The adaptor instance being used.
 AdaptorContext setup(HttpServer server, HttpServer dashboardServer, String contextPrefix)
          Start services necessary for handling outgoing requests.
 void start()
          Start servicing incoming requests.
 boolean stop(long time, TimeUnit unit)
          Stops servicing incoming requests, allowing up to maxDelay seconds for things to shutdown.
 void teardown()
          Stop services necessary for handling outgoing requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GsaCommunicationHandler

public GsaCommunicationHandler(Adaptor adaptor,
                               Config config)
Method Detail

setup

public AdaptorContext setup(HttpServer server,
                            HttpServer dashboardServer,
                            String contextPrefix)
                     throws IOException,
                            InterruptedException
Start services necessary for handling outgoing requests. "" is used for contextPrefix if the passed value is null.

Throws:
IOException
InterruptedException

start

public void start()
Start servicing incoming requests. This makes use of the previously-provided HttpServers and configuration.


stop

public boolean stop(long time,
                    TimeUnit unit)
Stops servicing incoming requests, allowing up to maxDelay seconds for things to shutdown. After called, no requests will be sent to the Adaptor.

Returns:
true if shutdown cleanly, false if requests may still be processing

teardown

public void teardown()
Stop services necessary for handling outgoing requests. This call invalidates the AdaptorContext returned from setup(com.sun.net.httpserver.HttpServer, com.sun.net.httpserver.HttpServer, java.lang.String).


checkAndScheduleImmediatePushOfDocIds

public boolean checkAndScheduleImmediatePushOfDocIds()
Ensure there is a push running right now. This schedules a new push if one is not already running. Returns true if it starts a new push, and false otherwise.


checkAndScheduleIncrementalPushOfDocIds

public boolean checkAndScheduleIncrementalPushOfDocIds()
Perform an push of incremental changes. This works only for adaptors that support incremental polling (implements PollingIncrementalLister.


getAdaptor

public Adaptor getAdaptor()
The adaptor instance being used.