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 namedname
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 namedname
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 namedname
.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
Adds a new space namedname
to the repository.- Parameters:
name
- space namespace
- space added to the repository
-
get
Returns the space namedname
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
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:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
closeGates
public void closeGates() -
shutDown
public void shutDown() -
setExceptionLogger
-