Using the TIBCO PageBus Managed Hub with WCC Components

If WCC components are being isolated in an iframe, and they are communicating with non-WCC code in another iframe, they must use the TIBCO PageBus Managed Hub to publish or subscribe to events between the components.

A class (IframeContainer) is provided with Workspace that contains methods that can be used to simplify the use of the PageBus Managed Hub.

This topic describes the methods available when communicating between components using the PageBus Managed Hub.

Also note that a sample application is provided that illustrates the use of these methods when using the PageBus Managed Hub. For information, see Managed Hub Sample Applications.

For additional information about the TIBCO PageBus Managed Hub, see the TIBCO PageBus Developer’s Guide.

com.tibco.wcc.components.IframeContainer

The IframeContainer class contains the following methods that can be used to contain a WCC application in an iframe:

  • publishExternalLogin - Publishes an externalLogin event to the TIBCO PageBus Managed Hub.
    publishExternalLogin();
  • publishExternalShowEvents - Publishes a externalShowEvents event to the TIBCO PageBus Managed Hub. This causes a temporary event view to be added to the event view list, according to the passed-in parameter values.
       publishExternalShowEvents(eventLinkId,
                                 substitutionDataXml,
                                 menuText,
                                 eventLinkXml);

    where:

    • eventLinkId (String) - The <links> element messageId attribute value to match. (For information about event links and the <links> element, see the Customizing Events chapter in the TIBCO Workspace Configuration and Customization Guide.)
    • substitutionDataXml (String) - The XML containing the attributes that are substituted into the <link> element that is used. The root element name is record: <record att1=”val1” att2=”val2”/>
    • menuText (String) (Optional) - If there are multiple <link> elements, the menuText value is used to locate a specific one. If null, the first link is used.
    • eventLinkXml (String) (Optional) - The XML that defines the event links. If this is null, the application-configured eventLinks XML is used.
  • publishSetAppLocale - Publishes a setAppLocale event to the TIBCO PageBus Managed Hub to notify application components of the locale change so they can reload and repaint as necessary to reflect the new language.
    setAppLocale(localeKey);

    where:

    • localeKey - (String) The lowercase, two-letter ISO-639 language code (ll), and optionally the uppercase (CC), two-letter ISO-3166 country code if the locale is country specific. If the country code is included, it must be separated from the language code with an underscore, in the form “ll_CC” (e.g., “es_MX” for Mexican Spanish).

      For a list of language codes, visit the following web site:

      http://www.loc.gov/standards/iso639-2/langhome.html

      For a list of country codes, visit the following web site:

      http://www.iso.org/iso/english_country_names_and_code_elements

  • subscribeAppPostLoad - Creates a TIBCO PageBus Managed Hub subscription to the appPostLoad event.
       subscribeAppPostLoad(onData,
                            scope,
                            onComplete,
                            subscriberData);

    where:

    • onData (Function) Callback function that is invoked whenever an appPostLoad event is published.
    • scope (Object) Optional. When onData callback or onComplete callback is invoked, the JavaScript “this” keyword refers to this scope object. If no scope is provided, the default is window.
    • onComplete (Function) Optional. Callback function that is invoked to tell the client application whether the subscribe operation succeeded or failed.
    • subscriberData (Any) Optional. The client application provides this data, which is handed back to the client application in the subscriberData parameter of the onData and onComplete callback functions.
  • subscribeLoginComplete - Creates a TIBCO PageBus Managed Hub subscription to the loginComplete event.
       subscribeLoginComplete(onData,
                              scope,
                              onComplete,
                              subscriberData);

    where:

    • onData (Function) Callback function that is invoked whenever a loginComplete event is published.
    • scope (Object) Optional. When onData callback or onComplete callback is invoked, the JavaScript “this” keyword refers to this scope object. If no scope is provided, the default is window.
    • onComplete (Function) Optional. Callback function that is invoked to tell the client application whether the subscribe operation succeeded or failed.
    • subscriberData (Any) Optional. The client application provides this data, which is handed back to the client application in the subscriberData parameter of the onData and onComplete callback functions.
  • publishPassThruEvent - Publishes a pass-through event (passThruEvent) that traverses the managedHub where the subscribing client subscribes to the event and displays either a work item list or process instance list, depending on the payload in the published event.
       publishPassThruEvent(pageBusSubject,
                        pageBusMessage);

    where:

    • pageBusSubject (String) Topic to publish on the client’s local PageBus. (Note - The latest release of the PageBus now refers to “subject” as “topic”.)
    • pageBusMessage (String) Message to publish on the client’s local PageBus.

      For an example of usage, see wccPassThruManagedHub Sample Application.

com.tibco.wcc.base.Application

The Application class contains the following methods that can be used when displaying a WCC application in an iframe (although they can be used with non-iframe applications also):

  • isExternalLogin - Returns the value of the isExternalLogin property, which indicates whether or not there is an authenticated login by an external application.
       isExternalLogin();
  • initializeExternalLogin - Initializes the application after login is completed by an external application.

    This method must be called if the login is done by an external application. However, it must not be called if the login is done by the current application (i.e., by the wcc.Login component or the app.login() method, as these call the initializeExternalLogin method).

    Note that calling this method has no affect if the user is already logged in.

       initializeExternalLogin();