com.agimatec.utility.fileimport
Class Importer

java.lang.Object
  extended by com.agimatec.utility.fileimport.Importer

public class Importer
extends Object

Description: API facade to import a document (file) in any format.
User: roman.stumm
Date: 20.11.2007
Time: 16:20:21
Copyright: Agimatec GmbH


Field Summary
protected static org.apache.log4j.Logger log
           
protected  ImporterProcessor processor
          processor is responsible to do the actual import process
protected  ImporterSpec spec
          is determines the input format and configuration
 
Constructor Summary
Importer(ImporterSpec spec)
           
 
Method Summary
 int getErrorCount()
           
 String getLastErrorMessage()
          last error message that occured during import processing
 Throwable getLastException()
          last exception thrown and handled during import processing
 int getRowCount()
           
protected  ImporterSpec getSpec()
           
 void importFrom(InputStream aStream)
          API - this method starts the import process.
 void importFrom(Reader aReader)
          API - this method starts the import process.
 boolean isCancelled()
           
 void log(Object obj)
          log an info message to the importLog.
 void setErrorWriter(Writer aErrorWriter)
          set the writer where errorous data rows should be stored to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

processor

protected final ImporterProcessor processor
processor is responsible to do the actual import process


spec

protected final ImporterSpec spec
is determines the input format and configuration

Constructor Detail

Importer

public Importer(ImporterSpec spec)
Method Detail

getSpec

protected ImporterSpec getSpec()
Returns:
the import specification

setErrorWriter

public final void setErrorWriter(Writer aErrorWriter)
set the writer where errorous data rows should be stored to. this is to create an error file that has the same format than the import file.

Parameters:
aErrorWriter -

importFrom

public void importFrom(Reader aReader)
                throws ImporterException
API - this method starts the import process. It imports the data read from the given reader. The reader is closed afterwards.

Parameters:
aReader - - reader to read the import data from.
Throws:
Exception
ImporterException

importFrom

public void importFrom(InputStream aStream)
                throws ImporterException
API - this method starts the import process. It imports the data read from the given stream. The stream is closed afterwards.

Parameters:
aStream - - stream to read the import data from.
Throws:
Exception
ImporterException

getRowCount

public int getRowCount()
Returns:
number of rows (data entries) successfully processed

getErrorCount

public int getErrorCount()
Returns:
number of errors found during import (data entries not imported)

isCancelled

public boolean isCancelled()
Returns:
true when import has been cancelled

getLastException

public Throwable getLastException()
last exception thrown and handled during import processing

Returns:
null or a throwable

getLastErrorMessage

public String getLastErrorMessage()
last error message that occured during import processing

Returns:
null or the message string

log

public void log(Object obj)
log an info message to the importLog.



Copyright © 2008-2011. All Rights Reserved.