001: /*
002: * <copyright>
003: *
004: * Copyright 2002-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.core.mobility.ldm;
028:
029: import org.cougaar.core.mobility.AbstractTicket;
030: import org.cougaar.core.mts.MessageAddress;
031: import org.cougaar.core.util.UID;
032: import org.cougaar.core.util.UniqueObject;
033:
034: /**
035: * Request an agent management operation, as defined in the
036: * {@link #getAbstractTicket()}.
037: * <p>
038: * Abstract tickets allow add / remove / move of agents.
039: *
040: * @see MoveAgent backwards compatible API for agent mobility.
041: */
042: public interface AgentControl extends UniqueObject {
043:
044: /**
045: * Status codes:
046: */
047: int NONE = 1;
048: int CREATED = 2;
049: int ALREADY_EXISTS = 3;
050: int REMOVED = 4;
051: int DOES_NOT_EXIST = 5;
052: int MOVED = 6;
053: int ALREADY_MOVED = 7;
054: int FAILURE = 8;
055:
056: /**
057: * UID support from unique-object.
058: */
059: UID getUID();
060:
061: /**
062: * Get the optional UID of the object that "owns" this
063: * agent control request.
064: */
065: UID getOwnerUID();
066:
067: /**
068: * Get the agent that created this request.
069: */
070: MessageAddress getSource();
071:
072: /**
073: * Get the agent that should perform the operation.
074: * <p>
075: * For agent mobility this should be eithe the mobile agent itself
076: * or the node containing the mobile agent. This must
077: * agree with the ticket.
078: * <p>
079: * Note that the behavior is different depending upon
080: * the target. If the node is specified then the
081: * request is not passed through the agent.
082: */
083: MessageAddress getTarget();
084:
085: /**
086: * The addresses specified in the ticket are not
087: * null.
088: */
089: AbstractTicket getAbstractTicket();
090:
091: /**
092: * Get the move status code, which is one of the above
093: * "*_STATUS" constants.
094: * <p>
095: * Initially the status is "NO_STATUS".
096: */
097: int getStatusCode();
098:
099: /**
100: * Get a string representation of the status.
101: */
102: String getStatusCodeAsString();
103:
104: /**
105: * If (getStatusCode() == FAILED_STATUS), this is
106: * the failure exception.
107: */
108: Throwable getFailureStackTrace();
109:
110: /**
111: * For infrastructure use only! Set the status.
112: */
113: void setStatus(int statusCode, Throwable stack);
114:
115: }
|