org.cougaar.pizza.relay
Class RSVPRelayTarget

java.lang.Object
  extended byorg.cougaar.pizza.relay.RSVPRelayTarget
All Implemented Interfaces:
org.cougaar.core.relay.Relay, org.cougaar.core.relay.Relay.Target, java.io.Serializable, org.cougaar.core.util.UniqueObject

public class RSVPRelayTarget
extends java.lang.Object
implements org.cougaar.core.relay.Relay.Target, org.cougaar.core.util.UniqueObject

A target-side Relay. It has a slot for the query (from the sender) and the local response.

The target relay has just a source address, and no target address, so that the relay won't be (re)propagated at the target agent.

An alternative would be to have the relay implement both source and target interfaces, but this could lead to endless pinging in this case where the target address is an ABA broadcast to all members of the community (as in this pizza app).

In contrast, SimpleRelayImpl which implements both source and target.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.cougaar.core.relay.Relay
org.cougaar.core.relay.Relay.Source, org.cougaar.core.relay.Relay.Target, org.cougaar.core.relay.Relay.TargetFactory, org.cougaar.core.relay.Relay.Token
 
Field Summary
 
Fields inherited from interface org.cougaar.core.relay.Relay
CONTENT_CHANGE, NO_CHANGE, RESPONSE_CHANGE
 
Constructor Summary
RSVPRelayTarget(org.cougaar.core.util.UID uid, org.cougaar.core.mts.MessageAddress source, java.lang.Object query)
           
 
Method Summary
 java.lang.Object getQuery()
          This is important so that if there are multiple relays, the RSVP plugin can know which to examine.
 java.lang.Object getResponse()
          Used by the RelayLP to get the response to send back the the Relay sender.
 org.cougaar.core.mts.MessageAddress getSource()
          Get Relay sender.
 org.cougaar.core.util.UID getUID()
          Implemented for UniqueObject interface.
 void setResponse(java.lang.Object response)
          Specify the reply to the invite.
 void setUID(org.cougaar.core.util.UID uid)
          Implemented for UniqueObject interface.
 java.lang.String toString()
           
 int updateContent(java.lang.Object newContent, org.cougaar.core.relay.Relay.Token token)
          Used by the RelayLP to update the query from the Relay sender.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSVPRelayTarget

public RSVPRelayTarget(org.cougaar.core.util.UID uid,
                       org.cougaar.core.mts.MessageAddress source,
                       java.lang.Object query)
Method Detail

getSource

public org.cougaar.core.mts.MessageAddress getSource()
Get Relay sender. Relay.Target implementation.

Specified by:
getSource in interface org.cougaar.core.relay.Relay.Target
Returns:
source (sender or inviter) address

setResponse

public void setResponse(java.lang.Object response)
Specify the reply to the invite.

Parameters:
response - - reply to relay (should be an RSVPReply object)

getResponse

public java.lang.Object getResponse()
Used by the RelayLP to get the response to send back the the Relay sender. Relay.Target implementation

Specified by:
getResponse in interface org.cougaar.core.relay.Relay.Target
Returns:
reply to relay

getQuery

public java.lang.Object getQuery()
This is important so that if there are multiple relays, the RSVP plugin can know which to examine.

Returns:
query - the type of invitation

updateContent

public int updateContent(java.lang.Object newContent,
                         org.cougaar.core.relay.Relay.Token token)
Used by the RelayLP to update the query from the Relay sender. Not used in our application. Relay.Target implementation

Specified by:
updateContent in interface org.cougaar.core.relay.Relay.Target
Returns:
Relay.NO_CHANGE - content doesn't need to be updated, only the response

getUID

public org.cougaar.core.util.UID getUID()
Implemented for UniqueObject interface.

Specified by:
getUID in interface org.cougaar.core.util.UniqueObject
Returns:
the UID of this UniqueObject.

setUID

public void setUID(org.cougaar.core.util.UID uid)
Implemented for UniqueObject interface. Does nothing - not allowed to reset UID.

Specified by:
setUID in interface org.cougaar.core.util.UniqueObject

toString

public java.lang.String toString()