Package de.businesscode.bcdui.wrs.load
Class DataLoader
- java.lang.Object
-
- de.businesscode.bcdui.wrs.load.DataLoader
-
public class DataLoader extends java.lang.Object
This algorithms
reads input from input options,
uses generator to interpret the options (generate SQL),
executes sql and
writes the resultSet out into the writer.
-
-
Constructor Summary
Constructors Constructor Description DataLoader(IRequestOptions options, ISqlGenerator generator, IDataWriter dataWriter)
DataLoader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.sql.ResultSet
executeQuery(java.sql.PreparedStatement statement)
Execute query generated by the generator Clients can overwrite this method to implement same logicprotected IDataWriter
getDataWriter()
long
getExecuteDuration()
protected ISqlGenerator
getGenerator()
protected IRequestOptions
getOptions()
long
getRsEndTime()
long
getRsStartTime()
long
getWriteDuration()
boolean
isEmpty()
isEmptyprotected java.sql.PreparedStatement
prepareStatement(java.sql.Connection connection, java.lang.String sql)
Create the prepared statement Clients can overwrite this method to implement same logicvoid
run()
runprotected void
writeResult(java.sql.ResultSet resultSet)
Write result out using the data writer.
-
-
-
Constructor Detail
-
DataLoader
public DataLoader(IRequestOptions options, ISqlGenerator generator, IDataWriter dataWriter)
DataLoader- Parameters:
options
-generator
-dataWriter
-
-
-
Method Detail
-
getOptions
protected final IRequestOptions getOptions()
- Returns:
- the options
-
getGenerator
protected final ISqlGenerator getGenerator()
- Returns:
- the generator
-
getDataWriter
protected final IDataWriter getDataWriter()
- Returns:
- the dataWriter
-
isEmpty
public boolean isEmpty()
isEmpty- Returns:
- true if no query was specified from the request
-
getExecuteDuration
public final long getExecuteDuration()
- Returns:
- the sql execution executeDuration
-
getWriteDuration
public long getWriteDuration()
- Returns:
- the writeDuration
-
getRsStartTime
public long getRsStartTime()
- Returns:
- the rsStartTime
-
getRsEndTime
public long getRsEndTime()
- Returns:
- the rsEndTime
-
run
public void run() throws java.lang.Exception
run- Throws:
java.lang.Exception
-
prepareStatement
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection connection, java.lang.String sql) throws java.lang.Exception
Create the prepared statement Clients can overwrite this method to implement same logic- Parameters:
connection
-sql
-- Returns:
- the statement
- Throws:
java.lang.Exception
-
executeQuery
protected java.sql.ResultSet executeQuery(java.sql.PreparedStatement statement) throws java.lang.Exception
Execute query generated by the generator Clients can overwrite this method to implement same logic- Parameters:
statement
-- Returns:
- the result set
- Throws:
java.lang.Exception
-
writeResult
protected void writeResult(java.sql.ResultSet resultSet) throws java.lang.Exception
Write result out using the data writer. Clients can overwrite this method to implement same logic- Parameters:
resultSet
- - data to write out. Can be null if generator was empty- Throws:
java.lang.Exception
-
-