HEADER

com.developmentontheedge.jobcontrol
Class AbstractJobControl

Direct Known Subclasses:
ClassJobControl, FunctionJobControl

public abstract class AbstractJobControl
implements JobControl

AbstractJobControl is default implementation of JobControl interface. AbstractJobControl provides base functionality of all methods of JobControl

Version: 1.0

Constructor Summary
AbstractJobControl(Category cat)
          Constructs JobControl with specified Category
AbstractJobControl(Category cat, JobControlListener listener)
          Constructs JobControl with specified Category and JobControlListener

Method Summary
 voidaddListener(JobControlListener listener)
           
 voidbegin()
          Derived classes should call this method when they want to start controlled process
 voidcheckStatus()
          Tests status of job control.
 voidend()
          Sets state defined by runStatus variable.
 voidfireValueChanged()
          Notifies all listeners that value returned by getPreparedness() is changed
 static Stringformat(long time)
          Converts time to the string
 static Stringformat(long time, String format)
          Converts time to the specified format string
 longgetCreatedTime()
           
 longgetElapsedTime()
           
 longgetEndedTime()
           
 intgetPreparedness()
           
 longgetRemainedTime()
           
 longgetStartedTime()
           
 intgetStatus()
           
 StringgetTextStatus()
           
 voidpause()
          Sets status of job control to the JobControl.PAUSED state
 voidresultsAreReady()
           
 voidresume()
          Sets status of job control to the JobControl.RUNNING state
 voidrun()
          Starts the job control process
 voidsetPreparedness(int percent)
          Sets value of job Preparednes
 voidterminate()
          Sets status of job control to the JobControl.TERMINATED_BY_REQUEST state

Constructor Detail

AbstractJobControl

public AbstractJobControl(Category cat)
Constructs JobControl with specified Category
Parameters:
cat - log Category of log4j package

AbstractJobControl

public AbstractJobControl(Category cat, JobControlListener listener)
Constructs JobControl with specified Category and JobControlListener
Parameters:
cat - log Category of log4j package
listener - specified JobControlListener
Method Detail

addListener

public void addListener(JobControlListener listener)

begin

public void begin()
Derived classes should call this method when they want to start controlled process

checkStatus

public void checkStatus()
throws JobControlException
Tests status of job control. If controlled process is terminated throws JobControlException with status TERMINATED_BY_REQUEST Waits of resuming action, if isPaused variable is set.
Throws:
JobControlException

end

public void end()
Sets state defined by runStatus variable. Notifies all listeners about state changing

fireValueChanged

public void fireValueChanged()
Notifies all listeners that value returned by getPreparedness() is changed

format

public static String format(long time)
Converts time to the string
Parameters:
time - Unix time
Returns: converted string

format

public static String format(long time, String format)
Converts time to the specified format string
Parameters:
time - Unix time
format - convert format
Returns: converted string
See Also:
SimpleDateFormat
todo low function should standart formatter

getCreatedTime

public long getCreatedTime()

getElapsedTime

public long getElapsedTime()

getEndedTime

public long getEndedTime()

getPreparedness

public int getPreparedness()

getRemainedTime

public long getRemainedTime()

getStartedTime

public long getStartedTime()

getStatus

public int getStatus()

getTextStatus

public String getTextStatus()

pause

public void pause()
Sets status of job control to the JobControl.PAUSED state

resultsAreReady

public void resultsAreReady()

resume

public void resume()
Sets status of job control to the JobControl.RUNNING state

run

public void run()
Starts the job control process

setPreparedness

public void setPreparedness(int percent)
Sets value of job Preparednes
Parameters:
percent - percent of job Preparedness

terminate

public void terminate()
Sets status of job control to the JobControl.TERMINATED_BY_REQUEST state

Association Links

to Class org.apache.log4j.Category

The log4j.Category to print logs.

to Class java.util.Vector


FOOTER

BOTTOM