Package ortus.boxlang.runtime.context
Class RuntimeBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.RuntimeBoxContext
- All Implemented Interfaces:
Serializable,IBoxContext,IBoxAttachable
This context represents the context of the entire BoxLang Runtime. The runtime is persistent once
started, and can be used to process one or more "requests" for execution. The "server" scope here is
global and will be shared by all requests.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
IBoxContext.ScopeSearchResult -
Field Summary
FieldsFields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, nullIsUndefined, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new execution contextRuntimeBoxContext(IBoxContext parent) Creates a new execution context with a bounded execution template and parent context -
Method Summary
Modifier and TypeMethodDescriptionGet the contexual config struct.Get the default variable assignment scope for this contextGet a scope from the context.getScopeNearby(Key name, boolean shallow) Get a scope from the context.getVisibleScopes(IStruct scopes, boolean nearby, boolean shallow) -------------------------------------------------------------------------- Getters + Setters --------------------------------------------------------------------------voidregisterUDF(UDF udf, boolean override) Register a UDF with the local context choosing to override.Try to get the requested key from the unscoped scopescopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Try to get the requested key from the unscoped scopevoidstartup()This is an optional method on contexts which require initialization outside of its constructor In this case we do, since we want modules to collaborate to the runtime contextMethods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
canOutput, clearBuffer, computeAttachmentIfAbsent, findBaseTemplate, findBIF, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, flushBuffer, getApplicationContext, getAttachment, getAttachmentKeys, getBuffer, getComponents, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getFunctionStaticClass, getLogger, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getRequestContext, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, isDefined, navigateConfig, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, pushTemplate, pushTemplate, putAttachment, queryFindNearby, registerQueryLoop, registerUDF, 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
getApplicationCache, getApplicationName, registerUDF, shutdown
-
Field Details
-
serverScope
The variables scope
-
-
Constructor Details
-
RuntimeBoxContext
Creates a new execution context with a bounded execution template and parent context- Parameters:
parent- The parent context
-
RuntimeBoxContext
public RuntimeBoxContext()Creates a new execution context
-
-
Method Details
-
startup
public void startup()This is an optional method on contexts which require initialization outside of its constructor In this case we do, since we want modules to collaborate to the runtime context -
getVisibleScopes
-------------------------------------------------------------------------- Getters + Setters --------------------------------------------------------------------------- Specified by:
getVisibleScopesin interfaceIBoxContext- Overrides:
getVisibleScopesin classBaseBoxContext- Returns:
- A struct containing all contextual and lexically visible scopes
-
scopeFindNearby
public IBoxContext.ScopeSearchResult scopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Try to get the requested key from the unscoped scope- Specified by:
scopeFindNearbyin interfaceIBoxContext- Overrides:
scopeFindNearbyin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to return if the key is not foundshallow- true, do not delegate to parent or default scope if not foundforAssign- true, this is for an assignment operation- Returns:
- The value of the key if found
-
scopeFind
Try to get the requested key from the unscoped scope- Specified by:
scopeFindin interfaceIBoxContext- Overrides:
scopeFindin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to return if the key is not foundforAssign- true, this is for an assignment operation- Returns:
- The value of the key if found
-
getScope
Get a scope from the context. If not found, the parent context is asked. Don't search for scopes which are local to an execution context- Specified by:
getScopein interfaceIBoxContext- Overrides:
getScopein classBaseBoxContext- Parameters:
name- The name of the scope to get- Returns:
- The requested scope
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getScopeNearby
Get a scope from the context. If not found, the parent context is asked. Search all konwn scopes- Specified by:
getScopeNearbyin interfaceIBoxContext- Overrides:
getScopeNearbyin classBaseBoxContext- Parameters:
name- The name of the scope to getshallow- true, do not delegate to parent or default scope if not found- Returns:
- The requested scope
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
registerUDF
Description copied from class:BaseBoxContextRegister a UDF with the local context choosing to override.- Specified by:
registerUDFin interfaceIBoxContext- Overrides:
registerUDFin classBaseBoxContext- Parameters:
udf- The UDF to registeroverride- true, override any existing UDF with the same name
-
getDefaultAssignmentScope
Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScopein interfaceIBoxContext- Overrides:
getDefaultAssignmentScopein classBaseBoxContext- Returns:
- The scope reference to use
-
getConfig
Get the contexual config struct. Each context has a chance to add in config of their own to the struct, or override existing config with a new struct of their own design. It depends on whether the context wants its changes to exist for the rest of the entire request or only for code that executes in the current context and below.- Specified by:
getConfigin interfaceIBoxContext- Overrides:
getConfigin classBaseBoxContext- Returns:
- A struct of configuration
-