public class MetaFactory
extends java.lang.Object
Constructor and Description |
---|
MetaFactory() |
Modifier and Type | Method and Description |
---|---|
static org.licas_xml.abs.Element |
add(org.licas_xml.abs.Element scriptXml,
org.licas_xml.abs.Element toAdd)
Add the new XML element to the admin document/script under the appropriate element type.
|
static org.licas_xml.abs.Element |
add(org.licas_xml.abs.Element scriptXml,
org.licas_xml.abs.Element toAdd,
java.lang.String type)
Add the new XML element to the admin document/script under the appropriate element type.
|
static void |
addAttribute(org.licas_xml.abs.Element xmlElem,
java.lang.String attrName,
java.lang.String attrValue)
Add an attribute to the base XML element that has a
attrName tag and
attrValue value. |
static org.licas_xml.abs.Element |
createAdmin()
Create an empty Admin XML element that can be used as the base of an admin script.
|
static org.licas_xml.abs.Element |
createCategory(java.lang.String category)
Create a category element that can be used as part of a script.
|
static org.licas_xml.abs.Element |
createMeta(java.lang.String metaType)
Create and return an XML element.
|
static org.licas_xml.abs.Element |
createMetaValue(java.lang.String metaType,
java.lang.Object metaValue)
Create an XML element that can be used as part of a script.
|
static org.licas_xml.abs.Element |
createMethod(java.lang.Class toInvoke,
java.lang.String methodName,
java.lang.String rtnType)
Parse the object using reflection, to find the first method that matches the spec and
return an XML-based description of it.
|
static org.licas_xml.abs.Element |
createMethod(java.lang.Class toInvoke,
java.lang.String methodName,
java.lang.String rtnType,
java.util.ArrayList<java.lang.String> paramTypes)
Parse the object using reflection, to find the method that matches the spec and
return an XML-based description of it.
|
static org.licas_xml.abs.Element |
createMethod(java.lang.Class toInvoke,
java.lang.String methodName,
java.lang.String rtnType,
java.util.ArrayList<java.lang.String> paramTypes,
java.util.ArrayList<java.lang.String> paramNames)
Parse the object using reflection, to find the method that matches the spec and
return an XML-based description of it.
|
static org.licas_xml.abs.Element |
createParser(java.lang.String toParseClass,
java.lang.String parserClass,
java.util.ArrayList<java.lang.String> jarFiles)
Create an XML element that can be used as part of a script to define a
parser to dynamically create and use, to parse a specified Java object to
or from XML.
|
static org.licas_xml.abs.Element |
createPolicy()
Create a Policy element that can be used as the base for the policy script,
as in
<Policy></Policy> . |
static MetaFactoryAI |
getFactoryAI()
Get the meta factory related to AI elements.
|
static MetaFactoryData |
getFactoryData()
Get the meta factory related to data elements.
|
static MetaFactoryService |
getFactoryService()
Get the meta factory related to service metadata.
|
static org.licas_xml.abs.Element |
objectToXml(java.lang.Object theObject)
Convert the known object to XML using the known parser.
|
static void |
parsedObjTypeAttr(org.licas_xml.abs.Element xmlElem,
java.lang.String className)
Format the XML-based description of a Java Object, to make sure that it will be
interpreted correctly by the automatic licas parsers.
|
static void |
replaceValue(org.licas_xml.abs.Element metaXml,
java.util.ArrayList<KeyValue> valueList)
Replace element text values that may be tagged with the equivalent value from the key-value list.
|
public static org.licas_xml.abs.Element createPolicy()
<Policy></Policy>
.public static org.licas_xml.abs.Element createCategory(java.lang.String category)
<Service_Category>category</Service_Category>
.category
- the category type to add.public static org.licas_xml.abs.Element createMethod(java.lang.Class toInvoke, java.lang.String methodName, java.lang.String rtnType)
toInvoke
- class of the object to invoke.methodName
- the name of the method to invoke. This is required.rtnType
- the method return type. Can be null for no match.public static org.licas_xml.abs.Element createMethod(java.lang.Class toInvoke, java.lang.String methodName, java.lang.String rtnType, java.util.ArrayList<java.lang.String> paramTypes, java.util.ArrayList<java.lang.String> paramNames)
toInvoke
- class of the object to invoke.methodName
- the name of the method to invoke. This is required.rtnType
- the method return type. Can be null for no match.paramTypes
- list of parameter types to match to.paramNames
- a list of names that get added to each parameter in order. This also
serves to specify the number of required parameters. If null, then the first match
is returned and only the parameter type is defined.public static org.licas_xml.abs.Element createMethod(java.lang.Class toInvoke, java.lang.String methodName, java.lang.String rtnType, java.util.ArrayList<java.lang.String> paramTypes)
toInvoke
- class of the object to invoke.methodName
- the name of the method to invoke. This is required.rtnType
- the method return type. Can be null for no match.paramTypes
- list of parameter types to match to.public static org.licas_xml.abs.Element createAdmin()
<Admin></Admin>
that then needs to be populated with other elements.public static void addAttribute(org.licas_xml.abs.Element xmlElem, java.lang.String attrName, java.lang.String attrValue)
attrName
tag and
attrValue
value. This will overwrite any existing attribute.xmlElem
- the element to add the attribute to.attrName
- the name of the attributeattrValue
- the value of the attribute.public static org.licas_xml.abs.Element add(org.licas_xml.abs.Element scriptXml, org.licas_xml.abs.Element toAdd)
scriptXml
- the current admin document/script. Can use createAdminXML
to create an empty admin document, for example.toAdd
- the XML element to add to the script.public static org.licas_xml.abs.Element add(org.licas_xml.abs.Element scriptXml, org.licas_xml.abs.Element toAdd, java.lang.String type)
scriptXml
- the current admin document/script. Can use createAdminXML
to create an empty admin document, for example.toAdd
- the XML element to add to the script.type
- the type of element to add, see the admin user guide spec for examples.
If null
, then the element gets added to scriptXml
directly. If not null,
then its type can be checked for correctness. Currently, the only manual correction is for
MetaConst.AISOLVER
that creates an Const.OTHERMETA
element only and then
adds the new element to that. Otherwise, a child element of scriptXml
, with the
the Name
of type
is retrieved and the new element is added to that.
If there is no element with that name, it gets added to scriptXml
again.
This is related to parsing problem solving scripts.public static org.licas_xml.abs.Element createParser(java.lang.String toParseClass, java.lang.String parserClass, java.util.ArrayList<java.lang.String> jarFiles)
toParseClass
- this can be used to define the class type that should be
parsed. It can also be null if the invoking object already knows the object to parse.parserClass
- this defines the class type of the parser itself. The parser should
probably extend the ParserDef interface, but it does not get added to the default
list automatically and so this is optional and implementation-dependent.jarFiles
- a list of jar files if the parser is from an external source.<Parser><To_Parse_Class>Optional class to parse</To_Parse_Class>
<Parser_Class>Parser class name</Parser_Class><Jar_Files><Jar_File>Jar file path</Jar_File>
</Jar_Files></Parser>
public static org.licas_xml.abs.Element createMeta(java.lang.String metaType)
<metaType></metaType>
and is just for convenience.metaType
- the metadata element name.public static org.licas_xml.abs.Element createMetaValue(java.lang.String metaType, java.lang.Object metaValue)
<metaType>String or Nested XML value</metaType>
.metaType
- the metadata element name.metaValue
- the value for the element. this should be either a String or XML.public static void replaceValue(org.licas_xml.abs.Element metaXml, java.util.ArrayList<KeyValue> valueList)
metaXml
- the xml script that can have element values with some name.valueList
- a list of KeyValue
objects, where if the key matches any
element value, the value is replaced by the KeyValue value, as a String cast.public static void parsedObjTypeAttr(org.licas_xml.abs.Element xmlElem, java.lang.String className)
Const.CONVERSIONTYPE
tag.
The conversion type is required for the automatic parsing and should be added to the
base element, if the XML description is being created manually. This will overwrite
any existing attribute.xmlElem
- the XML-based or parsed description of the Java object.className
- the fully qualified class name of the object that was parsed.public static org.licas_xml.abs.Element objectToXml(java.lang.Object theObject) throws java.lang.Exception
Parsers.serializeToString(...)
to serializeToString the Object to an XML Element
reply.theObject
- the object to parse, including its values. The object must already
be known by Parsers
, including having added its parser.java.lang.Exception
- any error.public static MetaFactoryService getFactoryService()
public static MetaFactoryData getFactoryData()
public static MetaFactoryAI getFactoryAI()