| java.lang.Object org.cougaar.lib.vishnu.client.XMLProcessor
XMLProcessor | public class XMLProcessor (Code) | | Handles XML interaction...
|
Inner Class :class FormatProcessor | |
Inner Class :class MergeProcessor extends FormatProcessor | |
Inner Class :class DuplicateProcessor extends FormatProcessor | |
Inner Class :public class ObjectDescrip | |
Method Summary | |
protected void | addFieldsForDifferentTypes(Node root, Document doc, Map nameToNodes, Map nameToDescrip) Add new fields
Where there was :
FIELDFORMAT datatype="indirectObject" ... | protected void | appendOtherData(Document dataDoc, Element placeToAdd, String otherData)
Append any global other data
Global data is optional, so if it can't find the file specified
(for instance a default odd file) nothing will happen. | public void | createDataXMLizer(Map nameToDescrip, String assetClassName) | protected boolean | duplicateNode(Node first, List nodes) Checks to see if first is an object format that has already been
seen when iterating over the document.
Duplicates can be subsets -- i.e. | protected String | getClusterName() | protected VishnuComm | getComm() | protected Document | getDataDoc(Collection taskAndAssets, Collection changedAssets, XMLizer dataXMLizer, String assetClassName) Uses dataXMLizer to generate XML for Vishnu
Passes nameToDescrip Map to dataXMLizer so can rename fields to be unique. | public XMLizer | getDataXMLizer() | protected Document | getFormatDoc(Collection taskAndAssets, String assetClassName) | public Document | getFormatDocWithoutDuplicates(Collection templates, String assetClassName, List returnedMap) | protected ParamMap | getMyParams() | protected String | getName() | protected Document | getOtherDataDoc(String otherDataFile) | protected Document | getVanillaHeader() | protected boolean | isObject(String type) | public void | localSetup() Here all the various runtime parameters get set. | protected void | mergeNode(Node first, List nodes, Iterator nodeListIter) | public boolean | otherDataFileExists(String otherDataFile) | protected void | postProcessData(Document dataDoc, Node dataNode, boolean sendingChangedObjects) | public Document | prepareDocument(Collection tasks, Collection changed, XMLizer dataXMLizer, boolean clearDatabase, boolean sendingChangedObjects, String assetClassName) | public Document | prepareFreezeAll() | public Document | prepareRescind(Enumeration removedTasks, String verb) | public Document | prepareUnfreeze(Collection unfreezeTasks) | protected void | processObjectFormats(Node root, Map nameToNodes, Set potentialDuplicates, FormatProcessor formatProcessor) Given a set of potential duplicate types, removes those that are duplicates
from the set of DOM Node OBJECTFORMATs sent to Vishnu. | protected Map | removeDuplicates(Node root, Document doc) Looks at all the object format nodes in the document
and removes duplicates (two object formats with the same name and
same fields). | protected void | setDataXMLizer(XMLizer xmlizer) | protected Node | setDocHeader(Document dataDoc, boolean clearDatabase) Sets the vishnu epoch start and end time and the proper problem name.
If clearDatabase is true, appends CLEARDATABASE tag. | protected void | setResourceAttributes(Node first, Node other) |
debugDataXMLizer | protected boolean debugDataXMLizer(Code) | | |
debugFormatXMLizer | protected boolean debugFormatXMLizer(Code) | | |
loggerformatXMLizeLoggerdataXMLizeLogger | protected Logger loggerformatXMLizeLoggerdataXMLizeLogger(Code) | | |
showDataXML | protected boolean showDataXML(Code) | | |
showFormatXML | protected boolean showFormatXML(Code) | | |
vishnuEpochStartTime | protected String vishnuEpochStartTime(Code) | | |
addFieldsForDifferentTypes | protected void addFieldsForDifferentTypes(Node root, Document doc, Map nameToNodes, Map nameToDescrip)(Code) | | Add new fields
Where there was :
FIELDFORMAT datatype="indirectObject" ... is_subobject="true" name="indirectObject"
now have :
FIELDFORMAT datatype="indirectObject_0" ... is_subobject="true" name="indirectObject_0"
FIELDFORMAT datatype="indirectObject_1" ... is_subobject="true" name="indirectObject_1"
FIELDFORMAT datatype="string(128)" ... is_subobject="true" name="indirectObject_2"
for as many duplicates as there are in the nameToNode map.
nameToDescrip is used to lookup the object description for a type. Then for each
field in the object description, if there is more than one known type for that field,
adds new fields with unique names for each type.
nameToDescrip is created in removeDuplicates
See Also: XMLProcessor.removeDuplicates Parameters: root - - of the document Parameters: doc - - needed so can manufacture new nodes (fields), gets altered through addition ofnew fields Parameters: nameToNodes - -- per field name, holds all the different possible object formats Parameters: nameToDescrip - -- contents are altered to record new name->type pairs |
appendOtherData | protected void appendOtherData(Document dataDoc, Element placeToAdd, String otherData)(Code) | |
Append any global other data
Global data is optional, so if it can't find the file specified
(for instance a default odd file) nothing will happen.
|
createDataXMLizer | public void createDataXMLizer(Map nameToDescrip, String assetClassName)(Code) | | |
duplicateNode | protected boolean duplicateNode(Node first, List nodes)(Code) | | Checks to see if first is an object format that has already been
seen when iterating over the document.
Duplicates can be subsets -- i.e. have some subset of the fields
of another object with this name.
NOTE : if first is a duplicate of another of the Nodes in
nodes , first is removed from the nodes list.
If something is a resource, it should not be seen as a duplicate of
another object that is not a resource!
Parameters: first - - the node itself Parameters: nameToNodes - - hash that records name -> object format node mappings true if it's a duplicate of one already seen |
getDataDoc | protected Document getDataDoc(Collection taskAndAssets, Collection changedAssets, XMLizer dataXMLizer, String assetClassName)(Code) | | Uses dataXMLizer to generate XML for Vishnu
Passes nameToDescrip Map to dataXMLizer so can rename fields to be unique.
Parameters: taskAndAssets - what to send Parameters: nameToDescrip - mapping of object type to object description (field names, etc.) |
getOtherDataDoc | protected Document getOtherDataDoc(String otherDataFile)(Code) | | send other global data wrapped in the problem header
Parameters: otherDataFile - - other data file to read, process, and send |
isObject | protected boolean isObject(String type)(Code) | | check type and see if it is not a primitive = object
|
localSetup | public void localSetup()(Code) | | Here all the various runtime parameters get set. See documentation for details.
|
otherDataFileExists | public boolean otherDataFileExists(String otherDataFile)(Code) | | |
postProcessData | protected void postProcessData(Document dataDoc, Node dataNode, boolean sendingChangedObjects)(Code) | | changes newobjects tag to changedobjects tag if sendingChangedObjects is true;
|
prepareDocument | public Document prepareDocument(Collection tasks, Collection changed, XMLizer dataXMLizer, boolean clearDatabase, boolean sendingChangedObjects, String assetClassName)(Code) | | get the document from the data xmlizer, set some attributes on the header,
and then do any post-processing
|
prepareFreezeAll | public Document prepareFreezeAll()(Code) | | make a document that tells Vishnu to freeze all assignments
|
processObjectFormats | protected void processObjectFormats(Node root, Map nameToNodes, Set potentialDuplicates, FormatProcessor formatProcessor)(Code) | | Given a set of potential duplicate types, removes those that are duplicates
from the set of DOM Node OBJECTFORMATs sent to Vishnu.
Removes duplicate OBJECTFORMATs from root .
If there is only one remaining Node for a type in potentialDuplicates, the type
is removed from the list of potential duplicates.
First finds those nodes that should be removed and then removes them in a separate
step.
Parameters: potentialDuplicates - set of type names of potential duplicates Parameters: nameToNodes - list of DOM Nodes for type Parameters: root - DATAFORMAT tag which is the parent of all OBJECTFORMATs |
removeDuplicates | protected Map removeDuplicates(Node root, Document doc)(Code) | | Looks at all the object format nodes in the document
and removes duplicates (two object formats with the same name and
same fields).
Object formats that have the same name but with different fields are
renamed to make them distinct.
addFieldsForDifferentTypes adds fields to refer to the new
unique names, and setObjectNames renames the object formats.
The returned maps are needed for the object data phase, so we
can figure out what the unique type should be for a data object
with an ambiguous type.
Parameters: root - - where to start in document Parameters: doc - - doc to remove the duplicates from Map [] containing two maps - name to object descriptionand name to node |
setDataXMLizer | protected void setDataXMLizer(XMLizer xmlizer)(Code) | | |
setDocHeader | protected Node setDocHeader(Document dataDoc, boolean clearDatabase)(Code) | | Sets the vishnu epoch start and end time and the proper problem name.
If clearDatabase is true, appends CLEARDATABASE tag.
|
setResourceAttributes | protected void setResourceAttributes(Node first, Node other)(Code) | | |
|
|