Package org.jboss.as.naming
Class InMemoryNamingStore
- java.lang.Object
-
- org.jboss.as.naming.InMemoryNamingStore
-
- All Implemented Interfaces:
NamingStore,WritableNamingStore
public class InMemoryNamingStore extends Object implements WritableNamingStore
In-memory implementation of the NamingStore. The backing for the entries is a basic tree structure with either context nodes or binding nodes. The context nodes are allowed to have children and can be represented by a NamingContext. A binding node is only allowed to have a normal object binding.- Author:
- John E. Bailey
-
-
Constructor Summary
Constructors Constructor Description InMemoryNamingStore()Construct instance with no event support, and an empty base name.InMemoryNamingStore(Name baseName)Construct instance with no event support, and the specified base name.InMemoryNamingStore(NamingEventCoordinator eventCoordinator)Construct instance with an event coordinator, and an empty base name.InMemoryNamingStore(NamingEventCoordinator eventCoordinator, Name baseName)Construct instance with an event coordinator, and the specified base name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNamingListener(Name target, int scope, NamingListener listener)Add aNamingListenerto the naming event coordinator.voidbind(Name name, Object object)Bind and object into the naming store, creating parent contexts if needed.voidbind(Name name, Object object, Class<?> bindType)Bind and object into the naming store, creating parent contexts if needed.voidclose()Close the store.ContextcreateSubcontext(Name name)Create a sub-context for the provided name.NamegetBaseName()Retrieves the store's base name, which is the prefix for the absolute name of each entry in the store.List<NameClassPair>list(Name name)List all NameClassPair instances at a given location in the tree.List<Binding>listBindings(Name name)List all the Binding instances at a given location in the tree.Objectlookup(Name name)Lookup the object value of a binding node in the tree.Objectlookup(Name name, boolean dereference)Look up an object from the naming store.voidrebind(Name name, Object object)Re-bind and object into the naming store.voidrebind(Name name, Object object, Class<?> bindType)Re-bind and object into the naming store.voidremoveNamingListener(NamingListener listener)Remove aNamingListenerfrom the naming event coordinator.voidunbind(Name name)Unbind the entry in the provided location.
-
-
-
Constructor Detail
-
InMemoryNamingStore
public InMemoryNamingStore()
Construct instance with no event support, and an empty base name.
-
InMemoryNamingStore
public InMemoryNamingStore(NamingEventCoordinator eventCoordinator)
Construct instance with an event coordinator, and an empty base name.- Parameters:
eventCoordinator- The event coordinator
-
InMemoryNamingStore
public InMemoryNamingStore(Name baseName)
Construct instance with no event support, and the specified base name.- Parameters:
baseName-
-
InMemoryNamingStore
public InMemoryNamingStore(NamingEventCoordinator eventCoordinator, Name baseName)
Construct instance with an event coordinator, and the specified base name.- Parameters:
eventCoordinator-baseName-
-
-
Method Detail
-
getBaseName
public Name getBaseName() throws NamingException
Retrieves the store's base name, which is the prefix for the absolute name of each entry in the store.- Specified by:
getBaseNamein interfaceNamingStore- Returns:
- Throws:
NamingException
-
bind
public void bind(Name name, Object object) throws NamingException
Bind and object into the naming store, creating parent contexts if needed. All parent contexts must be created before this can be executed. The bind object type will be determined by the class of the object being passed in.- Specified by:
bindin interfaceWritableNamingStore- Parameters:
name- The entry nameobject- The entry object- Throws:
NamingException- If any problems occur
-
bind
public void bind(Name name, Object object, Class<?> bindType) throws NamingException
Bind and object into the naming store, creating parent contexts if needed. All parent contexts must be created before this can be executed.- Specified by:
bindin interfaceWritableNamingStore- Parameters:
name- The entry nameobject- The entry objectbindType- The entry class- Throws:
NamingException- If any problems occur
-
rebind
public void rebind(Name name, Object object) throws NamingException
Re-bind and object into the naming store. All parent contexts must be created before this can be executed. The bind object type will be determined by the class of the object being passed in.- Specified by:
rebindin interfaceWritableNamingStore- Parameters:
name- The entry nameobject- The entry object- Throws:
NamingException- If any problems occur
-
rebind
public void rebind(Name name, Object object, Class<?> bindType) throws NamingException
Re-bind and object into the naming store. All parent contexts must be created before this can be executed.- Specified by:
rebindin interfaceWritableNamingStore- Parameters:
name- The entry nameobject- The entry objectbindType- The entry class- Throws:
NamingException- If any problems occur
-
unbind
public void unbind(Name name) throws NamingException
Unbind the entry in the provided location. This will remove the node in the tree and no longer manage it.- Specified by:
unbindin interfaceWritableNamingStore- Parameters:
name- The entry name- Throws:
NamingException
-
lookup
public Object lookup(Name name) throws NamingException
Lookup the object value of a binding node in the tree.- Specified by:
lookupin interfaceNamingStore- Parameters:
name- The entry name- Returns:
- The object value of the binding
- Throws:
NamingException
-
lookup
public Object lookup(Name name, boolean dereference) throws NamingException
Description copied from interface:NamingStoreLook up an object from the naming store. An entry for this name must already exist.- Specified by:
lookupin interfaceNamingStore- Parameters:
name- The entry namedereference- if true indicates that managed references should retrieve the instance.- Returns:
- The object from the store.
- Throws:
NamingException- If any errors occur.
-
list
public List<NameClassPair> list(Name name) throws NamingException
List all NameClassPair instances at a given location in the tree.- Specified by:
listin interfaceNamingStore- Parameters:
name- The entry name- Returns:
- The NameClassPair instances
- Throws:
NamingException
-
listBindings
public List<Binding> listBindings(Name name) throws NamingException
List all the Binding instances at a given location in the tree.- Specified by:
listBindingsin interfaceNamingStore- Parameters:
name- The entry name- Returns:
- The Binding instances
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(Name name) throws NamingException
Description copied from interface:WritableNamingStoreCreate a sub-context for the provided name.- Specified by:
createSubcontextin interfaceWritableNamingStore- Parameters:
name- The entry name- Returns:
- The new sub-context
- Throws:
NamingException- If any errors occur
-
close
public void close() throws NamingExceptionClose the store. This will clear all children from the root node.- Specified by:
closein interfaceNamingStore- Throws:
NamingException
-
addNamingListener
public void addNamingListener(Name target, int scope, NamingListener listener)
Add aNamingListenerto the naming event coordinator.- Specified by:
addNamingListenerin interfaceNamingStore- Parameters:
target- The target name to add the listener toscope- The listener scopelistener- The listener
-
removeNamingListener
public void removeNamingListener(NamingListener listener)
Remove aNamingListenerfrom the naming event coordinator.- Specified by:
removeNamingListenerin interfaceNamingStore- Parameters:
listener- The listener
-
-