Package org.qdl_lang.expressions.module
Class Module
- java.lang.Object
- 
- org.qdl_lang.expressions.module.Module
 
- 
- All Implemented Interfaces:
- Serializable,- Cloneable,- XThing
 - Direct Known Subclasses:
- JavaModule,- QDLModule
 
 public abstract class Module extends Object implements XThing, Serializable Created by Jeff Gaynor 
 on 1/21/20 at 11:03 AM- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description booleanFDOC_CONVERT
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract List<String>createDefaultDocs()voiddeserializeFromJSON(net.sf.json.JSONObject json, SerializationState serializationState)Deserializes a JSON object into the current module.voidfromJSON(net.sf.json.JSONArray array)voidfromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, QDLInterpreter qi)voidfromXML(XMLEventReader xer, SerializationState SerializationState, boolean isTemplate)Used in version 2,0 serializationStringgetAlias()List<String>getDescription()The will create basic documentation for functions and such, and is called automatically during module initialization, but the actual description of this module -- if any -- is done here.abstract List<String>getDocumentation()UUIDgetId()intgetInheritMode()XKeygetKey()abstract List<String>getListByTag()protected List<String>getListByTag(XMLEventReader xer, String tag)Getting the documentation from the XML serialization 2.0.MTKeygetMTKey()StringgetName()URIgetNamespace()StringgetParentInstanceAlias()UUIDgetParentInstanceID()UUIDgetParentTemplateID()StategetState()booleanisExternal()This returns true only if the module is from another language than a QDL module.booleanisTemplate()The system will mark loaded modules as template.booleanisUsed()If this was imported by the use command.abstract ModulenewInstance(State state)Modules are effectively templates.voidreadExtraXMLAttributes(XMLEvent xe)This is passed the current event and should only have calls to read the attributes.voidreadExtraXMLElements(XMLEvent xe, XMLEventReader xer)This passes in the current start event so you can add your own event loop and cases.net.sf.json.JSONObjectserializeToJSON(SerializationState serializationState)The result of this is a json objectvoidsetAlias(String alias)voidsetDescription(List<String> description)abstract voidsetDocumentation(List<String> documentation)voidsetId(UUID id)voidsetInheritanceMode(int inheritMode)voidsetNamespace(URI namespace)voidsetParentInstanceAlias(String parentInstanceAlias)voidsetParentInstanceID(UUID parentInstanceID)voidsetParentTemplateID(UUID parentTemplateID)voidsetState(State state)voidsetTemplate(boolean template)protected voidsetupModule(Module module)Called innewInstance(State)to finish setting up the module for things like serialization.voidsetUsed(boolean used)net.sf.json.JSONArraytoJSON()StringtoString()voidtoXML(XMLStreamWriter xsw, String alias)voidtoXML(XMLStreamWriter xsw, String alias, boolean fullSerialization, SerializationState SerializationState)voidtoXML2(XMLStreamWriter xsw, String alias, boolean fullSerialization, SerializationState SerializationState)voidwriteExtraXMLAttributes(XMLStreamWriter xsw)Add any attributes you want to the module tag (you must read them later).voidwriteExtraXMLElements(XMLStreamWriter xsw)Write extra elements.
 
- 
- 
- 
Method Detail- 
getMTKeypublic MTKey getMTKey() 
 - 
isExternalpublic boolean isExternal() This returns true only if the module is from another language than a QDL module.- Returns:
 
 - 
isTemplatepublic boolean isTemplate() The system will mark loaded modules as template.- Returns:
 
 - 
setTemplatepublic void setTemplate(boolean template) 
 - 
getStatepublic State getState() 
 - 
setStatepublic void setState(State state) 
 - 
getAliaspublic String getAlias() 
 - 
setAliaspublic void setAlias(String alias) 
 - 
getNamespacepublic URI getNamespace() 
 - 
setNamespacepublic void setNamespace(URI namespace) 
 - 
toJSONpublic net.sf.json.JSONArray toJSON() 
 - 
fromJSONpublic void fromJSON(net.sf.json.JSONArray array) 
 - 
isUsedpublic boolean isUsed() If this was imported by the use command.- Returns:
 
 - 
setUsedpublic void setUsed(boolean used) 
 - 
newInstancepublic abstract Module newInstance(State state) Modules are effectively templates. This passes in the state of the parser at the point a new module is required and the contract is to create a new instance of this module with the state. Note that the state passed in may have nothing to do with the state here. You are creating a new module for the given state using this as a template.
 All implementations should gracefully handle a null state with the assumption that the full state will be set later. This is because of bootstrapping networks of modules during deserialization.- Parameters:
- state-
- Returns:
 
 - 
setupModuleprotected void setupModule(Module module) Called innewInstance(State)to finish setting up the module for things like serialization. When you writenewInstance(State)the very last thing you should do is invoke this on your new module.- Parameters:
- module-
 
 - 
toXMLpublic void toXML(XMLStreamWriter xsw, String alias) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
toXML2public void toXML2(XMLStreamWriter xsw, String alias, boolean fullSerialization, SerializationState SerializationState) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
serializeToJSONpublic net.sf.json.JSONObject serializeToJSON(SerializationState serializationState) throws Throwable The result of this is a json object- Parameters:
- serializationState-
- Returns:
- Throws:
- Throwable
 
 - 
deserializeFromJSONpublic void deserializeFromJSON(net.sf.json.JSONObject json, SerializationState serializationState) throws ThrowableDeserializes a JSON object into the current module. You must check the type in the json object o know which class (e.g.,JavaModuleto instantiate first.- Parameters:
- json-
- serializationState-
- Throws:
- Throwable
 
 - 
toXMLpublic void toXML(XMLStreamWriter xsw, String alias, boolean fullSerialization, SerializationState SerializationState) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeExtraXMLAttributespublic void writeExtraXMLAttributes(XMLStreamWriter xsw) throws XMLStreamException Add any attributes you want to the module tag (you must read them later).- Parameters:
- xsw-
- Throws:
- XMLStreamException
 
 - 
writeExtraXMLElementspublic void writeExtraXMLElements(XMLStreamWriter xsw) throws XMLStreamException Write extra elements. You must control for the opening and closing tags. These are inserted right after the state element.- Parameters:
- xsw-
- Throws:
- XMLStreamException
 
 - 
fromXMLpublic void fromXML(XMLEventReader xer, SerializationState SerializationState, boolean isTemplate) throws XMLStreamException Used in version 2,0 serialization- Parameters:
- xer-
- SerializationState-
- isTemplate-
- Throws:
- XMLStreamException
 
 - 
getListByTagprotected List<String> getListByTag(XMLEventReader xer, String tag) throws XMLStreamException Getting the documentation from the XML serialization 2.0.- Parameters:
- xer-
- Returns:
- Throws:
- XMLStreamException
 
 - 
fromXMLpublic void fromXML(XMLEventReader xer, edu.uiuc.ncsa.security.core.configuration.XProperties xp, QDLInterpreter qi) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readExtraXMLAttributespublic void readExtraXMLAttributes(XMLEvent xe) throws XMLStreamException This is passed the current event and should only have calls to read the attributes.- Parameters:
- xe-
- 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
 
 - 
getParentTemplateIDpublic UUID getParentTemplateID() 
 - 
setParentTemplateIDpublic void setParentTemplateID(UUID parentTemplateID) 
 - 
getParentInstanceIDpublic UUID getParentInstanceID() 
 - 
setParentInstanceIDpublic void setParentInstanceID(UUID parentInstanceID) 
 - 
getParentInstanceAliaspublic String getParentInstanceAlias() 
 - 
setParentInstanceAliaspublic void setParentInstanceAlias(String parentInstanceAlias) 
 - 
getIdpublic UUID getId() 
 - 
setIdpublic void setId(UUID id) 
 - 
getInheritModepublic int getInheritMode() 
 - 
setInheritanceModepublic void setInheritanceMode(int inheritMode) 
 - 
getDescriptionpublic List<String> getDescription() The will create basic documentation for functions and such, and is called automatically during module initialization, but the actual description of this module -- if any -- is done here. Override and return your description.- Returns:
 
 
- 
 
-