Package org.jspace

Class SpaceRepository

java.lang.Object
org.jspace.SpaceRepository

public class SpaceRepository
extends java.lang.Object
A repository is a container for a group of spaces each of which is identified by a name. Spaces in a repository can be accessed either locally or remotely.
  • Constructor Summary

    Constructors
    Constructor Description
    SpaceRepository()
    Creates a new respository.
  • Method Summary

    Modifier and Type Method Description
    void add​(java.lang.String name, Space space)
    Adds a new space named name to the repository.
    boolean addGate​(java.lang.String uri)  
    boolean addGate​(java.net.URI uri)  
    boolean addGate​(ServerGate gate)  
    void closeGate​(java.lang.String uri)
    Closes the gate represented by the specific uri, and terminates the underlying thread.
    void closeGate​(java.net.URI uri)
    Closes the gate represented by the specific uri, and terminates the underlying thread.
    void closeGate​(ServerGate gate)  
    void closeGates()  
    protected void finalize()  
    Space get​(java.lang.String name)
    Returns the space named name or null if this space does not exist.
    boolean isEmpty()
    Returns true if the repository is empty.
    boolean put​(java.lang.String target, java.lang.Object... fields)
    Adds a tuple in the space.
    Space remove​(java.lang.String name)
    Removes the space named name.
    void setExceptionLogger​(ExceptionLogger logger)  
    void shutDown()  
    int size()
    Returns the number of spaces in the repository.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpaceRepository

      public SpaceRepository()
      Creates a new respository.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns true if the repository is empty.
      Returns:
      true, if the repository is empty.
    • size

      public int size()
      Returns the number of spaces in the repository.
      Returns:
      the number of spaces in the repository.
    • add

      public void add​(java.lang.String name, Space space)
      Adds a new space named name to the repository.
      Parameters:
      name - space name
      space - space added to the repository
    • get

      public Space get​(java.lang.String name)
      Returns the space named name or null if this space does not exist.
      Parameters:
      name - space name
      Returns:
      the space named name or null if this space does not exist.
    • remove

      public Space remove​(java.lang.String name)
      Removes the space named name.
      Parameters:
      name - the name of the space to remove
      Returns:
      the space previously identified by name, null if no space is named name.
    • addGate

      public boolean addGate​(java.lang.String uri)
    • addGate

      public boolean addGate​(java.net.URI uri)
    • addGate

      public boolean addGate​(ServerGate gate)
    • closeGate

      public void closeGate​(java.lang.String uri)
      Closes the gate represented by the specific uri, and terminates the underlying thread.
      Parameters:
      uri -
    • closeGate

      public void closeGate​(java.net.URI uri)
      Closes the gate represented by the specific uri, and terminates the underlying thread.
      Parameters:
      uri -
    • closeGate

      public void closeGate​(ServerGate gate)
    • put

      public boolean put​(java.lang.String target, java.lang.Object... fields) throws java.lang.InterruptedException
      Adds a tuple in the space.
      Parameters:
      target - target space
      fields - fields fields of inserted tuple
      Returns:
      true if the action has been successfully executed false otherwise.
      Throws:
      java.lang.InterruptedException - if any thread interrupted the current thread before the action is executed.
    • finalize

      protected void finalize() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • closeGates

      public void closeGates()
    • shutDown

      public void shutDown()
    • setExceptionLogger

      public void setExceptionLogger​(ExceptionLogger logger)