Class SpaceFactory

java.lang.Object
org.jpos.space.SpaceFactory

public class SpaceFactory extends Object
Creates a space based on a space URI.

A space URI has three parts:

  • scheme
  • name
  • optional parameter

Examples:

  // default unnamed space (tspace:default)
  Space sp = SpaceFactory.getSpace ();

  // transient space named "test"
  Space sp = SpaceFactory.getSpace ("transient:test");

  // lspace (Loom-optimized) named "test"
  Space sp = SpaceFactory.getSpace ("lspace:test");

  // persistent space named "test"
  Space sp = SpaceFactory.getSpace ("persistent:test");

  // jdbm space named test
  Space sp = SpaceFactory.getSpace ("jdbm:test");

  // jdbm space named test, storage located in /tmp/test
  Space sp = SpaceFactory.getSpace ("jdbm:test:/tmp/test");
  • Field Details

  • Constructor Details

    • SpaceFactory

      public SpaceFactory()
      Default constructor; no instance state to initialise.
  • Method Details

    • getSpace

      public static Space getSpace()
      Returns the default transient space (equivalent to tspace:default).
      Returns:
      the default TransientSpace
    • getSpace

      public static Space getSpace(String spaceUri)
      Resolves a space URI of the form scheme:name[:param].
      Parameters:
      spaceUri - space URI; null returns the default space
      Returns:
      Space for given URI or null
    • getSpace

      public static Space getSpace(String scheme, String name, String param)
      Resolves the space identified by scheme, name, and optional param, registering a newly-created space in NameRegistrar on first use.
      Parameters:
      scheme - space scheme (one of the TSPACE/LSPACE/... constants)
      name - space name
      param - optional scheme-specific parameter (e.g. file path for jdbm:)
      Returns:
      the resolved space
      Throws:
      SpaceError - if the scheme is unknown or registration fails
    • getGCExecutor

      Returns the shared executor used by spaces to run lease-expiry/GC tasks.
      Returns:
      the shared GC executor