org.ws4d.java.eventing
Interface EventSink

All Superinterfaces:
Bindable
All Known Implementing Classes:
DefaultEventSink

public interface EventSink
extends Bindable

Interface used by a client to receive events. Incoming events/ solicit responses will be transmitted to it.

To receive events/ solicit responses, the event sink needs to have at least one CommunicationBinding. A communication binding can be added by Bindable.addBinding(CommunicationBinding) to the event sink. Afterwards the event sink must be opened by open(), so that all bindings are bound to their CommunicationManagers.

Important Subscribing to events is done via Service.subscribe(EventSink, String, org.ws4d.java.types.URISet, long) .


Method Summary
 void addSubscription(java.lang.String clientSubId, ClientSubscription subscription)
          Internal method used within the subscription process.
 void close()
          Closes event receiving for this event endpoint.
 EventListener getEventListener()
          Get associated event listener of this event sink.
 ClientSubscription getSubscription(java.lang.String clientSubId)
           
 boolean isOpen()
          Returns if event sink is open to receive notifications/ solicit responses.
 void open()
          Opens event receiving for this event endpoint.
 ParameterValue receiveLocalEvent(java.lang.String clientSubscriptionId, URI actionUri, ParameterValue outputParameter)
          Callback method for receiving local notifications/ solicit responses.
 
Methods inherited from interface org.ws4d.java.communication.Bindable
addBinding, clearBindings, getBindings, hasBindings, removeBinding, supportsBindingChanges
 

Method Detail

getEventListener

EventListener getEventListener()
Get associated event listener of this event sink.

Returns:
EventListener associated with this event sink.

receiveLocalEvent

ParameterValue receiveLocalEvent(java.lang.String clientSubscriptionId,
                                 URI actionUri,
                                 ParameterValue outputParameter)
Callback method for receiving local notifications/ solicit responses.

Parameters:
clientSubscriptionId - Subscription id the client sent to the service for subscription.
actionUri - Action of event fired.
outputParameter - The parameter value the service transmitted with the event message.
Returns:
Case event message: null
Case solicit response message: parameter value to be transmitted with the response message.

isOpen

boolean isOpen()
Returns if event sink is open to receive notifications/ solicit responses.

Returns:
true - if event sink is open to receive events/ solicit responses, else false.

open

void open()
          throws EventingException
Opens event receiving for this event endpoint. All contained bindings will be bound to their communication managers and start listening to incoming event/ solicit response messages.

Throws:
EventingException - in case opening this event sink fails for any reason (e.g. binding to a specified local address fails)

close

void close()
Closes event receiving for this event endpoint. All bindings of the event sink will be unbound.


addSubscription

void addSubscription(java.lang.String clientSubId,
                     ClientSubscription subscription)
Internal method used within the subscription process.
Subscribing to an event is done by Service.subscribe(EventSink, String, org.ws4d.java.types.URISet, long) .

Parameters:
clientSubId - client subscription id
subscription - client subscription

getSubscription

ClientSubscription getSubscription(java.lang.String clientSubId)
Parameters:
clientSubId -
Returns:
the client subscription with the given ID