com.tibco.bpm.web.client.model.pagebus.hub
Class ManagedEventHub

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

public abstract class ManagedEventHub
extends ManagedEventService

Encapsulates the details of creating a ManagedHubFrame and adding subscribers, events, and handlers.

©2014 Cloud Software Group, Inc.

Since:
TODO

Field Summary
 
Fields inherited from class com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
onSubscribeCompleteCallback, subscriptions
 
Constructor Summary
protected ManagedEventHub(java.lang.String hubPolicyXml)
          Creates a ManagedEventHub using a default serviceId set to: "ManagedEventHub"
protected ManagedEventHub(java.lang.String serviceId, java.lang.String hubPolicyXml)
          Creates a ManagedEventHub.
 
Method Summary
 Subscription addSubscriber(java.lang.String topic, OnDataCallback onDataCallback, OnSubscribeCompleteCallback onSubscribeCompleteCallback, SubscriberData subscriberData)
          Creates a subscription to a topic name.
 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.
 void applyHubPolicy(java.lang.String hubPolicyXml)
          The given hubPolicyXml is used to grant/revoke permissions on the HubPolicy.
 ManagedHubFrame createManagedHubFrame(java.lang.String iFrameUri, java.lang.Integer timeout)
           
static void log(java.lang.String msg)
           
 void policyGrant(java.lang.String uri, HubPolicy.Operation opType, java.lang.String topic)
           
 void policyRevoke(java.lang.String uri, HubPolicy.Operation opType, java.lang.String topic)
           
 void publish(PageBusMessage message)
          Publishes the given message.
 void publish(java.lang.String topic, PageBusMessage message)
          Publishes the given message using the given topic.
 void removeSubscriber(Subscription subscription)
          Removes the given subscription.
 void removeSubscribers()
          Removes subscriptions previously added and clears the subscriptions set.
 
Methods inherited from class com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
addEvent, addEvents, addHandler, addHandlers, addSubscribers, alertMessage, getServiceId, onRemoveSubscriberComplete, removeEvents, removeHandlers, setServiceId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedEventHub

protected ManagedEventHub(java.lang.String hubPolicyXml)
Creates a ManagedEventHub using a default serviceId set to: "ManagedEventHub"

See Also:
ManagedEventHub(String, String)

ManagedEventHub

protected ManagedEventHub(java.lang.String serviceId,
                          java.lang.String hubPolicyXml)
Creates a ManagedEventHub.

The given hubPolicyXml is used to grant/revoke permissions on the HubPolicy. The HubPolicy and ManagedHub are created. The ManagedHub is used to fire ManagedEvents between participating applications, such as the main application page or any apps running in a ManagedHubFrame (iframe).

The HubPolicy controls which URL origins can publish/subscribe specified topics or fire/handle specified ManagedEvents.

If initialized with a null value for hubPolicyXml this will result in no HubPolicy being set and all events are allowed to all publishers and subscribers.

If the policyGrant, policyRevoke, or applyHubPolicy method are used this must be called with a non-null value to initialize the HubPolicy.

Parameters:
serviceId - May be used in alert messages or logs to identify the service instance.
hubPolicyXml - The XML used to define the HubPolicy.
Method Detail

addSubscriber

public Subscription addSubscriber(java.lang.String topic,
                                  OnDataCallback onDataCallback,
                                  OnSubscribeCompleteCallback onSubscribeCompleteCallback,
                                  SubscriberData subscriberData)
Description copied from class: ManagedEventService
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 ManagedEventService.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.

Specified by:
addSubscriber in class ManagedEventService
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:
ManagedEventService.removeSubscriber(Subscription)

addSubscriberNative

public 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)
Description copied from class: ManagedEventService
Creates a subscription to a topic name using native JSO arguments.

Specified by:
addSubscriberNative in class ManagedEventService
Returns:
See Also:
ManagedEventService.addSubscriber(String, OnDataCallback, OnSubscribeCompleteCallback, SubscriberData)

removeSubscribers

public void removeSubscribers()
Description copied from class: ManagedEventService
Removes subscriptions previously added and clears the subscriptions set. The ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String) method is called for each callback when the unsubscribe action is complete.

Specified by:
removeSubscribers in class ManagedEventService
See Also:
ManagedEventService.addSubscribers(), ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String)

removeSubscriber

public void removeSubscriber(Subscription subscription)
Description copied from class: ManagedEventService
Removes the given subscription. The ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String) method is called for each callback when the unsubscribe action is complete.

Specified by:
removeSubscriber in class ManagedEventService

applyHubPolicy

public void applyHubPolicy(java.lang.String hubPolicyXml)
The given hubPolicyXml is used to grant/revoke permissions on the HubPolicy.

Parameters:
hubPolicyXml - The XML used to define the HubPolicy.

createManagedHubFrame

public ManagedHubFrame createManagedHubFrame(java.lang.String iFrameUri,
                                             java.lang.Integer timeout)

policyGrant

public void policyGrant(java.lang.String uri,
                        HubPolicy.Operation opType,
                        java.lang.String topic)
See Also:
HubPolicy#grant(String, Operation, String)}

policyRevoke

public void policyRevoke(java.lang.String uri,
                         HubPolicy.Operation opType,
                         java.lang.String topic)
See Also:
HubPolicy#revoke(String, Operation, String)}

publish

public void publish(PageBusMessage message)
Description copied from class: ManagedEventService
Publishes the given message. The message is delivered to all current subscribers whose subscriptions match the topic that is set on the message.

Specified by:
publish in class ManagedEventService
Parameters:
message - Message to be published on the given topic.

publish

public void publish(java.lang.String topic,
                    PageBusMessage message)
Description copied from class: ManagedEventService
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.

Specified by:
publish in class ManagedEventService
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.

log

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


Copyright © 2015 Cloud Software Group, Inc. All Rights Reserved.