JBoss.orgCommunity Documentation

Chapter 3. Connector API

3.1. Overview
3.2. Connector Lifecycle
3.2.1. Initialization
3.2.2. Starting and Stopping
3.3. Connections to Source
3.3.1. Obtaining connections
3.3.2. Releasing Connections
3.4. Executing Commands
3.4.1. Execution Modes
3.4.2. Synchronous Query Execution
3.4.3. Asynchronous Query Execution
3.4.4. Update Execution
3.4.5. Batched Update / Bulk Insert Execution
3.4.6. Procedure Execution
3.4.7. Command Completion
3.4.8. Command Cancellation

A component called the Connector Manager is controlling access to your connector. This chapter reviews the basics of how the Connector Manager interacts with your connector while leaving reference details and advanced topics to be covered in later chapters.

A custom connector must implement the following interfaces to connect and query an enterprise Data Source. These interfaces are in package called com.metamatrix.data.api:

The most important interfaces provided by Teiid to the connector are the following:

  • ConnectorEnvironment – an interface describing access to external resources for your connector.

  • ConnectorLogger – an interface for writing logging information to Teiid logs.

  • SecurityContext / ExecutionContext – interfaces defining the security information and execution context available to the connector when executing a command.

The Connector API uses a connection to obtain an execution interface for the command it is executing. Connectors may support any subset of the available execution modes. The execution modes are defined by constants in the ConnectorCapabilities.EXECUTION_MODE class. The following execution modes are available:

Following is a class diagram further defining the relationships between the execution interfaces:

All of the execution interfaces extend the base execution interface that defines how executions are cancelled and closed. SynchQueryExecution, AsynchQueryExecution, and ProcedureExecution all extend the BatchedExecution interface, which defines how batched results are returned from an execution.