org.musicontroller.core.jobs
Class ImportJob
java.lang.Object
org.musicontroller.core.jobs.ImportJob
public class ImportJob
- extends java.lang.Object
The ImportJob is responsible for unpacking zip-files and placing unpacked
files in the appropriate directories.
The ImportJob is run every few seconds. It scans for files in the
upload-directory. If there are files present, the first will be unpacked
into the unpack-directory.
- Author:
- Varienaja
Method Summary |
static void |
addData(java.io.InputStream in,
java.lang.String name)
Call this method to add an inputstream to the TODO-list |
int |
execute()
This method is to be executed periodically. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
READY_FOR_INSPECTION
public static final java.lang.String READY_FOR_INSPECTION
- See Also:
- Constant Field Values
TRANSFERRING
public static final java.lang.String TRANSFERRING
- See Also:
- Constant Field Values
ImportJob
public ImportJob()
addData
public static void addData(java.io.InputStream in,
java.lang.String name)
- Call this method to add an inputstream to the TODO-list
- Parameters:
in
- An InputStreamname
- A name (filename without path) for the InputStream
execute
public int execute()
- This method is to be executed periodically. It checks for the presence of
new 'todos', and if there is something to do, the file is moved (non-zip) or
unpacked (zip) to the Unpackdir ( @see FileUtils). This method should not
be run in parallel (avoid disk-thrashing unpacking many files at a time).
Unpacked files are unpacked into a 'working'-directory. (busyunzipping)
When the job is done, this directory is renamed to 'readyforinspection'
to signal other processes they can read from the directory now. As long
as the directory is still named busyunzipping, files can be in an incomplete
state and should not be read.
- Returns:
- true if there was something done, alse if there was nothing to do.
Copyright © 2010 A.J.V.. All Rights Reserved.