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 class
XMLUtils.ModuleAttributes
Internal 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, 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 void
deserializeFunctions(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)
static void
deserializeImports(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)
protected static Module
deserializeModule(XMLEventReader xer, XMLUtils.ModuleAttributes moduleAttributes, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)
process a single module.static void
deserializeTemplates(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, State state)
static XMLUtils.ModuleAttributes
getModuleAttributes(XMLEvent xe)
static XMLEventReader
getReader(File f)
static XMLEventReader
getXMLEventReader(Reader reader)
static XMLEventReader
getZippedReader(byte[] byteArray)
static XMLEventReader
getZippedReader(File f)
protected static QDLStem
makeStem(XMLStreamReader xsr)
static void
oldDeserializeFunctions(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 String
prettyPrint(String input)
static String
prettyPrint(String input, int indent)
static Object
read(XMLEventReader xer)
static Object
read(XMLStreamReader xsr)
static List<String>
readStemAsStrings(XMLEventReader xer)
Note that this requires the stem to be exactly a standard list.static Object
resolveConstant(XMLEventReader xer)
resolve a constant of type integer, decimal, stem, null, boolean or stringprotected static QDLStem
resolveStem(XMLEventReader xer)
static void
write(XMLStreamWriter xsw, Boolean bool)
static void
write(XMLStreamWriter xsw, Long ll)
static void
write(XMLStreamWriter xsw, Object obj)
static void
write(XMLStreamWriter xsw, String ll)
static void
write(XMLStreamWriter xsw, BigDecimal decimal)
static void
write(XMLStreamWriter xsw, List list)
write a list of anything Java (String, URIs etc.) as a stem of strings.static void
write(XMLStreamWriter xsw, QDLNull qdlNull)
static void
write(XMLStreamWriter xsw, QDLStem stem)
static void
write(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)
-
-