public abstract class BatchProcessing extends Observable implements IBatchProcessing
| Modifier and Type | Field and Description |
|---|---|
protected File |
configFile |
protected Date |
dateCreated |
protected Date |
dateLastSaved |
protected boolean |
deleteConfigOnSuccess |
protected FileState |
inputFile |
protected static Logger |
logger |
protected static String |
MSG_CANTCREATEFILE |
protected static String |
MSG_ERRORCOUNTING |
protected static String |
MSG_ERRORSAVE |
protected static String |
MSG_FILEDONOTEXISTS |
protected static String |
MSG_OPEN |
protected static String |
MSG_UNSUPPORTEDFORMAT |
protected FileState |
outputFile |
protected int |
saveStateFrequency |
int |
status |
static int |
STATUS_ABORTED |
static int |
STATUS_FINISHED |
static int |
STATUS_NOTINITIALIZED |
static int |
STATUS_NOTSTARTED |
static int |
STATUS_PAUSED |
static int |
STATUS_RUNNING |
protected static String[] |
statusMsg |
protected String |
tmpDir |
| Constructor and Description |
|---|
BatchProcessing()
Creates empty BatchProcessing it should be configured prior to use
|
BatchProcessing(File input,
File output)
Creates BatchProcessing given input and output file names
|
BatchProcessing(String input,
String output)
Creates BatchProcessing given input and output file names
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
close() |
File |
createConfigFile() |
void |
createOutputFile() |
boolean |
equals(Object obj) |
File |
getConfigFile()
Where to store batchprocessing configuration itself
|
Date |
getDateCreated() |
Date |
getDateLastProcessed() |
FileState |
getInputFile() |
FileState |
getOutputFile() |
long |
getReadRecordsCount()
Returns the number of records read from the input file
|
int |
getSaveStateFrequency()
BatchProcessing saves its state on each saveStateFrequency records
|
int |
getStatus() |
String |
getTempDir() |
long |
getWrittenRecordsCount()
Returns the number of records written to the output file
|
boolean |
isCancelled() |
boolean |
isPaused() |
boolean |
isRunning() |
boolean |
isStatus(int status) |
void |
loadConfig() |
void |
openInputFile() |
void |
pause() |
void |
saveConfig() |
void |
saveConfig(OutputStream out) |
void |
setConfigFile(File configFile) |
void |
setSaveStateFrequency(int saveStateFrequency)
BatchProcessing saves its state on each saveStateFrequency records
|
protected void |
setStatus(int status) |
void |
start() |
String |
toString() |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseInputFile, closeOutputFile, hasNextRecord, processRecord, readRecord, writeRecordprotected int saveStateFrequency
protected FileState inputFile
protected FileState outputFile
protected Date dateCreated
protected Date dateLastSaved
protected transient File configFile
protected transient String tmpDir
protected transient boolean deleteConfigOnSuccess
protected static transient String MSG_FILEDONOTEXISTS
protected static transient String MSG_CANTCREATEFILE
protected static transient String MSG_OPEN
protected static transient String MSG_UNSUPPORTEDFORMAT
protected static transient String MSG_ERRORSAVE
protected static transient String MSG_ERRORCOUNTING
protected static transient Logger logger
protected static transient String[] statusMsg
public static final transient int STATUS_NOTSTARTED
public static final transient int STATUS_RUNNING
public static final transient int STATUS_FINISHED
public static final transient int STATUS_PAUSED
public static final transient int STATUS_ABORTED
public static final transient int STATUS_NOTINITIALIZED
public int status
public BatchProcessing()
public BatchProcessing(String input, String output) throws BatchProcessingException
input - Input filename; should existsoutput - Results (output) filename ; deleted if existsBatchProcessingException - -
if input file do not exists - if output file can't be deleted
and a new one created; - on any IOExceptionpublic BatchProcessing(File input, File output) throws BatchProcessingException
input - Input filename; should existsoutput - Results (output) filename ; deleted if existsBatchProcessingException - -
if input file do not exists - if output file can't be deleted
and a new one created; - on any IOExceptionpublic void openInputFile()
throws BatchProcessingException
openInputFile in interface IBatchProcessingBatchProcessingExceptionpublic void createOutputFile()
throws BatchProcessingException
createOutputFile in interface IBatchProcessingBatchProcessingExceptionpublic void start()
throws BatchProcessingException
start in interface IBatchProcessingBatchProcessingExceptionpublic void close()
throws BatchProcessingException
close in interface IBatchProcessingBatchProcessingExceptionpublic void pause()
throws BatchProcessingException
pause in interface IBatchProcessingBatchProcessingExceptionpublic void cancel()
throws BatchProcessingException
cancel in interface IBatchProcessingBatchProcessingExceptionpublic void saveConfig()
throws BatchProcessingException
saveConfig in interface IBatchProcessingBatchProcessingExceptionpublic void saveConfig(OutputStream out) throws BatchProcessingException
BatchProcessingExceptionpublic void loadConfig()
throws BatchProcessingException
loadConfig in interface IBatchProcessingBatchProcessingExceptionpublic boolean isStatus(int status)
protected void setStatus(int status)
status - The status to set.public int getSaveStateFrequency()
public void setSaveStateFrequency(int saveStateFrequency)
saveStateFrequency - The saveStateFrequency to set.public String getTempDir()
public File createConfigFile()
public File getConfigFile()
public void setConfigFile(File configFile)
setConfigFile in interface IBatchProcessingconfigFile - The configFile to set.public int getStatus()
public long getReadRecordsCount()
getReadRecordsCount in interface IBatchProcessingpublic long getWrittenRecordsCount()
getWrittenRecordsCount in interface IBatchProcessingpublic FileState getInputFile()
public FileState getOutputFile()
public boolean isRunning()
isRunning in interface IBatchProcessingpublic boolean isPaused()
isPaused in interface IBatchProcessingpublic boolean isCancelled()
isCancelled in interface IBatchProcessingpublic Date getDateCreated()
getDateCreated in interface IBatchProcessingDate when batch job was first createdpublic Date getDateLastProcessed()
getDateLastProcessed in interface IBatchProcessingDate when batch job was processed lastCopyright © 2004–2018 Ideaconsult Ltd. All rights reserved.