Class ContextImpl
- java.lang.Object
-
- org.apache.derby.iapi.services.context.ContextImpl
-
- All Implemented Interfaces:
Context
- Direct Known Subclasses:
ClassFactoryContext,CompilerContextImpl,DatabaseContextImpl,EmbedConnectionContext,GenericExecutionContext,GenericLanguageConnectionContext,GenericStatementContext,RAMTransactionContext,ServiceBootContext,SystemContext,XactContext,XATransactionState
public abstract class ContextImpl extends java.lang.Object implements Context
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
Fields Modifier and Type Field Description private ContextManagermyContextManagerprivate java.lang.StringmyIdName
-
Constructor Summary
Constructors Modifier Constructor Description protectedContextImpl(ContextManager cm, java.lang.String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBufferappendErrorInfo()ContextManagergetContextManager()Returns the context manager that has stored this context in its stack.java.lang.StringgetIdName()Returns the current id name associated with this context.booleanisLastHandler(int severity)Return whether or not this context is the "last" handler for a the specified severity level.voidpopMe()Pop myself of the context stack.voidpushMe()Push myself onto my context stack.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.services.context.Context
cleanupOnError
-
-
-
-
Field Detail
-
myIdName
private final java.lang.String myIdName
-
myContextManager
private final ContextManager myContextManager
-
-
Constructor Detail
-
ContextImpl
protected ContextImpl(ContextManager cm, java.lang.String id)
-
-
Method Detail
-
getContextManager
public final ContextManager getContextManager()
Description copied from interface:ContextReturns the context manager that has stored this context in its stack.- Specified by:
getContextManagerin interfaceContext- See Also:
Context.getContextManager()
-
getIdName
public final java.lang.String getIdName()
Description copied from interface:ContextReturns 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.
- Specified by:
getIdNamein interfaceContext- See Also:
Context.getIdName()
-
pushMe
public final void pushMe()
Description copied from interface:ContextPush myself onto my context stack.
-
popMe
public final void popMe()
Description copied from interface:ContextPop myself of the context stack.- Specified by:
popMein interfaceContext- See Also:
Context.popMe()
-
isLastHandler
public boolean isLastHandler(int severity)
Description copied from interface:ContextReturn 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.- Specified by:
isLastHandlerin interfaceContext- See Also:
Context.isLastHandler(int)
-
appendErrorInfo
public java.lang.StringBuffer appendErrorInfo()
-
-