|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.phleisch.app.itsucks.job.impl.AbstractJob
de.phleisch.app.itsucks.job.download.impl.UrlDownloadJob
public class UrlDownloadJob
This is the implementation of a job for downloading files. It contains a URL to the file or directory to be downloaded.
| Nested Class Summary | |
|---|---|
protected class |
UrlDownloadJob.ProgressListener
|
static class |
UrlDownloadJob.RetryBehaviour
|
| Field Summary | |
|---|---|
static java.lang.String |
JOB_PROGRESS_PROPERTY
Constant used to determine when the progress property has changed. |
protected boolean |
mAbort
|
protected long |
mBytesDownloaded
|
protected DataProcessorManager |
mDataProcessorManager
|
protected UrlDataRetriever |
mDataRetriever
|
protected DataRetrieverManager |
mDataRetrieverManager
|
protected int |
mDepth
|
protected ResumeUrlDataRetriever |
mFileResumeRetriever
|
protected int |
mMaxRetryCount
|
protected Metadata |
mMetadata
|
protected java.lang.ref.WeakReference<UrlDownloadJob> |
mParent
|
protected float |
mProgress
|
protected ProgressInputStream |
mProgressInputStream
|
protected UrlDownloadJob.RetryBehaviour |
mRetryBehaviour
|
protected java.io.File |
mSavePath
|
protected boolean |
mSaveToDisk
|
protected int |
mTryCount
|
protected boolean |
mTryResume
|
protected java.net.URL |
mUrl
|
protected long |
mWaitUntil
|
| Fields inherited from class de.phleisch.app.itsucks.job.impl.AbstractJob |
|---|
mGroupContext, mJobManager |
| Fields inherited from interface de.phleisch.app.itsucks.job.Job |
|---|
JOB_PRIORITY_PROPERTY, JOB_STATE_PROPERTY, MAX_PRIORITY, MIN_PRIORITY, STATE_ALREADY_PROCESSED, STATE_ASSIGNED, STATE_CLOSED, STATE_ERROR, STATE_FAILED, STATE_FINISHED, STATE_IGNORED, STATE_IN_PROGRESS, STATE_IN_PROGRESS_RETRY, STATE_OPEN, STATE_REOPEN |
| Constructor Summary | |
|---|---|
UrlDownloadJob()
|
|
| Method Summary | |
|---|---|
void |
abort()
Aborts the job when running. |
UrlDownloadJob |
clone()
|
protected void |
download()
|
protected void |
executeDownload()
|
protected void |
executeProcessorChain()
|
long |
getBytesDownloaded()
Returns the count of bytes which are downloaded |
UrlDataRetriever |
getDataRetriever()
|
int |
getDepth()
Gets the recursive depth of the job. |
int |
getMaxRetryCount()
Returns the maximum count of retries when an retryable error occurs. |
Metadata |
getMetadata()
Gets the metadata of the data retriever. |
Job |
getParent()
Parent is saved as wek reference to save memory. |
float |
getProgress()
Returns the current download progress. |
UrlDownloadJob.RetryBehaviour |
getRetryBehaviour()
|
int |
getRetryCount()
Returns the actual retry count. |
java.io.File |
getSavePath()
Returns the base save path for saving downloaded files. |
java.net.URL |
getUrl()
Gets the URL to be downloaded. |
boolean |
isSaveToDisk()
|
boolean |
isTryResume()
|
protected void |
prepareResume(DataProcessorChain dataProcessorChain,
long resumeOffset)
|
void |
run()
Starts the execution of the job. |
void |
setDataProcessorManager(DataProcessorManager pDataProcessorManager)
Sets the data processor manager. |
void |
setDataRetrieverManager(DataRetrieverManager pDataRetrieverManager)
Sets the data retriever manager. |
void |
setDepth(int pDepth)
Sets the recursive depth of the job. |
void |
setMaxRetryCount(int pMaxRetryCount)
Sets the maximum count of retries when an retryable error occurs. |
void |
setParent(UrlDownloadJob pParent)
Sets the parent of the job. |
void |
setRetryBehaviour(UrlDownloadJob.RetryBehaviour pRetryBehaviour)
|
void |
setSavePath(java.io.File pSavePath)
Sets the base save path for saving downloaded files. |
void |
setSaveToDisk(boolean pSaveToDisk)
Sets if this file should be saved as file. |
void |
setTryResume(boolean pTryResume)
Set if this job should try to resume partial downloaded files. |
void |
setUrl(java.net.URL pUrl)
Sets the url to be downloaded. |
java.lang.String |
toString()
|
protected void |
tryResume()
|
| Methods inherited from class de.phleisch.app.itsucks.job.impl.AbstractJob |
|---|
addPropertyChangeListener, firePropertyChange, getGroupContext, getId, getJobManager, getName, getParameter, getParameterList, getPriority, getState, hashCode, isClosed, isIgnoreFilter, removePropertyChangeListener, setGroupContext, setId, setIgnoreFilter, setJobManager, setName, setParameter, setPriority, setState |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface de.phleisch.app.itsucks.job.Job |
|---|
addPropertyChangeListener, getGroupContext, getId, getJobManager, getName, getParameter, getParameterList, getPriority, getState, isClosed, isIgnoreFilter, removePropertyChangeListener, setGroupContext, setId, setIgnoreFilter, setJobManager, setName, setParameter, setPriority, setState |
| Field Detail |
|---|
public static final java.lang.String JOB_PROGRESS_PROPERTY
getProgress(),
AbstractJob.addPropertyChangeListener(java.beans.PropertyChangeListener),
Constant Field Valuesprotected boolean mSaveToDisk
protected boolean mTryResume
protected boolean mAbort
protected java.io.File mSavePath
protected java.net.URL mUrl
protected java.lang.ref.WeakReference<UrlDownloadJob> mParent
protected int mDepth
protected int mMaxRetryCount
protected int mTryCount
protected transient DataProcessorManager mDataProcessorManager
protected transient DataRetrieverManager mDataRetrieverManager
protected transient UrlDataRetriever mDataRetriever
protected transient ResumeUrlDataRetriever mFileResumeRetriever
protected transient ProgressInputStream mProgressInputStream
protected float mProgress
protected long mBytesDownloaded
protected transient Metadata mMetadata
protected UrlDownloadJob.RetryBehaviour mRetryBehaviour
protected long mWaitUntil
| Constructor Detail |
|---|
public UrlDownloadJob()
| Method Detail |
|---|
public void run()
throws java.lang.Exception
Job
run in interface Jobrun in class AbstractJobjava.lang.Exception
protected void download()
throws java.io.IOException
java.io.IOException
protected void executeDownload()
throws java.io.IOException
java.io.IOException
protected void tryResume()
throws java.io.IOException
java.io.IOException
protected void executeProcessorChain()
throws java.io.IOException
java.io.IOException
protected void prepareResume(DataProcessorChain dataProcessorChain,
long resumeOffset)
throws java.io.IOException
java.io.IOExceptionpublic void abort()
Job
abort in interface Jobabort in class AbstractJobpublic java.net.URL getUrl()
public void setUrl(java.net.URL pUrl)
pUrl - public void setDataRetrieverManager(DataRetrieverManager pDataRetrieverManager)
pDataRetrieverManager - public void setDataProcessorManager(DataProcessorManager pDataProcessorManager)
pDataProcessorManager - public int getDepth()
DownloadJob
getDepth in interface DownloadJobpublic void setDepth(int pDepth)
pDepth - public Job getParent()
public void setParent(UrlDownloadJob pParent)
pParent - public boolean isSaveToDisk()
isSaveToDisk in interface DownloadJobpublic void setSaveToDisk(boolean pSaveToDisk)
pSaveToFile - public java.io.File getSavePath()
DownloadJob
getSavePath in interface DownloadJobpublic void setSavePath(java.io.File pSavePath)
pSavePath - public boolean isTryResume()
public void setTryResume(boolean pTryResume)
pTryResume - public UrlDataRetriever getDataRetriever()
getDataRetriever in interface DownloadJobpublic float getProgress()
DownloadJob
getProgress in interface DownloadJobpublic int getMaxRetryCount()
DownloadJob
getMaxRetryCount in interface DownloadJobpublic void setMaxRetryCount(int pMaxRetryCount)
pMaxRetryCount - public int getRetryCount()
DownloadJob
getRetryCount in interface DownloadJobpublic UrlDownloadJob.RetryBehaviour getRetryBehaviour()
public void setRetryBehaviour(UrlDownloadJob.RetryBehaviour pRetryBehaviour)
public long getBytesDownloaded()
DownloadJob
getBytesDownloaded in interface DownloadJobpublic Metadata getMetadata()
DownloadJob
getMetadata in interface DownloadJobpublic java.lang.String toString()
toString in class java.lang.Objectpublic UrlDownloadJob clone()
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||