net.datacrow.fileimporters
Class ImportBatch

java.lang.Object
  extended by java.lang.Thread
      extended by net.datacrow.fileimporters.ImportBatch
All Implemented Interfaces:
java.lang.Runnable

public class ImportBatch
extends java.lang.Thread

The import batch coaches the import process. This is the class that actually should be used to start a file import.

Author:
Robert Jan van der Waals

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  IFileImportClient client
           
protected  FileImporter importer
           
protected  java.util.Collection<java.lang.String> sources
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ImportBatch(IFileImportClient client, FileImporter importer, java.util.Collection<java.lang.String> sources)
          Creates a new import batch.
 
Method Summary
protected  void cleanup()
          Free resources.
protected  void parse(java.util.Collection<java.lang.String> files)
          Parse the files and pass the resulted items to the listener.
protected  DcObject parse(java.lang.String filename)
          Parse a single file.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

client

protected IFileImportClient client

importer

protected FileImporter importer

sources

protected java.util.Collection<java.lang.String> sources
Constructor Detail

ImportBatch

public ImportBatch(IFileImportClient client,
                   FileImporter importer,
                   java.util.Collection<java.lang.String> sources)
            throws java.lang.Exception
Creates a new import batch.

Parameters:
client -
importer -
sources -
Throws:
java.lang.Exception
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

parse

protected void parse(java.util.Collection<java.lang.String> files)
Parse the files and pass the resulted items to the listener.

Parameters:
files -

cleanup

protected void cleanup()
Free resources.


parse

protected DcObject parse(java.lang.String filename)
Parse a single file. In case all fails an empty item will be created (only the filename will be set).

Parameters:
filename -
Returns:
The result (never null)