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 voidclose()abstract voidconfigure()Configure the input sources using the variousinputmethods.Collection<Reader>getReader(String filename)booleanhandle(ImportException e)Provide import error handler.booleanhandle(IOException e)ProvideIOExceptionhandler.booleanhandle(ClassNotFoundException e)ProvideClassNotFoundExceptionhandler.voidinit()voidinput(String inputName, File source)Provide the input source.voidinput(String inputName, File source, Charset charset)Provide the input source.voidinput(String inputName, InputStream source)Provide the input source.voidinput(String inputName, InputStream source, Charset charset)Provide the input source.voidinput(String inputName, Reader reader)Provide the input source.
-
-
-
Method Detail
-
configure
public abstract void configure() throws IOExceptionConfigure the input sources using the variousinputmethods.- 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
trueto continue else terminate the task immediately.
-
handle
public boolean handle(IOException e)
ProvideIOExceptionhandler.- Parameters:
e- the error cause- Returns:
- return
trueto continue else terminate the task immediately.
-
handle
public boolean handle(ClassNotFoundException e)
ProvideClassNotFoundExceptionhandler.- Parameters:
e- the error cause- Returns:
- return
trueto 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-