public abstract class Connector extends java.lang.Object implements ConnectorInterface, ConnectorInterface, ConnectorInterface, com.exalead.mercury.component.CVComponent
Modifier and Type | Class and Description |
---|---|
protected static class |
Connector.ConnectorNameThreadFactory
A Thread factory that can have the name of spawned thread prefix customized.
|
Modifier and Type | Field and Description |
---|---|
protected ConnectorConfig |
config
Connector configuration.
|
static java.lang.String |
DEFAULT_SCAN_MODE
Default scan mode
|
protected PushAPI |
papi
Deprecated.
|
Constructor and Description |
---|
Connector(ConnectorConfig config)
Standard connector constructor
|
Connector(PushAPI papi,
ConnectorConfig config)
Deprecated.
This constructor is deprecated.
The preferred constructor is
Connector(ConnectorConfig) .
See the 5.1 -> 6.0 connector migration guide |
Modifier and Type | Method and Description |
---|---|
void |
callBeforeDestruction()
Override this method to do some task before the destruction of the
connector
|
void |
checkAbortingOperation()
Deprecated.
Use
checkAbortingOperation member function instead. |
void |
checkAbortingOperation(java.lang.String scanMode)
Checks the current connector status and, if an abort command was
sent, throws an ConnectorAbortingException exception.
|
protected void |
checkDataSourceAvailability()
Deprecated.
Provides the
CheckConnectivity introspection query
instead using the @{link IntrospectableComponent IntrospectableComponent} annotation. |
boolean |
checkSecurityTokens(java.lang.String uri,
java.lang.String[] securityTokensUser)
Check if a given user can access a given URI.
|
Document |
fetch(java.lang.String uri)
This method is used to retrieve document from the source when CloudView
product needs it.
|
Document |
fetch(java.lang.String uri,
java.lang.String[] securityTokens,
boolean shouldCheckSecurityTokens)
This method is used to retrieve document from the source when CloudView
product needs it.
|
ConnectorConfig |
getConnectorConfig()
Return the connector's configuration.
|
java.lang.String |
getConnectorName() |
MetaContainer |
getDocumentSecurityTokens(java.lang.String uri)
This method is used to retrieve security tokens of a document.
|
EndpointBuilder<? extends PushAPI> |
getEndpointBuilder()
A connector may require a specific end-point.
|
org.apache.log4j.Logger |
getLogger()
Get the root logger for this connector.
|
org.apache.log4j.Logger |
getLogger(java.lang.String suffix)
Get a sub-logger for this connector.
|
java.util.Set<java.lang.String> |
getScanModes() |
ConnectorState |
getState()
Deprecated.
use @{link
getState member function instead. |
ConnectorState |
getState(java.lang.String scanMode)
Get state of the connector.
|
ConnectorStatus |
getStatus()
Deprecated.
Use
getStatus member function instead. |
ConnectorStatus |
getStatus(java.lang.String scanMode)
Get status of the connector.
|
java.lang.Exception |
getStatusException()
Get exception of the connector which caused the connector to be in the
ConnectorStatus.ERROR state.
|
void |
init()
Initialization method called by connector framework after construction
|
void |
init(java.lang.String connectorName,
boolean useSeparateStates)
Internal initialization member method called by the connector framework.
|
void |
onScanAborted()
Deprecated.
Implement
onScanAborted member function instead. |
void |
onScanAborted(java.lang.String scanMode)
Called by the framework when scan abort is requested.
|
void |
onScanResumed()
Deprecated.
Use
onScanResumed member function instead. |
void |
onScanResumed(java.lang.String scanMode)
Called by the framework when scan resume is requested.
|
void |
onScanSuspended()
Deprecated.
Implement
onScanSuspended member function instead. |
void |
onScanSuspended(java.lang.String scanMode)
Called by the framework when scan suspend is requested.
|
void |
scan(PushAPI papi,
java.lang.String scanMode,
java.lang.Object scanModeConfig)
This method is used to push (or synchronize) all documents from the source
to CloudView product.
|
void |
scratch(PushAPI papi)
Clear connector state, default implementation:
removes documents previously sent by the connector from CloudView index.
clears checkpoints of the connector.
Unless the connector is persisting additional data, there is not point to
override this method.
|
void |
selfAbortScan(java.lang.String reason)
Deprecated.
Use
selfAbortScan(String) method instead. |
void |
selfAbortScan(java.lang.String scanMode,
java.lang.String reason)
Helper which can be called by the connector code to self-abort.
|
protected void |
synchronizeDocuments(SynchronizationMode mode)
Deprecated.
|
@Deprecated protected PushAPI papi
scan
method.protected ConnectorConfig config
public static final java.lang.String DEFAULT_SCAN_MODE
public Connector(ConnectorConfig config) throws java.lang.Exception
config
- A valid/filled configurationjava.lang.Exception
@Deprecated public Connector(PushAPI papi, ConnectorConfig config) throws java.lang.Exception
Connector(ConnectorConfig)
.
See the 5.1 -> 6.0 connector migration guidepapi
- PushAPI implementationconfig
- filled configurationjava.lang.Exception
@Deprecated protected void checkDataSourceAvailability() throws java.lang.Exception
CheckConnectivity
introspection query
instead using the @{link IntrospectableComponent IntrospectableComponent} annotation.java.lang.Exception
- if the data source is unavailable in the current
configuration state
This method is to be overridden to do source configuration check ; to
ensure that the source can provide data for reindexing@Deprecated protected void synchronizeDocuments(SynchronizationMode mode) throws java.lang.Exception
java.lang.Exception
public final java.util.Set<java.lang.String> getScanModes()
getScanModes
in interface ConnectorInterface
public void scan(PushAPI papi, java.lang.String scanMode, java.lang.Object scanModeConfig) throws java.lang.Exception
papi
- PushAPI used to dialog with CloudViewscanMode
- Type of scan to perform. Is always DEFAULT_SCAN_MODE
unless
the connector declares additional scan modes with ConnectorCapabilities
annotation.scanModeConfig
- Optional configuration given to the scanMode, according to ScanModeDefinition
annotation.java.lang.Exception
public Document fetch(java.lang.String uri, java.lang.String[] securityTokens, boolean shouldCheckSecurityTokens) throws java.lang.Exception
uri
- document identifier to retrievesecurityTokens
- Security tokens of the user querying the documentshouldCheckSecurityTokens
- If true, then the connector must send
the document according to the security tokens given in parameters. For example the
connector must return null if the user does not have credentials enough to view it,
or only send the partial content the user is allowed to access.java.lang.Exception
- The default implementation throws a NoSuchMethodException exception ;
(no preview nor fetch is possible in this case).public Document fetch(java.lang.String uri) throws java.lang.Exception
uri
- document identifier to retrievejava.lang.Exception
- The default implementation throws a NoSuchMethodException exception ;
(no preview nor fetch is possible in this case).public MetaContainer getDocumentSecurityTokens(java.lang.String uri) throws java.io.IOException
uri
- Uri of documentjava.io.IOException
public void scratch(PushAPI papi) throws java.lang.Exception
papi
- The PushAPI to dialog with CloudViewjava.lang.Exception
public ConnectorConfig getConnectorConfig()
public final ConnectorStatus getStatus(java.lang.String scanMode)
getStatus
in interface ConnectorInterface
scanMode
- Type of the scan in progressConnectorStatus}
,
#checkAbortingOperation(String) checkAbortingOperation} member function.
@Deprecated public ConnectorStatus getStatus()
getStatus
member function instead.ConnectorStatus
,
checkAbortingOperation()
public final ConnectorState getState(java.lang.String scanMode)
getState
in interface ConnectorInterface
scanMode
- Type of scan in progress@Deprecated public ConnectorState getState()
getState
member function instead.public void checkAbortingOperation(java.lang.String scanMode) throws ConnectorAbortingException
checkAbortingOperation
in interface ConnectorInterface
scanMode
- Type of scan in progress.
This function is a helper which can be called by connector. It is not
called by the framework.ConnectorAbortingException
@Deprecated public void checkAbortingOperation() throws ConnectorAbortingException
checkAbortingOperation
member function instead.ConnectorAbortingException
public java.lang.Exception getStatusException()
getStatusException
in interface ConnectorStatusExceptionInterface
public boolean checkSecurityTokens(java.lang.String uri, java.lang.String[] securityTokensUser)
uri
- ID of requested documentjava.io.IOException
public void onScanAborted(java.lang.String scanMode) throws java.lang.Exception
onScanAborted
in interface ConnectorInterface
scanMode
- The type of scan to abort.java.lang.Exception
@Deprecated public void onScanAborted() throws java.lang.Exception
onScanAborted
member function instead.ConnectorInterface
java.lang.Exception
public void onScanSuspended(java.lang.String scanMode) throws java.lang.Exception
onScanSuspended
in interface ConnectorInterface
scanMode
- The type of scan to suspend.java.lang.Exception
@Deprecated public void onScanSuspended() throws java.lang.Exception
onScanSuspended
member function instead.java.lang.Exception
public void onScanResumed(java.lang.String scanMode) throws java.lang.Exception
onScanResumed
in interface ConnectorInterface
scanMode
- The type of scan to resume.java.lang.Exception
@Deprecated public void onScanResumed() throws java.lang.Exception
onScanResumed
member function instead.java.lang.Exception
public void callBeforeDestruction() throws java.lang.Exception
java.lang.Exception
public java.lang.String getConnectorName()
getConnectorName
in interface ConnectorInterface
java.lang.Exception
- If the member method is called before the init()
method.public final void init(java.lang.String connectorName, boolean useSeparateStates) throws java.lang.Exception
useSeparateStates
- java.lang.Exception
public void init() throws java.lang.Exception
java.lang.Exception
public EndpointBuilder<? extends PushAPI> getEndpointBuilder()
EndPointBuilder
, or null
if no specific end-point builder is required.public org.apache.log4j.Logger getLogger()
public org.apache.log4j.Logger getLogger(java.lang.String suffix)
public void selfAbortScan(java.lang.String scanMode, java.lang.String reason)
selfAbortScan
in interface ConnectorInterface
scanMode
- scan to abort, given by the scan(PushAPI, String, Object)
method.reason
- the reason why the abort was issues ; may be null@Deprecated public void selfAbortScan(java.lang.String reason)
selfAbortScan(String)
method instead.reason
- the reason why the abort was issued ; may be @c nullCopyright © 2021 Dassault Systèmes, All Rights Reserved.