java.lang .Object org.cougaar.lib.vishnu.client .BaseXMLize org.cougaar.lib.vishnu.client .FormatXMLize org.cougaar.lib.vishnu.client .DataXMLize DataXMLize public class DataXMLize extends FormatXMLize (Code) Create XML document in the Vishnu Data format, directly from ALP objects.
Create and return xml for first class log plan objects.
Element name is extracted from object class, by taking the
last field of the object class, and dropping a trailing "Impl",
if it exists.
Method Summary protected voidaddNodes (Document doc, Object obj, Element parentElement, int searchDepth, Collection createdNodes) protected booleancheckForLatLong (Document doc, Element parentElem, PropertyNameValue pnv, PropertyNameValue [] currentLatLong) public synchronized Document createDoc (Collection items, Collection changedAssets, String assetClassName)
Converts a collection of ALP objects into a Vishnu Data DOM document
Format is :
... protected Element createField (Document doc, String name, Object theObj, boolean hasObject, ObjectDescrip od)
Creates an element, field, of the form:
OR
Uses the type of theObj
to format the value properly.
protected Element createIntervalNamed (String name, Document doc, Schedule rs) protected Element createLatlong (Document doc, String latitude, String longitude) protected Element createList (Document doc) protected Element createLittleInterval (Document doc, Date start, Date end) protected Element createObject (Document doc, String name, Object theObj, boolean isTask, boolean isResource) protected Element createRootNode (Document doc, String tag, boolean isTask, boolean isResource, Object obj, String resourceClassName) protected Element createValue (Document doc) protected voidgenerateElem (Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, ObjectDescrip od, Collection createdNodes) protected voidgenerateElementReachedMaxDepth (Document doc, Element parentElement, Object obj, ObjectDescrip od) Already seen this object or reached maximum depth.protected voidgenerateLeaf (Document doc, Element parentElement, String propertyName, Object propertyValue, ObjectDescrip od) protected voidgenerateNonLeaf (Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, ObjectDescrip od, Collection createdNodes) Create a with an underneath it.
The object that is the OBJECT is propertyValue.
Keeps track of global objects, and sets the field values to properly reference them.
Ignores longitude objects since they are handled with latitudes.
Also skips creating an object tag for dates, latitudes, longitudes, and uids.
Object tags are created for non globals and for the first instance of a global.
Role Schedules get interval tags added to them.
Globals get entered into two maps : one mapping object to DOM node, and one
mapping object to the global's name. protected String getTypeName (Object theObj, boolean hasObject) protected voidnoListProcessProperties (List propertyNameValues, Document doc, Element parentElement, int searchDepth, ObjectDescrip od, Collection createdNodes) protected voidprintWarning (String parentType) public voidsetNameToDescrip (Map nameToDescrip) public voidsetResourceName (String resourceName)
classToInstances protected Map classToInstances(Code)
globalsToSend protected Set globalsToSend(Code)
nameToDescrip protected Map nameToDescrip(Code)
numAddNodes int numAddNodes (Code)
printedDataWarning protected boolean printedDataWarning(Code)
roleScheduleImplClass protected Class roleScheduleImplClass(Code)
unique Map unique (Code) Recursively introspect and add nodes to the XML document.
Keeps a Set of objects (as these can be circular) and stops
when it tries to introspect over an object a second time.
Also keeps a depth counter, decrements for each call to addNodes,
and stops when the counter is zero. Use Integer.MAX_VALUE to
indicate an unlimited search.
uniqueObjectClass protected Class uniqueObjectClass(Code)
createDoc public synchronized Document createDoc(Collection items, Collection changedAssets, String assetClassName)(Code)
Converts a collection of ALP objects into a Vishnu Data DOM document
Format is :
...
Where each tag corresponds to each item.
Parameters: items - collection of items to translate result document
createField protected Element createField(Document doc, String name, Object theObj, boolean hasObject, ObjectDescrip od)(Code)
Creates an element, field, of the form:
OR
Uses the type of theObj
to format the value properly.
Renames the field with the od
ObjectDescrip. This
object holds the mapping of oldname to newname. It is created in the
VishnuPlugin. The general problem that some fields can have multiple
types of objects, and each needs a distinct name.
Parameters: doc - needed to create new elementsParameters: name - the name of the fieldParameters: theObj - the value for the fieldParameters: hasObject - is there an object inside of this fieldParameters: od - ObjectDescrip, used to figure out how to rename the field the field element that is created
createIntervalNamed protected Element createIntervalNamed(String name, Document doc, Schedule rs)(Code) need to have special code to add plan element intervals to role schedule data, since
bean properties don't include them
generateElem protected void generateElem(Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, ObjectDescrip od, Collection createdNodes)(Code)
generateElementReachedMaxDepth protected void generateElementReachedMaxDepth(Document doc, Element parentElement, Object obj, ObjectDescrip od)(Code) Already seen this object or reached maximum depth.
Write the UID if possible, otherwise write the "toString".
generateNonLeaf protected void generateNonLeaf(Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, ObjectDescrip od, Collection createdNodes)(Code) Create a with an underneath it.
The object that is the OBJECT is propertyValue.
Keeps track of global objects, and sets the field values to properly reference them.
Ignores longitude objects since they are handled with latitudes.
Also skips creating an object tag for dates, latitudes, longitudes, and uids.
Object tags are created for non globals and for the first instance of a global.
Role Schedules get interval tags added to them.
Globals get entered into two maps : one mapping object to DOM node, and one
mapping object to the global's name. Also, a class to instance map maps
types to instances, so we can rename the globals properly. I.e. the fifth
TypeIdentificationPG becomes TypeIdentificationPG5.
Subsequent encounters of the same object generate a value tag with that global's
name.
Recurses on propertyValue using addNodes.
See Also: DataXMLize.addNodes Parameters: doc - the document to add nodes toParameters: parentElement - append new nodes hereParameters: propertyName - classname of the propertyValue objectParameters: propertyValue - object that we're translating into XMLParameters: searchDepth - how deep in the tree we can still goParameters: isList - is the object part of a list - IGNORED (used in Format)Parameters: isFirst - is the object the first elem in a list - IGNORED (used in Format)Parameters: od - object description - structure of object created in format xmlize,used in field renamingParameters: od - createdNodes - IGNORED
noListProcessProperties protected void noListProcessProperties(List propertyNameValues, Document doc, Element parentElement, int searchDepth, ObjectDescrip od, Collection createdNodes)(Code)
printWarning protected void printWarning(String parentType)(Code)
setNameToDescrip public void setNameToDescrip(Map nameToDescrip)(Code)
setResourceName public void setResourceName(String resourceName)(Code)
Methods inherited from org.cougaar.lib.vishnu.client.FormatXMLize protected void addIntervalNamed(String name, Document doc, Element item)(Code) (Java Doc) protected void addNodes(Document doc, Object obj, Element parentElement, int searchDepth, Collection createdNodes)(Code) (Java Doc) protected void addScheduleElements(Document doc, Element item)(Code) (Java Doc) protected boolean checkForDateAspect(PropertyNameValue pnv, boolean foundDateAspect)(Code) (Java Doc) protected void correctKey(Element parentElement, Element item)(Code) (Java Doc) public Document createDoc(Collection items, Collection ignoredChangedItems, String assetClassName)(Code) (Java Doc) protected Element createFieldFormat(Document doc, String name, Object theObj, boolean isList, boolean isSubobject)(Code) (Java Doc) protected Element createObjectFormat(Document doc, String name, boolean isTask, boolean isResource, Object theObj, String resourceClassName)(Code) (Java Doc) protected Element createRootNode(Document doc, String tag, boolean isTask, boolean isResource, Object obj, String resourceClassName)(Code) (Java Doc) protected void generateElementReachedMaxDepth(Document doc, Element parentElement, Object obj)(Code) (Java Doc) protected void generateLeaf(Document doc, Element parentElement, String propertyName, Object propertyValue)(Code) (Java Doc) protected void generateNonLeaf(Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, Collection createdNodes)(Code) (Java Doc) protected String getTypeFor(Object theObj)(Code) (Java Doc) public Map getUnique()(Code) (Java Doc) protected boolean ignoreObject(Object theObj)(Code) (Java Doc) protected boolean isGlobal(Object obj)(Code) (Java Doc) protected boolean isKey(Object theObj)(Code) (Java Doc) protected boolean isList(Object theObj)(Code) (Java Doc) protected void removeChildNamed(Element roleScheduleImpl, String childName)(Code) (Java Doc) protected boolean skipObject(Object theObj)(Code) (Java Doc)
Methods inherited from org.cougaar.lib.vishnu.client.BaseXMLize protected void addNodes(Document doc, Object obj, Element parentElement, int searchDepth, Collection createdNodes)(Code) (Java Doc) abstract protected Element createRootNode(Document doc, String tag, boolean isTask, boolean isResource, Object obj, String resourceClassName)(Code) (Java Doc) protected void generateElem(Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, Collection createdNodes)(Code) (Java Doc) abstract protected void generateElementReachedMaxDepth(Document doc, Element parentElement, Object obj)(Code) (Java Doc) abstract protected void generateLeaf(Document doc, Element parentElement, String propertyName, Object propertyValue)(Code) (Java Doc) abstract protected void generateNonLeaf(Document doc, Element parentElement, String propertyName, Object propertyValue, int searchDepth, boolean isList, boolean isFirst, Collection createdNodes)(Code) (Java Doc) public List getDynamicAssetProperties(Asset asset)(Code) (Java Doc) public Element getPlanObjectXML(Object obj, Document doc, String resourceClassName)(Code) (Java Doc) public Element getPlanObjectXML(Object obj, Document doc, int searchDepth, String resourceClassName)(Code) (Java Doc) public Collection getPlanObjectXMLNodes(Object obj, Document doc, String resourceClassName)(Code) (Java Doc) public Collection getPlanObjectXMLNodes(Object obj, Document doc, int searchDepth, String resourceClassName)(Code) (Java Doc) protected List getProperties(Object obj, Map listProps)(Code) (Java Doc) protected Object getReadResult(Object obj, Method rm)(Code) (Java Doc) protected String getValueOfPrimitiveFloat(Object value)(Code) (Java Doc) protected boolean ignoreClass(Class aClass)(Code) (Java Doc) protected boolean isPrimitive(Class propertyClass)(Code) (Java Doc) protected boolean isPrimitiveFloat(Class theClass)(Code) (Java Doc) protected boolean isUniqueObject(Object obj)(Code) (Java Doc) protected PropertyDescriptor [] prunePropertiesFromMeasure(AbstractMeasure measure, PropertyDescriptor [] properties)(Code) (Java Doc) protected void reportTime(String prefix, Date start)(Code) (Java Doc)