Application

public class Application extends AbstractIdleService
Known Direct Subclasses

Main object and access point for the SDK.

Every connector begins execution by creating an instance of this class and calling its start() method. This starts processing, triggering the SDK to begin making connector calls as configured in the configuration file.

Sample usage:

public static void main(String[] args) throws IOException, InterruptedException {
     Application application = new Application.Builder(
         new MyConnector(new MyRepository()), args).build();
     application.start();
   } 
 

Optional configuration parameter(s):

  • .INCREMENTAL_INTERVAL_SECONDS - Specifies the interval between scheduled incremental traversals (in seconds).
  • .TRAVERSE_ON_START - Specifies whether to run the traversal immediately at start up rather than waiting for the first interval to expire.
  • .POLL_INTERVAL_SECONDS - Specifies the interval between scheduled poll queue intervals (in seconds).
  • .TRAVERSE_INTERVAL_SECONDS - Specifies the interval between scheduled traversals (in seconds).
  • .RUN_ONCE - Specifies whether the connector should exit after a single traversal.

Nested Class Summary

class Application.AbstractApplicationHelper<C extends AbstractBuilder<C, T extends ConnectorContext>, S extends AbstractBuilder<S, T>, T> Helper class to make our class more testable: factory and util methods  
class Application.AbstractBuilder<B extends AbstractBuilder<B, H extends AbstractApplicationHelper, T extends ConnectorContext>, H, T>  
class Application.Builder Builder object for creating Application instance. 
class Application.ShutdownHook Runnable implementation to register with addShutdownHook(Thread)

Constant Summary

String INCREMENTAL_INTERVAL_SECONDS Configuration key for incremental traversal interval.
String POLL_INTERVAL_SECONDS Configuration key for interval between poll requests.
String RUN_ONCE Configuration key to specify if connector should exit after full traversal.
String TRAVERSE_INTERVAL_SECONDS Configuration key for full traversal intervals.
String TRAVERSE_ON_START Configuration key to indicate if traversal should be performed at start of the connector process.

Field Summary

protected static final ExceptionHandler DEFAULT_EXCEPTION_HANDLER
protected final Connector<T extends ConnectorContext> connector
protected ConnectorScheduler<T extends ConnectorContext> connectorScheduler
protected ConnectorScheduler.ShutdownHolder shutdownHolder
protected final AtomicBoolean started

Protected Constructor Summary

Application(AbstractBuilder<? extends AbstractBuilder, H, T> builder)

Public Method Summary

static void
setLogger(Logger logger)
Helper method to override default Logger used by Application implementation.
synchronized void
shutdown(String event)
Shutdown Connector in response to an event.
void
start()
Begins connector execution by initializing and starting the SDK.

Protected Method Summary

T
buildConnectorContext()
Returns a connector context.
void
void
T
void
startScheduler(T context)
void

Inherited Method Summary

Constants

public static final String INCREMENTAL_INTERVAL_SECONDS

Configuration key for incremental traversal interval.

Constant Value: "schedule.incrementalTraversalIntervalSecs"

public static final String POLL_INTERVAL_SECONDS

Configuration key for interval between poll requests.

Constant Value: "schedule.pollQueueIntervalSecs"

public static final String RUN_ONCE

Configuration key to specify if connector should exit after full traversal.

Constant Value: "connector.runOnce"

public static final String TRAVERSE_INTERVAL_SECONDS

Configuration key for full traversal intervals.

Constant Value: "schedule.traversalIntervalSecs"

public static final String TRAVERSE_ON_START

Configuration key to indicate if traversal should be performed at start of the connector process.

Constant Value: "schedule.performTraversalOnStart"

Fields

protected static final ExceptionHandler DEFAULT_EXCEPTION_HANDLER

protected final Connector<T extends ConnectorContext> connector

protected ConnectorScheduler<T extends ConnectorContext> connectorScheduler

protected ConnectorScheduler.ShutdownHolder shutdownHolder

protected final AtomicBoolean started

Protected Constructors

protected Application (AbstractBuilder<? extends AbstractBuilder, H, T> builder)

Parameters
builder

Public Methods

public static void setLogger (Logger logger)

Helper method to override default Logger used by Application implementation.

Parameters
logger to use

public synchronized void shutdown (String event)

Shutdown Connector in response to an event.

Parameters
event triggering shutdown.

public void start ()

Begins connector execution by initializing and starting the SDK.

This is the main entry point for the SDK. This method initializes all the objects used in traversing a repository and schedules the traversals based on the configuration parameters.

Throws
InterruptedException if aborted during start up

Protected Methods

protected T buildConnectorContext ()

Returns a connector context. Connectors that extend ConnectorContext, should override this method.

protected void shutDown ()

Throws
Exception

protected void startApplication ()

protected T startConnector ()

Throws
InterruptedException

protected void startScheduler (T context)

Parameters
context

protected void startUp ()

Throws
Exception

Send feedback about...

Cloud Search
Cloud Search