001: /*
002: * <copyright>
003: *
004: * Copyright 2001-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026: package org.cougaar.lib.vishnu.client.custom;
027:
028: import org.cougaar.planning.ldm.asset.Asset;
029: import org.cougaar.planning.ldm.plan.LatLonPoint;
030: import org.cougaar.planning.ldm.plan.NamedPosition;
031:
032: import java.util.Date;
033:
034: /**
035: * Defines interface for a data helper that can either produce XML or
036: * Vishnu objects. The interface is neutral to either.
037: */
038: public interface DataHelper {
039: /**
040: * Add a field on <code>parent</code>, but don't set the value. <br>
041: * The value is set by using createObject.
042: *
043: * @param parent Element/SchObject object to add the field to
044: * @param parentType type of the parent SchObject/Element
045: * @param name field name
046: * @see #createObject
047: */
048: Object createField(Object parent, String parentType, String name);
049:
050: /**
051: * Create an object (DOM Element/Vishnu SchObject) of type <code>type</code>
052: *
053: * @param parent - Element/Object to attach this new Element/Object to
054: * @param type - type of the new OBJECT Element/Object
055: */
056: Object createObject(Object parent, String type);
057:
058: /**
059: * Generic field creation <p>
060: *
061: * Attach the field to either an XML Element or Vishnu Object. <p>
062: *
063: * Given the parentType and the name of the field, may look up the other
064: * field attributes.
065: *
066: * @param parent Element/SchObject object to add the field to
067: * @param parentType type of the parent SchObject/Element
068: * @param name field name
069: * @param value field value
070: */
071: void createField(Object parent, String parentType, String name,
072: String value);
073:
074: Object startList(Object object, String name);
075:
076: void addListValue(Object parent, String fieldName, String type,
077: Object toAppend);
078:
079: /** shortcut to create a date field on <code>parent</code> */
080: void createDateField(Object parent, String name, Date date);
081:
082: /** shortcut to create a boolean field on <code>parent</code> */
083: void createBooleanField(Object parent, String name, boolean val);
084:
085: /** shortcut to create a float field on <code>parent</code> */
086: void createFloatField(Object parent, String name, float val);
087:
088: /** Adds a latlong object to the parent object, and adds the geoloc object to the parent. */
089: void createGeoloc(Object parent, String parentFieldName,
090: NamedPosition loc);
091:
092: /** Adds a latlong object to the parent object */
093: void createLatLon(Object parent, String parentFieldName,
094: LatLonPoint loc);
095:
096: /**
097: * Translate TimeSpans(PlanElements) in the role schedule into
098: * Vishnu intervals (see the link for more info).
099: * @see <a href="http://www.cougaar.org/projects/vishnu/fulldoc.html#predefined">Vishnu interval definition</a>
100: */
101: void createRoleScheduleListField(Object object, String name,
102: Asset asset);
103:
104: /**
105: * Translate TimeSpans(PlanElements) in the available schedule into
106: * Vishnu intervals (see the link for more info).
107: * @see <a href="http://www.cougaar.org/projects/vishnu/fulldoc.html#predefined">Vishnu interval definition</a>
108: */
109: void createAvailableScheduleListField(Object object, String name,
110: Asset asset);
111: }
|