| java.lang.Object org.cougaar.lib.vishnu.client.custom.DirectDataHelper
DirectDataHelper | public class DirectDataHelper implements DataHelper(Code) | | Fills in the fields of Vishnu objects sent to the Vishnu Scheduler.
Scans the format document to determine the types of each field of data.
This is necessary with direct translation because when a field is added
its attributes must be set. These are :
- datatype - the field type
- is_subobject - is the field's type a primitive or a subobject
- is_key - is this field the key field for the object
- is_list - is this field a list
|
Inner Class :protected class ObjectInfo | |
Constructor Summary | |
public | DirectDataHelper(Document formatDoc, SchedulingData schedData, Logger logger) Sets up the endOfWorld time, used in createRoleScheduleListField. |
Method Summary | |
public void | addListValue(Object parent, String fieldName, String type, Object toAppend) | public void | createAvailableScheduleListField(Object object, String name, Asset asset) | public void | createBooleanField(Object parent, String name, boolean value) | public void | createDateField(Object parent, String name, Date date) | public Object | createField(Object parent, String name) | public Object | createField(Object parent, String name, String value) | public void | createField(Object parent, String parentType, String name, String value) Generic field creation
Given the parentType and the name of the field, looks up the other
field attributes in the objects map, using the isKey, isList,
and getType methods. | public Object | createFieldPair(String name, String value) | public void | createFloatField(Object parent, String name, float value) | public void | createGeoloc(Object parent, String parentFieldName, NamedPosition loc) Translate a Cougaar GeolocLocation into the equivalent Vishnu structure. | public void | createLatLon(Object parent, String parentFieldName, LatLonPoint loc) | public Object | createObject(Object parent, String type) | public void | createRoleScheduleListField(Object object, String name, Asset asset) Translate an asset's role schedule into a list of Vishnu intervals
The interval has a start and end time and the verb of plan element in the role schedule. | protected void | createScheduleFields(Collection schedule, SchObject resource, String name) | protected String | getType(String parentType, String name) | protected boolean | isKey(String parentType, String name) In all of these methods (isKey, isList, isSub, getType),
if a type is not found in the objects map, it may
be because it's a predefined type. | protected boolean | isList(String parentType, String name) | protected boolean | isPredefined(String type) | protected boolean | isSub(String parentType, String name) | protected void | scanFormatDoc(Document formatDoc) Scans the format document to determine the types of each field of data. | public Object | startList(Object object, String name) |
endOfWorld | protected Date endOfWorld(Code) | | used in createRoleScheduleListField
|
geolocCodeCache | protected Map geolocCodeCache(Code) | | |
objects | protected Map objects(Code) | | holds Vishnu object attributes per type
|
schedData | protected SchedulingData schedData(Code) | | reference to SchedulingData object, used whenever a date is created
|
createAvailableScheduleListField | public void createAvailableScheduleListField(Object object, String name, Asset asset)(Code) | | |
createBooleanField | public void createBooleanField(Object parent, String name, boolean value)(Code) | | shortcut to create a boolean field on parent
|
createDateField | public void createDateField(Object parent, String name, Date date)(Code) | | shortcut to create a date field on parent
|
createField | public void createField(Object parent, String parentType, String name, String value)(Code) | | Generic field creation
Given the parentType and the name of the field, looks up the other
field attributes in the objects map, using the isKey, isList,
and getType methods.
This map is set in scanFormatDoc.
See Also: DirectDataHelper.scanFormatDoc See Also: DirectDataHelper.objects Parameters: parent - SchObject object to add the field to Parameters: parentType - type of the SchObject Parameters: name - field name Parameters: value - field's value |
createFloatField | public void createFloatField(Object parent, String name, float value)(Code) | | shortcut to create a float field on parent
|
createGeoloc | public void createGeoloc(Object parent, String parentFieldName, NamedPosition loc)(Code) | | Translate a Cougaar GeolocLocation into the equivalent Vishnu structure.
The field names here are all "parentFieldName".name, e.g.
from.geolocCode.
Adds a latlong SchObject to the parent object, and adds the geoloc
to the parent.
Uses a geolocCode and latLon Cache to drastically reduce the number
of Geoloc and latLon objects that are created.
Parameters: parent - - the SchObject to add the parentFieldName geoloc field to Parameters: parentFieldName - - the base name of the geoloc field Parameters: loc - - the Cougaar GeolocLocation to translate into a Vishnu structure |
createObject | public Object createObject(Object parent, String type)(Code) | | create a vanilla Vishnu object
Parameters: parent - - ignored here Parameters: type - - ignored here |
createRoleScheduleListField | public void createRoleScheduleListField(Object object, String name, Asset asset)(Code) | | Translate an asset's role schedule into a list of Vishnu intervals
The interval has a start and end time and the verb of plan element in the role schedule.
Parameters: object - - the SchObject to add the name list field to Parameters: name - - the name of the list field Parameters: asset - - the asset with the role schedule |
createScheduleFields | protected void createScheduleFields(Collection schedule, SchObject resource, String name)(Code) | | |
isKey | protected boolean isKey(String parentType, String name)(Code) | | In all of these methods (isKey, isList, isSub, getType),
if a type is not found in the objects map, it may
be because it's a predefined type.
This should never happen, though.
|
isPredefined | protected boolean isPredefined(String type)(Code) | | |
scanFormatDoc | protected void scanFormatDoc(Document formatDoc)(Code) | | Scans the format document to determine the types of each field of data.
Stores this information in the objects map.
Parameters: formatDoc - the object format document |
|
|