fipaos.ont.fipa.fipaman
Class Envelope


public class Envelope
implements Cloneable, Serializable

This class provides a representation of the FIPA99/2000 envelope (implements XC00067C)

In conformance with the FIPA99/2000 specification slots cannot be overwriten, just
overridden.


Constructor Summary
Envelope()
          Default constructor - creates an empty envelope
Envelope(ACL msg)
          Creates an Envelope based upon the given ACL object

Method Summary
 voidaddMessageListener(MessageListener ml)
          Add a MessageListener to this
 Objectclone()
           
 ObjectcloneSlot(Object slot)
          Attempt to clone a value that has been inserted into a slot
 StringgetACLRepresentation()
          Gets the ACL representation associated with this envelope
 StringgetComments()
          Gets the comments associated with this Envelope
 UTCTimegetDate()
          Gets the creating date of this Envelope
 ListgetEncrypted()
          Gets details of the encryption used on the content of the envelope
 intgetErrorCode()
          Get the internal error condition for this envelope
N.B.
 ListgetIntendedReceiver()
          Gets the intended receivers for the message
 ListgetMessageListeners()
          Get list of MessageListeners
 StringgetPayloadEncoding()
          Gets the payload encoding associated with this Envelope
 intgetPayloadLength()
          Gets the payload length associated with this Envelope
 ReceivedgetReceived()
          Gets details of when the message was received by an entity
 ListgetReceivers()
          Gets a List of the recipients' AID's
 AgentIDgetSender()
          Gets the sender of the message
 synchronized ObjectgetSlotValue(String slot)
          Generic method for retreiving the value assigned to a slot within the envelope
 synchronized EnvelopegetSubEnvelope(int x)
          Gets a particular sub-envelope
 synchronized ListgetSubEnvelopes()
          Returns a list of the sub-envelopes composing this
 TransportBehaviourgetTransportBehaviour()
          Gets the TransportBehviour parameter
 ListgetTransportsTried()
          Returns the transports that have been tried whilst attempting to send
this message
 ListgetUnknownURLsTried()
          Returns the URL's that have been tried, but an MTP implementation
hasn't been found
 synchronized SetgetUserSlots()
          Returns a list of the names of non-standard slots contained within this
Envelope
 booleangetViaACC()
          Indicates if this should be routed via the ACC
 static voidmain(String[] args)
          Test-harness
 synchronized voidnewSubEnvelope()
          Indicates that a new sub-envelope should be started (i.e.
 voidremoveMessageListener(MessageListener ml)
          Remove a MessageListener from this
 voidsetACLRepresentation(String type)
          Sets the ACL representation of this Envelope
 voidsetComments(String comments)
          Sets the comments associated with this envelope
 voidsetDate(UTCTime utc)
          Sets the date of creation for this envelope
 voidsetEncrypted(List enc)
          Sets details of the encryption used on the content of the envelope
 voidsetErrorCode(int code)
          Set the internal error condition for this envelope
N.B.
 voidsetIntendedReceiver(List aids)
          Sets the intended receivers for the message
 voidsetPayloadEncoding(String encoding)
          Sets the payload encoding associated with this envelope
 voidsetPayloadLength(int length)
          Sets the payload length associated with this envelope
 voidsetReceived(Received received)
          Sets details of when the message was received by an entity
 voidsetReceivers(List aids)
          Sets the list of receivers for the message
 voidsetSender(AgentID aid)
          Sets the sender of the message
 synchronized voidsetSlotValue(String slot, Object value)
          Generic method for adding a value to a slot within the envelope
 voidsetTransportBehaviour(TransportBehaviour behaviour)
          Sets the TransportBehviour parameter
 voidsetViaACC(boolean value)
          Sets the flag that indicates if the message this encapsulates should be
routed via the ACC
 StringtoString()
          Overrides default toString() method - displays contents of Envelope

Constructor Detail

Envelope

public Envelope()
Default constructor - creates an empty envelope

Envelope

public Envelope(ACL msg)
Creates an Envelope based upon the given ACL object
Parameters:
msg - ACL to base the Envelope on
Method Detail

addMessageListener

public void addMessageListener(MessageListener ml)
Add a MessageListener to this

clone

public Object clone()

cloneSlot

public Object cloneSlot(Object slot)
Attempt to clone a value that has been inserted into a slot

getACLRepresentation

public String getACLRepresentation()
Gets the ACL representation associated with this envelope
Returns: ACL encoding

getComments

public String getComments()
Gets the comments associated with this Envelope
Returns: The comments

getDate

public UTCTime getDate()
Gets the creating date of this Envelope
Returns: UTCTime representing the creation time

getEncrypted

public List getEncrypted()
Gets details of the encryption used on the content of the envelope
Returns: Details of the encryption used

getErrorCode

public int getErrorCode()
Get the internal error condition for this envelope

N.B. This is not part of the FIPA specification, but
servers as a mechanism for "tagging" messages with "exception" codes
at the transport layer

Returns:

getIntendedReceiver

public List getIntendedReceiver()
Gets the intended receivers for the message
Returns: AgentID belonging to the intended recipient of the message

getMessageListeners

public List getMessageListeners()
Get list of MessageListeners

getPayloadEncoding

public String getPayloadEncoding()
Gets the payload encoding associated with this Envelope

getPayloadLength

public int getPayloadLength()
Gets the payload length associated with this Envelope
Returns: The length, or -1 if this hasn't been set

getReceived

public Received getReceived()
Gets details of when the message was received by an entity
Returns: Details of when & what entity received the message last

getReceivers

public List getReceivers()
Gets a List of the recipients' AID's
Returns: List of the recipients' AID's

getSender

public AgentID getSender()
Gets the sender of the message
Returns: The AID of the sending Agent

getSlotValue

public synchronized Object getSlotValue(String slot)
Generic method for retreiving the value assigned to a slot within the envelope
Parameters:
slot - Slot name
Returns: Most recent value associated with a slot

getSubEnvelope

public synchronized Envelope getSubEnvelope(int x)
Gets a particular sub-envelope
Parameters:
x - The sub-envelope number to get
Returns: A sub-envelope of this

getSubEnvelopes

public synchronized List getSubEnvelopes()
Returns a list of the sub-envelopes composing this
Returns: A List of Envelope objects

getTransportBehaviour

public TransportBehaviour getTransportBehaviour()
Gets the TransportBehviour parameter
Returns: A description of the transport level behaviour

getTransportsTried

public List getTransportsTried()
Returns the transports that have been tried whilst attempting to send
this message
Returns: A List of transports tried (by protocol)

getUnknownURLsTried

public List getUnknownURLsTried()
Returns the URL's that have been tried, but an MTP implementation
hasn't been found
Returns: A List of transports tried (by protocol)

getUserSlots

public synchronized Set getUserSlots()
Returns a list of the names of non-standard slots contained within this
Envelope
Returns: A Set of user-defined slot names

getViaACC

public boolean getViaACC()
Indicates if this should be routed via the ACC
Returns: If true, this should be routed via the ACC

main

public static void main(String[] args)
Test-harness

newSubEnvelope

public synchronized void newSubEnvelope()
Indicates that a new sub-envelope should be started (i.e. when the
Envelope is received by a new ACC)

removeMessageListener

public void removeMessageListener(MessageListener ml)
Remove a MessageListener from this

setACLRepresentation

public void setACLRepresentation(String type)
Sets the ACL representation of this Envelope
Parameters:
type - The type of the ACL representation (i.e. RDF)

setComments

public void setComments(String comments)
Sets the comments associated with this envelope
Parameters:
comments - Comment to add

setDate

public void setDate(UTCTime utc)
Sets the date of creation for this envelope
Parameters:
utc - The UTCTime representing the creation time of the envelope

setEncrypted

public void setEncrypted(List enc)
Sets details of the encryption used on the content of the envelope
Parameters:
enc - Details of encryption applied

setErrorCode

public void setErrorCode(int code)

Set the internal error condition for this envelope

N.B. This is not part of the FIPA specification, but
servers as a mechanism for "tagging" messages with "exception" codes
at the transport layer

Parameters:
code

setIntendedReceiver

public void setIntendedReceiver(List aids)
Sets the intended receivers for the message
Parameters:
aids - A List of AgentID's

setPayloadEncoding

public void setPayloadEncoding(String encoding)
Sets the payload encoding associated with this envelope

setPayloadLength

public void setPayloadLength(int length)
Sets the payload length associated with this envelope
Parameters:
length - of payload (or -1 for none)

setReceived

public void setReceived(Received received)
Sets details of when the message was received by an entity
Parameters:
received - Description of the time & entity

setReceivers

public void setReceivers(List aids)
Sets the list of receivers for the message
Parameters:
aids - A List of AgentID's belonging to the recipients of the message

setSender

public void setSender(AgentID aid)
Sets the sender of the message
Parameters:
aid - The AID belonging to the sending Agent

setSlotValue

public synchronized void setSlotValue(String slot, Object value)
Generic method for adding a value to a slot within the envelope
Parameters:
slot - Slot name
value - Value

setTransportBehaviour

public void setTransportBehaviour(TransportBehaviour behaviour)
Sets the TransportBehviour parameter
Parameters:
behaviour - A description of the behaviour to use

setViaACC

public void setViaACC(boolean value)
Sets the flag that indicates if the message this encapsulates should be
routed via the ACC
Parameters:
value - If true, indicates this message should be routed via the ACC

toString

public String toString()
Overrides default toString() method - displays contents of Envelope
Returns: Stringified representation of this

Association Links

to Class java.lang.String

Array of non-user slots

to Class java.util.Map

Slots are contained within this Map, key => value(s). The values are
represented as a List containing Strings making up entries of the slot

to Class java.util.List

List of Envelope's composing this envelope

to Class fipaos.ont.fipa.fipaman.Envelope

Envelope that this belongs to

to Class fipaos.ont.fipa.fipaman.Envelope

Current envelope object (to be added to list of sub-envelopes)

to Class java.util.List

List of transports "tried" when trying to send this message

to Class java.util.List

List of URL's "tried" when trying to send this message, but no MTP could deal with it

to Class java.util.List

List of MessageListener's interested in the message this is associated with