org.space4j
Interface Space4J

All Known Implementing Classes:
MasterSpace4J, SimpleSpace4J, SlaveSpace4J

public interface Space4J

Our Java database of objects. Clients will use the Space4J object to execute commands in the underlying space. Space4J will be running in the same JVM the client is running, in other words, the client will be able to access the Space4J directly in memomy.


Method Summary
 int exec(Command cmd)
          Executes a command on the underlying Space.
 void executeSnapshot()
          Take a snapshot of the Space to disk.
 Space getSpace()
          Returns the Space where the Objects are stored, so the client can direct access them.
 int reapply(Command cmd)
          Re-apply a command on the underlying Space.
 void start()
          Starts the Space4J.
 

Method Detail

reapply

int reapply(Command cmd)
            throws CommandException,
                   LoggerException
Re-apply a command on the underlying Space. This method will be used to re-apply the commands from the logs. OBS: Logging is done AFTER the command is executed. If, for some reason, a CommandException is thrown, the command will not be logged.

Parameters:
cmd - The command to execute.
Returns:
An int containing the number of objects modified by this operation.
Throws:
CommandException - if there is a problem executing this command
LoggerException - if there is a problem logging thie command

exec

int exec(Command cmd)
         throws CommandException,
                LoggerException
Executes a command on the underlying Space. The client must use this method to perform any update on the Space. The client must never do any modifications on the Space objects without using this method, otherwise, the change will not be persisted. Space4J will execute the command and log the changes for future recovery if needed. OBS: Logging is done AFTER the command is executed. If, for some reason, a CommandException is thrown, the command will not be logged.

Parameters:
cmd - The command to execute.
Returns:
An int containing the number of objects modified by this operation.
Throws:
CommandException - if there is a problem executing this command
LoggerException - if there is a problem logging thie command

executeSnapshot

void executeSnapshot()
                     throws LoggerException
Take a snapshot of the Space to disk. The Space will be serialized and written to disk.

Throws:
LoggerException

getSpace

Space getSpace()
Returns the Space where the Objects are stored, so the client can direct access them.

Returns:
a Space if Space4J is running locally or null otherwise

start

void start()
           throws java.net.UnknownHostException,
                  java.io.IOException,
                  java.lang.ClassNotFoundException
Starts the Space4J. This is only necessary for a replicated Space4J.

Throws:
java.net.UnknownHostException
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 2005 Space4J Team. All Rights Reserved.