Package ortus.boxlang.runtime.context
Class ThreadBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.ThreadBoxContext
- All Implemented Interfaces:
Serializable,IBoxContext,IJDBCCapableContext,IBoxAttachable
This context represents the context of any function execution in BoxLang
It encapsulates the arguments scope and local scope and has a reference to
the function being invoked.
This context is extended for use with both UDFs and Closures as well
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
IBoxContext.ScopeSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IScopeThe thread local scopeprotected IScopeThe parent's this scopeprotected ThreadThe Threadprotected KeyThe BoxLang name of the thread as registered in the thread manager.protected IScopeThe parent's variables scopeFields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionThreadBoxContext(IBoxContext parent, RequestThreadManager threadManager, Key threadName) Creates a new execution context with a bounded function instance and parent context -
Method Summary
Modifier and TypeMethodDescriptionGet the ConnectionManager, which is the central point for managing database connections and transactions.Get the default variable assignment scope for this contextLook for a scope by namegetScopeNearby(Key name, boolean shallow) Look for a "nearby" scope by nameGet the threadgetVisibleScopes(IStruct scopes, boolean nearby, boolean shallow) This is mostly for the debugger.voidregisterUDF(UDF udf) Register a UDF with the local context.Search for a variable in scopesscopeFindNearby(Key key, IScope defaultScope, boolean shallow) Search for a variable in "nearby" scopesSet the threadvoidShutdown the ConnectionManager and release any resources.Methods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
canOutput, clearBuffer, findBaseTemplate, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, flushBuffer, getAttachment, getAttachmentKeys, getBuffer, getComponents, getConfig, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, pushTemplate, putAttachment, queryFindNearby, registerQueryLoop, removeAttachment, removeParentContext, rethrow, scopeFindNearby, setParent, unregisterQueryLoop, unwrapQueryColumn, writeToBuffer, writeToBufferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ortus.boxlang.runtime.context.IBoxContext
startup
-
Field Details
-
localScope
The thread local scope -
variablesScope
The parent's variables scope -
thisScope
The parent's this scope -
thread
The Thread -
threadName
The BoxLang name of the thread as registered in the thread manager.
-
-
Constructor Details
-
ThreadBoxContext
Creates a new execution context with a bounded function instance and parent context- Parameters:
parent- The parent contextthreadManager- The thread managerthreadName- The name of the thread
-
-
Method Details
-
setThread
Set the thread- Returns:
- THis context
-
getVisibleScopes
Description copied from class:BaseBoxContextThis is mostly for the debugger. It returns all visible scopes from this context.- Specified by:
getVisibleScopesin interfaceIBoxContext- Overrides:
getVisibleScopesin classBaseBoxContext- Returns:
- A struct containing all contextual and lexically visible scopes
-
scopeFindNearby
Search for a variable in "nearby" scopes- Specified by:
scopeFindNearbyin interfaceIBoxContext- Overrides:
scopeFindNearbyin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to use if the key is not foundshallow- Whether to search only the "nearby" scopes or all scopes- Returns:
- The search result
-
scopeFind
Search for a variable in scopes- Specified by:
scopeFindin interfaceIBoxContext- Overrides:
scopeFindin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to use if the key is not found- Returns:
- The search result
-
getScope
Look for a scope by name- Specified by:
getScopein interfaceIBoxContext- Overrides:
getScopein classBaseBoxContext- Parameters:
name- The name of the scope to look for- Returns:
- The scope reference to use
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getScopeNearby
Look for a "nearby" scope by name- Specified by:
getScopeNearbyin interfaceIBoxContext- Overrides:
getScopeNearbyin classBaseBoxContext- Parameters:
name- The name of the scope to look forshallow- true, do not delegate to parent or default scope if not found- Returns:
- The scope reference to use
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getDefaultAssignmentScope
Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScopein interfaceIBoxContext- Overrides:
getDefaultAssignmentScopein classBaseBoxContext- Returns:
- The scope reference to use
-
registerUDF
Description copied from class:BaseBoxContextRegister a UDF with the local context.- Specified by:
registerUDFin interfaceIBoxContext- Overrides:
registerUDFin classBaseBoxContext- Parameters:
udf- The UDF to register
-
getThread
Get the thread- Returns:
- The thread
-
getConnectionManager
Get the ConnectionManager, which is the central point for managing database connections and transactions.- Specified by:
getConnectionManagerin interfaceIJDBCCapableContext
-
shutdownConnections
public void shutdownConnections()Shutdown the ConnectionManager and release any resources.- Specified by:
shutdownConnectionsin interfaceIJDBCCapableContext
-