Class DataConductor
- java.lang.Object
-
- guru.mikelue.jdut.DataConductor
-
public class DataConductor extends Object
The main executor ofDataGrainOperator
forDataGrain
.
Main functions
This object is responsible for retrieving
Connection
fromDataSource
, and uses the connection to execute any method ofconduct(DataGrain, DataGrainOperator)
.Before operating the action on data grain, this conductor would load database schema by
TableSchemaLoadingDecorator
object, which caches loaded schema of tables.Afterward decorating
Every method provided by this object has an overloading method with additional
DataGrainDecorator
, the decorator is used after the loading of table schema on the data grain.The building/cleaning actions defined by
DuetConductor
, however, doesn't know the decorator has decorated the data grain or not, you should be cautious about the re-decorating behaviour.
DataRow
object hasputAttribute
andgetAttribute
method to let you keep supplementary information of the row. These method is useful for implementingDataGrainDecorator
.
-
-
Constructor Summary
Constructors Constructor Description DataConductor(DataSource newDataSource)
Constructs this object with a validDataSource
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JdbcFunction<Connection,DataGrain>
buildJdbcFunction(DataGrain dataGrain, DataGrainOperator operator)
Builds JDBC function, which loads schema and executes operator on dataGrain object.JdbcFunction<Connection,DataGrain>
buildJdbcFunction(DataGrain dataGrain, DataGrainOperator operator, DataGrainDecorator decorator)
Builds JDBC function, which loads schema and executes operator on dataGrain object.DataGrain
conduct(DataGrain dataGrain, DataGrainOperator operator)
Gets connection of database and feeds it to operator.DataGrain
conduct(DataGrain dataGrain, DataGrainOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.DataGrain
conduct(DataGrain dataGrain, DataRowOperator operator)
Gets connection of database and feeds it to operator.DataGrain
conduct(DataGrain dataGrain, DataRowOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.DataGrain
conduct(DataGrain dataGrain, DataRowsOperator operator)
Gets connection of database and feeds it to operator.DataGrain
conduct(DataGrain dataGrain, DataRowsOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.<T> T
conduct(JdbcFunction<Connection,T> jdbcFunction)
Executes aJdbcFunction
, the connection would be put intoConductorContext
.
-
-
-
Constructor Detail
-
DataConductor
public DataConductor(DataSource newDataSource)
Constructs this object with a validDataSource
object.- Parameters:
newDataSource
- The initialized object of data source
-
-
Method Detail
-
buildJdbcFunction
public JdbcFunction<Connection,DataGrain> buildJdbcFunction(DataGrain dataGrain, DataGrainOperator operator, DataGrainDecorator decorator)
Builds JDBC function, which loads schema and executes operator on dataGrain object.- Parameters:
dataGrain
- The data grain object to be operatedoperator
- The operator to affects database for testingdecorator
- The decorator to decorate the data grain after loading of table chema- Returns:
- The function of JDBC
-
buildJdbcFunction
public JdbcFunction<Connection,DataGrain> buildJdbcFunction(DataGrain dataGrain, DataGrainOperator operator)
Builds JDBC function, which loads schema and executes operator on dataGrain object.- Parameters:
dataGrain
- The data grain object to be operatedoperator
- The operator to affects database for testing- Returns:
- The function of JDBC
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataGrainOperator operator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executed- Returns:
- The processed data grain
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataGrainOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executeddecorator
- The decorator used after schema matching- Returns:
- The processed data grain
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataRowsOperator operator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executed- Returns:
- The processed data grain
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataRowsOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executeddecorator
- The decorator used after schema matching- Returns:
- The processed data grain
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataRowOperator operator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executed- Returns:
- The processed data grain
-
conduct
public DataGrain conduct(DataGrain dataGrain, DataRowOperator operator, DataGrainDecorator decorator)
Gets connection of database and feeds it to operator.- Parameters:
dataGrain
- The data grain to be processedoperator
- The operator to be executeddecorator
- The decorator used after schema matching- Returns:
- The processed data grain
-
conduct
public <T> T conduct(JdbcFunction<Connection,T> jdbcFunction)
Executes aJdbcFunction
, the connection would be put intoConductorContext
.- Type Parameters:
T
- The type of returned value- Parameters:
jdbcFunction
- The JDBC function to be executed- Returns:
- The result of function
-
-