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

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

public class HubPolicy
extends java.lang.Object

Wrapper for a native implementation of the PageBus.policy.HubPolicy interface.

The HubPolicy controls what topics an application loaded from a specified origin can publish or subscribe to. A HubPolicy instance controls each of the following implementations of Hub:

©2011 Cloud Software Group, Inc.

Since:
1.2.0

Nested Class Summary
static class HubPolicy.Operation
          Specifies the operation used as parameters by the grant() and revoke() methods.
 
Field Summary
static java.lang.String WINDOW_LOCATION
          Constant used to indicate the domain URL is the currently loaded window.
 
Constructor Summary
HubPolicy()
          Creates an instance using the default native PageBus.policy.HubPolicy.
HubPolicy(com.google.gwt.core.client.JavaScriptObject nativeHubPolicy)
          Creates an instance using the provided nativeHubPolicy implementation.
 
Method Summary
 void applyHubPolicyXml(java.lang.String hubPolicyXml)
          Sets the HubPolicy based on the elements in the given hubPolicyXml.
protected  com.google.gwt.core.client.JavaScriptObject getNativeHubPolicy()
           
 void grant(java.lang.String uri, HubPolicy.Operation opType, java.lang.String topic)
          Grants a privilege to the origin of the given uri.
 boolean isPublishAllowed(java.lang.String uri, java.lang.String topic)
           
 boolean isSubscribeAllowed(java.lang.String uri, java.lang.String topic)
           
 java.lang.String[] listPublishAllowed(java.lang.String uri)
           
 java.lang.String[] listSubscribeAllowed(java.lang.String uri)
           
static java.lang.String originForUri(java.lang.String uri)
          Returns the origin for the given uri.
 void revoke(java.lang.String uri, HubPolicy.Operation opType, java.lang.String topic)
          Revokes a privilege from the origin of the given uri.
 void revokeAll(java.lang.String uri)
          Revokes all privileges from the origin of the given uri.
 void revokeHubPolicyXml(java.lang.String hubPolicyXml)
          Revokes all privileges that are contained in the given hubPolicyXml regardless of the value of the grant attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WINDOW_LOCATION

public static final java.lang.String WINDOW_LOCATION
Constant used to indicate the domain URL is the currently loaded window.

See Also:
Constant Field Values
Constructor Detail

HubPolicy

public HubPolicy()
Creates an instance using the default native PageBus.policy.HubPolicy.


HubPolicy

public HubPolicy(com.google.gwt.core.client.JavaScriptObject nativeHubPolicy)
Creates an instance using the provided nativeHubPolicy implementation. If nativeHubPolicy is null then the default native PageBus.policy.HubPolicy is used.

Parameters:
nativeHubPolicy -
Method Detail

originForUri

public static java.lang.String originForUri(java.lang.String uri)
Returns the origin for the given uri. The uri value is decoded using the Javascript decodeURIComponent function prior to processing its content. The returned origin is in the form required by the HubPolicy class methods for the origin param.

The origin has the format

[protocol]://[host]

where:

[protocol] is "http" or "https"
[host] is the hostname of the given uri.

Parameters:
uri - A URI in the form: http://host:port/path/page.html. The URI may be URI encoded.
Returns:
The origin of the given uri in the form required by the HubPolicy class methods.
See Also:
ManagedHubFrame.getOrigin()

getNativeHubPolicy

protected com.google.gwt.core.client.JavaScriptObject getNativeHubPolicy()

grant

public void grant(java.lang.String uri,
                  HubPolicy.Operation opType,
                  java.lang.String topic)
Grants a privilege to the origin of the given uri.

Parameters:
uri - The uri of the application whose origin will be used to grant the privilege.
opType - The Operation type: PUBLISH or SUBSCRIBE.
topic - The topic on which to grant the privilege.

revoke

public void revoke(java.lang.String uri,
                   HubPolicy.Operation opType,
                   java.lang.String topic)
Revokes a privilege from the origin of the given uri.

Parameters:
uri - The uri of the application whose origin will be used to revoke the privilege.
opType - The Operation type: PUBLISH or SUBSCRIBE.
topic - The topic on which to revoke the privilege.

revokeAll

public void revokeAll(java.lang.String uri)
Revokes all privileges from the origin of the given uri.

Parameters:
uri -

applyHubPolicyXml

public void applyHubPolicyXml(java.lang.String hubPolicyXml)
Sets the HubPolicy based on the elements in the given hubPolicyXml.

Parameters:
hubPolicyXml -

revokeHubPolicyXml

public void revokeHubPolicyXml(java.lang.String hubPolicyXml)
Revokes all privileges that are contained in the given hubPolicyXml regardless of the value of the grant attribute value. This is the same as if all grant attributes where set to grant="0" and applyHubPolicyXml where called.

Parameters:
hubPolicyXml -

isPublishAllowed

public boolean isPublishAllowed(java.lang.String uri,
                                java.lang.String topic)

isSubscribeAllowed

public boolean isSubscribeAllowed(java.lang.String uri,
                                  java.lang.String topic)

listPublishAllowed

public java.lang.String[] listPublishAllowed(java.lang.String uri)

listSubscribeAllowed

public java.lang.String[] listSubscribeAllowed(java.lang.String uri)


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