Class ScriptContext
java.lang.Object
com.inductiveautomation.ignition.common.script.ScriptContext
The ScriptContext class provides a particular set of functions that can be used to pass default or assumed values to
 scripts, based on the context of the call. For example, it allows us to provide the default database connection name
 to gateway side scripts, which can differ based on where the call is coming from.
 
It is built around a threadlocal. The entity that is executing the scripting call can set any desired values, and then execute the call. Important: after the call, the caller should invoke clear(), in order to erase all settings, preventing any bleedover to other calls on the same thread.
Although any arbitrary properties can be set on the script context, a few common properties have been defined directly on the class with convenience functions for getting and setting them.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidclear()Clears all properties set in the current thread local.static Stringstatic Stringstatic Stringstatic Stringstatic ObjectGets the value of a key set on the script context.static com.inductiveautomation.ignition.common.tags.config.model.TagReferenceLocationstatic booleanisSet()static TagPathstatic voidSets the value of of a property on the script context.static voidsetDefaultDatasource(String value) static voidsetDefaultProject(String project) static voidsetDefaultTagProvider(String value) static voidsetDescription(String desc) static voidSets the root tag path for relative path calculations.static voidsetTagReferenceLocation(com.inductiveautomation.ignition.common.tags.config.model.TagReferenceLocation location) 
- 
Field Details- 
KEY_DEFAULT_DATASOURCE- See Also:
 
- 
KEY_DEFAULT_TAGPROVIDER- See Also:
 
- 
KEY_PARENT_PATH- See Also:
 
- 
KEY_PARENT_PATH2- See Also:
 
- 
KEY_DEFAULT_PROJECT- See Also:
 
- 
KEY_DESCRIPTION- See Also:
 
- 
KEY_TAG_REFERENCE_LOCATION- See Also:
 
 
- 
- 
Constructor Details- 
ScriptContextpublic ScriptContext()
 
- 
- 
Method Details- 
getGets the value of a key set on the script context. Returns null if the key is not defined.
- 
setSets the value of of a property on the script context.
- 
clearpublic static void clear()Clears all properties set in the current thread local. Entities using this class should be sure to call this function in a finally block to make sure all settings get cleaned up.
- 
isSetpublic static boolean isSet()
- 
defaultTagProvider
- 
setDefaultTagProvider
- 
defaultDatasource
- 
setDefaultDatasource
- 
relativeTagPathRoot
- 
description
- 
setDescription
- 
setRelativeTagPathRootSets the root tag path for relative path calculations. Should be the path to the folder which would contain the virtual tag.
- 
setDefaultProject
- 
defaultProject
- 
setTagReferenceLocationpublic static void setTagReferenceLocation(com.inductiveautomation.ignition.common.tags.config.model.TagReferenceLocation location) 
- 
getTagReferenceLocationpublic static com.inductiveautomation.ignition.common.tags.config.model.TagReferenceLocation getTagReferenceLocation()
 
-