org.teiid.connector.api
Interface Connection

All Known Subinterfaces:
XAConnection, XMLConnection
All Known Implementing Classes:
BasicConnection, FileConnection, FileConnectionImpl, HTTPConnectionImpl, JDBCSourceConnection, JDBCSourceXAConnection, LDAPConnection, LoopbackConnection, ObjectConnection, SalesforceConnection, SoapConnection, SOAPConnectionImpl, TextConnection, XMLConnectionImpl, XMLSourceConnection

public interface Connection

Represents a connection to this connector. A connection will be obtained from the connector for every query that is executed, then closed after the query has completed.

If pooling is enabled, see PoolAwareConnection to optionally implement pooling specific behavior.


Method Summary
 void close()
          Release the connection.
 void closeCalled()
          Called by the pool to indicate that the connection was returned to the pool.
 Execution createExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
          Create an execution object for the specified command
 ConnectorCapabilities getCapabilities()
          Get the capabilities of this connector.
 boolean isAlive()
          Called to determine whether the connection is open
 void setConnectorIdentity(ConnectorIdentity context)
          Called by the pool when an existing connection is leased so that the underlying Connection may have it's identity switched to a different user.
 

Method Detail

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:
Connector capabilities, may return null if the Connector returns globally scoped capabilities Connector.getCapabilities()

createExecution

Execution createExecution(ICommand command,
                          ExecutionContext executionContext,
                          RuntimeMetadata metadata)
                          throws ConnectorException
Create an execution object for the specified command

Parameters:
command - the command
executionContext - Provides information about the context that this command is executing within, such as the identifiers for the MetaMatrix command being executed
metadata - Access to runtime metadata if needed to translate the command
Returns:
An execution object that MetaMatrix can use to execute the command
Throws:
ConnectorException

close

void close()
Release the connection. This will be called when MetaMatrix has completed using the connection for an execution.


isAlive

boolean isAlive()
Called to determine whether the connection is open

Returns:
true if open, false if there is a source error.

setConnectorIdentity

void setConnectorIdentity(ConnectorIdentity context)
                          throws ConnectorException
Called by the pool when an existing connection is leased so that the underlying Connection may have it's identity switched to a different user.

Parameters:
identity -
Throws:
ConnectorException

closeCalled

void closeCalled()
Called by the pool to indicate that the connection was returned to the pool. The actual close call will be made when the pool wants to purge this connection.



Copyright © 2009. All Rights Reserved.