001: /*
002: * <copyright>
003: *
004: * Copyright 1997-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:
027: package org.cougaar.planning.ldm;
028:
029: import org.cougaar.core.agent.service.alarm.Alarm;
030: import org.cougaar.core.agent.service.alarm.ExecutionTimer;
031: import org.cougaar.core.mts.MessageAddress;
032: import org.cougaar.core.service.UIDServer;
033: import org.cougaar.util.ConfigFinder;
034:
035: /**
036: * ClusterServesPlugin is the API which plugins may use to access
037: * agent-level services.
038: **/
039: public interface ClusterServesPlugin {
040:
041: //
042: // Mix of DomainService & PrototypeRegistryService
043: //
044:
045: /**
046: * return our LDM instance. You can get the factory(ies) from
047: * the LDM instance.
048: **/
049: LDMServesPlugin getLDM();
050:
051: //
052: // AgentIdentificationService
053: //
054:
055: /**
056: * @return MessageAddress the MessageAddress associated with
057: * the Agent where the Plugin is plugged in.
058: */
059: MessageAddress getMessageAddress();
060:
061: //
062: // ConfigFinderService
063: //
064:
065: /**
066: * @return the agent's ConfigFinder instance.
067: **/
068: ConfigFinder getConfigFinder();
069:
070: //
071: // UIDService
072: //
073:
074: UIDServer getUIDServer();
075:
076: //
077: // AlarmService & DemoControlService
078: //
079:
080: /**
081: * This method sets the COUGAAR scenario time to a specific time
082: * in the future, leaving the clock stopped.
083: * Time is in milliseconds.
084: * Equivalent to setTime(time, false);
085: * <em>Only UI Plugins controlling the demonstration should use
086: * this method.</em>
087: **/
088: void setTime(long time);
089:
090: /** General form of setTime, allowing the clock to be left running.
091: * <em>Only UI Plugins controlling the demonstration should use
092: * this method.</em>
093: **/
094: void setTime(long time, boolean leaveRunning);
095:
096: /**
097: * Changes the rate at which execution time advances. There is no
098: * discontinuity in the value of execution time; it flows smoothly
099: * from the current rate to the new rate.
100: **/
101: void setTimeRate(double newRate);
102:
103: /**
104: * This method advances the COUGAAR scenario time a period of time
105: * in the future, leaving the clock stopped.
106: * Time is in milliseconds.
107: * Equivalent to advanceTime(timePeriod, false);
108: * <em>Only UI Plugins controlling the demonstration should use
109: * this method.</em>
110: **/
111: void advanceTime(long timePeriod);
112:
113: /** General form of advanceTime, allowing the clock to be left running.
114: * <em>Only UI Plugins controlling the demonstration should use
115: * this method.</em>
116: **/
117: void advanceTime(long timePeriod, boolean leaveRunning);
118:
119: /** General form of advanceTime, allowing the clock to be left running at a new rate.
120: * <em>Only UI Plugins controlling the demonstration should use
121: * this method.</em>
122: **/
123: void advanceTime(long timePeriod, double newRate);
124:
125: /**
126: * Set a series of time parameter changes. The number of such
127: * changes is limited. See ExecutionTimer.create() for details.
128: **/
129: void advanceTime(ExecutionTimer.Change[] changes);
130:
131: /**
132: * Get the current execution time rate.
133: **/
134: double getExecutionRate();
135:
136: /**
137: * This method gets the current COUGAAR scenario time.
138: * The returned time is in milliseconds.
139: **/
140: long currentTimeMillis();
141:
142: /**
143: * Called by a plugin to schedule an Alarm to ring
144: * at some future Scenario time.
145: * This alarm functions over Scenario time which may be discontinuous
146: * and/or offset from realtime.
147: * If you want real (wallclock time, use addRealTimeAlarm instead).
148: * Most plugins will want to just use the wake() functionality,
149: * which is implemented in terms of addAlarm().
150: **/
151: void addAlarm(Alarm alarm);
152:
153: /**
154: * Called by a plugin to schedule an Alarm to ring
155: * at some future Real (wallclock) time.
156: **/
157: void addRealTimeAlarm(Alarm alarm);
158: }
|