|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ws4d.java.eventing.DefaultEventSink
public class DefaultEventSink
Class represents an endpoint to receive notifications.
Constructor Summary | |
---|---|
DefaultEventSink(EventListener eventListener,
DataStructure bindings)
Constructor. |
|
DefaultEventSink(EventListener eventListener,
int configurationId)
|
Method Summary | |
---|---|
void |
addBinding(CommunicationBinding binding)
Adds the given binding to this Bindable . |
void |
addSubscription(java.lang.String clientSubId,
ClientSubscription subscription)
Internal method used within the subscription process. |
void |
clearBindings()
Removes all bindings from this Bindable instance. |
void |
close()
Closes event receiving for this event endpoint. |
Iterator |
getBindings()
Returns an iterator over all bindings
assigned to this Bindable instance. |
EventListener |
getEventListener()
Get associated event listener of this event sink. |
ClientSubscription |
getSubscription(java.lang.String clientSubId)
|
boolean |
hasBindings()
Returns true only if this Bindable instance has
at least one binding assigned. |
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. |
boolean |
removeBinding(CommunicationBinding binding)
Removes the specified binding from this Bindable instance. |
ClientSubscription |
removeSubscription(java.lang.String clientSubId)
|
boolean |
supportsBindingChanges()
Returns true , if it is safe to call one of the mutator
methods ((Bindable.addBinding(CommunicationBinding) ,
Bindable.removeBinding(CommunicationBinding) , (Bindable.clearBindings() ,
etc.) at this time without getting an IllegalStateException . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultEventSink(EventListener eventListener, DataStructure bindings)
eventListener
- Client with which this event sink should be
associated. Received events will be transmitted to the
eventListener.bindings
- a data structure of CommunicationBinding
instances over which to expose this event sinkpublic DefaultEventSink(EventListener eventListener, int configurationId)
eventListener
- configurationId
- Method Detail |
---|
public boolean hasBindings()
Bindable
true
only if this Bindable
instance has
at least one binding
assigned. Returns
false
, if it doesn't have any bindings.
hasBindings
in interface Bindable
public Iterator getBindings()
Bindable
bindings
assigned to this Bindable
instance. This iterator will have
no next elements (rather than being ), if the
Bindable
doesn't have any bindings.
- Specified by:
getBindings
in interface Bindable
- Returns:
- an iterator over all available
bindings
public boolean supportsBindingChanges()
Bindable
true
, if it is safe to call one of the mutator
methods ((Bindable.addBinding(CommunicationBinding)
,
Bindable.removeBinding(CommunicationBinding)
, (Bindable.clearBindings()
,
etc.) at this time without getting an IllegalStateException
.
Returns false
otherwise.
Some implementations of this interface may not allow for bindings to be
added or removed all the time, but rather only when the actual
implementation is in a certain set of states (note that this set could be
empty or contain solely a single set). By calling this method and
observing its return value it is possible for a client to determine
whether this Bindable
supports changes within its current
state.
supportsBindingChanges
in interface Bindable
true
if this Bindable
instance may be
modified at the moment without throwing
IllegalStateException
s, false
otherwiseBindable.addBinding(CommunicationBinding)
,
Bindable.removeBinding(CommunicationBinding)
,
Bindable.clearBindings()
public void addBinding(CommunicationBinding binding) throws WS4DIllegalStateException
Bindable
Bindable
. Does nothing if the
Bindable
already contains the binding.
addBinding
in interface Bindable
binding
- the binding to add
WS4DIllegalStateException
- in case this Bindable
doesn't currently support modifications (see
Bindable.supportsBindingChanges()
)public boolean removeBinding(CommunicationBinding binding) throws WS4DIllegalStateException
Bindable
Bindable
instance.
Does nothing, if the Bindable
doesn't contain the given
binding. Returns true
if the binding was removed and
false
if it didn't exist.
removeBinding
in interface Bindable
binding
- the binding to remove
true
if this Bindable
instance had the
given binding assigned and it was removed successfully,
false
otherwise
WS4DIllegalStateException
- in case this Bindable
doesn't currently support modifications (see
Bindable.supportsBindingChanges()
)public void clearBindings() throws WS4DIllegalStateException
Bindable
Bindable
instance. Does
nothing if there are no bindings assigned.
clearBindings
in interface Bindable
WS4DIllegalStateException
- in case this Bindable
doesn't support modifications at the current time (see
Bindable.supportsBindingChanges()
)public void open() throws EventingException
open
in interface EventSink
EventingException
- in case opening this event sink fails for any
reason (e.g. binding to a specified local address fails)public void close()
close
in interface EventSink
public EventListener getEventListener()
EventSink
getEventListener
in interface EventSink
public boolean isOpen()
EventSink
isOpen
in interface EventSink
true
- if event sink is open to receive events/
solicit responses, else false
.public ClientSubscription getSubscription(java.lang.String clientSubId)
getSubscription
in interface EventSink
public ClientSubscription removeSubscription(java.lang.String clientSubId)
clientSubId
-
public void addSubscription(java.lang.String clientSubId, ClientSubscription subscription)
EventSink
Service.subscribe(EventSink, String, org.ws4d.java.types.URISet, long)
.
addSubscription
in interface EventSink
clientSubId
- client subscription idsubscription
- client subscriptionpublic ParameterValue receiveLocalEvent(java.lang.String clientSubscriptionId, URI actionUri, ParameterValue outputParameter)
EventSink
receiveLocalEvent
in interface EventSink
clientSubscriptionId
- actionUri
- outputParameter
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |