cluster5.client
Class ClusterInterfaceImpl

java.lang.Object
  extended by cluster5.client.ClusterInterfaceImpl
All Implemented Interfaces:
ClusterInterface

public class ClusterInterfaceImpl
extends java.lang.Object
implements ClusterInterface


Method Summary
 java.lang.Long createTask(java.lang.Object argument)
          Creates new task to be evaluated on a remote machine by the project's main class.
 void dropProject()
          Deletes currently opened project with all associated tasks and files.
static ClusterInterfaceImpl getInstance()
           
 float getProjectProgress()
           
 Project.Status getProjectStatus()
           
 Task getTask(java.lang.Long taskId)
          Returns instance of a task.
 Task.Status getTaskStatus(java.lang.Long taskId)
           
 java.util.List<java.lang.String> listProjectNames()
           
 java.util.List<java.lang.Long> listTaskIds()
           
 boolean login(java.lang.String loginName, java.lang.String password)
          Log in to the cluster server.
 void logout()
          Logout from the cluster server.
 boolean openProject(java.lang.String projectName)
          Opens a project identified by the name.
 void reconnect()
          If a RemoteException has been thrown due to communocation problem, call this method to renew connection to the server.
 void removeTask(java.lang.Long taskId)
          Deletes specified task.
 void runProject()
          Sets the project's flag to RUNNING singalizing the scheduler that this project configuration is ready to evaluate the project's tasks.
 void setProjectLibraries(java.lang.Class[] classes)
          Sets list of classes required by this project to be successfully evaluated.
 void setProjectMainClass(java.lang.Class clazz)
          Sets main class of a project.
 void stopProject()
          Sets the project's flag to STOPPED so no further tasks will be processed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ClusterInterfaceImpl getInstance()

reconnect

public void reconnect()
Description copied from interface: ClusterInterface
If a RemoteException has been thrown due to communocation problem, call this method to renew connection to the server.

Specified by:
reconnect in interface ClusterInterface

createTask

public java.lang.Long createTask(java.lang.Object argument)
                          throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Creates new task to be evaluated on a remote machine by the project's main class. Null is returned in case the argument is not serializable; then, the task is not created.

Specified by:
createTask in interface ClusterInterface
Parameters:
argument - a Serializable array, list or structure to be passed to the project's main class as an argument of parameters.
Returns:
task ID if the task was successfully created; null otherwise
Throws:
java.rmi.RemoteException

dropProject

public void dropProject()
                 throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Deletes currently opened project with all associated tasks and files.

Specified by:
dropProject in interface ClusterInterface
Throws:
java.rmi.RemoteException

getProjectStatus

public Project.Status getProjectStatus()
                                throws java.rmi.RemoteException
Specified by:
getProjectStatus in interface ClusterInterface
Returns:
current status of the project
Throws:
java.rmi.RemoteException

getProjectProgress

public float getProjectProgress()
                         throws java.rmi.RemoteException
Specified by:
getProjectProgress in interface ClusterInterface
Returns:
progress of the project, a number between 0 and 1 where 1 = processing of all all tasks has finished. The value is calculated by the task's status in the database.
Throws:
java.rmi.RemoteException

getTask

public Task getTask(java.lang.Long taskId)
             throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Returns instance of a task. If the task is finished, there might be a result set (if a result was returned) and a log of system.out and system.err recorded during the taks' run.

Specified by:
getTask in interface ClusterInterface
Returns:
instance of Task or null if there is no such task
Throws:
java.rmi.RemoteException

getTaskStatus

public Task.Status getTaskStatus(java.lang.Long taskId)
                          throws java.rmi.RemoteException
Specified by:
getTaskStatus in interface ClusterInterface
Parameters:
taskId - task ID
Returns:
status of a task
Throws:
java.rmi.RemoteException

listProjectNames

public java.util.List<java.lang.String> listProjectNames()
                                                  throws java.rmi.RemoteException
Specified by:
listProjectNames in interface ClusterInterface
Returns:
all existing project names owned by the logged in user
Throws:
java.rmi.RemoteException

listTaskIds

public java.util.List<java.lang.Long> listTaskIds()
                                           throws java.rmi.RemoteException
Specified by:
listTaskIds in interface ClusterInterface
Returns:
list of task IDs for currently open project or empty list if there are no tasks or no project is open
Throws:
java.rmi.RemoteException

login

public boolean login(java.lang.String loginName,
                     java.lang.String password)
              throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Log in to the cluster server.

Specified by:
login in interface ClusterInterface
Returns:
true if the combination was accepted
Throws:
java.rmi.RemoteException

logout

public void logout()
            throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Logout from the cluster server.

Specified by:
logout in interface ClusterInterface
Throws:
java.rmi.RemoteException

openProject

public boolean openProject(java.lang.String projectName)
                    throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Opens a project identified by the name.

Specified by:
openProject in interface ClusterInterface
Returns:
true if a project was opened or created
Throws:
java.rmi.RemoteException

removeTask

public void removeTask(java.lang.Long taskId)
                throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Deletes specified task.

Specified by:
removeTask in interface ClusterInterface
Parameters:
taskId - task ID
Throws:
java.rmi.RemoteException

runProject

public void runProject()
                throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Sets the project's flag to RUNNING singalizing the scheduler that this project configuration is ready to evaluate the project's tasks.

Specified by:
runProject in interface ClusterInterface
Throws:
java.rmi.RemoteException

setProjectLibraries

public void setProjectLibraries(java.lang.Class[] classes)
                         throws java.lang.RuntimeException,
                                java.rmi.RemoteException
Description copied from interface: ClusterInterface
Sets list of classes required by this project to be successfully evaluated.

Specified by:
setProjectLibraries in interface ClusterInterface
Parameters:
classes - list of classes needed to run the main class on remote machines
Throws:
java.lang.RuntimeException
java.rmi.RemoteException

setProjectMainClass

public void setProjectMainClass(java.lang.Class clazz)
                         throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Sets main class of a project.

Specified by:
setProjectMainClass in interface ClusterInterface
Parameters:
clazz - main class of the project
Throws:
java.rmi.RemoteException

stopProject

public void stopProject()
                 throws java.rmi.RemoteException
Description copied from interface: ClusterInterface
Sets the project's flag to STOPPED so no further tasks will be processed.

Specified by:
stopProject in interface ClusterInterface
Throws:
java.rmi.RemoteException