Egeria Developer Guide - What is a Connector?

Connectors are plug-in Java classes that either perform an additional service, or, more typically, enable Egeria to integrate with a third party technology.

What is a connector?

The concept of a connector comes from the Open Connector Framework (OCF). The OCF provides a common framework for components that enable one technology to call another, arbitrary technology through a common interface. The implementation of the connector is dynamically loaded based on the connector’s configuration.

Through the OCF, we can “plug in” different technologies to Egeria. We also use the OCF to “plug in” support for open metadata into the client libraries used by applications to access data resources and services.

Figure 1 contrasts these two approaches:

Figure 1

Figure 1: How OCF connectors are used in Egeria

Many subsystems in Egeria’s OMAG Server Platform and Servers support the first approach. They define a specialized interface for the type of connector they support.

The second approach is used by organizations that want to make use of metadata directly in applications and tools - or to externalize the security and driver properties needed to call the data source or service. In this case the OCF Connector typically has the same interface as the data source’s client library (unless you can do better :). This minimized the learning curve for application developers. The configuration for the connector is stored in an open metadata server and the application uses the Asset Consumer OMAS client to request a new instance of the connector.
The application uses the returned connector instance to access the data source or server along with the metadata stored about it.

Connector configuration

The configuration for a connector is managed in a Connection object.

A Connection contains properties about the specific use of the connector, such as user Id and password, or parameters that control the scope or resources that should be made available to the connector. It links to an optional Endpoint and a mandatory ConnectorType object.

Connector types and endpoints can be reused in multiple connections.

Connection Structure

Figure 1: Structure of a connection object

Click for more information on Connection objects …

Connector factories

Each connector implementation has a factory object called a Connector Provider. The connector provider has two types of methods:

Click for more information on Connector Providers …

Inside the connector

Each connector has its own unique implementation that is structured around a simple lifecycle that is defined by the OCF. The OCF provides the interface for a connector called org.odpi.openmetadata.frameworks.connectors.Connector that has three methods: initialize, start and disconnect.

This connector interface supports the basic lifecycle of a connector. There are three phases:

Depending on the type of connector you are writing, there may be additional initialization calls occurring between the initialize and the start method. The connector may also support additional methods for its normal operation that can be called between the start and disconnect calls.

The OCF also provides the base class for a connector called org.odpi.openmetadata.frameworks.connectors.ConnectorBase. The ConnectorBase base class manages the lifecycle state of the connector.
For example, the default implementation of initialize in the ConnectorBase class stores the supplied unique instance identifier and connection values in protected variables called connectorInstanceId and connectionProperties respectively. If you override any of the initialize, start or disconnect methods, be sure to call at the start of your implementation to call the appropriate super class method so that the state is properly maintained.

Where to next?

License: CC BY 4.0, Copyright Contributors to the ODPi Egeria project.