com.parabon.client
Class RemoteJob

java.lang.Object
  extended by com.parabon.client.Job
      extended by com.parabon.client.RemoteJob
Direct Known Subclasses:
SimulatorJob

public class RemoteJob
extends Job


Nested Class Summary
protected  class RemoteJob.Establisher
           
 
Nested classes/interfaces inherited from class com.parabon.client.Job
Job.JobConstraints, Job.TaskProxyIterator, Job.TaskProxySet, Job.WeakTaskReference
 
Constructor Summary
RemoteJob(RemoteSessionManager manager_, java.lang.String jobID_, java.util.Map<java.lang.String,java.lang.String> attributes_, com.parabon.util.ObjectPool pool_, boolean isOriginator_)
           
RemoteJob(RemoteSessionManager manager_, java.lang.String jobID_, java.util.Map<java.lang.String,java.lang.String> attributes_, com.parabon.util.ObjectPool pool_, boolean isOriginator_, Job.JobConstraints constraints)
           
 
Method Summary
 java.net.URI addElement(java.lang.String identifier, com.parabon.io.DataWrapper contents)
          Create a job-level element with the given identifier which can be referred to in tasks contained in this job.
 java.net.URI addElementBundle(java.lang.String identifier, com.parabon.io.DataWrapper contents)
          Create a job-level element bundle containing elements which can be referred to in tasks contained in this job.
 void consumeContentsMessage(com.parabon.message.sp.ContentsMessage message)
           
 void consumeTaskMessage(com.parabon.message.sp.TaskMessage m)
           
 void consumeTaskStatusMessage(com.parabon.message.sp.TaskStatusMessage m)
           
 java.lang.String createTaskID()
          Returns a valid task ID unique within this Job
protected  com.parabon.client.TaskMaster createTaskMaster(TaskSpec spec, java.util.Map<java.lang.String,java.lang.String> taskAttributes)
           
 java.util.Set<TaskProxy> findRemoteTasksByAttribute(java.util.Map<java.lang.String,java.lang.String> template, int blockMillis)
          Search for tasks with attributes matching the given template.
 java.lang.String getLaunchToken()
           
protected  com.parabon.client.RemoteTaskMaster getOrCreateTaskMaster(java.lang.String taskID, java.util.Map<java.lang.String,java.lang.String> attributes, boolean updateAttributes)
           
protected  void notifyListenersChanged()
           
 void reestablish()
          Equivalent to reestablish(-1).
 void reestablish(int blockMillis)
          Request that the list of tasks contained in this job be reestablished if possible from a remote repository.
 void reestablish(com.parabon.util.Listener completionListener)
          Similar to reestablish(int), but does not block, instead calling the Listener.alert() method of the given listener when and if results are obtained.
 void reestablishPartial(java.util.Map<java.lang.String,java.lang.String> template, com.parabon.util.Listener completionListener)
          Similar to reestablish(Listener completionListener), but reestablishes at a minimum only those tasks matching the given template (as defined in findTasksByAttribute()).
 void remove()
          Destroy this job and all tasks it contains, removing all references to it locally and remotely.
 void setLaunchToken(java.lang.String value)
           
protected  void setManager(SessionManager sm)
           
protected  void stopJob()
           
protected  void updateAttach()
           
 
Methods inherited from class com.parabon.client.Job
addElement, addElement, addElement, addElementBundle, addElementBundle, addElementBundle, addListener, addTask, addTask, attributesMatchTemplate, createSerializableTaskSpec, createTaskSpec, destroy, finalize, findTasksByAttribute, getAllowTaskRelease, getAttributes, getElements, getElementURIs, getJobConstraints, getJobID, getListeners, getListeners, getLog, getManager, getPool, getTask, getTaskMaster, getTaskMastersAndReferences, getTaskProxy, getTasks, hasTask, notifyTaskEventOccurred, releaseTask, removeAllListeners, removeListener, resolveElement, setAllowTaskRelease, setJobConstraints, stop
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteJob

public RemoteJob(RemoteSessionManager manager_,
                 java.lang.String jobID_,
                 java.util.Map<java.lang.String,java.lang.String> attributes_,
                 com.parabon.util.ObjectPool pool_,
                 boolean isOriginator_)

RemoteJob

public RemoteJob(RemoteSessionManager manager_,
                 java.lang.String jobID_,
                 java.util.Map<java.lang.String,java.lang.String> attributes_,
                 com.parabon.util.ObjectPool pool_,
                 boolean isOriginator_,
                 Job.JobConstraints constraints)
Method Detail

setLaunchToken

public void setLaunchToken(java.lang.String value)

getLaunchToken

public java.lang.String getLaunchToken()

setManager

protected void setManager(SessionManager sm)
Overrides:
setManager in class Job

remove

public void remove()
Description copied from class: Job
Destroy this job and all tasks it contains, removing all references to it locally and remotely. If any tasks contained in this job are actively executing, they will be stopped.

Overrides:
remove in class Job

addElement

public java.net.URI addElement(java.lang.String identifier,
                               com.parabon.io.DataWrapper contents)
Description copied from class: Job
Create a job-level element with the given identifier which can be referred to in tasks contained in this job.

Method may or may not block until data is sent.

Overrides:
addElement in class Job
Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this job; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - the data to be associated with the new element
Returns:
the global unique identifier which may be used to refer to this element by tasks within this job. If the returned URI is used in tasks outside this job, behavior is undefined.

addElementBundle

public java.net.URI addElementBundle(java.lang.String identifier,
                                     com.parabon.io.DataWrapper contents)
Description copied from class: Job
Create a job-level element bundle containing elements which can be referred to in tasks contained in this job.

Method may or may not block until data is sent.

Overrides:
addElementBundle in class Job
Parameters:
identifier - the globally unique identifier to be associated with the new element, formed using the provided string. Should be unique within this job; if a data element with this identifier already exists on the server, behavior will be undefined.
contents - the data to be associated with the new elements. The data must be in Parabon Element Bundle format, including a valid bundle manifest.
Returns:
the global unique identifier which may be used to refer to the elements in the bundle from within this task. If the returned URI is used in other tasks, behavior is undefined.

createTaskMaster

protected com.parabon.client.TaskMaster createTaskMaster(TaskSpec spec,
                                                         java.util.Map<java.lang.String,java.lang.String> taskAttributes)
Specified by:
createTaskMaster in class Job

findRemoteTasksByAttribute

public java.util.Set<TaskProxy> findRemoteTasksByAttribute(java.util.Map<java.lang.String,java.lang.String> template,
                                                           int blockMillis)
                                                    throws TimeoutException
Description copied from class: Job
Search for tasks with attributes matching the given template. A tasks's attributes are considered to match a template if, for each attribute present in the template, the task has an attribute with identical name and value.

Searches all tasks, whether released or not, employing a remote repository (the Frontier server) if applicable.

Overrides:
findRemoteTasksByAttribute in class Job
Returns:
a read-only Set of TaskProxys corresponding to the tasks matching the given template
Throws:
TimeoutException

reestablishPartial

public void reestablishPartial(java.util.Map<java.lang.String,java.lang.String> template,
                               com.parabon.util.Listener completionListener)
Description copied from class: Job
Similar to reestablish(Listener completionListener), but reestablishes at a minimum only those tasks matching the given template (as defined in findTasksByAttribute()).

Overrides:
reestablishPartial in class Job
See Also:
Job.findTasksByAttribute(Map), Job.reestablish(Listener)

reestablish

public void reestablish()
Description copied from class: Job
Equivalent to reestablish(-1).

Overrides:
reestablish in class Job
See Also:
Job.reestablish(int)

reestablish

public void reestablish(int blockMillis)
                 throws TimeoutException
Description copied from class: Job
Request that the list of tasks contained in this job be reestablished if possible from a remote repository.

Blocks a maximum of approximately the specified number of milliseconds. If results are not obtained within the specitied timeout, a TimeoutException will be thrown. If blockMillis == -1, will block indefinitely.

Note that this method should never be called with a negative or large block timeout from within an event listener or any other method which must complete in order for further events to be processed, as this would lead to a possible deadlock.

Overrides:
reestablish in class Job
Throws:
TimeoutException

reestablish

public void reestablish(com.parabon.util.Listener completionListener)
Description copied from class: Job
Similar to reestablish(int), but does not block, instead calling the Listener.alert() method of the given listener when and if results are obtained.

Overrides:
reestablish in class Job
See Also:
Job.reestablish(int)

createTaskID

public java.lang.String createTaskID()
Description copied from class: Job
Returns a valid task ID unique within this Job

Overrides:
createTaskID in class Job

notifyListenersChanged

protected void notifyListenersChanged()
Overrides:
notifyListenersChanged in class Job

updateAttach

protected void updateAttach()

stopJob

protected void stopJob()
Specified by:
stopJob in class Job

getOrCreateTaskMaster

protected com.parabon.client.RemoteTaskMaster getOrCreateTaskMaster(java.lang.String taskID,
                                                                    java.util.Map<java.lang.String,java.lang.String> attributes,
                                                                    boolean updateAttributes)

consumeTaskStatusMessage

public void consumeTaskStatusMessage(com.parabon.message.sp.TaskStatusMessage m)

consumeTaskMessage

public void consumeTaskMessage(com.parabon.message.sp.TaskMessage m)

consumeContentsMessage

public void consumeContentsMessage(com.parabon.message.sp.ContentsMessage message)