Package com.axelor.data
Class ImportTask
- java.lang.Object
-
- com.axelor.data.ImportTask
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public abstract class ImportTask extends Object implements Closeable
Import task configures input sources and provides error handler.
-
-
Constructor Summary
Constructors Constructor Description ImportTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
abstract void
configure()
Configure the input sources using the variousinput
methods.Collection<Reader>
getReader(String filename)
boolean
handle(ImportException e)
Provide import error handler.boolean
handle(IOException e)
ProvideIOException
handler.boolean
handle(ClassNotFoundException e)
ProvideClassNotFoundException
handler.void
init()
void
input(String inputName, File source)
Provide the input source.void
input(String inputName, File source, Charset charset)
Provide the input source.void
input(String inputName, InputStream source)
Provide the input source.void
input(String inputName, InputStream source, Charset charset)
Provide the input source.void
input(String inputName, Reader reader)
Provide the input source.
-
-
-
Method Detail
-
configure
public abstract void configure() throws IOException
Configure the input sources using the variousinput
methods.- Throws:
IOException
- if unable to read configuration- See Also:
input(String, File)
,input(String, File, Charset)
,input(String, InputStream)
,input(String, InputStream, Charset)
,input(String, Reader)
-
init
public void init() throws IOException
- Throws:
IOException
-
handle
public boolean handle(ImportException e)
Provide import error handler.- Parameters:
e
- the error cause- Returns:
- return
true
to continue else terminate the task immediately.
-
handle
public boolean handle(IOException e)
ProvideIOException
handler.- Parameters:
e
- the error cause- Returns:
- return
true
to continue else terminate the task immediately.
-
handle
public boolean handle(ClassNotFoundException e)
ProvideClassNotFoundException
handler.- Parameters:
e
- the error cause- Returns:
- return
true
to continue else terminate the task immediately.
-
input
public void input(String inputName, File source) throws FileNotFoundException
Provide the input source.- Parameters:
inputName
- the input namesource
- the input source- Throws:
FileNotFoundException
- if source file doesn't exist
-
input
public void input(String inputName, File source, Charset charset) throws FileNotFoundException
Provide the input source.- Parameters:
inputName
- the input namesource
- the input sourcecharset
- the source encoding- Throws:
FileNotFoundException
- if source file doesn't exist
-
input
public void input(String inputName, InputStream source)
Provide the input source.- Parameters:
inputName
- the input namesource
- the input source
-
input
public void input(String inputName, InputStream source, Charset charset)
Provide the input source.- Parameters:
inputName
- the input namesource
- the input sourcecharset
- the source encoding
-
input
public void input(String inputName, Reader reader)
Provide the input source.- Parameters:
inputName
- the input namereader
- the input source
-
getReader
public Collection<Reader> getReader(String filename)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-