org.atmosphere.cpr
Class BroadcasterFactory

java.lang.Object
  extended by org.atmosphere.cpr.BroadcasterFactory
Direct Known Subclasses:
DefaultBroadcasterFactory

public abstract class BroadcasterFactory
extends Object

Broadcaster factory used by Atmosphere when creating broadcaster.

Author:
Jeanfrancois Arcand

Field Summary
protected static BroadcasterFactory factory
           
 
Constructor Summary
BroadcasterFactory()
           
 
Method Summary
abstract  boolean add(Broadcaster b, Object id)
          Add a Broadcaster to the list.
abstract  void destroy()
          Shutdown all Broadcaster
abstract  Broadcaster get()
          Return an instance of the default Broadcaster
abstract  Broadcaster get(Class<? extends Broadcaster> c, Object id)
          Create a new instance of Broadcaster and store it for
static BroadcasterFactory getDefault()
          Return the default BroadcasterFactory.
abstract  Broadcaster lookup(Class<? extends Broadcaster> c, Object id)
          Lookup a Broadcaster instance using Broadcaster.getID() or ID used when invoking getDefault()
abstract  Broadcaster lookup(Class<? extends Broadcaster> c, Object id, boolean createIfNull)
          Lookup a Broadcaster instance using Broadcaster.getID() or ID used when invoking getDefault()
abstract  Collection<Broadcaster> lookupAll()
          Return an immutable Collection of Broadcaster this factory contains.
abstract  boolean remove(Broadcaster b, Object id)
          Remove a Broadcaster to the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected static BroadcasterFactory factory
Constructor Detail

BroadcasterFactory

public BroadcasterFactory()
Method Detail

get

public abstract Broadcaster get()
                         throws IllegalAccessException,
                                InstantiationException
Return an instance of the default Broadcaster

Returns:
an instance of the default Broadcaster
Throws:
IllegalAccessException
InstantiationException

get

public abstract Broadcaster get(Class<? extends Broadcaster> c,
                                Object id)
                         throws IllegalAccessException,
                                InstantiationException
Create a new instance of Broadcaster and store it for

Parameters:
c - The Broadcaster class instance.
id - The unique ID used to retrieve Broadcaster
Returns:
a new instance of Broadcaster
Throws:
IllegalAccessException
InstantiationException

destroy

public abstract void destroy()
Shutdown all Broadcaster


add

public abstract boolean add(Broadcaster b,
                            Object id)
Add a Broadcaster to the list.

Parameters:
b - a Broadcaster
Returns:
false if a with the same name Broadcaster was already stored

remove

public abstract boolean remove(Broadcaster b,
                               Object id)
Remove a Broadcaster to the list.

Parameters:
b - a Broadcaster
Returns:
false if wasn't present, or Broadcaster

lookup

public abstract Broadcaster lookup(Class<? extends Broadcaster> c,
                                   Object id)
Lookup a Broadcaster instance using Broadcaster.getID() or ID used when invoking getDefault()

Parameters:
c -
id - The Broadcaster's unique ID, or name.
Returns:
a Broadcaster, or null if not found.

lookup

public abstract Broadcaster lookup(Class<? extends Broadcaster> c,
                                   Object id,
                                   boolean createIfNull)
Lookup a Broadcaster instance using Broadcaster.getID() or ID used when invoking getDefault()

Parameters:
c -
id - The Broadcaster's unique ID, or name.
createIfNull - If the broadcaster is not found, create it.
Returns:
a Broadcaster, or null if not found.

lookupAll

public abstract Collection<Broadcaster> lookupAll()
Return an immutable Collection of Broadcaster this factory contains.

Returns:
an immutable Collection of Broadcaster this factory contains.

getDefault

public static BroadcasterFactory getDefault()
Return the default BroadcasterFactory.

Returns:
the default BroadcasterFactory.


Copyright © 2010. All Rights Reserved.