|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.core.BasicItem<D>
org.proteios.core.OwnedItem<JobData>
org.proteios.core.Job
public class Job
This class represents the execution of a job. Normally a job is executed by a
plugin, but it can also be executed by an external program. To find the type
of the job check the getJobType() method. Many of the methods in
this class only apply to jobs of one of the types. The following methods can
only be used on jobs that are executed by a plugin:
configure(GuiContext): Starts the configuration sequence of
the job
execute(ProgressReporter, String): Starts executing the job
start(String, String): Tell the core that job has started
setProgress(int, String): Update the progress status of the
job
doneOk(String): Tell the core that the job finished
successfully
doneError(String): Thell the core that the job finished with
an error
| Nested Class Summary | |
|---|---|
static class |
Job.ExecutionTime
A rough estimate of the execution time of a job. |
static class |
Job.Status
The status of a job. |
static class |
Job.Type
The type of job. |
| Field Summary | |
|---|---|
static int |
MAX_SERVER_LENGTH
The maximum allowed length of the server name. |
static int |
MAX_STATUS_MESSAGE_LENGTH
The maximum allowed length of the status message. |
static Item |
TYPE
The type of item represented by this class. |
| Fields inherited from interface org.proteios.core.Nameable |
|---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
| Method Summary | |
|---|---|
boolean |
abort()
Handles aborted job command. |
PluginConfigurationRequest |
configure(GuiContext context)
Start the configuration sequence for a job. |
void |
doneAborted(String statusMessage)
Register the job as aborted. |
void |
doneError(String statusMessage)
Register the job as completed with an error. |
void |
doneOk(String statusMessage)
Register the job as successfully completed. |
PluginExecutionRequest |
execute(ProgressReporter progress,
String server)
Start the execution sequence for a job. |
AbortableJobQueueReadOnlyInterface |
getAbortableJobQueue()
Get the abortable job queue used for the job. |
int |
getActiveProjectId()
The ID of the project that should be made the active project while running this job. |
Job |
getBlocker()
|
static Job |
getById(DbControl dc,
int id)
Get a Job item when you know the id. |
Date |
getCreated()
Get the date and time the job was registered in the database. |
String |
getDescription()
Get the description for the item. |
Date |
getEnded()
Get the date and time the job ended. |
Job.ExecutionTime |
getEstimatedExecutionTime()
Get the estimated execution time of the job. |
Job.Type |
getJobType()
Get the type of job, ie. if it is a job executed by a plugin or not. |
String |
getName()
Get the name of the item. |
Set<String> |
getParameterNames()
Get the names of all parameters for the job. |
List<?> |
getParameterValues(String name)
Get the values of a named parameter. |
int |
getPercentComplete()
An estimate of the percentage of the work currently completed by an executing job. |
PluginConfiguration |
getPluginConfiguration()
Get the PluginConfiguration defining the plugin this job should
execute. |
PluginDefinition |
getPluginDefinition()
Get the PluginConfiguration defining the plugin this job should
execute. |
PluginExecutionRequest |
getPluginExecutionRequest()
Get the PluginExecutionRequest for the job. |
int |
getPriority()
Get the priority of the job. |
static ItemQuery<Job> |
getQuery()
Get a query configured to retrieve |
String |
getServer()
Get the name of the server where the job is executing. |
Date |
getStarted()
Get the date and time the job was started. |
Job.Status |
getStatus()
Get the status of the job. |
String |
getStatusMessage()
Get a message about the current status of the job. |
Thread |
getThread()
Get the Thread for the job. |
Item |
getType()
Get the type of item represented by the object. |
boolean |
isRemoved()
Check if the removed flag is set for this item. |
boolean |
isUsed()
Return TRUE if the status is EXECUTING, FALSE otherwise. |
boolean |
jobCommandAborted()
Check if the job command is aborted. |
void |
removeAbortedJobId(int jobId)
Remove job id from the aborted job id list. |
void |
setBlocker(Job blocker)
|
void |
setDescription(String description)
Set the description for the item. |
void |
setEstimatedExecutionTime(Job.ExecutionTime executionTime)
Set the estimated execution time of the job. |
void |
setName(String name)
Set the name of the item. |
void |
setParameterValue(String name,
ParameterType<?> parameterType,
Object value)
Set the value of a configuration parameter. |
void |
setParameterValues(String name,
ParameterType<?> parameterType,
List<?> values)
Set the value of a configuration parameter. |
void |
setPriority(int priority)
Set the priority of the job. |
void |
setProgress(int percentComplete,
String statusMessage)
Set the progress of the job. |
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
void |
start(String statusMessage,
String server)
Register the job as started. |
| Methods inherited from class org.proteios.core.OwnedItem |
|---|
getOwner, setOwner |
| Methods inherited from class org.proteios.core.BasicItem |
|---|
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.proteios.core.Identifiable |
|---|
getId, getVersion |
| Methods inherited from interface org.proteios.core.AccessControlled |
|---|
checkPermission, hasPermission |
| Field Detail |
|---|
public static final Item TYPE
Item.JOB,
getType()public static final int MAX_STATUS_MESSAGE_LENGTH
public static final int MAX_SERVER_LENGTH
| Method Detail |
|---|
public static Job getById(DbControl dc,
int id)
throws ItemNotFoundException,
PermissionDeniedException,
BaseException
Job item when you know the id.
dc - The DbControl which will be used for permission
checking and database access.id - The id of the item to load
Job item
ItemNotFoundException - If an item with the specified id is not
found
PermissionDeniedException - If the logged in user doesn't have read
permission to the item
BaseException - If there is another errorpublic static ItemQuery<Job> getQuery()
ItemQuery objectpublic AbortableJobQueueReadOnlyInterface getAbortableJobQueue()
public PluginExecutionRequest getPluginExecutionRequest()
public Thread getThread()
public Item getType()
IdentifiableItem enumeration.
getType in interface Identifiablepublic String getName()
Nameable
getName in interface NameableString with the name of the item
public void setName(String name)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_NAME_LENGTH constant.
setName in interface Nameablename - The new name for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH constantpublic String getDescription()
Nameable
getDescription in interface NameableString with a description of the item
public void setDescription(String description)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_DESCRIPTION_LENGTH constant.
setDescription in interface Nameabledescription - The new description for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH constantpublic boolean isRemoved()
Removable
isRemoved in interface Removable
public void setRemoved(boolean removed)
throws PermissionDeniedException
Removable
setRemoved in interface Removableremoved - TRUE if the item should be flagged as removed,
FALSE otherwise
PermissionDeniedException - If the logged in user doesn't
have Permission.DELETE permission for setting the flag
to TRUE or Permission.WRITE permission for setting the
flag to FALSE
public boolean isUsed()
throws BaseException
isUsed in class BasicItem<JobData>BaseExceptionpublic Job.Type getJobType()
public PluginDefinition getPluginDefinition()
throws PermissionDeniedException,
BaseException
PluginConfiguration defining the plugin this job should
execute.
PluginConfiguration item, or null if this job
isn't executed by a plugin
PermissionDeniedException - If the logged in user doesn't have read
permission for the plugin configuration
BaseException - If there is another error
public PluginConfiguration getPluginConfiguration()
throws PermissionDeniedException,
BaseException
PluginConfiguration defining the plugin this job should
execute.
PluginConfiguration item, or null if this job
isn't executed by a plugin
PermissionDeniedException - If the logged in user doesn't have read
permission for the plugin configuration
BaseException - If there is another errorpublic Job.ExecutionTime getEstimatedExecutionTime()
ExecutionTime objectpublic void setEstimatedExecutionTime(Job.ExecutionTime executionTime)
executionTime - ExecutionTime The execution time to set.public Job.Status getStatus()
public String getStatusMessage()
public int getPercentComplete()
public int getPriority()
public void setPriority(int priority)
throws PermissionDeniedException,
InvalidDataException
PermissionDeniedException - If the logged in user doesn't have
write permission or the job's status isn't WAITING
InvalidDataException - If the priority isn't between 1 and 10public int getActiveProjectId()
public Date getCreated()
public Date getStarted()
start(String, String)public String getServer()
public Date getEnded()
public void start(String statusMessage,
String server)
throws PermissionDeniedException,
InvalidDataException
statusMessage - A messageserver - The name of the server where the job is started
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the status message is too long
public void setProgress(int percentComplete,
String statusMessage)
throws PermissionDeniedException,
InvalidDataException
Job.Status.EXECUTING status.
percentComplete - The number of percent completedstatusMessage - A message
PermissionDeniedException - If the logged in user doesn't have
write permission of the job isn't in the EXECUTING
status
InvalidDataException - If the status message is too long or the
percentage value isn't between 0 and 100
public void doneOk(String statusMessage)
throws PermissionDeniedException,
InvalidDataException
statusMessage - A message
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the status message is too long
public void doneError(String statusMessage)
throws PermissionDeniedException,
InvalidDataException
statusMessage - A message
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the status message is too long
public void doneAborted(String statusMessage)
throws PermissionDeniedException,
InvalidDataException
statusMessage - A message
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the status message is too long
public PluginConfigurationRequest configure(GuiContext context)
throws PermissionDeniedException,
BaseException
DbControl.commit() until the configuration sequence is done. See
PluginRequest for more information. This method
changes the status of the job to Job.Status.WAITING.
PluginRequest object
PermissionDeniedException - If the logged in user doesn't have
write permission
BaseException - If there is another error
public PluginExecutionRequest execute(ProgressReporter progress,
String server)
throws PermissionDeniedException,
InvalidDataException,
BaseException
DbControl.commit() before calling
PluginRequest.invoke().
progress - The ProgressReporter where the plugin can
report its progress. If
null ProgressReporterImpl is usedserver - The name of the server executing the plugin
PluginRequest object
PermissionDeniedException - If the logged in user doesn't have
write permission or the job isn't in the Job.Status.WAITING
status
InvalidDataException - If the server name is too long
BaseException - If there is another errorpublic Set<String> getParameterNames()
Set containing the names of the parameters or an
empty set if no parameters has been defined
public List<?> getParameterValues(String name)
throws PermissionDeniedException,
BaseException
name - The name of the parameter
PermissionDeniedException - If the parameter contain values that
the logged in user doesn't have read permission for
BaseException - If there is another error
public void setParameterValue(String name,
ParameterType<?> parameterType,
Object value)
throws InvalidDataException,
PermissionDeniedException,
BaseException
Job.Status.WAITING.
name - The name of the parameterparameterType - The type of the parametervalue - The value of the parameter
PermissionDeniedException - If the logged in user doesn't have
write permission or if the job is executing
InvalidDataException - If name is null or the new value doesn't
validate against the parameter type
BaseException - If there is another error
public void setParameterValues(String name,
ParameterType<?> parameterType,
List<?> values)
throws InvalidDataException,
PermissionDeniedException,
BaseException
Job.Status.WAITING.
name - The name of the parameterparameterType - The type of the parametervalues - A list containing the values
PermissionDeniedException - If the logged in user doesn't have
write permission or if the job is executing
InvalidDataException - If name is null or the new value doesn't
validate against the parameter type
BaseException - If there is another errorpublic Job getBlocker()
public void setBlocker(Job blocker)
public boolean abort()
throws PermissionDeniedException
PermissionDeniedException - If the logged in user doesn't have
write permission.public void removeAbortedJobId(int jobId)
jobId - int The job id to remove from the aborted job id list.public boolean jobCommandAborted()
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||