| java.lang.Object org.directwebremoting.proxy.openajax.PubSubHub
PubSubHub | public class PubSubHub (Code) | | A Server-side hub to manage subscriptions
author: Joe Walker [joe at getahead dot ltd dot uk] |
Method Summary | |
public void | addSubscriptionListener(SubscriptionListener li) | protected void | fireSubscribeHappenedEvent(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener) | protected void | fireUnsubscribeHappenedEvent(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener) | public String | getHubId() | public Set<String> | getSubscribedNames() If other hubs wish to synchronize with the messages passed through this
hub they need to be able to filter to keep the message storm down. | public Set<String> | getSubscribedPrefixes() If other hubs wish to synchronize with the messages passed through this
hub they need to be able to filter to keep the message storm down. | public void | publish(String prefix, String name) Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: prefix - The prefix that corresponds to this event. | public void | publish(String prefix, String name, Object publisherData) Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: prefix - The prefix that corresponds to this event. | public void | publish(String httpSessionId, String scriptSessionId, String prefix, String name) Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. | public void | publish(String httpSessionId, String scriptSessionId, String prefix, String name, Object publisherData) Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. | public void | publish(String httpSessionId, String scriptSessionId, String prefix, String name, Object publisherData, List<String> hubsVisited) Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. | public void | removeSubscriptionListener(SubscriptionListener li) | public void | subscribe(String prefix, String name, PublishListener listener) | public void | subscribe(String prefix, String name, PublishListener listener, Object subscriberData) | public void | subscribe(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener) | public void | subscribe(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener, Object subscriberData) Allows registration of interest in named events based on library-specific
prefix and event name. | public String | toString() | public void | unsubscribe(String prefix, String name, PublishListener listener) | public void | unsubscribe(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener) Removes a subscription to an event. |
ANY_HTTP_SESSION | final public static String ANY_HTTP_SESSION(Code) | | A constant to denote a match to any
HttpSession .
|
ANY_NAME | final public static String ANY_NAME(Code) | | A constant to denote a match to any name .
|
ANY_PREFIX | final public static String ANY_PREFIX(Code) | | A constant to denote a match to any prefix .
|
fireSubscribeHappenedEvent | protected void fireSubscribeHappenedEvent(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener)(Code) | | This should be called whenever a
ScriptSession is destroyed
Parameters: httpSessionId - The ID match of the HttpSession that was subscribed to Parameters: scriptSessionId - The ID match of the ScriptSession that was subscribed to Parameters: prefix - The prefix match that was subscribed to Parameters: name - The name match that was subscripbed to Parameters: listener - The subscribed object |
fireUnsubscribeHappenedEvent | protected void fireUnsubscribeHappenedEvent(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener)(Code) | | This should be called whenever a
ScriptSession is created
Parameters: httpSessionId - The ID match of the HttpSession that was subscribed to Parameters: scriptSessionId - The ID match of the ScriptSession that was subscribed to Parameters: prefix - The prefix match that was subscribed to Parameters: name - The name match that was subscripbed to Parameters: listener - The subscribed object |
getHubId | public String getHubId()(Code) | | To allow hubs to not create publish loops we need to know what
The ID of this Hub |
getSubscribedNames | public Set<String> getSubscribedNames()(Code) | | If other hubs wish to synchronize with the messages passed through this
hub they need to be able to filter to keep the message storm down.
A set of the names that this hub is interested in. |
getSubscribedPrefixes | public Set<String> getSubscribedPrefixes()(Code) | | If other hubs wish to synchronize with the messages passed through this
hub they need to be able to filter to keep the message storm down.
A set of the prefixes that this hub is interested in. |
publish | public void publish(String prefix, String name)(Code) | | Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: prefix - The prefix that corresponds to this event. This must be aprefix that has been registered via OpenAjax.registerLibrary(). Parameters: name - The name of the event to listen for. Names can be any string |
publish | public void publish(String prefix, String name, Object publisherData)(Code) | | Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: prefix - The prefix that corresponds to this event. This must be aprefix that has been registered via OpenAjax.registerLibrary(). Parameters: name - The name of the event to listen for. Names can be any string Parameters: publisherData - Data to be sent to the Listener along with theeventHappened message |
publish | public void publish(String httpSessionId, String scriptSessionId, String prefix, String name)(Code) | | Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_HTTP_SESSION todenote a match for all HttpSessions. Parameters: scriptSessionId - A ScriptSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_SCRIPT_SESSIONto denote a match for all ScriptSessions. Parameters: prefix - The prefix that corresponds to this event. This must be aprefix that has been registered via OpenAjax.registerLibrary(). Parameters: name - The name of the event to listen for. Names can be any string |
publish | public void publish(String httpSessionId, String scriptSessionId, String prefix, String name, Object publisherData)(Code) | | Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_HTTP_SESSION todenote a match for all HttpSessions. Parameters: scriptSessionId - A ScriptSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_SCRIPT_SESSIONto denote a match for all ScriptSessions. Parameters: prefix - The prefix that corresponds to this event. This must be aprefix that has been registered via OpenAjax.registerLibrary(). Parameters: name - The name of the event to listen for. Names can be any string Parameters: publisherData - Data to be sent to the Listener along with theeventHappened message |
publish | public void publish(String httpSessionId, String scriptSessionId, String prefix, String name, Object publisherData, List<String> hubsVisited)(Code) | | Publishes (broadcasts) an event based on a library-specific prefix and
event name.
Parameters: httpSessionId - An HttpSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_HTTP_SESSION todenote a match for all HttpSessions. Parameters: scriptSessionId - A ScriptSession that we are publishing to. The valueshould not be null , but can be PubSubHub.ANY_SCRIPT_SESSIONto denote a match for all ScriptSessions. Parameters: prefix - The prefix that corresponds to this event. This must be aprefix that has been registered via OpenAjax.registerLibrary(). Parameters: name - The name of the event to listen for. Names can be any string Parameters: publisherData - Data to be sent to the Listener along with theeventHappened message Parameters: hubsVisited - A list of the hubs that the message has passed through |
subscribe | public void subscribe(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener, Object subscriberData)(Code) | | Allows registration of interest in named events based on library-specific
prefix and event name. Global event matching is provided by passing "*"
in the prefix and/or name arguments. Optional arguments may be specified
for executing the specified handler function in a provided scope and for
further filtering events prior to application.
The callback function will receive the following parameters
(see OpenAjax.publish() for description of publisherData):
function(prefix, name, subscriberData, publisherData){ ... }
Parameters: httpSessionId - An HttpSession that we are subscribing to. The valueshould not be null , but can be PubSubHub.ANY_HTTP_SESSION todenote a match for all HttpSessions. Parameters: scriptSessionId - A ScriptSession that we are subscribing to. The valueshould not be null , but can be PubSubHub.ANY_SCRIPT_SESSIONto denote a match for all ScriptSessions. Parameters: prefix - The prefix that corresponds to this library. This is thesame value that was previously passed to registerLibrary(). Can be "*" tomatch the provided event name across all libraries. Parameters: name - The name of the event to listen for. Names can be any string.Can be "*" to match all events in the specified toolkit (see prefix). Ifboth name and prefix specify "*", all events in the system will be routedto the registered handler (modulo any filtering provided by filter). Parameters: listener - The object to deliver messages to Parameters: subscriberData - Data to be send to the Listener along with theeventHappened message |
unsubscribe | public void unsubscribe(String httpSessionId, String scriptSessionId, String prefix, String name, PublishListener listener)(Code) | | Removes a subscription to an event. In order for a subscription to be
removed, the values of the parameters supplied to OpenAjax.unsubscribe()
must exactly match the values of the parameters supplied to a previous
call to OpenAjax.subscribe(). Note that it is possible that one
invocation of OpenAjax.unsubscribe() might result in removal of multiple
subscriptions.
Parameters: prefix - The prefix that corresponds to this library. This is thesame value that was previously passed to registerLibrary(). Can be "*" tomatch the provided event name across all libraries. Parameters: name - The name of the event to listen for. Names can be any string.Can be "*" to match all events in the specified toolkit (see prefix). Ifboth name and prefix specify "*", all events in the system will be routedto the registered handler (modulo any filtering provided by filter). Parameters: listener - The object to deliver messages to |
|
|