org.teiid.connector.api
Interface Connector

All Known Subinterfaces:
CachingConnector, StatefulConnector, XAConnector
All Known Implementing Classes:
AbstractCachingConnector, BasicConnector, Connector, IndexConnector, JDBCConnector, LDAPConnector, LoggingConnector, LoopbackConnector, ObjectConnector, OracleSpatialConnector, TextConnector, XMLConnector, XMLSourceConnector

public interface Connector

The primary entry point for a Connector. This interface should be implemented by the connector writer.

The Connector Manager will instantiate the implementation of this class by reflection in an isolated classloader. Once the class has been instantiated, the #initialize(ConnectorEnvironment) method will be called with all necessary connector properties. The #start() and stop() methods are lifecycle methods called when starting or stopping the connector.


Method Summary
 ConnectorIdentity createIdentity(ExecutionContext context)
          Create an identity object based on a security context.
 ConnectorCapabilities getCapabilities()
          Get the capabilities of this connector.
 Connection getConnection(ExecutionContext context)
          Obtain a connection with the connector.
 void start(ConnectorEnvironment environment)
          Start the connector with the connector environment.
 void stop()
          Stop the connector.
 

Method Detail

start

void start(ConnectorEnvironment environment)
           throws ConnectorException
Start the connector with the connector environment. The environment provides access to external resources the connector implementation may need to use.

Parameters:
environment - The connector environment, provided by the Connector Manager
Throws:
ConnectorException

stop

void stop()
Stop the connector. No commands will be executed on the connector when it is stopped.


getConnection

Connection getConnection(ExecutionContext context)
                         throws ConnectorException
Obtain a connection with the connector. The connection typically is associated with a particular security context. The connection is assumed to be pooled in the underlying source if pooling is necessary - the connection will be closed when execution has completed against it.

Parameters:
context - The context of the current user that will be using this connection, may be null if this connection is for an administrative operation.
Returns:
A Connection, created by the Connector
Throws:
ConnectorException - If an error occurred obtaining a connection

getCapabilities

ConnectorCapabilities getCapabilities()
Get the capabilities of this connector. The capabilities affect what kinds of queries (and other commands) will be sent to the connector.

Returns:
ConnectorCapabilities, may return null if the Connector provides User scoped capabilities Connection.getCapabilities()

createIdentity

ConnectorIdentity createIdentity(ExecutionContext context)
                                 throws ConnectorException
Create an identity object based on a security context. If single identity is not supported then an exception should be thrown when a null context is supplied. Implementors of this class may use a different implementation of the ConnectorIdentity interface to similarly affect pooling.

Parameters:
context - The context provided by the Connector Manager
Returns:
The associated connector identity
Throws:
ConnectorException - If a null context is not accepted or an error occurs while creating the identity.


Copyright © 2009. All Rights Reserved.