Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tibco.bpm.web.client.model.pagebus.hub
Class ManagedEventService

    java.lang.Object
      com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService

Direct Known Subclasses:
  ManagedEventClient, ManagedEventHub

    public abstract class ManagedEventService

extends java.lang.Object

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 TIBCO Software Inc.

Since:
  TODO

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.
`
`<H extends com.google.gwt.event.shared.EventHandler> void`
` | `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

### onSubscribeCompleteCallback

    protected OnSubscribeCompleteCallback onSubscribeCompleteCallback

### subscriptions

    protected java.util.HashSet<Subscription> subscriptions

Constructor Detail

### ManagedEventService

    protected ManagedEventService(java.lang.String serviceId)

  Creates an instance of the service as implemented by one of the concrete subclasses: ManagedEventFrame ManagedEventClient

  Parameters:
    `serviceId` - May be used in alert messages or logs to identify the service instance.

Method Detail

### addEvents

    public abstract void addEvents()

  The implementing class can add ManagedEvents here using the addEvent method.

  See Also:
    `addEvent(ManagedEvent)`

### addHandlers

    public abstract void addHandlers()

  The implementing class can add ManagedEvent handlers here using the addEventHandler method.

  See Also:
    `addHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler)`

### addSubscribers

    public abstract void addSubscribers()

  The implementing class can add subscriptions here using the addSubscriber method.

  See Also:
    `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)`

### addEvent

    public void addEvent(ManagedEvent<?> managedEvent)

  Adds a ManagedEvent and registers the event with the ManagedEventBus. The ManagedEvent is added to the managedEvents set which is used to remove the event when `removeEvents()` is called.

  Parameters:
    `type` - The Type class used to register the event.
    `handler` - The handler for the ManagedEvent. #see `removeEvents()`

### removeEvents

    public void removeEvents()

  Removes ManagedEvent previously added and clears the managedEvents set.

  See Also:
    `addEvents()`

### addHandler

    public <H extends com.google.gwt.event.shared.EventHandler> void addHandler(com.google.gwt.event.shared.GwtEvent.Type<H> type,
                                                                                H handler)

  Adds a ManagedEvent handler. Type is parameterized by the handler type in order to make the addHandler method type safe. The resulting HandlerRegistration is added to the eventHandlerRegistrations set which is used to remove the handler when `removeHandlers()` is called.

  Parameters:
    `type` - The Type class used to register the event.
    `handler` - The handler for the ManagedEvent. #see `removeHandlers()`

### removeHandlers

    public void removeHandlers()

  Removes ManagedEvent handlers previously added and clears the eventHandlerRegistrations set.

  See Also:
    `addHandlers()`

### addSubscriber

    public abstract Subscription addSubscriber(java.lang.String topic,
                                               OnDataCallback onDataCallback,
                                               OnSubscribeCompleteCallback onSubscribeCompleteCallback,
                                               SubscriberData subscriberData)

  Creates a subscription to a topic name. When an event is published on a topic name that matches the specified topic, the given onDataCallback is invoked.

  The subscription is added to a set of subscriptions that is used to remove the subscription when `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.

  Parameters:
    `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.
  Returns:
    The Subscription created. This can be used with removeSubscriber(Subscription).
  See Also:
    `removeSubscriber(Subscription)`

### addSubscriberNative

    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)

  Creates a subscription to a topic name using native JSO arguments.

  Parameters:
    `topic` -
    `onDataCallback` -
    `onSubscribeCompleteCallback` -
    `subscriberData` -
  Returns:
  See Also:
    `addSubscriber(String, OnDataCallback, OnSubscribeCompleteCallback, SubscriberData)`

### removeSubscribers

    public abstract void removeSubscribers()

  Removes subscriptions previously added and clears the subscriptions set. The `onRemoveSubscriberComplete(Subscription, boolean, String)` method is called for each callback when the unsubscribe action is complete.

  See Also:
    `addSubscribers()`, `onRemoveSubscriberComplete(Subscription, boolean, String)`

### removeSubscriber

    public abstract void removeSubscriber(Subscription subscription)

  Removes the given subscription. The `onRemoveSubscriberComplete(Subscription, boolean, String)` method is called for each callback when the unsubscribe action is complete.

  Parameters:
    `subscription` -

### onRemoveSubscriberComplete

    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.

  Parameters:
    `subscription` -
    `success` -
    `error` -

### alertMessage

    protected void alertMessage(java.lang.String msg)

  Displays the given msg using a Window.alert. This is called by the base class callbacks when an error or security warning is encountered. This can be overridden by the extending class if required.

  Parameters:
    `msg` -

### log

    public static void log(java.lang.String msg)

### getServiceId

    public java.lang.String getServiceId()

### setServiceId

    public void setServiceId(java.lang.String serviceId)

### publish

    public abstract void publish(PageBusMessage message)

  Publishes the given message. The message is delivered to all current subscribers whose subscriptions match the topic that is set on the message.

  Parameters:
    `message` - Message to be published on the given topic.

### publish

    public abstract void publish(java.lang.String topic,
                                 PageBusMessage message)

  Publishes the given message using the given topic. The topic value will be set on the message. The message is delivered to all current subscribers whose subscriptions match the topic.

  Parameters:
    `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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2015 TIBCO Software Inc. All Rights Reserved.