Class NameRegistrar

java.lang.Object
org.jpos.util.NameRegistrar
All Implemented Interfaces:
Loggeable

public class NameRegistrar extends Object implements Loggeable
Allow runtime binding of jPOS's components (ISOChannels, Logger, MUXes, etc)
  • Method Details

    • getSpace

      public static TSpace<String,Object> getSpace()
      Returns the underlying TSpace used for name registration.
      Returns:
      the shared TSpace instance
    • getAsMap

      public static Map<String,Object> getAsMap()
      Returns a copy of the NameRegistrar's entries as a Map.
      Returns:
      a copy of the NameRegistrar's entries as a Map
    • getInstance

      public static NameRegistrar getInstance()
      Returns the singleton NameRegistrar instance.
      Returns:
      singleton instance
    • register

      public static void register(String key, Object value)
      register object
      Parameters:
      key - - key with which the specified value is to be associated.
      value - - value to be associated with the specified key
    • unregister

      public static void unregister(String key)
      Removes the mapping for the given key from the registrar.
      Parameters:
      key - key whose mapping is to be removed from registrar.
    • get

      public static <T> T get(String key) throws NameRegistrar.NotFoundException
      Get a value from the registry.
      Type Parameters:
      T - desired type of entry value.
      Parameters:
      key - the key whose associated value is to be returned.
      Returns:
      a value
      Throws:
      NameRegistrar.NotFoundException - if key not present in registrar
    • get

      public static <T> T get(String key, long timeout)
      Get a value from the registry - wait for it specified time.
      Type Parameters:
      T - desired type of value.
      Parameters:
      key - the key whose associated value is to be returned.
      timeout - the maximum waiting time (in miliseconds) for the appearance of value in the registry.
      Returns:
      a value or null if it does not exist
    • getIfExists

      public static <T> T getIfExists(String key)
      Get a value from the registry - without casting NotFoundException.
      Type Parameters:
      T - desired type of value.
      Parameters:
      key - the key whose associated value is to be returned.
      Returns:
      a value or null if it does not exist
    • dump

      public void dump(PrintStream p, String indent)
      Dumps a summary of registered names to the given stream.
      Specified by:
      dump in interface Loggeable
      Parameters:
      p - output stream
      indent - indent prefix
    • dump

      public void dump(PrintStream p, String indent, boolean detail)
      Dumps registered names to the given stream, optionally including object detail.
      Parameters:
      p - output stream
      indent - indent prefix
      detail - if true, also dumps Loggeable objects