org.teiid.connector.basic
Class BasicConnection

java.lang.Object
  extended by org.teiid.connector.basic.BasicConnection
All Implemented Interfaces:
Connection

public abstract class BasicConnection
extends java.lang.Object
implements Connection

Provides a default implementation of a PoolAwareConnection for a Connector that supports global capabilities. Extensions of this class should implement createProcedureExecution(IProcedure, ExecutionContext, RuntimeMetadata) #createResultSetExecution(IProcedure, ExecutionContext, RuntimeMetadata) #createUpdateExecution(IProcedure, ExecutionContext, RuntimeMetadata) as necessary.


Constructor Summary
BasicConnection()
           
 
Method Summary
 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
 ProcedureExecution createProcedureExecution(IProcedure command, ExecutionContext executionContext, RuntimeMetadata metadata)
           
 ResultSetExecution createResultSetExecution(IQueryCommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
           
 UpdateExecution createUpdateExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.teiid.connector.api.Connection
close
 

Constructor Detail

BasicConnection

public BasicConnection()
Method Detail

createExecution

public Execution createExecution(ICommand command,
                                 ExecutionContext executionContext,
                                 RuntimeMetadata metadata)
                          throws ConnectorException
Description copied from interface: Connection
Create an execution object for the specified command

Specified by:
createExecution in interface Connection
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

createResultSetExecution

public ResultSetExecution createResultSetExecution(IQueryCommand command,
                                                   ExecutionContext executionContext,
                                                   RuntimeMetadata metadata)
                                            throws ConnectorException
Throws:
ConnectorException

createProcedureExecution

public ProcedureExecution createProcedureExecution(IProcedure command,
                                                   ExecutionContext executionContext,
                                                   RuntimeMetadata metadata)
                                            throws ConnectorException
Throws:
ConnectorException

createUpdateExecution

public UpdateExecution createUpdateExecution(ICommand command,
                                             ExecutionContext executionContext,
                                             RuntimeMetadata metadata)
                                      throws ConnectorException
Throws:
ConnectorException

isAlive

public boolean isAlive()
Description copied from interface: Connection
Called to determine whether the connection is open

Specified by:
isAlive in interface Connection
Returns:
true if open, false if there is a source error.

getCapabilities

public ConnectorCapabilities getCapabilities()
Description copied from interface: Connection
Get the capabilities of this connector. The capabilities affect what kinds of queries (and other commands) will be sent to the connector.

Specified by:
getCapabilities in interface Connection
Returns:
Connector capabilities, may return null if the Connector returns globally scoped capabilities Connector.getCapabilities()

closeCalled

public void closeCalled()
Description copied from interface: Connection
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.

Specified by:
closeCalled in interface Connection

setConnectorIdentity

public void setConnectorIdentity(ConnectorIdentity context)
                          throws ConnectorException
Description copied from interface: Connection
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.

Specified by:
setConnectorIdentity in interface Connection
Throws:
ConnectorException


Copyright © 2009. All Rights Reserved.