vgrid.server
Class InMemoryExecutiongPlodderServer

java.lang.Object
  extended by vgrid.server.InMemoryExecutiongPlodderServer
All Implemented Interfaces:
ExecutingPlodderServer

public class InMemoryExecutiongPlodderServer
extends java.lang.Object
implements ExecutingPlodderServer

A Server that keeps the managed tasks i the main Memeory. Mainly for testing purposes.


Constructor Summary
InMemoryExecutiongPlodderServer()
           
 
Method Summary
 void clear()
          Removes all tasks and libraries from the server.
 void deleteLibrary(java.lang.String name)
          Deletes a library from the server.
 void deleteTask(java.lang.String id)
          Deletes a task from the server.
 java.lang.String getConfiguration()
          A description of server, containing static information of the server.
 java.util.Collection getLibraryNames()
          Returns a collection of library names.
 java.util.Collection getLibraryUrls()
          Returns a collection of urls (java.net.URL) that describe the libraries deployed on the server.
 java.lang.String getNextId()
          Returns a unique ID to be used as Job- or Taskid.
 java.lang.String getState()
          A string describing the state of the server.
 java.io.InputStream getTask(java.lang.String id)
          Downloads a specific task from the server.
 java.util.Collection getTaskIds(TaskState state)
          Returns a collection of strings containing the task-ids beeing in a given state on the server.
 java.io.InputStream getUnfinishedTask()
          Provides an unfinished task to be executed by a client.
 java.lang.String getVersion()
          Returns the version of the server.
 void setErrorTask(java.io.InputStream in)
          Sends a task to the server.
 void setFinishedTask(java.io.InputStream in)
          Sends a task to the server.
 void setLibrary(java.lang.String name, java.io.InputStream in)
          Sends a library containing java classes in zipped form to the server.
 void setUnfinishedTask(java.io.InputStream in)
          Sends a task to the server.
 java.lang.String toDescriptionString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryExecutiongPlodderServer

public InMemoryExecutiongPlodderServer()
Method Detail

getUnfinishedTask

public java.io.InputStream getUnfinishedTask()
                                      throws VgridException
Description copied from interface: ExecutingPlodderServer
Provides an unfinished task to be executed by a client. The client cannot influence which task it gets.

Specified by:
getUnfinishedTask in interface ExecutingPlodderServer
Returns:
The task in serialized form.
Throws:
VgridException

getTask

public java.io.InputStream getTask(java.lang.String id)
                            throws VgridException
Description copied from interface: ExecutingPlodderServer
Downloads a specific task from the server. Should be used by the vendor receive the finished tasks.

Specified by:
getTask in interface ExecutingPlodderServer
Parameters:
id - The id of the task to be downloaded.
Returns:
The task in serialized form.
Throws:
VgridException

deleteTask

public void deleteTask(java.lang.String id)
                throws VgridException
Description copied from interface: ExecutingPlodderServer
Deletes a task from the server. This method should be used from the vendor to delete the finished tasks from the server.

Specified by:
deleteTask in interface ExecutingPlodderServer
Parameters:
id - The id of the task to be deleted.
Throws:
VgridException

getTaskIds

public java.util.Collection getTaskIds(TaskState state)
                                throws VgridException
Description copied from interface: ExecutingPlodderServer
Returns a collection of strings containing the task-ids beeing in a given state on the server. Should be used by the vendor to find out if his tasks are finished.

Specified by:
getTaskIds in interface ExecutingPlodderServer
Parameters:
state - The state what whos ids should be requested. Possible values: Server.TASK_STATE_UNFINISHED, Server.TASK_STATE_UNFINISHED, Server.TASK_STATE_REQUESTED, Server.TASK_STATE_ERROR, Server.TASK_STATE_ABSENT
Returns:
Collection of Strings.
Throws:
VgridException

setFinishedTask

public void setFinishedTask(java.io.InputStream in)
                     throws VgridException
Description copied from interface: ExecutingPlodderServer
Sends a task to the server. Task that reach the client by calling this method are put into the finished category. They are not redistributed to other clients. The client should use that method to send a task to the server that was finished during execution.

Specified by:
setFinishedTask in interface ExecutingPlodderServer
Parameters:
in - The task in serialized form.
Throws:
VgridException

setErrorTask

public void setErrorTask(java.io.InputStream in)
                  throws VgridException
Description copied from interface: ExecutingPlodderServer
Sends a task to the server. Task that reach the client by calling this method are put into the error category. They are not redistributed to other clients. The client should use that method to send a task to the server that caused an error during execution.

Specified by:
setErrorTask in interface ExecutingPlodderServer
Parameters:
in - The task in serialized form.
Throws:
VgridException

setUnfinishedTask

public void setUnfinishedTask(java.io.InputStream in)
                       throws VgridException
Description copied from interface: ExecutingPlodderServer
Sends a task to the server. Task that reach the client by calling this method are put into the unfinished category. They are redistributed to other clients. The client should use that method to send a task to the server that was not finished during execution.

Specified by:
setUnfinishedTask in interface ExecutingPlodderServer
Parameters:
in - The task in serialized form.
Throws:
VgridException

getConfiguration

public java.lang.String getConfiguration()
Description copied from interface: ExecutingPlodderServer
A description of server, containing static information of the server.

Specified by:
getConfiguration in interface ExecutingPlodderServer
Returns:
The current configuration of the server..

toDescriptionString

public java.lang.String toDescriptionString()

setLibrary

public void setLibrary(java.lang.String name,
                       java.io.InputStream in)
                throws VgridException
Description copied from interface: ExecutingPlodderServer
Sends a library containing java classes in zipped form to the server. Typically a .jar file.

Specified by:
setLibrary in interface ExecutingPlodderServer
Parameters:
name - The name of the library. E.g. mylib.jar, lib.jar, ... . The name must be unique. Therefore a prefix spezifying the vendor and the vendor project should be used.
in - A stream containing the library.
Throws:
VgridException

getLibraryUrls

public java.util.Collection getLibraryUrls()
                                    throws VgridException
Description copied from interface: ExecutingPlodderServer
Returns a collection of urls (java.net.URL) that describe the libraries deployed on the server. These urls should be used by the client to download the latest versions of code to be executed. Is typically uses by an URLClassLoader.

Specified by:
getLibraryUrls in interface ExecutingPlodderServer
Returns:
A collection of strings containing urls.
Throws:
VgridException

getLibraryNames

public java.util.Collection getLibraryNames()
Description copied from interface: ExecutingPlodderServer
Returns a collection of library names. Used for the implementation of getLibraryUrls().

Specified by:
getLibraryNames in interface ExecutingPlodderServer
Returns:
Collection of java.net.URL.

deleteLibrary

public void deleteLibrary(java.lang.String name)
                   throws VgridException
Description copied from interface: ExecutingPlodderServer
Deletes a library from the server. Should be used by the vendor to delete libraries that are no longer needed because no mor tasks are deployed using it.

Specified by:
deleteLibrary in interface ExecutingPlodderServer
Parameters:
name - The name of the libray to be deleted.
Throws:
VgridException

getVersion

public java.lang.String getVersion()
Description copied from interface: ExecutingPlodderServer
Returns the version of the server.

Specified by:
getVersion in interface ExecutingPlodderServer

getNextId

public java.lang.String getNextId()
                           throws VgridException
Description copied from interface: ExecutingPlodderServer
Returns a unique ID to be used as Job- or Taskid.

Specified by:
getNextId in interface ExecutingPlodderServer
Throws:
VgridException

clear

public void clear()
Description copied from interface: ExecutingPlodderServer
Removes all tasks and libraries from the server.

Specified by:
clear in interface ExecutingPlodderServer

getState

public java.lang.String getState()
Description copied from interface: ExecutingPlodderServer
A string describing the state of the server.

Specified by:
getState in interface ExecutingPlodderServer


vgrid the vienna grid project