|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectNameService
public final class NameService
This class implements a service that will name and track objects which implement the
INameable
interface. The typical use of this class is in the XmlHttpRequest
request processing to lookup the object that should handle the request.
Field Summary | |
---|---|
static String |
NAME_SERVICE_MUTEX_ATTRIBUTE
|
Method Summary | |
---|---|
void |
addNamingObjectListener(NamingObjectListener nol)
This method will add a NamingObjectListener to the set of listeners for the NamingObject event. |
void |
debugSetNameIntValue(int val)
This is a debug method that will set the next integer value. |
INameable |
get(String name)
Given the name, return the INameable object stored by the NameService . |
Map |
getMap(String name,
boolean create)
This method will return the state map associated with the Nameable object if the object has been stored in the NameService and something has been stored
into the Map . |
static NameService |
instance(HttpSession session)
This will return the session specific instance of a NameService. |
void |
nameObject(String namePrefix,
INameable object)
This method will create a unique name for an INameable object. |
void |
put(INameable object)
This method will store an INameable object into the NameService . |
void |
removeNamingObjectListener(NamingObjectListener nol)
This method will remove a NamingObjectListener from the set of listeners. |
static NameService |
staticInstance()
This will return a create a static name service. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAME_SERVICE_MUTEX_ATTRIBUTE
Method Detail |
---|
public static NameService instance(HttpSession session)
session
- the HttpSession that contains the NameService
public static NameService staticInstance()
NameService
public void addNamingObjectListener(NamingObjectListener nol)
NamingObjectListener
to the set of listeners for the NamingObject event.
nol
- The NamingObjectListener
to add as a listener. This must not be null.
IllegalArgumentException
- when nol is null.public void removeNamingObjectListener(NamingObjectListener nol)
NamingObjectListener
from the set of listeners. If the
It is safe to call this if the NamingObjectListener hasn't been added to the listener list.
nol
- The NamingObjectListener
to remove as a listener. This must not be null.
IllegalArgumentException
- when nol is null.public void nameObject(String namePrefix, INameable object)
namePrefix
- The prefix of the generated name.object
- the INameable object.
IllegalStateException
- if this method is called more than once for an objectpublic void debugSetNameIntValue(int val)
val
- the integer value that will be forced to be the next value.public void put(INameable object)
NameService
. The name
is obtained from the INameable. The object will be stored in the NameService
with a WeakReference
so the NameService
will not keep an object alive.
object
- The INameable
to be stored in the name service.public INameable get(String name)
INameable
object stored by the NameService
. Objects
are stored in the NameService
using WeakReference
s so this will not keep an object
alive. If the object is not found or has been reclaimed, this method will return null.
name
- The name of the object to get from the NameService
null
is returned.public Map getMap(String name, boolean create)
NameService
and something has been stored
into the Map
. Otherwise this will return null indicating that the map
is empty. If the create
parameter is true, we will always return the
Map
object.
name
- The name of the object to return the named object. This must not be null.create
- This will create the map if necessary.
create
is false.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |