de.phleisch.app.itsucks.job
Interface Job

All Known Subinterfaces:
DownloadJob
All Known Implementing Classes:
AbstractJob, UrlDownloadJob

public interface Job

A job is a single task to be done.

Author:
olli

Field Summary
static java.lang.String JOB_PRIORITY_PROPERTY
          Constant used to determine when the priority property has changed.
static java.lang.String JOB_STATE_PROPERTY
          Constant used to determine when the state property has changed.
static int MAX_PRIORITY
          The possible maximum priority for an job.
static int MIN_PRIORITY
          The possible minimum priority for an job.
static int STATE_ALREADY_PROCESSED
          This job was already processed.
static int STATE_ASSIGNED
          The job is assigned to an worker thread.
static int STATE_CLOSED
          The job is closed and not longer in progress.
static int STATE_ERROR
          The job processing has been aborted by an error.
static int STATE_FAILED
          The job processing failed.
static int STATE_FINISHED
          The job finished without error.
static int STATE_IGNORED
          This job is set to ignored by an filter.
static int STATE_IN_PROGRESS
          The job processing is in progress.
static int STATE_IN_PROGRESS_RETRY
          The job processing is in retry progress.
static int STATE_OPEN
          The job is open and waits to be assigned.
static int STATE_REOPEN
          The job is closed but should be reopened
 
Method Summary
 void abort()
          Aborts the job when running.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pListener)
          Adds a PropertyChangeListener to the listener list.
 Context getGroupContext()
          The context for this job group.
 int getId()
          Returns the unique id of this job.
 JobManager getJobManager()
          The job manager the job is managed by.
 java.lang.String getName()
          Gets the name of the job
 JobParameter getParameter(java.lang.String pKey)
          Returns the parameter under the given key or null.
 java.util.List<JobParameter> getParameterList()
          Get a list of all job parameter
 int getPriority()
          The higher the number, the higher the priority, max is 999, min is 0 Default is 500
 int getState()
          Returns the current state of the Job.
 boolean isClosed()
          Returns true when the job is closed.
 boolean isIgnoreFilter()
          Returns true when the filter should not be applied for this job.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pListener)
          Removes a PropertyChangeListener from the listener list.
 void run()
          Starts the execution of the job.
 void setGroupContext(Context pContext)
          Sets the context for this job group.
 void setId(int pJobId)
          Sets the id of this job.
 void setIgnoreFilter(boolean pIgnoreFilter)
          When set to true, the JobFilter will not filter out this job.
 void setJobManager(JobManager pJobManager)
          Sets the jobManager for this job.
 void setName(java.lang.String pName)
          Sets the name of the job
 void setParameter(JobParameter pParameter)
          Set a parameter to the job
 void setPriority(int pPriority)
          The higher the number, the higher the priority, max is 999, min is 0 Default is 500
 void setState(int pState)
          Sets the current state of the job.
 

Field Detail

STATE_OPEN

static final int STATE_OPEN
The job is open and waits to be assigned.

See Also:
Constant Field Values

STATE_ASSIGNED

static final int STATE_ASSIGNED
The job is assigned to an worker thread.

See Also:
Constant Field Values

STATE_IN_PROGRESS

static final int STATE_IN_PROGRESS
The job processing is in progress.

See Also:
Constant Field Values

STATE_IN_PROGRESS_RETRY

static final int STATE_IN_PROGRESS_RETRY
The job processing is in retry progress.

See Also:
Constant Field Values

STATE_CLOSED

static final int STATE_CLOSED
The job is closed and not longer in progress.

See Also:
Constant Field Values

STATE_REOPEN

static final int STATE_REOPEN
The job is closed but should be reopened

See Also:
Constant Field Values

STATE_IGNORED

static final int STATE_IGNORED
This job is set to ignored by an filter.

See Also:
Constant Field Values

STATE_ALREADY_PROCESSED

static final int STATE_ALREADY_PROCESSED
This job was already processed.

See Also:
Constant Field Values

STATE_FAILED

static final int STATE_FAILED
The job processing failed.

See Also:
Constant Field Values

STATE_FINISHED

static final int STATE_FINISHED
The job finished without error.

See Also:
Constant Field Values

STATE_ERROR

static final int STATE_ERROR
The job processing has been aborted by an error.

See Also:
Constant Field Values

JOB_PRIORITY_PROPERTY

static final java.lang.String JOB_PRIORITY_PROPERTY
Constant used to determine when the priority property has changed. The old value in the PropertyChangeEvent will be the old priority and the new value will be the new priority.

See Also:
getPriority(), addPropertyChangeListener(java.beans.PropertyChangeListener), Constant Field Values

JOB_STATE_PROPERTY

static final java.lang.String JOB_STATE_PROPERTY
Constant used to determine when the state property has changed. The old value in the PropertyChangeEvent will be the old state and the new value will be the new state.

See Also:
getState(), addPropertyChangeListener(java.beans.PropertyChangeListener), Constant Field Values

MAX_PRIORITY

static final int MAX_PRIORITY
The possible maximum priority for an job.

See Also:
Constant Field Values

MIN_PRIORITY

static final int MIN_PRIORITY
The possible minimum priority for an job.

See Also:
Constant Field Values
Method Detail

run

void run()
         throws java.lang.Exception
Starts the execution of the job. It returns when the job is finished.

Throws:
java.lang.Exception

isClosed

boolean isClosed()
Returns true when the job is closed.

Returns:
true when job is closed.

getJobManager

JobManager getJobManager()
The job manager the job is managed by.

Returns:
the job manager the job is managed by.

setJobManager

void setJobManager(JobManager pJobManager)
Sets the jobManager for this job.

Parameters:
pJobManager -

getGroupContext

Context getGroupContext()
The context for this job group.

Returns:
the context the job belongs.

setGroupContext

void setGroupContext(Context pContext)
Sets the context for this job group.

Parameters:
pContext - the context the job belongs.

isIgnoreFilter

boolean isIgnoreFilter()
Returns true when the filter should not be applied for this job.

Returns:

setIgnoreFilter

void setIgnoreFilter(boolean pIgnoreFilter)
When set to true, the JobFilter will not filter out this job. Handy for manual added jobs.


getState

int getState()
Returns the current state of the Job. Check out the STATE_* constants for possible values.

Returns:
the current state of the Job.

setState

void setState(int pState)
Sets the current state of the job. The observers will be notificated from this change.

Parameters:
pState -

getPriority

int getPriority()
The higher the number, the higher the priority, max is 999, min is 0 Default is 500

Returns:
the current priority for this job.

setPriority

void setPriority(int pPriority)
The higher the number, the higher the priority, max is 999, min is 0 Default is 500

Parameters:
pPriority -

getId

int getId()
Returns the unique id of this job.

Returns:
the unique id of this job.

setId

void setId(int pJobId)
Sets the id of this job. Do this only when the job is not added to a job list!

Parameters:
pJobId -

getName

java.lang.String getName()
Gets the name of the job

Returns:

setName

void setName(java.lang.String pName)
Sets the name of the job

Parameters:
pName -

setParameter

void setParameter(JobParameter pParameter)
Set a parameter to the job

Parameters:
pParameter -

getParameter

JobParameter getParameter(java.lang.String pKey)
Returns the parameter under the given key or null.

Parameters:
pKey -
Returns:

getParameterList

java.util.List<JobParameter> getParameterList()
Get a list of all job parameter

Returns:

abort

void abort()
Aborts the job when running.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener pListener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all Accessible properties and will be called when those properties change.

Parameters:
pListener - The PropertyChangeListener to be added
See Also:
JOB_PRIORITY_PROPERTY, JOB_STATE_PROPERTY

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener pListener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
pListener - The PropertyChangeListener to be removed


Copyright © 2010. All Rights Reserved.