Top Description Fields Constructors Methods
org.apache.derby.iapi.services.context

public abstract Class ContextImpl

extends Object
implements Context
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.context.Context
Known Direct Subclasses
org.apache.derby.iapi.services.context.SystemContext, org.apache.derby.impl.store.access.RAMTransactionContext, org.apache.derby.impl.db.DatabaseContextImpl, org.apache.derby.impl.services.monitor.ServiceBootContext, org.apache.derby.impl.sql.compile.CompilerContextImpl, org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext, org.apache.derby.impl.sql.conn.GenericStatementContext, org.apache.derby.impl.store.raw.xact.XactContext, org.apache.derby.impl.jdbc.EmbedConnectionContext, org.apache.derby.impl.jdbc.XATransactionState, org.apache.derby.iapi.services.loader.ClassFactoryContext, org.apache.derby.impl.sql.execute.GenericExecutionContext

Contexts are created and used to manage the execution environment. They provide a convenient location for storing globals organized by the module using the globals.

We provide this abstract class for other implementations to use so that they can simply add fields and operations on them. To be usable by the context manager, the subclasses must define CleanupOnError and call super() in any constructor.

Contexts assist in cleanup when errors are caught in the outer block.

Contexts implement the sanity interface to check and provide information about their contents.

Field Summary

Modifier and TypeField and Description
private final ContextManager
private final String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public StringBuffer
public final ContextManager
getContextManager()

Implements org.apache.derby.iapi.services.context.Context.getContextManager.

Returns the context manager that has stored this context in its stack.

public final String
getIdName()

Implements org.apache.derby.iapi.services.context.Context.getIdName.

Returns the current id name associated with this context.

public boolean
isLastHandler(int
The severity level
severity
)

Implements org.apache.derby.iapi.services.context.Context.isLastHandler.

Return whether or not this context is the "last" handler for a the specified severity level.

public final void
popMe()

Implements org.apache.derby.iapi.services.context.Context.popMe.

Pop myself of the context stack.

public final void
pushMe()

Implements org.apache.derby.iapi.services.context.Context.pushMe.

Push myself onto my context stack.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

myContextManagerback to summary
private final ContextManager myContextManager
myIdNameback to summary
private final String myIdName

Constructor Detail

ContextImplback to summary
protected ContextImpl(ContextManager cm, String id)

Method Detail

appendErrorInfoback to summary
public StringBuffer appendErrorInfo()
getContextManagerback to summary
public final ContextManager getContextManager()

Implements org.apache.derby.iapi.services.context.Context.getContextManager.

Doc from org.apache.derby.iapi.services.context.Context.getContextManager.

Returns the context manager that has stored this context in its stack.

Returns:ContextManager

the context manager

See Also
org.apache.derby.iapi.services.context.Context#getContextManager
getIdNameback to summary
public final String getIdName()

Implements org.apache.derby.iapi.services.context.Context.getIdName.

Doc from org.apache.derby.iapi.services.context.Context.getIdName.

Returns the current id name associated with this context. Contexts are placed into stacks by id, in a context manager. Null if the context is not assigned to an id. Contexts known by context managers are always assigned to an id.

A default Id name should be defined in each specific context interface as a static final field with the name CONTEXT_ID. For example, see org.apache.derby.iapi.sql.compile.CompilerContext.CONTEXT_ID.

Returns:String

the current id name

See Also
org.apache.derby.iapi.services.context.Context#getIdName
isLastHandlerback to summary
public boolean isLastHandler(int severity)

Implements org.apache.derby.iapi.services.context.Context.isLastHandler.

Doc from org.apache.derby.iapi.services.context.Context.isLastHandler.

Return whether or not this context is the "last" handler for a the specified severity level. Previously, the context manager would march through all of the contexts in cleanupOnError() and call each of their cleanupOnError() methods. That did not work with server side JDBC, especially for a StatementException, because outer contexts could get cleaned up incorrectly. This functionality is specific to the Language system. Any non-language system contexts should return ExceptionSeverity.NOT_APPLICABLE_SEVERITY.

Note

Both the LanguageConnectionContext and the JDBC Connection Context are interested in session level errors because they both have clean up to do. This method allows both of them to return false so that all such handlers under them can do their clean up.

Parameters
severity:int

The severity level

Returns:boolean

whether or not this context is the "last" handler for a severity level

See Also
Context#isLastHandler
popMeback to summary
public final void popMe()

Implements org.apache.derby.iapi.services.context.Context.popMe.

Doc from org.apache.derby.iapi.services.context.Context.popMe.

Pop myself of the context stack.

See Also
Context#popMe
pushMeback to summary
public final void pushMe()

Implements org.apache.derby.iapi.services.context.Context.pushMe.

Doc from org.apache.derby.iapi.services.context.Context.pushMe.

Push myself onto my context stack.