Class ConnectorBase
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
- All Implemented Interfaces:
SecureConnectorExtension
- Direct Known Subclasses:
ApacheAtlasRESTConnector
,BasicFileStoreConnector
,DataEngineConnectorBase
,DataFolderConnector
,DiscoveryService
,GovernanceActionServiceConnector
,IntegrationConnectorBase
,JDBCResourceConnector
,LineageGraphConnector
,OMAGServerConfigStoreConnectorBase
,OMRSAuditLogStoreConnectorBase
,OMRSCohortRegistryStoreConnectorBase
,OMRSRepositoryConnector
,OMRSRepositoryEventMapperConnector
,OMRSTopicConnector
,OpenMetadataArchiveStoreConnector
,OpenMetadataPlatformSecurityConnector
,OpenMetadataServerSecurityConnector
,OpenMetadataTopicConnector
,OpenMetadataTopicConsumerBase
,RepositoryGovernanceServiceConnector
,RESTClientConnector
,SecretsStoreConnector
The ConnectorBase is an implementation of the Connector interface.
Connectors are client-side interfaces to assets such as data stores, data sets, APIs, analytical functions. They handle the communication with the server that hosts the assets, along with the communication with the metadata server to serve up metadata about the assets, and support for an audit log for the caller to log its activity.
Each connector implementation is paired with a connector provider. The connector provider is the factory for connector instances.
The Connector interface defines that a connector instance should be able to return a unique identifier, a connection object and a metadata properties object for its connected asset. These are supplied to the connector during its initialization.
The ConnectorBase base class implements all the methods required by the Connector interface. Each specific implementation of a connector then extends this interface to add the methods to work with the particular type of asset it supports. For example, a JDBC connector would add the standard JDBC SQL interface, the OMRS Connectors add the metadata repository management APIs...
Connectors are client-side interfaces to assets such as data stores, data sets, APIs, analytical functions. They handle the communication with the server that hosts the assets, along with the communication with the metadata server to serve up metadata about the assets, and support for an audit log for the caller to log its activity.
Each connector implementation is paired with a connector provider. The connector provider is the factory for connector instances.
The Connector interface defines that a connector instance should be able to return a unique identifier, a connection object and a metadata properties object for its connected asset. These are supplied to the connector during its initialization.
The ConnectorBase base class implements all the methods required by the Connector interface. Each specific implementation of a connector then extends this interface to add the methods to work with the particular type of asset it supports. For example, a JDBC connector would add the standard JDBC SQL interface, the OMRS Connectors add the metadata repository management APIs...
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
ProtectedConnection provides a subclass to Connection in order to extract protected values from the connection in order to supply them to the Connector implementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConnectedAssetProperties
protected Connection
protected ConnectionProperties
protected String
protected Map<String,
SecretsStoreConnector> -
Constructor Summary
ConstructorsConstructorDescriptionTypical Constructor: Connectors should always have a constructor requiring no parameters and perform initialization in the initialize method. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Free up any resources held since the connector is no longer needed.protected void
disconnectConnectors
(List<Connector> activeConnectors) Disconnect all of the connectors in the supplied list.boolean
Provide a common implementation of equals for all OCF Connector Provider objects.getConnectedAssetProperties
(String userId) Returns the properties that contain the metadata for the asset.Returns the connection object that was used to create the connector instance.Returns the unique connector instance id that assigned to the connector instance when it was created.int
hashCode()
Provide a common implementation of hashCode for all OCF Connector objects.void
initialize
(String connectorInstanceId, ConnectionProperties connectionProperties) Call made by the ConnectorProvider to initialize the Connector with the base services.void
initializeConnectedAssetProperties
(ConnectedAssetProperties connectedAssetProperties) Set up the connected asset properties object.void
initializeSecretsStoreConnector
(String displayName, SecretsStoreConnector secretsStoreConnector) Set up information about an embedded connector that this connector can use to support secure access to its resources.boolean
isActive()
Return a flag indicating whether the connector is active.void
start()
Indicates that the connector is completely configured and can begin processing.toString()
Standard toString method.Methods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, setStatisticProperty, setStatisticTimestamp
-
Field Details
-
connectorInstanceId
-
connectionProperties
-
connectionBean
-
connectedAssetProperties
-
secretsStoreConnectorMap
-
-
Constructor Details
-
ConnectorBase
public ConnectorBase()Typical Constructor: Connectors should always have a constructor requiring no parameters and perform initialization in the initialize method.
-
-
Method Details
-
initialize
Call made by the ConnectorProvider to initialize the Connector with the base services.- Specified by:
initialize
in classConnector
- Parameters:
connectorInstanceId
- unique id for the connector instance useful for messages etcconnectionProperties
- POJO for the configuration used to create the connector.
-
getConnectorInstanceId
Returns the unique connector instance id that assigned to the connector instance when it was created. It is useful for error and audit messages.- Specified by:
getConnectorInstanceId
in classConnector
- Returns:
- guid for the connector instance
-
getConnection
Returns the connection object that was used to create the connector instance. Its contents are never refreshed during the lifetime of the connector instance, even if the connection information is updated or removed from the originating metadata repository.- Specified by:
getConnection
in classConnector
- Returns:
- connection properties object
-
initializeConnectedAssetProperties
Set up the connected asset properties object. This provides the known metadata properties stored in one or more metadata repositories. The properties are populated whenever getConnectedAssetProperties() is called.- Specified by:
initializeConnectedAssetProperties
in classConnector
- Parameters:
connectedAssetProperties
- properties of the connected asset
-
initializeSecretsStoreConnector
public void initializeSecretsStoreConnector(String displayName, SecretsStoreConnector secretsStoreConnector) Set up information about an embedded connector that this connector can use to support secure access to its resources.- Specified by:
initializeSecretsStoreConnector
in interfaceSecureConnectorExtension
- Parameters:
displayName
- name of the secrets storesecretsStoreConnector
- an embedded secrets store connector
-
getConnectedAssetProperties
public ConnectedAssetProperties getConnectedAssetProperties(String userId) throws PropertyServerException, UserNotAuthorizedException Returns the properties that contain the metadata for the asset. The asset metadata is retrieved from the metadata repository and cached in the ConnectedAssetProperties object each time the getConnectedAssetProperties method is requested by the caller. Once the ConnectedAssetProperties object has the metadata cached, it can be used to access the asset property values many times without a return to the metadata repository. The cache of metadata can be refreshed simply by calling this getConnectedAssetProperties() method again.- Specified by:
getConnectedAssetProperties
in classConnector
- Parameters:
userId
- userId of requesting user- Returns:
- ConnectedAssetProperties connected asset properties
- Throws:
PropertyServerException
- indicates a problem retrieving properties from a metadata repositoryUserNotAuthorizedException
- indicates that the user is not authorized to access the asset properties.
-
start
Indicates that the connector is completely configured and can begin processing.- Specified by:
start
in classConnector
- Throws:
ConnectorCheckedException
- there is a problem within the connector.
-
disconnect
Free up any resources held since the connector is no longer needed.- Specified by:
disconnect
in classConnector
- Throws:
ConnectorCheckedException
- there is a problem within the connector.
-
disconnectConnectors
Disconnect all of the connectors in the supplied list. Any failures are ignored. This method is typically used by virtual connectors to disconnect their embedded connectors.- Parameters:
activeConnectors
- connectors to disconnect.
-
isActive
public boolean isActive()Return a flag indicating whether the connector is active. This means it has been started and not yet disconnected.- Returns:
- isActive flag
-
hashCode
public int hashCode()Provide a common implementation of hashCode for all OCF Connector objects. The UUID is unique and is randomly assigned and so its hashCode is as good as anything to describe the hash code of the connector object. -
equals
Provide a common implementation of equals for all OCF Connector Provider objects. The UUID is unique and is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the connector provider object. -
toString
Standard toString method.
-