Connector
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Interface for user-specific implementation details of the connector.
Implementations must be thread-safe. Implementations are discouraged from keeping any state
locally except perhaps soft-state such as a connection cache.
Public Method Summary
abstract
void
|
destroy()
Shuts down and releases connector resources.
|
String
|
|
abstract
void
|
init(T context)
Initializes the connector with the current context.
|
abstract
void
|
saveCheckpoint(boolean isShutdown)
Saves checkpoint information such as current traversal position or incremental change tokens.
|
abstract
void
|
traverse()
Implements a connector-specific traversal strategy.
|
Public Methods
public
abstract
void
destroy
()
Shuts down and releases connector resources.
public
String
getDefaultId
()
Gets the default connector ID.
public
abstract
void
init
(T context)
Initializes the connector with the current context.
Initialization is the ideal time to start any threads to do extra behind-the-scenes work.
The context
allows access to other useful objects that can be used at any time.
If an unrecoverable fatal error occurs during initialization, throw a StartupException
to cancel the startup process. If a recoverable error occurs during
initialization, most Exception
instances other than StartupException
cause a
retry of initialization after a short delay.
Throws
Exception |
if errors occur during connector initialization
|
public
abstract
void
saveCheckpoint
(boolean isShutdown)
Saves checkpoint information such as current traversal position or incremental change tokens.
The checkpoint contents are implementation-specific as defined by the connector code. This
method is called during shutdown to allow the connector to save the current traversal state.
Parameters
isShutdown |
flag indicating a connector shutdown |
Throws
IOException |
if saving checkpoint fails. |
InterruptedException |
if an IO operations throws it
|
public
abstract
void
traverse
()
Throws
IOException |
if getting data access errors |
InterruptedException |
if an IO operations throws it
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# Connector\n\npublic interface **Connector** \n\n|---|---|---|\n| Known Indirect Subclasses [FullSyncIdentityConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/identity/FullSyncIdentityConnector), [FullTraversalConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/FullTraversalConnector), [IdentityConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/identity/IdentityConnector), [IndexingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnector), [ListingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ListingConnector) |-----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| | [FullSyncIdentityConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/identity/FullSyncIdentityConnector) | Connector implementation which periodically sync all users and groups with Google | | [FullTraversalConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/FullTraversalConnector) | Template connector that performs a full repository traversal and uploads every document. | | [IdentityConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/identity/IdentityConnector) | Interface for user-specific implementation details of the connector. | | [IndexingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/IndexingConnector) | Interface for user-specific implementation details of the connector. | | [ListingConnector](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/indexing/template/ListingConnector) | Template connector that performs complete repository list traversals. | |||\n\nInterface for user-specific implementation details of the connector.\n\nImplementations must be thread-safe. Implementations are discouraged from keeping any state\nlocally except perhaps soft-state such as a connection cache. \n\n### Public Method Summary\n\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [destroy](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#destroy())() Shuts down and releases connector resources. |\n| String | [getDefaultId](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#getDefaultId())() Gets the default connector ID. |\n| abstract void | [init](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#init(T))(T context) Initializes the connector with the current context. |\n| abstract void | [saveCheckpoint](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#saveCheckpoint(boolean))(boolean isShutdown) Saves checkpoint information such as current traversal position or incremental change tokens. |\n| abstract void | [traverse](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/Connector#traverse())() Implements a connector-specific traversal strategy. |\n\nPublic Methods\n--------------\n\n#### public abstract void\n**destroy**\n()\n\nShuts down and releases connector resources. \n\n#### public String\n**getDefaultId**\n()\n\nGets the default connector ID. \n\n#### public abstract void\n**init**\n(T context)\n\nInitializes the connector with the current context.\n\nInitialization is the ideal time to start any threads to do extra behind-the-scenes work.\nThe `context` allows access to other useful objects that can be used at any time.\n\nIf an unrecoverable fatal error occurs during initialization, throw a [StartupException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/StartupException) to cancel the startup process. If a recoverable error occurs during\ninitialization, most [Exception](/workspace/cloud-search/docs/reference/sdk/java/lang/Exception) instances other than [StartupException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/StartupException) cause a\nretry of initialization after a short delay. \n\n##### Parameters\n\n| context | [ConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ConnectorContext) instance for accessing framework objects |\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n##### Throws\n\n| Exception | if errors occur during connector initialization |\n|-----------|-------------------------------------------------|\n\n#### public abstract void\n**saveCheckpoint**\n(boolean isShutdown)\n\nSaves checkpoint information such as current traversal position or incremental change tokens.\n\nThe checkpoint contents are implementation-specific as defined by the connector code. This\nmethod is called during shutdown to allow the connector to save the current traversal state. \n\n##### Parameters\n\n| isShutdown | flag indicating a connector shutdown |\n|------------|--------------------------------------|\n\n##### Throws\n\n| IOException | if saving checkpoint fails. |\n| InterruptedException | if an IO operations throws it |\n|----------------------|-------------------------------|\n\n#### public abstract void\n**traverse**\n()\n\nImplements a connector-specific traversal strategy.\n\nThis method may take a while and implementations may want to call [sleep(long)](/workspace/cloud-search/docs/reference/sdk/java/lang/Thread#sleep(long))\noccasionally to reduce load.\n\nIf fatal errors occur, throw an [IOException](/workspace/cloud-search/docs/reference/sdk/java/io/IOException) or [RuntimeException](/workspace/cloud-search/docs/reference/sdk/java/lang/RuntimeException).\nIn the case of an error, the [ExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler) defined in [ConnectorContext](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ConnectorContext)\ndetermines if and when to retry. \n\n##### Throws\n\n| IOException | if getting data access errors |\n| InterruptedException | if an IO operations throws it |\n|----------------------|-------------------------------|"]]