ch.epfl.lsr.apex.services
Class APEXReliableBroadcastService

java.lang.Object
  extended bych.epfl.lsr.apex.services.APEXService
      extended bych.epfl.lsr.apex.services.APEXReliableBroadcastService

public class APEXReliableBroadcastService
extends APEXService

The 'Reliable Broadcast Service' is an additional service for the APEX model. It is registered with the external URI 'http://lsrwww.epfl.ch/APEX/reliableBroadcast' and internal SERVICENAME 'APEXReliableBroadcast'.

A message containing an option with the form:
 
<option external='http://lsrwww.epfl.ch/APEX/reliableBroadcast' targetHop='final' 
        mustUnderstand='true' transID='2'>
    <endpoint identity='user1@lsrwww.epfl.ch' order='0' /> 
    <endpoint identity='user2@ltiwww.epfl.ch' order='1' /> 
    <endpoint identity='user3@lcawww.epfl.ch' order='2' /> 
</option> 
 
invokes the use of this service.

The reliable service is only used in relays which go along the order of every specified endpoint and sends a message, dependant on if the order of the endpoint is less than the order of all its attached and specified endpoints and on if it hasn't already sent a message to the corresponding endpoint.

Author:
Marc Stoecklin
See Also:
APEXService

Field Summary
static String ORDER
          Reliable Broadcast service syntax: order
static String RELIABLEBROADCAST
          External URI for a reliable broadcast option: http://lsrwww.epfl.ch/APEX/reliableBroadcast
static String SERVICENAME
          Service name: APEXReliableBroadcast
 
Fields inherited from class ch.epfl.lsr.apex.services.APEXService
manager
 
Constructor Summary
APEXReliableBroadcastService()
          Creates a new APEXReliableBroadcastService within the specified APEX manager
 
Method Summary
 Hashtable getOptions()
          Returns a table of all options this service is willing to handle.
static APEXOption getReliableBroadcastOption(APEXEndpointManager manager, APEXEndpointAddress originator, APEXEndpointAddress[] destinations)
          Returns an 'APEXOption' formed for 'Reliable Broadcast'.
 void handleDiscarded(APEXOption option, APEXMessage message, int code, String reason, String hopName)
          This method is not used for reliable broadcast service
 void handleMessage(APEXMessage message)
          Handles an incoming message destined explicitly to this service.
 void handleOption(APEXOption option, APEXMessage message, String administrativeDomain)
          Handles an option destinated to this service.
 void handleReliableBroadcastOption(APEXOption option, APEXDataMessage message, String administrativeDomain)
          Handles a 'reliable broadcast' option and sends appropriate messages to the relay.
 void handleSent(APEXOption option, APEXMessage message, APEXReply reply, String hopName)
          This method is not used for reliable broadcast service
 
Methods inherited from class ch.epfl.lsr.apex.services.APEXService
setManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICENAME

public static final String SERVICENAME
Service name: APEXReliableBroadcast

See Also:
Constant Field Values

RELIABLEBROADCAST

public static final String RELIABLEBROADCAST
External URI for a reliable broadcast option: http://lsrwww.epfl.ch/APEX/reliableBroadcast

See Also:
Constant Field Values

ORDER

public static final String ORDER
Reliable Broadcast service syntax: order

See Also:
Constant Field Values
Constructor Detail

APEXReliableBroadcastService

public APEXReliableBroadcastService()
Creates a new APEXReliableBroadcastService within the specified APEX manager

Method Detail

handleMessage

public void handleMessage(APEXMessage message)
Handles an incoming message destined explicitly to this service.

Specified by:
handleMessage in class APEXService
Parameters:
message - The incoming message to handle

handleOption

public void handleOption(APEXOption option,
                         APEXMessage message,
                         String administrativeDomain)
                  throws APEXOptionException
Handles an option destinated to this service. This method is invoked only if the option targetHop field is set to final and at least one endpoint is applicable.

Specified by:
handleOption in class APEXService
Parameters:
option - The option to handle
message - The message which contains the option
administrativeDomain - The administrative domain of the processing relay
Throws:
APEXOptionException - Thrown on an error in processing the option
See Also:
APEXOption

getOptions

public Hashtable getOptions()
Returns a table of all options this service is willing to handle.

Specified by:
getOptions in class APEXService
Returns:
Hashtable containing option identifiers this services handles as well as their corresponding handlers.

handleReliableBroadcastOption

public void handleReliableBroadcastOption(APEXOption option,
                                          APEXDataMessage message,
                                          String administrativeDomain)
                                   throws APEXOptionException
Handles a 'reliable broadcast' option and sends appropriate messages to the relay.

Parameters:
option - The option to handle
message - The message which contains the option
administrativeDomain - The administrative domain of the processing relay
Throws:
APEXOptionException - Thrown if there is an error in processing the option

getReliableBroadcastOption

public static APEXOption getReliableBroadcastOption(APEXEndpointManager manager,
                                                    APEXEndpointAddress originator,
                                                    APEXEndpointAddress[] destinations)
                                             throws APEXOptionException

Returns an 'APEXOption' formed for 'Reliable Broadcast'. The order of the endpoints depends on the order in the address in the array, say key '0' in the array is order '0' (first) in the reliable broadcast algorithm.

Note: a reliable broadcast option is always final and mustUnderstand='true' to guarantee the mechanism

Parameters:
manager - The endpoint manager for the APEX communication
originator - The originator of the message containing the option
destinations - An array of destinated endpoints (ordered!)
Returns:
A correct formed 'Reliable Broadcast Option'
Throws:
APEXOptionException

handleSent

public void handleSent(APEXOption option,
                       APEXMessage message,
                       APEXReply reply,
                       String hopName)
This method is not used for reliable broadcast service

Specified by:
handleSent in class APEXService
Parameters:
option - The option to handle
message - The message successfully sent (modified message)
reply - The reply received by the next hop
hopName - The name of the hop (endpoint address or administrative domain)

handleDiscarded

public void handleDiscarded(APEXOption option,
                            APEXMessage message,
                            int code,
                            String reason,
                            String hopName)
This method is not used for reliable broadcast service

Specified by:
handleDiscarded in class APEXService
Parameters:
option - The option to handle
message - The message successfully sent (modified message)
hopName - The name of the hop (endpoint address or administrative domain)