org.jwarp.service.work
Class AJob

java.lang.Object
  |
  +--org.jwarp.service.work.AJob
All Implemented Interfaces:
IJob, java.lang.Runnable
Direct Known Subclasses:
ToolJob

public abstract class AJob
extends java.lang.Object
implements IJob

This is the abstract base class who helps implementing job enities. It implements the IJob interface.


Field Summary
protected  java.util.Date creationDate
           
protected  java.lang.String exitResult
           
protected  java.util.Date finishedDate
           
protected  int id
           
protected  long maxTime
           
protected  int priority
           
protected  java.lang.String reference
           
protected  java.util.Date startDate
           
protected  int status
           
protected  int user
           
 
Fields inherited from interface org.jwarp.service.work.IJob
ANY, STATUS_ACTIVE, STATUS_CREATED, STATUS_EXITED_ERROR, STATUS_EXITED_OK
 
Constructor Summary
AJob(int id, int user, java.lang.String reference)
           
AJob(int id, int user, java.lang.String reference, long maxTime)
           
 
Method Summary
protected abstract  void doWork()
           
 java.util.Date getCreationDate()
          The date time of the creation of this job.
 java.lang.String getExitResult()
           
 java.util.Date getFinishedDate()
          The date time of the execution or null if the job is not executed yet.
 int getId()
          Returns the ID of the job.
 long getMaxTime()
          Returns the result of the calculation.
 int getPriority()
          Return the job's desired priority
 java.lang.String getReference()
          The user who created this job.
 java.util.Date getStartDate()
          The date time of the execution or null if the job is not executed yet.
 int getStatus()
          This returns the status of the job as defined in the constants.
 long getTotalRuntime()
          Returns the result of the calculation.
 int getUser()
          The user who created this job.
protected  void jobFinished()
           
protected  void jobFinishedWithError(java.lang.String errorString)
           
protected  void jobStarted()
           
 void run()
           
 void setCreationDate(java.util.Date date)
           
 void setExitResult(java.lang.String result)
           
 void setFinishedDate(java.util.Date date)
          The date time of the execution or null if the job is not executed yet.
 void setId(int id)
           
 void setMaxTime(long newTime)
           
 void setPriority(int prio)
           
 void setReference(java.lang.String ref)
           
 void setStartDate(java.util.Date date)
           
 void setStatus()
           
 void setStatus(int status)
           
 void setUser(int user)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

protected int status

exitResult

protected java.lang.String exitResult

user

protected int user

reference

protected java.lang.String reference

creationDate

protected java.util.Date creationDate

maxTime

protected long maxTime

startDate

protected java.util.Date startDate

finishedDate

protected java.util.Date finishedDate

id

protected int id

priority

protected int priority
Constructor Detail

AJob

public AJob(int id,
            int user,
            java.lang.String reference)

AJob

public AJob(int id,
            int user,
            java.lang.String reference,
            long maxTime)
Method Detail

getStatus

public int getStatus()
This returns the status of the job as defined in the constants. The life cycle is CREATED, ACTIVE, EXITED(OK or ERROR). The status any is for earching or undefined behaviour.
Specified by:
getStatus in interface IJob
Returns:
The status of the job.

setStatus

public void setStatus()

getReference

public java.lang.String getReference()
Description copied from interface: IJob
The user who created this job.
Specified by:
getReference in interface IJob
Following copied from interface: org.jwarp.service.work.IJob
Returns:
the user

setReference

public void setReference(java.lang.String ref)

jobStarted

protected void jobStarted()
                   throws InvalidJobStateException

jobFinished

protected void jobFinished()
                    throws InvalidJobStateException

doWork

protected abstract void doWork()
                        throws java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable

jobFinishedWithError

protected void jobFinishedWithError(java.lang.String errorString)
                             throws InvalidJobStateException

getId

public int getId()
Returns the ID of the job.
Specified by:
getId in interface IJob
Returns:
The ID

getPriority

public int getPriority()
Return the job's desired priority
Specified by:
getPriority in interface IJob
Returns:
The priority

setPriority

public void setPriority(int prio)

getUser

public int getUser()
The user who created this job.
Specified by:
getUser in interface IJob
Returns:
the user

setUser

public void setUser(int user)

getCreationDate

public java.util.Date getCreationDate()
The date time of the creation of this job.
Specified by:
getCreationDate in interface IJob
Returns:
the creation date

setCreationDate

public void setCreationDate(java.util.Date date)
                     throws java.lang.IllegalAccessException

getStartDate

public java.util.Date getStartDate()
The date time of the execution or null if the job is not executed yet.
Specified by:
getStartDate in interface IJob
Returns:
the execution date

setStartDate

public void setStartDate(java.util.Date date)
                  throws java.lang.IllegalAccessException

getFinishedDate

public java.util.Date getFinishedDate()
The date time of the execution or null if the job is not executed yet.
Specified by:
getFinishedDate in interface IJob
Returns:
the execution date

getTotalRuntime

public long getTotalRuntime()
Returns the result of the calculation. The type depends on wheter the tools execution was successful. If not an exceptino is the result of the execution. If successfull the type is determined by the tool executed. If the job is not executed yet null must be returned.
Specified by:
getTotalRuntime in interface IJob
Returns:
the execution result

setMaxTime

public void setMaxTime(long newTime)

getExitResult

public java.lang.String getExitResult()

setId

public void setId(int id)
           throws java.lang.IllegalAccessException

getMaxTime

public long getMaxTime()
Description copied from interface: IJob
Returns the result of the calculation. The type depends on wheter the tools execution was successful. If not an exceptino is the result of the execution. If successfull the type is determined by the tool executed. If the job is not executed yet null must be returned.
Specified by:
getMaxTime in interface IJob
Following copied from interface: org.jwarp.service.work.IJob
Returns:
the execution result

setStatus

public void setStatus(int status)
               throws java.lang.IllegalAccessException

setExitResult

public void setExitResult(java.lang.String result)
                   throws java.lang.IllegalAccessException

setFinishedDate

public void setFinishedDate(java.util.Date date)
                     throws java.lang.IllegalAccessException
The date time of the execution or null if the job is not executed yet.
Returns:
the execution date

©   O R C A   S y s t e m s