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 Details

    • 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 Details

    • 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:
      getBaseName in interface NamingStore
      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:
      bind in interface WritableNamingStore
      Parameters:
      name - The entry name
      object - 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:
      bind in interface WritableNamingStore
      Parameters:
      name - The entry name
      object - The entry object
      bindType - 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:
      rebind in interface WritableNamingStore
      Parameters:
      name - The entry name
      object - 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:
      rebind in interface WritableNamingStore
      Parameters:
      name - The entry name
      object - The entry object
      bindType - 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:
      unbind in interface WritableNamingStore
      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:
      lookup in interface NamingStore
      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: NamingStore
      Look up an object from the naming store. An entry for this name must already exist.
      Specified by:
      lookup in interface NamingStore
      Parameters:
      name - The entry name
      dereference - 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:
      list in interface NamingStore
      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:
      listBindings in interface NamingStore
      Parameters:
      name - The entry name
      Returns:
      The Binding instances
      Throws:
      NamingException
    • createSubcontext

      public Context createSubcontext(Name name) throws NamingException
      Description copied from interface: WritableNamingStore
      Create a sub-context for the provided name.
      Specified by:
      createSubcontext in interface WritableNamingStore
      Parameters:
      name - The entry name
      Returns:
      The new sub-context
      Throws:
      NamingException - If any errors occur
    • close

      public void close() throws NamingException
      Close the store. This will clear all children from the root node.
      Specified by:
      close in interface NamingStore
      Throws:
      NamingException
    • addNamingListener

      public void addNamingListener(Name target, int scope, NamingListener listener)
      Add a NamingListener to the naming event coordinator.
      Specified by:
      addNamingListener in interface NamingStore
      Parameters:
      target - The target name to add the listener to
      scope - The listener scope
      listener - The listener
    • removeNamingListener

      public void removeNamingListener(NamingListener listener)
      Remove a NamingListener from the naming event coordinator.
      Specified by:
      removeNamingListener in interface NamingStore
      Parameters:
      listener - The listener