Package jade.core.messaging
Class OutgoingEncodingFilter
- java.lang.Object
-
- jade.core.Filter
-
- jade.core.messaging.OutgoingEncodingFilter
-
public class OutgoingEncodingFilter extends Filter
Class that filters outgoing commands related to the encoding of ACL messages- Version:
- $Date$ $Revision$
- Author:
- Jerome Picault - Motorola Labs, Nicolas Lhuillier - Motorola Labs
-
-
Constructor Summary
Constructors Constructor Description OutgoingEncodingFilter(Map m, AgentContainer ac, MessagingService ms)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(VerticalCommand cmd)Process the SEND_MESSAGE VCommand encoding the ACLMessage with the proper representation and adjusting Envelope fields: 1) If the receiver lives in the local container --> Do not encode (to speed up performances) --> Don't touch the envelope 2) If the receiver lives in a remote container --> Encode using the specified representation or "LEAP" if no representation is specified --> If an envelope is present adjust its fields 3) If the receiver lives in a remote platform --> Encode using the specified representation or "String" if no representation is specified --> Create a default envelope if not present and adjust its fieldsbyte[]encodeMessage(ACLMessage msg)Encodes an ACL message according to the acl-representation described in the envelope.voidpostProcess(VerticalCommand cmd)Post-process a command object after it has been processed by the successive filters in the filter chain.voidprepareEnvelope(ACLMessage msg, AID receiver, GenericMessage gmsg)This method puts into the envelope the missing information if required-
Methods inherited from class jade.core.Filter
getPreferredPosition, isBlocking, isSkipping, setBlocking, setPreferredPosition, setSkipping
-
-
-
-
Constructor Detail
-
OutgoingEncodingFilter
public OutgoingEncodingFilter(Map m, AgentContainer ac, MessagingService ms)
-
-
Method Detail
-
accept
public boolean accept(VerticalCommand cmd)
Process the SEND_MESSAGE VCommand encoding the ACLMessage with the proper representation and adjusting Envelope fields: 1) If the receiver lives in the local container --> Do not encode (to speed up performances) --> Don't touch the envelope 2) If the receiver lives in a remote container --> Encode using the specified representation or "LEAP" if no representation is specified --> If an envelope is present adjust its fields 3) If the receiver lives in a remote platform --> Encode using the specified representation or "String" if no representation is specified --> Create a default envelope if not present and adjust its fields- Overrides:
acceptin classFilter- Parameters:
cmd- AVerticalCommanddescribing what operation has been requested from previous layers (that can be the actual prime source of the command or previous filters in the chain).- Returns:
- A boolean value, telling whether the filtered command has
been accepted or not. A filter can veto a command by
returning
falsefrom this method. A vetoed command is not propagated in the filter chain.
-
postProcess
public void postProcess(VerticalCommand cmd)
Description copied from class:FilterPost-process a command object after it has been processed by the successive filters in the filter chain.- Overrides:
postProcessin classFilter- Parameters:
cmd- AVerticalCommanddescribing what operation has been requested from previous layers (that can be the actual prime source of the command or previous filters in the chain).
-
prepareEnvelope
public void prepareEnvelope(ACLMessage msg, AID receiver, GenericMessage gmsg)
This method puts into the envelope the missing information if required
-
encodeMessage
public byte[] encodeMessage(ACLMessage msg) throws MessagingService.UnknownACLEncodingException
Encodes an ACL message according to the acl-representation described in the envelope. If there is no explicit acl-representation in the envelope, uses the String representation- Parameters:
msg- the message to be encoded- Returns:
- the payload of the message
- Throws:
MessagingService.UnknownACLEncodingException
-
-