Package org.qdl_lang.state
Class State
- 
- All Implemented Interfaces:
- edu.uiuc.ncsa.security.core.Logable,- edu.uiuc.ncsa.security.util.scripting.StateInterface,- Serializable,- QDLConstants
 
 public class State extends FunctionState implements QDLConstants This is a facade for the various stateful components we have to track. Represents the internal state of the system.Created by Jeff Gaynor 
 on 1/21/20 at 7:25 AM- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.qdl_lang.state.VariableStateVariableState.CyclicalError, VariableState.ResolveState
 - 
Nested classes/interfaces inherited from class org.qdl_lang.state.AbstractStateAbstractState.QDLStackTraceElement
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static FStackextrinsicFuncsstatic VStackextrinsicVars- 
Fields inherited from class org.qdl_lang.state.VariableStateEXTRINSIC_MARKER, int_regex, typeSafetyMode, var_regex
 - 
Fields inherited from class org.qdl_lang.state.NamespaceAwareStateNS_DELIMITER, RESERVED_NAMESPACE
 - 
Fields inherited from class org.qdl_lang.state.ModuleStateMTemplates
 - 
Fields inherited from class org.qdl_lang.state.AbstractStateINTRINSIC_PREFIX, libPath, scriptArgs
 - 
Fields inherited from interface org.qdl_lang.state.QDLConstantsALL_CHARS, ALPHA_CHARS, ASCII_CHARS, FUNCTION_REFERENCE_MARKER, FUNCTION_REFERENCE_MARKER2, GREEK_CHARS, JSON_QDL_NULL, KEYWORDS, RESERVED_FALSE, RESERVED_NULL, RESERVED_NULL_SET, RESERVED_TRUE, STEM_PATH_MARKER, STEM_PATH_MARKER2, SYS_ASSERT_CODE_SYSTEM_ERROR, SYS_BOOT, SYS_BOOT_BOOT_SCRIPT, SYS_BOOT_CONFIG_FILE, SYS_BOOT_CONFIG_NAME, SYS_BOOT_LOG_FILE, SYS_BOOT_LOG_NAME, SYS_BOOT_QDL_HOME, SYS_BOOT_RESTRICTED_IO_MODE, SYS_BOOT_SERVER_MODE, SYS_CODEC_ALGORITHMS, SYS_CODEC_B16CODE, SYS_CODEC_B32CODE, SYS_CODEC_B64CODE, SYS_CODEC_CSV, SYS_CODEC_ECMA, SYS_CODEC_HTML3, SYS_CODEC_HTML4, SYS_CODEC_JAVA, SYS_CODEC_JSON, SYS_CODEC_QDL_ENCODE, SYS_CODEC_URLCODE, SYS_CODEC_VENCODE, SYS_CODEC_XML_1_0, SYS_CODEC_XML_1_1, SYS_CODEC_XSI, SYS_DETOKENIZE_APPEND, SYS_DETOKENIZE_OMIT_DANGLING_DELIMITER, SYS_DETOKENIZE_PREPEND, SYS_DETOKENIZE_TYPE, SYS_ERROR_CODE_DEFAULT_USER_ERROR, SYS_ERROR_CODE_SYSTEM_ERROR, SYS_ERROR_CODES, SYS_FILE_TYPE_BINARY, SYS_FILE_TYPE_INIT, SYS_FILE_TYPE_NO_LIST_INIT, SYS_FILE_TYPE_STEM, SYS_FILE_TYPE_STRING, SYS_FILE_TYPES, SYS_HASH_ALGORITHMS, SYS_INFO_CLASS_PATH, SYS_INFO_INIT_MEMORY, SYS_INFO_JVM_VERSION, SYS_INFO_OS, SYS_INFO_OS_ARCHITECTURE, SYS_INFO_OS_NAME, SYS_INFO_OS_VERSION, SYS_INFO_QDL_HOME_DIR, SYS_INFO_SYSTEM, SYS_INFO_SYSTEM_PROCESSORS, SYS_INFO_USER, SYS_INFO_USER_HOME_DIR, SYS_INFO_USER_INVOCATION_DIR, SYS_LOG_ERROR, SYS_LOG_INFO, SYS_LOG_LEVELS, SYS_LOG_NONE, SYS_LOG_SEVERE, SYS_LOG_TRACE, SYS_LOG_WARN, SYS_MODULE_IMPORT_MODES, SYS_QDL_BUILD, SYS_QDL_BUILD_CLASS_PATH, SYS_QDL_BUILD_VERSION, SYS_QDL_VERSION, SYS_QDL_VERSION_BUILD_JDK, SYS_QDL_VERSION_BUILD_NUMBER, SYS_QDL_VERSION_BUILD_TIME, SYS_QDL_VERSION_CREATED_BY, SYS_SCRIPTS_PATH, SYS_VAR_TYPE_BOOLEAN, SYS_VAR_TYPE_CHARACTER_MAP, SYS_VAR_TYPE_CHARACTERS, SYS_VAR_TYPE_DECIMAL, SYS_VAR_TYPE_INTEGER, SYS_VAR_TYPE_NULL, SYS_VAR_TYPE_RESERVED, SYS_VAR_TYPE_SET, SYS_VAR_TYPE_STEM, SYS_VAR_TYPE_STRING, SYS_VAR_TYPE_UNDEFINED, SYS_VAR_TYPES, UNICODE_CHARS, URI_AUTHORITY, URI_FIELDS, URI_FRAGMENT, URI_HOST, URI_PATH, URI_PORT, URI_QUERY, URI_SCHEME, URI_SCHEME_SPECIFIC_PART, URI_USER_INFO
 
- 
 - 
Constructor SummaryConstructors Constructor Description State()This is needed for XML deserialization and makes dummy state for everything, assuming the deserializer will replace it all.State(VStack vStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, FStack<? extends FTable<? extends FKey,? extends FunctionRecordInterface>> ftStack, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade, boolean isServerMode, boolean isRestrictedIO, boolean assertionsOn)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddJSONtoState(net.sf.json.JSONObject jsonObject, String tag, XStack xStack, SerializationState serializationState)voidaddLibEntries(String libraryKey, QDLStem classPaths)Adds a list of classpath to the info().lib key entry.voidaddLibEntry(String libraryKey, String moduleKey, String className)Add a single entry to a given libraryprotected QDLStemaddManifestConstants(String path)If this is packaged in a jar, read off the information from the manifest file.voidaddModule(Module module)Add the module under the default aliasvoidaddVFSProvider(VFSFileProvider scriptProvider)voidbuildSO(SerializationState SerializationState)Recurse through the modules and collects templates and state objects from instances.protected net.sf.json.JSONObjectcreateConstants()voidcreateSystemConstants()voidcreateSystemInfo(QDLEnvironment qe)voiddeserializeFromJSON(net.sf.json.JSONObject jsonObject, SerializationState s)protected voiddoLocalSerialization(XStack oldStack, String tag, net.sf.json.JSONObject jsonObject, SerializationState serializationState)protected voiddoXMLImportedModules(XMLEventReader xer)This just drives running through a bunch of modulesvoidfromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp)voidfromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, SerializationState serializationState)edu.uiuc.ncsa.security.core.util.MetaDebugUtilgetDebugUtil()Debug utility for QDL.FStackgetExtrinsicFuncs()VStackgetExtrinsicVars()static StategetFactory()VFSEntrygetFileFromVFS(String fqName, int type)StringgetInternalID()The internal id of the state object is needed in serialization and other operations.QDLStemgetLibMap()protected QDLStemgetQDLReservedNames()Get a listing of all the functions, operators and keywords for QDL.static StategetRootState()At system startup this is set to be the top-level state object for the system.QDLScriptgetScriptFromVFS(String fqName)Convenience to get a script from the VFS.intgetStackSize()intgetStateID()This is used in the debugger and refers to paused vs running processes.QDLStemgetSystemConstants()QDLStemgetSystemInfo()StategetTargetState()The target state is used in cases where argument lists are processed.StringgetTempVariableName()Returns an unused variable name.Map<Integer,QDLThreadRecord>getThreadTable()VFSFileProvidergetVFS(String fqName)Given a fully qualified path, find the VFS corresponding to the mount point and return it or null if no such mount point existsHashMap<String,VFSFileProvider>getVfsFileProviders()WorkspaceCommandsgetWorkspaceCommands()Allows back reference to workspace to run macros.booleanhasMountPoint(String mountPoint)booleanhasVFSProviders()voidinjectTransientFields(State oldState)For the case where this has been deserialized and needs to have its transient fields initialized.booleanisAllowBaseFunctionOverrides()booleanisAssertionsOn()booleanisRestrictedIO()In server mode, some IO for debugging with debugger is still be allowed.booleanisServerMode()booleanisVFSFile(String path)Returns if theVFSPaths.SCHEME_DELIMITERis part of this path, while means it is intended for the virtual file system.static voidmain(String[] args)StatenewCleanState()This creates a completely clean state, using the current environment (so modules and script paths, but not variables, modules etc.) and preserves debuggingStatenewFunctionState()Carries over modules and functions, but not variables.StatenewInstance()A new instance with the default components.StatenewInstance(VStack symbolStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, FStack<? extends FTable<? extends FKey,? extends FunctionRecordInterface>> ftStack, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade, boolean isServerMode, boolean isRestrictedIO, boolean assertionsOn)If you extend this class, you must override this method to return a new instance of your state with everything in it you want or need.StatenewLocalState()Convenience method fornewLocalState(State)with a null argumentStatenewLocalState(State moduleState)Creates a new state object and pushes the moduleState's stacks onto the current one.StatenewSelectiveState(State moduleState)StatenewSelectiveState(State moduleState, boolean inheritVariables)Create a clean state, taking the old modules from moduleState, all the functions and allowing inheritance of the current variable stackStatenewSelectiveState(State moduleState, boolean inheritFunctions, boolean inheritVariables)This will clone the current state and will add the modules (templates and instances -- old modules) from moduleState.StatenewSelectiveState(State moduleState, boolean inheritModules, boolean inheritFunctions, boolean inheritVariables, boolean inheritIntrinsics)Create a new state based on the current state and choosing what to inherit.protected QDLStemprocessManifest(QDLStem versionInfo, ArrayList<String> manifest)protected QDLStemprocessManifest2(QDLStem versionInfo, ArrayList<String> manifest)protected voidreadConstantsFromJSON(net.sf.json.JSONObject json)voidreadExtraXMLAttributes(StartElement xe)Allows you to read custom attributes from the state tag.voidreadExtraXMLElements(XMLEvent xe, XMLEventReader xer)This passes in the current start event so you can add your own event loop and cases.voidremoveScriptProvider(String scheme)voidremoveVFSProvider(String mountPoint)net.sf.json.JSONObjectserializeLocalStateToJSON(SerializationState serializationState)Only serialize the local part of the state.net.sf.json.JSONObjectserializeToJSON(SerializationState s)voidsetAllowBaseFunctionOverrides(boolean allowBaseFunctionOverrides)voidsetAssertionsOn(boolean assertionsOn)voidsetDebugUtil(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugUtil)static voidsetExtrinsicFuncs(FStack extrinsicFuncs)voidsetExtrinsicVars(VStack extrinsicVars)static voidsetFactory(State factory)voidsetRestrictedIO(boolean restrictedIO)static voidsetRootState(State newRoot)voidsetServerMode(boolean serverMode)voidsetStateID(int pid)protected voidsetStemValue(QDLStem stem, Map<String,Object> values)voidsetSystemConstants(QDLStem systemConstants)voidsetSystemInfo(QDLStem systemInfo)voidsetTargetState(State targetState)voidsetThreadTable(Map<Integer,QDLThreadRecord> threadTable)voidsetVfsFileProviders(HashMap<String,VFSFileProvider> vfsFileProviders)voidsetWorkspaceCommands(WorkspaceCommands workspaceCommands)voidtoXML(XMLStreamWriter xsw)voidtoXML(XMLStreamWriter xsw, SerializationState serializationState)voidwriteExtraXMLAttributes(XMLStreamWriter xsw)This exists to let you add additional attributes to the state tag.voidwriteExtraXMLElements(XMLStreamWriter xsr)This is invoked at the end of the serialization and lets you add additional things to be serialized in the State.- 
Methods inherited from class org.qdl_lang.state.FunctionStategetAllFunctionsByName, getFTStack, getIntrinsicFunctions, listAllDocumentation, listFunctionDoc, listFunctions, listFunctions, listModuleDoc, putFunction, resolveFunction, resolveFunction, setFTStack, setIntrinsicFunctions
 - 
Methods inherited from class org.qdl_lang.state.VariableStategetIntrinsicVariables, getTypeSafetyMode, getValue, getValue, gsrNSScalarOp, gsrNSStemOp, handleVariableType, isDefined, isExtrinsic, isStem, listVariables, remove, resolveStemIndex, resolveStemIndex, setIntrinsicVariables, setTypeSafetyMode, setValue, setValue
 - 
Methods inherited from class org.qdl_lang.state.NamespaceAwareStategetAlias, getUNQName
 - 
Methods inherited from class org.qdl_lang.state.ModuleStategetImportedModule, getMInstances, getModule, getMTemplates, getUsedModules, hasModule, isImportMode, isModuleState, setImportMode, setMInstances, setModule, setModuleState, setMTemplates, setUsedModules
 - 
Methods inherited from class org.qdl_lang.state.AbstractStatedebug, error, error, error, getCompletionProvider, getIoInterface, getLibPath, getLibrarySupportMode, getLogger, getMetaEvaluator, getModulePaths, getOperatorType, getOpEvaluator, getScriptArgs, getScriptArgStem, getScriptName, getScriptPaths, getScriptStack, getStateRegistry, getSuperState, getUuid, getVStack, hasCompletionProvider, hasLogging, hasScriptArgs, hasScriptName, hasSuperState, info, isDebugOn, isEnableLibrarySupport, isIntrinsic, isPrintUnicode, pathToList, setCompletionProvider, setDebugOn, setEnableLibrarySupport, setIoInterface, setLibPath, setLibPath, setLibrarySupportMode, setLogger, setMetaEvaluator, setModulePaths, setModulePaths, setOpEvaluator, setPrintUnicode, setScriptArgs, setScriptArgStem, setScriptName, setScriptPaths, setScriptPaths, setScriptStack, setSuperState, setUuid, setvStack, warn
 
- 
 
- 
- 
- 
Constructor Detail- 
Statepublic State(VStack vStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, FStack<? extends FTable<? extends FKey,? extends FunctionRecordInterface>> ftStack, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade, boolean isServerMode, boolean isRestrictedIO, boolean assertionsOn) 
 - 
Statepublic State() This is needed for XML deserialization and makes dummy state for everything, assuming the deserializer will replace it all. Generally do not use outside of XML deserialization.
 
- 
 - 
Method Detail- 
getInternalIDpublic String getInternalID() The internal id of the state object is needed in serialization and other operations. Every instance of a state object has a unique id.- Returns:
 
 - 
getStateIDpublic int getStateID() This is used in the debugger and refers to paused vs running processes. It does not refer to process ids or the internal id of the state object.- Returns:
 
 - 
setStateIDpublic void setStateID(int pid) 
 - 
getThreadTablepublic Map<Integer,QDLThreadRecord> getThreadTable() 
 - 
setThreadTablepublic void setThreadTable(Map<Integer,QDLThreadRecord> threadTable) 
 - 
newInstancepublic State newInstance() A new instance with the default components.- Returns:
 
 - 
getFactorypublic static State getFactory() 
 - 
setFactorypublic static void setFactory(State factory) 
 - 
newInstancepublic State newInstance(VStack symbolStack, OpEvaluator opEvaluator, MetaEvaluator metaEvaluator, FStack<? extends FTable<? extends FKey,? extends FunctionRecordInterface>> ftStack, MTStack mtStack, MIStack miStack, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLoggingFacade, boolean isServerMode, boolean isRestrictedIO, boolean assertionsOn) If you extend this class, you must override this method to return a new instance of your state with everything in it you want or need. Then set yoursetFactory(State)- Parameters:
- opEvaluator-
- metaEvaluator-
- ftStack-
- mtStack-
- miStack-
- myLoggingFacade-
- isServerMode-
- isRestrictedIO-
- assertionsOn-
- Returns:
 
 - 
getSystemConstantspublic QDLStem getSystemConstants() 
 - 
setSystemConstantspublic void setSystemConstants(QDLStem systemConstants) 
 - 
getSystemInfopublic QDLStem getSystemInfo() 
 - 
setSystemInfopublic void setSystemInfo(QDLStem systemInfo) 
 - 
createSystemInfopublic void createSystemInfo(QDLEnvironment qe) 
 - 
addLibEntriespublic void addLibEntries(String libraryKey, QDLStem classPaths) Adds a list of classpath to the info().lib key entry. This allows modules to add their classes to the library so users can find them. The argument is a stem with key values pairs:
 name : classpath
 and will be added to an existing entry with the same key or a new one.E.g. calling addLibEntries("oa2", {"store":"path.to.store"})would result in the entry info().'lib'.'oa2'.'store' 
 returning the path.to.store- Parameters:
- libraryKey-
- classPaths-
 
 - 
addLibEntrypublic void addLibEntry(String libraryKey, String moduleKey, String className) Add a single entry to a given library- Parameters:
- libraryKey-
- moduleKey-
- className-
 
 - 
getLibMappublic QDLStem getLibMap() 
 - 
createSystemConstantspublic void createSystemConstants() 
 - 
getQDLReservedNamesprotected QDLStem getQDLReservedNames() Get a listing of all the functions, operators and keywords for QDL.- Returns:
 
 - 
getDebugUtilpublic edu.uiuc.ncsa.security.core.util.MetaDebugUtil getDebugUtil() Debug utility for QDL. Note that this is completely independent of theDebugUtilfor the JVM, which can be toggled with the WS variable 'debug'- Returns:
 
 - 
setDebugUtilpublic void setDebugUtil(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugUtil) 
 - 
addManifestConstantsprotected QDLStem addManifestConstants(String path) If this is packaged in a jar, read off the information from the manifest file. If no manifest, skip this.- Returns:
 
 - 
processManifest2protected QDLStem processManifest2(QDLStem versionInfo, ArrayList<String> manifest) 
 - 
isServerModepublic boolean isServerMode() 
 - 
setServerModepublic void setServerMode(boolean serverMode) 
 - 
isRestrictedIOpublic boolean isRestrictedIO() In server mode, some IO for debugging with debugger is still be allowed. If this flag is set true, then printing is not allowed nor is saving the workspace.- Returns:
 
 - 
setRestrictedIOpublic void setRestrictedIO(boolean restrictedIO) 
 - 
getVfsFileProviderspublic HashMap<String,VFSFileProvider> getVfsFileProviders() 
 - 
setVfsFileProviderspublic void setVfsFileProviders(HashMap<String,VFSFileProvider> vfsFileProviders) 
 - 
addVFSProviderpublic void addVFSProvider(VFSFileProvider scriptProvider) 
 - 
hasMountPointpublic boolean hasMountPoint(String mountPoint) 
 - 
removeVFSProviderpublic void removeVFSProvider(String mountPoint) 
 - 
removeScriptProviderpublic void removeScriptProvider(String scheme) 
 - 
getScriptFromVFSpublic QDLScript getScriptFromVFS(String fqName) throws Throwable Convenience to get a script from the VFS. This takes any file and tries to turn it in to a script, so the "onus is on the app" to make sure this is a script.- Parameters:
- fqName-
- Returns:
- Throws:
- Throwable
 
 - 
getVFSpublic VFSFileProvider getVFS(String fqName) throws Throwable Given a fully qualified path, find the VFS corresponding to the mount point and return it or null if no such mount point exists- Parameters:
- fqName-
- Returns:
- Throws:
- Throwable
 
 - 
getFileFromVFSpublic VFSEntry getFileFromVFS(String fqName, int type) throws Throwable - Throws:
- Throwable
 
 - 
hasVFSProviderspublic boolean hasVFSProviders() 
 - 
isVFSFilepublic boolean isVFSFile(String path) Returns if theVFSPaths.SCHEME_DELIMITERis part of this path, while means it is intended for the virtual file system.- Parameters:
- path-
- Returns:
 
 - 
newLocalStatepublic State newLocalState() Convenience method fornewLocalState(State)with a null argument- Returns:
- State
 
 - 
newLocalStatepublic State newLocalState(State moduleState) Creates a new state object and pushes the moduleState's stacks onto the current one. This means the resulting state inherits everything.- Parameters:
- moduleState-
- Returns:
 
 - 
newSelectiveStatepublic State newSelectiveState(State moduleState, boolean inheritVariables) Create a clean state, taking the old modules from moduleState, all the functions and allowing inheritance of the current variable stack- Parameters:
- moduleState-
- inheritVariables-
- Returns:
 
 - 
newSelectiveStatepublic State newSelectiveState(State moduleState, boolean inheritFunctions, boolean inheritVariables) This will clone the current state and will add the modules (templates and instances -- old modules) from moduleState. If pushFunctions is- Parameters:
- moduleState-
- inheritFunctions-
- inheritVariables-
- Returns:
 
 - 
newSelectiveStatepublic State newSelectiveState(State moduleState, boolean inheritModules, boolean inheritFunctions, boolean inheritVariables, boolean inheritIntrinsics) Create a new state based on the current state and choosing what to inherit. In this case, inherited objects come first, items in current state are appended. This allows for overrides inStatement.evaluate(State)calls.- Parameters:
- moduleState-
- inheritModules-
- inheritFunctions-
- inheritVariables-
- Returns:
 
 - 
injectTransientFieldspublic void injectTransientFields(State oldState) For the case where this has been deserialized and needs to have its transient fields initialized. These are things like theMetaEvaluatorthat should not be serialized or current mount points (which can't be serialized because you'd have to serialize the entire backing file system to satisfy the contract of serialization!)- Parameters:
- oldState-
 
 - 
newCleanStatepublic State newCleanState() This creates a completely clean state, using the current environment (so modules and script paths, but not variables, modules etc.) and preserves debugging- Returns:
 
 - 
newFunctionStatepublic State newFunctionState() Carries over modules and functions, but not variables.- Returns:
 
 - 
addModulepublic void addModule(Module module) Add the module under the default alias- Parameters:
- module-
 
 - 
getStackSizepublic int getStackSize() 
 - 
toXMLpublic void toXML(XMLStreamWriter xsw, SerializationState serializationState) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
toXMLpublic void toXML(XMLStreamWriter xsw) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
fromXMLpublic void fromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, SerializationState serializationState) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
fromXMLpublic void fromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
doXMLImportedModulesprotected void doXMLImportedModules(XMLEventReader xer) throws XMLStreamException This just drives running through a bunch of modules- Parameters:
- xer-
- Throws:
- XMLStreamException
 
 - 
writeExtraXMLElementspublic void writeExtraXMLElements(XMLStreamWriter xsr) throws XMLStreamException This is invoked at the end of the serialization and lets you add additional things to be serialized in the State. All new elements are added right before the final closing tag for the state object.- Parameters:
- xsr-
- Throws:
- XMLStreamException
 
 - 
createConstantsprotected net.sf.json.JSONObject createConstants() 
 - 
writeExtraXMLAttributespublic void writeExtraXMLAttributes(XMLStreamWriter xsw) throws XMLStreamException This exists to let you add additional attributes to the state tag. It should only containXMLStreamWriter.writeAttribute(String, String)calls, nothing else.- Parameters:
- xsw-
- Throws:
- XMLStreamException
 
 - 
readExtraXMLElementspublic void readExtraXMLElements(XMLEvent xe, XMLEventReader xer) throws XMLStreamException This passes in the current start event so you can add your own event loop and cases. Note you need have only a switch on the tag names you want.- Parameters:
- xe-
- xer-
- Throws:
- XMLStreamException
 
 - 
readConstantsFromJSONprotected void readConstantsFromJSON(net.sf.json.JSONObject json) 
 - 
readExtraXMLAttributespublic void readExtraXMLAttributes(StartElement xe) throws XMLStreamException Allows you to read custom attributes from the state tag. This should only contain calls toStartElement.getAttributeByName(QName)by name calls.- Parameters:
- xe-
- Throws:
- XMLStreamException
 
 - 
getTempVariableNamepublic String getTempVariableName() Returns an unused variable name.- Returns:
 
 - 
isAssertionsOnpublic boolean isAssertionsOn() 
 - 
setAssertionsOnpublic void setAssertionsOn(boolean assertionsOn) 
 - 
getWorkspaceCommandspublic WorkspaceCommands getWorkspaceCommands() Allows back reference to workspace to run macros.- Returns:
 
 - 
setWorkspaceCommandspublic void setWorkspaceCommands(WorkspaceCommands workspaceCommands) 
 - 
buildSOpublic void buildSO(SerializationState SerializationState) Recurse through the modules and collects templates and state objects from instances. Now that templates and instances are handled as stacks with local state, old form of serialization fails due to recursion.
 These are serialized into a flat list and references to them are used. This also checks for cycles.- Parameters:
- SerializationState-
 
 - 
setExtrinsicVarspublic void setExtrinsicVars(VStack extrinsicVars) 
 - 
getExtrinsicVarspublic VStack getExtrinsicVars() - Overrides:
- getExtrinsicVarsin class- VariableState
 
 - 
setExtrinsicFuncspublic static void setExtrinsicFuncs(FStack extrinsicFuncs) 
 - 
getExtrinsicFuncspublic FStack getExtrinsicFuncs() - Overrides:
- getExtrinsicFuncsin class- FunctionState
 
 - 
isAllowBaseFunctionOverridespublic boolean isAllowBaseFunctionOverrides() 
 - 
setAllowBaseFunctionOverridespublic void setAllowBaseFunctionOverrides(boolean allowBaseFunctionOverrides) 
 - 
getTargetStatepublic State getTargetState() The target state is used in cases where argument lists are processed. This allows for theANode2assignment to a different state that the calling state, in particular, this is how functions can assign variables in their argument list only for the duration of the function.- Returns:
 
 - 
setTargetStatepublic void setTargetState(State targetState) 
 - 
getRootStatepublic static State getRootState() At system startup this is set to be the top-level state object for the system. It is used, e.g. in resolving default namepsace requests everywhere and should be set exactly once on startup by the system.- Returns:
 
 - 
setRootStatepublic static void setRootState(State newRoot) 
 - 
serializeLocalStateToJSONpublic net.sf.json.JSONObject serializeLocalStateToJSON(SerializationState serializationState) throws Throwable Only serialize the local part of the state. This is used by e.g., modules that have shared state and should never overwrite shared state on deserialization.- Parameters:
- serializationState-
- Returns:
- Throws:
- Throwable
 
 - 
doLocalSerializationprotected void doLocalSerialization(XStack oldStack, String tag, net.sf.json.JSONObject jsonObject, SerializationState serializationState) throws Throwable - Throws:
- Throwable
 
 - 
serializeToJSONpublic net.sf.json.JSONObject serializeToJSON(SerializationState s) throws Throwable - Throws:
- Throwable
 
 - 
addJSONtoStateprotected void addJSONtoState(net.sf.json.JSONObject jsonObject, String tag, XStack xStack, SerializationState serializationState) throws Throwable- Throws:
- Throwable
 
 - 
deserializeFromJSONpublic void deserializeFromJSON(net.sf.json.JSONObject jsonObject, SerializationState s) throws Throwable- Throws:
- Throwable
 
 - 
mainpublic static void main(String[] args) 
 
- 
 
-