ch.epfl.lsr.apex.services
Class APEXReportService

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

public class APEXReportService
extends APEXService

The APEXReportService represents the report service as it is specified in RFC3340.

Author:
Marc Stoecklin

Field Summary
static String DESTINATION
          APEX Report Service syntax: destination
static String SERVICEADDRESS
          Service address: apex=report
static String SERVICENAME
          Service name: APEXReportService
static String STATUSREQUEST
          APEX Report Service syntax: statusRequest
static String STATUSRESPONSE
          APEX Report Service syntax: statusResponse
 
Fields inherited from class ch.epfl.lsr.apex.services.APEXService
manager
 
Constructor Summary
APEXReportService()
          Instantiates a new report service
 
Method Summary
 Hashtable getOptions()
          Offers a Hashtable containing all identifiers of options this service is able to handle.
static APEXOption getStatusRequestOption(APEXEndpointManager manager, APEXEndpointAddress originator)
          Returns an APEXOption for the specified arguments with automatically obtained transID, targetHop='final', and mustUnderstan='false'.
static APEXOption getStatusRequestOption(APEXEndpointManager manager, APEXEndpointAddress originator, String targetHop)
          Returns an APEXOption for the specified arguments with automatically obtained transID and mustUnderstand='false'.
static APEXOption getStatusRequestOption(APEXEndpointManager manager, APEXEndpointAddress originator, String targetHop, String mustUnderstand)
          Returns an APEXOption for the specified arguments with automatically obtained transID.
static APEXOption getStatusRequestOption(int transID)
          Returns an APEXOption for the specified transID with targetHop='final' and mustUnderstan='false'.
static APEXOption getStatusRequestOption(int transID, String targetHop)
          Returns an APEXOption for the specified arguments and mustUnderstand='false'.
static APEXOption getStatusRequestOption(int transID, String targetHop, String mustUnderstand)
          Returns an APEXOption for the specified arguments.
 void handleDiscarded(APEXOption option, APEXMessage message, int code, String reason, String hopName)
          Updates the status in the hashtable for a discarded message.
 void handleMessage(APEXMessage message)
          Handles an incoming message destined explicitly to this service.
 void handleOption(APEXOption option, APEXMessage message, String administrativeDomain)
          Handles the statusRequest option for the first time: in a RELAY: adds all status objects for alls applicable endpoints in a hashtable in an ENDPOINT: replies with a statusResponse message
 void handleSent(APEXOption option, APEXMessage message, APEXReply reply, String hopName)
          Updates the status in the hashtable for a sent message.
 
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: APEXReportService

See Also:
Constant Field Values

SERVICEADDRESS

public static final String SERVICEADDRESS
Service address: apex=report

See Also:
Constant Field Values

STATUSREQUEST

public static final String STATUSREQUEST
APEX Report Service syntax: statusRequest

See Also:
Constant Field Values

STATUSRESPONSE

public static final String STATUSRESPONSE
APEX Report Service syntax: statusResponse

See Also:
Constant Field Values

DESTINATION

public static final String DESTINATION
APEX Report Service syntax: destination

See Also:
Constant Field Values
Constructor Detail

APEXReportService

public APEXReportService()
Instantiates a new report service

Method Detail

handleMessage

public void handleMessage(APEXMessage message)
Description copied from class: APEXService
Handles an incoming message destined explicitly to this service.

Specified by:
handleMessage in class APEXService
Parameters:
message - The incoming message to handle
See Also:
APEXService.handleMessage(ch.epfl.lsr.apex.APEXMessage)

getOptions

public Hashtable getOptions()
Description copied from class: APEXService
Offers a Hashtable containing all identifiers of options this service is able to handle. The content of each entry should be a handler (normally this) for the corresponding identifyer.
If no options are handled, the value must be null.

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

handleOption

public void handleOption(APEXOption option,
                         APEXMessage message,
                         String administrativeDomain)
                  throws APEXOptionException
Handles the statusRequest option for the first time:

Specified by:
handleOption in class APEXService
Parameters:
option - The option to handle
message - The whole message where the option is nested in
administrativeDomain - The name of the hop (endpoint address or administrative domain)
Throws:
APEXOptionException - Is thrown if the option isn't well-formed.
See Also:
APEXOption

getStatusRequestOption

public static APEXOption getStatusRequestOption(int transID,
                                                String targetHop,
                                                String mustUnderstand)
Returns an APEXOption for the specified arguments.

Parameters:
transID - A transaction identifier
targetHop - The targetHop attribute's value (APEX.THIS, APEX.FINAL, or APEX.ALL)
mustUnderstand - The mustUnderstand attribute (APEX.TRUE or APEX.FALSE)
Returns:
The resulting APEXOption
See Also:
APEX.THIS, APEX.FINAL, APEX.ALL, APEX.TRUE, APEX.FALSE

getStatusRequestOption

public static APEXOption getStatusRequestOption(int transID,
                                                String targetHop)
Returns an APEXOption for the specified arguments and mustUnderstand='false'.

Parameters:
transID - A transaction identifier
targetHop - The targetHop attribute's value (APEX.THIS, APEX.FINAL, or APEX.ALL)
Returns:
The resulting APEXOption
See Also:
APEX.THIS, APEX.FINAL, APEX.ALL

getStatusRequestOption

public static APEXOption getStatusRequestOption(int transID)
Returns an APEXOption for the specified transID with targetHop='final' and mustUnderstan='false'.

Parameters:
transID - A transaction identifier
Returns:
The resulting APEXOption

getStatusRequestOption

public static APEXOption getStatusRequestOption(APEXEndpointManager manager,
                                                APEXEndpointAddress originator,
                                                String targetHop,
                                                String mustUnderstand)
                                         throws APEXOptionException
Returns an APEXOption for the specified arguments with automatically obtained transID.

Parameters:
manager - The endpoint manager
originator - The originator endpoint address
targetHop - The targetHop attribute's value (APEX.THIS, APEX.FINAL, or APEX.ALL)
mustUnderstand - The mustUnderstand attribute (APEX.TRUE or APEX.FALSE)
Returns:
The resulting APEXOption
Throws:
APEXOptionException - Thrown if the manager is not (yet) attached as the specified endpoint address
See Also:
APEX.THIS, APEX.FINAL, APEX.ALL, APEX.TRUE, APEX.FALSE

getStatusRequestOption

public static APEXOption getStatusRequestOption(APEXEndpointManager manager,
                                                APEXEndpointAddress originator,
                                                String targetHop)
                                         throws APEXOptionException
Returns an APEXOption for the specified arguments with automatically obtained transID and mustUnderstand='false'.

Parameters:
manager - The endpoint manager
originator - The originator endpoint address
targetHop - The targetHop attribute's value (APEX.THIS, APEX.FINAL, or APEX.ALL))
Returns:
The resulting APEXOption
Throws:
APEXOptionException - Thrown if the manager is not (yet) attached as the specified endpoint address
See Also:
APEX.THIS, APEX.FINAL, APEX.ALL

getStatusRequestOption

public static APEXOption getStatusRequestOption(APEXEndpointManager manager,
                                                APEXEndpointAddress originator)
                                         throws APEXOptionException
Returns an APEXOption for the specified arguments with automatically obtained transID, targetHop='final', and mustUnderstan='false'.

Parameters:
manager - The endpoint manager
originator - The originator endpoint address
Returns:
The resulting APEXOption
Throws:
APEXOptionException - Thrown if the manager is not (yet) attached as the specified endpoint address

handleSent

public void handleSent(APEXOption option,
                       APEXMessage message,
                       APEXReply reply,
                       String hopName)
Updates the status in the hashtable for a sent message. Is called by the 'APEXRelayManager' if a message is sent to another entity and an or an message is returned.

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)
Updates the status in the hashtable for a discarded message. Is called by the 'APEXRelayManager' if a message is discarded since the relay wasn't able / gave up establishing a connection to a destination after serveral attempts or the message hasn't been accepted.

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)