ApplicationBroadcaster
| Kind of class: | public class |
|---|---|
| Package: | com.bourre.events |
| Inherits from: | ChannelBroadcaster |
| Author: | Francis Bourre, Romain Flacher |
| Classpath: | com.bourre.events.ApplicationBroadcaster |
| File last modified: | Monday, 24 November 2008, 11:36:53 |
The
implementation of the
used for Inversion of Controls purpose. More formally
the application broadcaster is dedicated to plugin to plugin
communication. When defining a plugin with a specific channel,
and then listeners of this plugin, a channel instance is created
in the
in order to create the whole dispatching stuff between these
plugins.
ApplicationBroadcaster class is a singletonimplementation of the
ChannelBroadcaster class, used for Inversion of Controls purpose. More formally
the application broadcaster is dedicated to plugin to plugin
communication. When defining a plugin with a specific channel,
and then listeners of this plugin, a channel instance is created
in the
ChannelExpert and then this channel is usedin order to create the whole dispatching stuff between these
plugins.
The class defines two constant channels dedicated to an IoC usage.
These channel represents particular behaviors of the application
broadcaster. Such :
NO_CHANNEL: That constant, when used as argument of
thegetChannelDispatchermethod, force the application
broadcaster to ignore the call. No broadcaster will be created and
then returned by the function.SYSTEM_CHANNEL: Defines the default channel of the
application broadcaster singleton. All objects which add themselves
as listener without specifying any channel are considered as system
listeners.
See also:
- ChannelBroadcaster
- com.bourre.plugin.ChannelExpert
Summary
Constructor
- ApplicationBroadcaster (access:PrivateConstructorAccess)
- Creates a new ApplicationBroadcaster object.
Constants
- NO_CHANNEL : EventChannel
- Inhibit the behavior of the getChannelDispatcherwhich will return nothing if this channel is passed as argument.
- SYSTEM_CHANNEL : EventChannel
- Default channel for the application broadcaster, all listeners
Class methods
- getInstance : ApplicationBroadcaster
- Returns the singleton instance of the ApplicationBroadcasterclass.
Instance methods
- getChannelDispatcher (channel:EventChannel = null, owner:Object = null) : Broadcaster
- Returns the EventBroadcaster object associated with
Constructor
ApplicationBroadcaster
Creates a new
is locked using a simple hack, you cannot call the constructor directly.
Please use the
in order to retreive the singleton instance of the class.
ApplicationBroadcaster object. This constructoris locked using a simple hack, you cannot call the constructor directly.
Please use the
ApplicationBroadcaster.getInstance method instead,in order to retreive the singleton instance of the class.
Parameters:
access:
a lock for direct instanciation of the
ApplicationBroadcaster classConstants
NO_CHANNEL
Inhibit the behavior of the
getChannelDispatcherwhich will return nothing if this channel is passed as argument. SYSTEM_CHANNEL
Default channel for the application broadcaster, all listeners
which not define any channel are considered as system listeners.
which not define any channel are considered as system listeners.
Class methods
getInstance
Returns the singleton instance of the
ApplicationBroadcasterclass. The class instance is created using the lazy initialisation concept. Returns:
- singleton instance of
ApplicationBroadcaster
Instance methods
getChannelDispatcher
override public function getChannelDispatcher (
channel:EventChannel = null,
owner:Object = null) : Broadcaster
Returns the
the passed-in
parameter which is used to initialize the newly created
EventBroadcaster object associated withthe passed-in
channel<code>. The <code>owner is an optionnalparameter which is used to initialize the newly created
EventBroadcasterwhen there is no broadcaster for this channel.There's a particular case defined by this class, when passing the NO_CHANNELchannel in this function, the function will return null instead of a broadcaster.
Parameters:
channel:
the channel for which get the associated broadcaster
owner :
an optional object which will used as source if there
is no broadcaster associated to the channel
is no broadcaster associated to the channel
Returns:
- the
EventBroadcasterobject associated with
the passed-inchannel
Overrides:
- ChannelBroadcaster.getChannelDispatcher