cluster5.server
Class ServerInterface4UserImpl

java.lang.Object
  extended by cluster5.server.ServerInterface4TerminalsImpl
      extended by cluster5.server.ServerInterface4UserImpl
All Implemented Interfaces:
ServerInterface4Terminals, ServerInterface4User, java.rmi.Remote
Direct Known Subclasses:
ServerImpl

public class ServerInterface4UserImpl
extends ServerInterface4TerminalsImpl
implements ServerInterface4User


Constructor Summary
ServerInterface4UserImpl()
           
 
Method Summary
 java.lang.Long createTask(java.lang.String token, java.lang.Long projectId, byte[] argument)
          Creates a new task for specified user (by token) and project ID with an argument object which has to be serializable (!).
 void dropProject(java.lang.String token, java.lang.Long projectId)
          Drops a project and all related tasks and files.
 float getProjectProgress(java.lang.String token, java.lang.Long projectId)
           
 Project.Status getProjectStatus(java.lang.String token, java.lang.Long projectId)
           
 Task getTask(java.lang.String token, java.lang.Long taskId)
           
 Task.Status getTaskStatus(java.lang.String token, java.lang.Long taskId)
           
 java.util.List<java.lang.String> listProjectNames(java.lang.String token)
          Lists project for user specified by the token.
 java.util.List<java.lang.Long> listTaskIds(java.lang.String token, java.lang.Long projectId)
           
 java.lang.String login(java.lang.String loginName, java.lang.String password)
           
 void logout(java.lang.String token)
           
 Project openProject(java.lang.String token, java.lang.String projectName)
          Opens a project by name.
 void removeTask(java.lang.String token, java.lang.Long projectId, java.lang.Long taskId)
          Deletes specified task.
 void runProject(java.lang.String token, java.lang.Long projectId)
          Sets project's flag to RUNNING.
 void setProjectMainClass(java.lang.String token, java.lang.Long projectId, java.lang.String canonicalClassName)
          Sets project main class.
 void stopProject(java.lang.String token, java.lang.Long projectId)
          Sets project's flag to STOPPED.
 void uploadFile(java.lang.String token, java.lang.Long projectId, SharedFile file)
          Uploads recent version of a file which will be distributed across executors.
 
Methods inherited from class cluster5.server.ServerInterface4TerminalsImpl
announceTerminalDown, announceTerminalUp, getFileData, getTask, listFiles, setResult
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerInterface4UserImpl

public ServerInterface4UserImpl()
Method Detail

createTask

public java.lang.Long createTask(java.lang.String token,
                                 java.lang.Long projectId,
                                 byte[] argument)
                          throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Creates a new task for specified user (by token) and project ID with an argument object which has to be serializable (!).

Specified by:
createTask in interface ServerInterface4User
Returns:
task ID
Throws:
java.rmi.RemoteException

dropProject

public void dropProject(java.lang.String token,
                        java.lang.Long projectId)
                 throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Drops a project and all related tasks and files.

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

getTask

public Task getTask(java.lang.String token,
                    java.lang.Long taskId)
             throws java.rmi.RemoteException
Specified by:
getTask in interface ServerInterface4User
Returns:
a task object no matter in which state
Throws:
java.rmi.RemoteException

getTaskStatus

public Task.Status getTaskStatus(java.lang.String token,
                                 java.lang.Long taskId)
                          throws java.rmi.RemoteException
Specified by:
getTaskStatus in interface ServerInterface4User
Returns:
current status of a task identified by task ID
Throws:
java.rmi.RemoteException

listProjectNames

public java.util.List<java.lang.String> listProjectNames(java.lang.String token)
                                                  throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Lists project for user specified by the token.

Specified by:
listProjectNames in interface ServerInterface4User
Returns:
list of project names
Throws:
java.rmi.RemoteException

listTaskIds

public java.util.List<java.lang.Long> listTaskIds(java.lang.String token,
                                                  java.lang.Long projectId)
                                           throws java.rmi.RemoteException
Specified by:
listTaskIds in interface ServerInterface4User
Returns:
list of task IDs for specific project ID
Throws:
java.rmi.RemoteException

login

public java.lang.String login(java.lang.String loginName,
                              java.lang.String password)
                       throws java.rmi.RemoteException
Specified by:
login in interface ServerInterface4User
Returns:
token uniquely identifying the user. This token changes after every call to login() and is invalidated by calling logout()
Throws:
java.rmi.RemoteException

logout

public void logout(java.lang.String token)
            throws java.rmi.RemoteException
Specified by:
logout in interface ServerInterface4User
Throws:
java.rmi.RemoteException

openProject

public Project openProject(java.lang.String token,
                           java.lang.String projectName)
                    throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Opens a project by name. If there is no such project, new project is created.

Specified by:
openProject in interface ServerInterface4User
Returns:
instance of a project or null if there is no such one owned by the user identified by the token
Throws:
java.rmi.RemoteException

setProjectMainClass

public void setProjectMainClass(java.lang.String token,
                                java.lang.Long projectId,
                                java.lang.String canonicalClassName)
                         throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Sets project main class. The class file must be uploaded and present on terminals before processing a task using this class. The main class MUST implement the ClusterTask interface.

Specified by:
setProjectMainClass in interface ServerInterface4User
Throws:
java.rmi.RemoteException

uploadFile

public void uploadFile(java.lang.String token,
                       java.lang.Long projectId,
                       SharedFile file)
                throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Uploads recent version of a file which will be distributed across executors.

Specified by:
uploadFile in interface ServerInterface4User
Throws:
java.rmi.RemoteException

getProjectStatus

public Project.Status getProjectStatus(java.lang.String token,
                                       java.lang.Long projectId)
Specified by:
getProjectStatus in interface ServerInterface4User
Returns:
current project status

getProjectProgress

public float getProjectProgress(java.lang.String token,
                                java.lang.Long projectId)
                         throws java.rmi.RemoteException
Specified by:
getProjectProgress in interface ServerInterface4User
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

removeTask

public void removeTask(java.lang.String token,
                       java.lang.Long projectId,
                       java.lang.Long taskId)
                throws java.rmi.RemoteException
Description copied from interface: ServerInterface4User
Deletes specified task.

Specified by:
removeTask in interface ServerInterface4User
Throws:
java.rmi.RemoteException

runProject

public void runProject(java.lang.String token,
                       java.lang.Long projectId)
Description copied from interface: ServerInterface4User
Sets project's flag to RUNNING.

Specified by:
runProject in interface ServerInterface4User

stopProject

public void stopProject(java.lang.String token,
                        java.lang.Long projectId)
Description copied from interface: ServerInterface4User
Sets project's flag to STOPPED.

Specified by:
stopProject in interface ServerInterface4User