Package org.qdl_lang.xml
Class XMLUtils
- java.lang.Object
-
- org.qdl_lang.xml.XMLUtils
-
- All Implemented Interfaces:
SerializationConstants
public class XMLUtils extends Object implements SerializationConstants
A class for all those XML related snippets that are re-used everywhere.Created by Jeff Gaynor
on 12/27/20 at 7:16 AM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLUtils.ModuleAttributesInternal class to manage attributes for a module.
-
Field Summary
-
Fields inherited from interface org.qdl_lang.xml.SerializationConstants
ASSERTIONS_ON, AUTOSAVE_INTERVAL, AUTOSAVE_MESSAGES_ON, AUTOSAVE_ON, BOOLEAN_TAG, BR_ALIAS, BR_CONTENT, BR_DELETED, BR_EDITED, BR_LINK, BR_LINK_SAVE_PATH, BR_MEMORY_ONLY, BR_SOURCE, BR_SOURCE_SAVE_PATH, BUFFER_DEFAULT_SAVE_PATH, BUFFER_MANAGER, BUFFER_RECORD, BUFFER_RECORDS, COMMAND_HISTORY, COMPRESS_XML, CURRENT_PID, CURRENT_WORKSPACE, DEBUG_LEVEL, DEBUG_MODE, DEBUG_UTIL, DECIMAL_TAG, DESCRIPTION, ECHO_MODE, EDITOR_CLIPBOARD, ENABLE_LIBRARY_SUPPORT, ENV_FILE, ENV_PROPERTIES, EXTERNAL_EDITOR_NAME, EXTERNAL_EDITOR_PATH, EXTRINSIC_FUNCTIONS_TAG, EXTRINSIC_VARIABLES_TAG, FUNCTION_ARG_COUNT_TAG, FUNCTION_NAME_TAG, FUNCTION_TABLE_STACK_TAG, FUNCTION_TAG, FUNCTIONS_TAG, IMPORTED_MODULES_TAG, INSTANCE_REFERENCE_TAG, INSTANCE_STACK, INTEGER_TAG, INTRINSIC_FUNCTIONS_TAG, INTRINSIC_VARIABLE_STACK, INTRINSIC_VARIABLES_TAG, LIBRARY_SUPPORT_MODE, LIST_INDEX_ATTR, MODULE_ALIAS_ATTR, MODULE_CLASS_NAME_TAG, MODULE_DOCUMENTATION_TAG, MODULE_INHERITANCE_MODE_TAG, MODULE_INPUT_FORM_TAG, MODULE_INSTANCES_TAG, MODULE_IS_INSTANCE_TAG, MODULE_IS_TEMPLATE_TAG, MODULE_JAVA_STATE_TAG, MODULE_NS_ATTR, MODULE_PATH, MODULE_SOURCE_TAG, MODULE_STACK_TAG, MODULE_STATE_TAG, MODULE_TAG, MODULE_TEMPLATE_TAG, MODULE_TYPE_JAVA_TAG, MODULE_TYPE_QDL_TAG, MODULE_TYPE_TAG, MODULE_TYPE_TAG2, MODULES_TAG, NULL_TAG, OLD_IMPORTED_MODULES_TAG, OLD_MODULE_TEMPLATE_TAG, OVERWRITE_BASE_FUNCTIONS, PARENT_INSTANCE_ALIAS_TAG, PARENT_INSTANCE_UUID_TAG, PARENT_TEMPLATE_UUID_TAG, PRETTY_PRINT, QDL_TYPE_TAG, ROOT_DIR, RUN_INIT_ON_LOAD, RUN_SCRIPT_PATH, SAVE_DIR, SCRIPT_PATH, SERIALIZATION_VERSION_TAG, STACK_TAG, STACKS_TAG, START_TS, STATE_ASSERTIONS_ENABLED_TAG, STATE_CONSTANTS_TAG, STATE_ID_TAG, STATE_INTERNAL_ID_TAG, STATE_NUMERIC_DIGITS_TAG, STATE_REFERENCE_TAG, STATE_RESTRICTED_IO_TAG, STATE_SERVER_MODE_TAG, STATE_TAG, STATES_TAG, STEM_ENTRY_TAG, STEM_KEY_TAG, STEM_TAG, STRING_TAG, TEMPLATE_REFERENCE_TAG, TEMPLATE_STACK, TYPE_TAG, USE_EXTERNAL_EDITOR, USED_MODULES, UUID_TAG, VARIABLE_NAME_TAG, VARIABLE_STACK, VARIABLE_TAG, VARIABLES_TAG, VERSION_2_0_TAG, VERSION_2_1_TAG, WORKSPACE_TAG, WS_ENV_TAG, WS_ID
-
-
Constructor Summary
Constructors Constructor Description XMLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddeserializeFunctions(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)static voiddeserializeImports(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)protected static ModuledeserializeModule(XMLEventReader xer, XMLUtils.ModuleAttributes moduleAttributes, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)process a single module.static voiddeserializeTemplates(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)static XMLUtils.ModuleAttributesgetModuleAttributes(XMLEvent xe)static XMLEventReadergetReader(File f)static XMLEventReadergetXMLEventReader(Reader reader)static XMLEventReadergetZippedReader(byte[] byteArray)static XMLEventReadergetZippedReader(File f)protected static QDLStemmakeStem(XMLStreamReader xsr)static voidoldDeserializeFunctions(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)Used for reading very old serialized versions, before there were multiple stacks.static StringprettyPrint(String input)static StringprettyPrint(String input, int indent)static Objectread(XMLEventReader xer)static Objectread(XMLStreamReader xsr)static List<String>readStemAsStrings(XMLEventReader xer)Note that this requires the stem to be exactly a standard list.static ObjectresolveConstant(XMLEventReader xer)resolve a constant of type integer, decimal, stem, null, boolean or stringprotected static QDLStemresolveStem(XMLEventReader xer)static voidwrite(XMLStreamWriter xsw, Boolean bool)static voidwrite(XMLStreamWriter xsw, Long ll)static voidwrite(XMLStreamWriter xsw, Object obj)static voidwrite(XMLStreamWriter xsw, String ll)static voidwrite(XMLStreamWriter xsw, BigDecimal decimal)static voidwrite(XMLStreamWriter xsw, List list)write a list of anything Java (String, URIs etc.) as a stem of strings.static voidwrite(XMLStreamWriter xsw, QDLNull qdlNull)static voidwrite(XMLStreamWriter xsw, QDLStem stem)static voidwrite(XMLStreamWriter xsw, SparseEntry sparseEntry)
-
-
-
Method Detail
-
makeStem
protected static QDLStem makeStem(XMLStreamReader xsr) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, Long ll) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, String ll) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, SparseEntry sparseEntry) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, BigDecimal decimal) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, List list) throws XMLStreamException
write a list of anything Java (String, URIs etc.) as a stem of strings.- Parameters:
xsw-list-- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, QDLStem stem) throws XMLStreamException
- Throws:
XMLStreamException
-
read
public static Object read(XMLEventReader xer) throws XMLStreamException
- Throws:
XMLStreamException
-
readStemAsStrings
public static List<String> readStemAsStrings(XMLEventReader xer) throws XMLStreamException
Note that this requires the stem to be exactly a standard list.- Parameters:
xer-- Returns:
- Throws:
XMLStreamException
-
resolveConstant
public static Object resolveConstant(XMLEventReader xer) throws XMLStreamException
resolve a constant of type integer, decimal, stem, null, boolean or string- Parameters:
xer-- Returns:
- Throws:
XMLStreamException
-
resolveStem
protected static QDLStem resolveStem(XMLEventReader xer) throws XMLStreamException
- Throws:
XMLStreamException
-
read
public static Object read(XMLStreamReader xsr) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, Object obj) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, QDLNull qdlNull) throws XMLStreamException
- Throws:
XMLStreamException
-
write
public static void write(XMLStreamWriter xsw, Boolean bool) throws XMLStreamException
- Throws:
XMLStreamException
-
deserializeFunctions
public static void deserializeFunctions(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state) throws XMLStreamException
- Throws:
XMLStreamException
-
oldDeserializeFunctions
public static void oldDeserializeFunctions(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state) throws XMLStreamException
Used for reading very old serialized versions, before there were multiple stacks. Keep for a bit just in case.- Parameters:
xer-xp-state-- Throws:
XMLStreamException
-
deserializeImports
public static void deserializeImports(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state) throws XMLStreamException
- Throws:
XMLStreamException
-
deserializeTemplates
public static void deserializeTemplates(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state) throws XMLStreamException
- Throws:
XMLStreamException
-
deserializeModule
protected static Module deserializeModule(XMLEventReader xer, XMLUtils.ModuleAttributes moduleAttributes, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state) throws XMLStreamException
process a single module. This is charged with creating the module (Java modules require introspection) and then deserializing any addtional state. Modules should put additional (de)serialization into their definitions.- Parameters:
xer-state-- Throws:
XMLStreamException
-
getModuleAttributes
public static XMLUtils.ModuleAttributes getModuleAttributes(XMLEvent xe) throws XMLStreamException
- Throws:
XMLStreamException
-
prettyPrint
public static String prettyPrint(String input, int indent) throws Throwable
- Throws:
Throwable
-
getXMLEventReader
public static XMLEventReader getXMLEventReader(Reader reader)
-
getReader
public static XMLEventReader getReader(File f)
-
getZippedReader
public static XMLEventReader getZippedReader(byte[] byteArray)
-
getZippedReader
public static XMLEventReader getZippedReader(File f)
-
-