Class DataConductor


  • public class DataConductor
    extends Object
    The main executor of DataGrainOperator for DataGrain.

    Main functions

    This object is responsible for retrieving Connection from DataSource, and uses the connection to execute any method of conduct(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 has putAttribute and getAttribute method to let you keep supplementary information of the row. These method is useful for implementing DataGrainDecorator.

    • Constructor Detail

      • DataConductor

        public DataConductor​(DataSource newDataSource)
        Constructs this object with a valid DataSource 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 operated
        operator - The operator to affects database for testing
        decorator - 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 operated
        operator - 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 processed
        operator - 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 processed
        operator - The operator to be executed
        decorator - 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 processed
        operator - 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 processed
        operator - The operator to be executed
        decorator - 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 processed
        operator - 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 processed
        operator - The operator to be executed
        decorator - The decorator used after schema matching
        Returns:
        The processed data grain
      • conduct

        public <T> T conduct​(JdbcFunction<Connection,​T> jdbcFunction)
        Executes a JdbcFunction, the connection would be put into ConductorContext.
        Type Parameters:
        T - The type of returned value
        Parameters:
        jdbcFunction - The JDBC function to be executed
        Returns:
        The result of function