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 voidadd(java.lang.String name, Space space)Adds a new space namednameto the repository.booleanaddGate(java.lang.String uri)booleanaddGate(java.net.URI uri)booleanaddGate(ServerGate gate)voidcloseGate(java.lang.String uri)Closes the gate represented by the specific uri, and terminates the underlying thread.voidcloseGate(java.net.URI uri)Closes the gate represented by the specific uri, and terminates the underlying thread.voidcloseGate(ServerGate gate)voidcloseGates()protected voidfinalize()Spaceget(java.lang.String name)Returns the space namednameor null if this space does not exist.booleanisEmpty()Returns true if the repository is empty.booleanput(java.lang.String target, java.lang.Object... fields)Adds a tuple in the space.Spaceremove(java.lang.String name)Removes the space namedname.voidsetExceptionLogger(ExceptionLogger logger)voidshutDown()intsize()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
Adds a new space namednameto the repository.- Parameters:
name- space namespace- space added to the repository
-
get
Returns the space namednameor null if this space does not exist.- Parameters:
name- space name- Returns:
- the space named
nameor null if this space does not exist.
-
remove
Removes the space namedname.- Parameters:
name- the name of the space to remove- Returns:
- the space previously identified by
name, null if no space is namedname.
-
addGate
public boolean addGate(java.lang.String uri) -
addGate
public boolean addGate(java.net.URI uri) -
addGate
-
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
-
put
public boolean put(java.lang.String target, java.lang.Object... fields) throws java.lang.InterruptedExceptionAdds a tuple in the space.- Parameters:
target- target spacefields- 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:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
closeGates
public void closeGates() -
shutDown
public void shutDown() -
setExceptionLogger
-