Class DBSubsetReader

  • All Implemented Interfaces:
    org.apache.uima.collection.base_cpm.BaseCollectionReader, org.apache.uima.collection.CollectionReader, org.apache.uima.resource.ConfigurableResource, org.apache.uima.resource.Resource
    Direct Known Subclasses:
    DBMultiplierReader, DBReader

    public abstract class DBSubsetReader
    extends DBReaderBase
    • Field Detail

      • PARAM_ADDITONAL_TABLES_STORAGE_PG_SCHEMA

        public static final String PARAM_ADDITONAL_TABLES_STORAGE_PG_SCHEMA
        See Also:
        Constant Field Values
      • resetTable

        protected Boolean resetTable
      • fetchIdsProactively

        protected Boolean fetchIdsProactively
      • additionalTableNames

        protected String[] additionalTableNames
      • additionalTableSchemas

        protected String[] additionalTableSchemas
      • hostName

        protected String hostName
      • dataTable

        protected String dataTable
        The name of the primary data table to read data from. This is either the exact parameter value given with DBReaderBase.PARAM_TABLE or, if this parameter denotes a subset table, the data table referenced by the subset.
      • readDataTable

        protected Boolean readDataTable
        This is true if the table name provided by the DBReaderBase.PARAM_TABLE parameter is a data table. If this parameter is false it means that we read from a subset table.
      • tables

        protected String[] tables
        The list of tables to read data from. The first element is always the data table. The following entries reference the "additional tables".
      • schemas

        protected String[] schemas
        The list of table schemas of the tables to read from. This is parallel to tables.
    • Constructor Detail

      • DBSubsetReader

        public DBSubsetReader()
    • Method Detail

      • initialize

        public void initialize​(org.apache.uima.UimaContext context)
                        throws org.apache.uima.resource.ResourceInitializationException
        Overrides:
        initialize in class DBReaderBase
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getAllRetrievedColumns

        protected List<Map<String,​Object>> getAllRetrievedColumns()
        Convenience method for extending classes.
        Returns:
      • checkAdditionalTableParameters

        protected void checkAdditionalTableParameters​(String[] additionalTableNames,
                                                      String[] additionalTableSchemas)
                                               throws org.apache.uima.resource.ResourceInitializationException
        This method checks whether the required parameters are set to meaningful values and throws an IllegalArgumentException when not.
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • checkAndAdjustAdditionalTables

        protected org.apache.commons.lang3.tuple.ImmutablePair<Integer,​String[]> checkAndAdjustAdditionalTables​(de.julielab.costosys.dbconnection.DataBaseConnector dbc,
                                                                                                                      String dataTable,
                                                                                                                      String[] additionalTableNames)
        Checks whether the given additional tables exist. If not, it is checked if the table names contain dots which are reserved for schema qualification in Postgres. It is tried again to find the tables with underscores ('_'), then. In this case, a colon character is interpreted as the separation between a specified Postgres schema and a Java-style path to be converted to a valid table name by replacing dots with underscores. Always includes the data table.