org.ws4d.java.dispatch
Class DefaultServiceReferenceCallback

java.lang.Object
  extended by org.ws4d.java.communication.DefaultResponseCallback
      extended by org.ws4d.java.dispatch.DefaultServiceReferenceCallback
All Implemented Interfaces:
ResponseCallback

public class DefaultServiceReferenceCallback
extends DefaultResponseCallback


Constructor Summary
DefaultServiceReferenceCallback(DefaultServiceReference servRef, XAddressInfo targetXAddressInfo)
           
 
Method Summary
 void handle(Message request, FaultMessage fault, ProtocolData protocolData)
          Receives a FaultMessage in response to a previously sent request message.
 void handle(Message request, GetMetadataResponseMessage response, ProtocolData protocolData)
          Receives a GetMetadataResponseMessage.
 void handle(Message request, ResolveMatchesMessage resolveMatches, ProtocolData protocolData)
          Receives a ResolveMatchesMessage in response to a previously sent ResolveMessage.
 void handleMalformedResponseException(Message request, java.lang.Exception exception, ProtocolData protocolData)
          Called when an exception occurs while receiving, decoding or processing the response message to a previously sent request.
 void handleTimeout(Message request)
          Called when an attempt to receive responses to a previously sent request message passed to CommunicationManager#send(Message, ProtocolDomain, ResponseCallback) timeouted.
 void handleTransmissionException(Message request, java.lang.Exception exception, ProtocolData protocolData)
          Called when an exception arises while sending the request message.
 
Methods inherited from class org.ws4d.java.communication.DefaultResponseCallback
getOperation, getTargetAddress, handle, handle, handle, handle, handle, handle, handle, setTargetAddress
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultServiceReferenceCallback

public DefaultServiceReferenceCallback(DefaultServiceReference servRef,
                                       XAddressInfo targetXAddressInfo)
Parameters:
servRef -
Method Detail

handle

public void handle(Message request,
                   ResolveMatchesMessage resolveMatches,
                   ProtocolData protocolData)
Description copied from interface: ResponseCallback
Receives a ResolveMatchesMessage in response to a previously sent ResolveMessage. This receiving ResponseCallback instance is the one passed as third argument to the send method.
Note that it is possible (depending on the underlying technology implemented by the concrete CommunicationManager in use) to receive none or exactly one ResolveMatchesMessage in response to a single sent ResolveMessage. This method would thus accordingly either not get called at all, or get called once.

If no responses to the sent resolve message are received within a protocol-specific time period, method ResponseCallback.handleTimeout(Message) will be called.

Specified by:
handle in interface ResponseCallback
Overrides:
handle in class DefaultResponseCallback
Parameters:
request - the original request message
resolveMatches - a message containing a response to the previously sent request
protocolData - protocol (aka. technology) specific addressing information attached to the received message; this is especially useful when sending resolve request messages over multiple different technologies like DPWS, Bluetooth, ZigBee, etc. (which can be done by specifying respective ProtocolDomains); the supplied protocolData enables in such cases the requester to distinguish which technology the result was obtained over

handle

public void handle(Message request,
                   GetMetadataResponseMessage response,
                   ProtocolData protocolData)
Description copied from interface: ResponseCallback
Receives a GetMetadataResponseMessage. The corresponding GetMetadataMessage has previously been sent by passing this ResponseCallback instance as the third argument to the send method.

Each GetMetadataMessage may result in a call to either this method (in case of successful two-way communication), or to methods:

Specified by:
handle in interface ResponseCallback
Overrides:
handle in class DefaultResponseCallback
Parameters:
request - the original request message
response - a message containing the response to the previously sent request
protocolData - protocol (aka. technology) specific addressing information attached to the received message

handle

public void handle(Message request,
                   FaultMessage fault,
                   ProtocolData protocolData)
Description copied from interface: ResponseCallback
Receives a FaultMessage in response to a previously sent request message.

A fault is raised on the responding side while processing the request message and then sent back to the requester (aka. this side). It is explicitly NOT created on this side while processing the received response (see method ResponseCallback.handleMalformedResponseException(Message, Exception, ProtocolData) for the latter case).

Specified by:
handle in interface ResponseCallback
Overrides:
handle in class DefaultResponseCallback
Parameters:
request - the original request message
fault - the fault generated by the responding side
protocolData - protocol (aka. technology) specific addressing information attached to the received message

handleMalformedResponseException

public void handleMalformedResponseException(Message request,
                                             java.lang.Exception exception,
                                             ProtocolData protocolData)
Description copied from interface: ResponseCallback
Called when an exception occurs while receiving, decoding or processing the response message to a previously sent request. The exception is passed to argument exception

Specified by:
handleMalformedResponseException in interface ResponseCallback
Overrides:
handleMalformedResponseException in class DefaultResponseCallback
Parameters:
request - the original request message
exception - the exception caused during processing the response
protocolData - protocol (aka. technology) specific addressing information related to the malformed response

handleTransmissionException

public void handleTransmissionException(Message request,
                                        java.lang.Exception exception,
                                        ProtocolData protocolData)
Description copied from interface: ResponseCallback
Called when an exception arises while sending the request message. This could be e.g. due to network reachability reasons, an IO problem within the transport connection, an invalid message construct, etc.

Specified by:
handleTransmissionException in interface ResponseCallback
Overrides:
handleTransmissionException in class DefaultResponseCallback
Parameters:
request - the request message which was meant to be sent when the exception occurred
exception - the exception cause while sending the request message
protocolData - protocol (aka. technology) specific addressing information related to the transmission exception

handleTimeout

public void handleTimeout(Message request)
Description copied from interface: ResponseCallback
Called when an attempt to receive responses to a previously sent request message passed to CommunicationManager#send(Message, ProtocolDomain, ResponseCallback) timeouted. This can only happen when using an unreliable connectionless transport layer for message transmission, such as UDP. Note that any other error related to sending the original request message is notified by the callback method ResponseCallback.handleTransmissionException(Message, Exception, ProtocolData). The original (request) message that was meant to be sent is passed as argument request.

Specified by:
handleTimeout in interface ResponseCallback
Overrides:
handleTimeout in class DefaultResponseCallback
Parameters:
request - the message meant to be sent, which resulted in a timeout