All Packages    This Package  Previous  Next  

Class sqlj.runtime.ref.ConnectionContextImpl

java.lang.Object
   |
   +----sqlj.runtime.ref.ConnectionContextImpl

public abstract class ConnectionContextImpl
extends Object
The connection context impl class is an abstract implementation of the connection context interface. It does not implement the connection context interface directly, but rather just defines the connection context method implementations. Subclasses must be defined which provide the static methods and constructors described in the connection context documentation.

Generated context classes will extend this class and implement the connection context interface.

See Also:
ConnectionContext

Constructor Index

 o ConnectionContextImpl(ProfileGroup, Connection)
Creates a new connection context impl class with the given profile group and connection.
 o ConnectionContextImpl(ProfileGroup, ConnectionContext)
Creates a new connection context impl class with the given profile group which uses the same connection as that of the passed context.
 o ConnectionContextImpl(ProfileGroup, String, boolean)
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url.
 o ConnectionContextImpl(ProfileGroup, String, Properties, boolean)
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url and properties.
 o ConnectionContextImpl(ProfileGroup, String, String, String, boolean)
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url, user and password.

Method Index

 o close()
closes the context, its underlying connection and connected profiles.
 o close(boolean)
Releases all resources used in maintaining database state on this context.
 o finalize()
Calls the finalize method of the super and closes this context if it has not already been closed.
 o getConnectedProfile(Object)
Returns the connected profile associated with a profileKey for this connection context instance.
 o getConnection()
Returns the underlying connection for this connection context.
 o getExecutionContext()
Returns the default execution context used by this connection context.
 o isClosed()
Returns true if this context has been closed, false otherwise.

Constructors

 o ConnectionContextImpl
 protected ConnectionContextImpl(ProfileGroup profiles,
                                 Connection conn) throws SQLException
Creates a new connection context impl class with the given profile group and connection. The auto commit mode of the connection is used unchanged. Each subclass must define its own profile group that will manage the set of profiles associated with that context class.

Parameters:
profiles - the profile group for the context subclass.
conn - the underlying connection for this context instance.
Throws: SQLException
if the passed connection is null
 o ConnectionContextImpl
 protected ConnectionContextImpl(ProfileGroup profiles,
                                 String url,
                                 String user,
                                 String password,
                                 boolean autoCommit) throws SQLException
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url, user and password. Each subclass must define its own profile group that will manage the set of profiles associated with that context class.

Parameters:
profiles - the profile group for the context subclass.
url - the database url
user - the username
password - the user password
autoCommit - true if the connection should be created in auto-commit mode, false otherwise.
Throws: SQLException
the underlying connection could not be created.
See Also:
getConnection, setAutoCommit
 o ConnectionContextImpl
 protected ConnectionContextImpl(ProfileGroup profiles,
                                 String url,
                                 Properties info,
                                 boolean autoCommit) throws SQLException
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url and properties. Each subclass must define its own profile group that will manage the set of profiles associated with that context class.

Parameters:
profiles - the profile group for the context subclass.
url - the database url
properties - the properties for creating a connection
autoCommit - true if the connection should be created in auto-commit mode, false otherwise.
Throws: SQLException
the underlying connection could not be created.
See Also:
setAutoCommit, getConnection
 o ConnectionContextImpl
 protected ConnectionContextImpl(ProfileGroup profiles,
                                 String url,
                                 boolean autoCommit) throws SQLException
Creates a new connection context impl class with the given profile group and creates a new connection using the passed url. Each subclass must define its own profile group that will manage the set of profiles associated with that context class.

Parameters:
profiles - the profile group for the context subclass.
url - the database url
autoCommit - true if the connection should be created in auto-commit mode, false otherwise.
Throws: SQLException
the underlying connection could not be created.
See Also:
getConnection, setAutoCommit
 o ConnectionContextImpl
 protected ConnectionContextImpl(ProfileGroup profiles,
                                 ConnectionContext other) throws SQLException
Creates a new connection context impl class with the given profile group which uses the same connection as that of the passed context. The auto commit mode of the shared connection is unchanged. Each subclass must define its own profile group that will manage the set of profiles associated with that context class.

Parameters:
profiles - the profile group for the context subclass.
other - a connection context instance with which to share a connection.
Throws: SQLException
if the underlying connection is null
See Also:
getConnection

Methods

 o getConnectedProfile
 public ConnectedProfile getConnectedProfile(Object profileKey) throws SQLException
Returns the connected profile associated with a profileKey for this connection context instance.

Parameters:
profileKey - the key asscoiated with the desired profile.
Throws: IllegalArgumentException
if the profileKey is null or invalid.
Throws: SQLException
if a connected profile instance could not be created
See Also:
getConnectedProfile
 o close
 public void close() throws SQLException
closes the context, its underlying connection and connected profiles.

Throws: SQLException
if an error occurs while closing
See Also:
close
 o isClosed
 public boolean isClosed()
Returns true if this context has been closed, false otherwise.

See Also:
isClosed
 o getConnection
 public Connection getConnection()
Returns the underlying connection for this connection context.

See Also:
getConnection
 o close
 public void close(boolean closeConnection) throws SQLException
Releases all resources used in maintaining database state on this context.

Note: A context is automatically closed when it is garbage collected. A context closed in such a way does not close the underlying JDBC connection since it will also be automatically closed when it is garbage collected.

Parameters:
closeConnection - is true if the underlying Connection should also be closed.
Throws: SQLException
if unable to close the context
See Also:
close
 o getExecutionContext
 public ExecutionContext getExecutionContext()
Returns the default execution context used by this connection context. The default execution context is the execution context used if no explicit context is supplied during the execution of a particular sql operation.

Returns:
the default excution context
 o finalize
 protected void finalize() throws Throwable
Calls the finalize method of the super and closes this context if it has not already been closed. The underlying connection is not closed.

Throws: Throwable
if an error occurs during finalization
Overrides:
finalize in class Object

All Packages    This Package  Previous  Next