|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
public abstract class ManagedEventService
The abstract super class for the ManagedEvent services as implemented by one of the concrete subclasses: ManagedEventFrame ManagedEventClient Encapsulates the details of creating a ManagedEventFrame or ManagedEventClient and adding subscribers, events, and handlers.
©2014 Cloud Software Group, Inc.
Field Summary | |
---|---|
protected OnSubscribeCompleteCallback |
onSubscribeCompleteCallback
|
protected java.util.HashSet<Subscription> |
subscriptions
|
Constructor Summary | |
---|---|
protected |
ManagedEventService(java.lang.String serviceId)
Creates an instance of the service as implemented by one of the concrete subclasses: ManagedEventFrame ManagedEventClient |
Method Summary | ||
---|---|---|
void |
addEvent(ManagedEvent<?> managedEvent)
Adds a ManagedEvent and registers the event with the ManagedEventBus. |
|
abstract void |
addEvents()
The implementing class can add ManagedEvents here using the addEvent method. |
|
|
addHandler(com.google.gwt.event.shared.GwtEvent.Type<H> type,
H handler)
Adds a ManagedEvent handler. |
|
abstract void |
addHandlers()
The implementing class can add ManagedEvent handlers here using the addEventHandler method. |
|
abstract Subscription |
addSubscriber(java.lang.String topic,
OnDataCallback onDataCallback,
OnSubscribeCompleteCallback onSubscribeCompleteCallback,
SubscriberData subscriberData)
Creates a subscription to a topic name. |
|
abstract Subscription |
addSubscriberNative(java.lang.String topic,
com.google.gwt.core.client.JavaScriptObject onDataCallback,
com.google.gwt.core.client.JavaScriptObject onSubscribeCompleteCallback,
com.google.gwt.core.client.JavaScriptObject subscriberData)
Creates a subscription to a topic name using native JSO arguments. |
|
abstract void |
addSubscribers()
The implementing class can add subscriptions here using the addSubscriber method. |
|
protected void |
alertMessage(java.lang.String msg)
Displays the given msg using a Window.alert. |
|
java.lang.String |
getServiceId()
|
|
static void |
log(java.lang.String msg)
|
|
protected void |
onRemoveSubscriberComplete(Subscription subscription,
boolean success,
java.lang.String error)
Extending class can override this as needed to perform specific tasks after a remove subscriber completes. |
|
abstract void |
publish(PageBusMessage message)
Publishes the given message. |
|
abstract void |
publish(java.lang.String topic,
PageBusMessage message)
Publishes the given message using the given topic. |
|
void |
removeEvents()
Removes ManagedEvent previously added and clears the managedEvents set. |
|
void |
removeHandlers()
Removes ManagedEvent handlers previously added and clears the eventHandlerRegistrations set. |
|
abstract void |
removeSubscriber(Subscription subscription)
Removes the given subscription. |
|
abstract void |
removeSubscribers()
Removes subscriptions previously added and clears the subscriptions set. |
|
void |
setServiceId(java.lang.String serviceId)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected OnSubscribeCompleteCallback onSubscribeCompleteCallback
protected java.util.HashSet<Subscription> subscriptions
Constructor Detail |
---|
protected ManagedEventService(java.lang.String serviceId)
serviceId
- May be used in alert messages or logs to identify the service instance.Method Detail |
---|
public abstract void addEvents()
addEvent(ManagedEvent)
public abstract void addHandlers()
addHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler)
public abstract void addSubscribers()
addSubscriber(java.lang.String, com.tibco.bpm.web.client.model.pagebus.callbacks.OnDataCallback, com.tibco.bpm.web.client.model.pagebus.callbacks.OnSubscribeCompleteCallback, com.tibco.bpm.web.client.model.pagebus.SubscriberData)
public void addEvent(ManagedEvent<?> managedEvent)
removeEvents()
is called.
type
- The Type class used to register the event.handler
- The handler for the ManagedEvent.
#see removeEvents()
public void removeEvents()
addEvents()
public <H extends com.google.gwt.event.shared.EventHandler> void addHandler(com.google.gwt.event.shared.GwtEvent.Type<H> type, H handler)
removeHandlers()
is called.
type
- The Type class used to register the event.handler
- The handler for the ManagedEvent.
#see removeHandlers()
public void removeHandlers()
addHandlers()
public abstract Subscription addSubscriber(java.lang.String topic, OnDataCallback onDataCallback, OnSubscribeCompleteCallback onSubscribeCompleteCallback, SubscriberData subscriberData)
removeSubscribers()
is called.
If the subscription's topic name contains wildcards, then the subscriber
will be notified via its onDataCallback if the wildcard topic associated
with the subscription matches the topic of the published event, even if
the two topics are not identical. For example, if a subscriber
subscribes to "a.b.*", then it will be notified when someone publishes on
the topic "a.b.c" or the topic "a.b.x".
The value of the subscriberData parameter determines whether the
subscriber is cache-enabled.
topic
- Topic name on which to subscribe. This MAY be a wildcard
topic.onDataCallback
- Callback function for ManagedEventService to invoke
when a message is published on the subscribed
subject.
This parameter must NOT be null.onSubscribeCompleteCallback
- Callback function for ManagedEventService
to invoke after the subscription has been added.
Optional, null value is permitted.subscriberData
- User-defined. Null value is permitted. This is
useful when the subscriber needs to access or
update any data members when the callback function
is invoked. The value of the subscriberData
parameter determines whether the subscriber is
cache-enabled.
removeSubscriber(Subscription)
public abstract Subscription addSubscriberNative(java.lang.String topic, com.google.gwt.core.client.JavaScriptObject onDataCallback, com.google.gwt.core.client.JavaScriptObject onSubscribeCompleteCallback, com.google.gwt.core.client.JavaScriptObject subscriberData)
topic
- onDataCallback
- onSubscribeCompleteCallback
- subscriberData
-
addSubscriber(String, OnDataCallback, OnSubscribeCompleteCallback, SubscriberData)
public abstract void removeSubscribers()
onRemoveSubscriberComplete(Subscription, boolean, String)
method is called for each callback when the unsubscribe action is
complete.
addSubscribers()
,
onRemoveSubscriberComplete(Subscription, boolean, String)
public abstract void removeSubscriber(Subscription subscription)
onRemoveSubscriberComplete(Subscription, boolean, String)
method is called for each callback when the unsubscribe action is
complete.
subscription
- protected void onRemoveSubscriberComplete(Subscription subscription, boolean success, java.lang.String error)
subscription
- success
- error
- protected void alertMessage(java.lang.String msg)
msg
- public static void log(java.lang.String msg)
public java.lang.String getServiceId()
public void setServiceId(java.lang.String serviceId)
public abstract void publish(PageBusMessage message)
message
- Message to be published on the given topic.public abstract void publish(java.lang.String topic, PageBusMessage message)
topic
- Topic name on which to publish the message. This must NOT
be a wildcard topic.message
- Message to be published on the given topic.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |