    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

##

ConnectionContextImpl(ProfileGroup, Connection)
  Creates a new connection context impl class with the given profile group and connection.
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.
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.
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.
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.

##

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

##

ConnectionContextImpl

     protected ConnectionContextImpl(ProfileGroup profiles,
                                     Connection conn)

  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.

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

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

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

ConnectionContextImpl

     protected ConnectionContextImpl(ProfileGroup profiles,
                                     ConnectionContext other)

  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.
  See Also:
    getConnection

##

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

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

isClosed

     public boolean isClosed()

  Returns true if this context has been closed, false otherwise.

  See Also:
    isClosed

getConnection

     public Connection getConnection()

  Returns the underlying connection for this connection context.

  See Also:
    getConnection

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

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

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