Class AbstractInformationExtractorImpl

    • Constructor Detail

      • AbstractInformationExtractorImpl

        public AbstractInformationExtractorImpl​(ExtractionContext extractionContext)
    • Method Detail

      • toMetaDataObjectName

        protected String toMetaDataObjectName​(Identifier identifier)
      • getResultSetCatalogLabel

        protected String getResultSetCatalogLabel()
      • getResultSetSchemaLabel

        protected String getResultSetSchemaLabel()
      • getResultSetTableNameLabel

        protected String getResultSetTableNameLabel()
      • getResultSetTableTypeLabel

        protected String getResultSetTableTypeLabel()
      • getResultSetRemarksLabel

        protected String getResultSetRemarksLabel()
      • getResultSetPrimaryKeyCatalogLabel

        protected String getResultSetPrimaryKeyCatalogLabel()
      • getResultSetPrimaryKeySchemaLabel

        protected String getResultSetPrimaryKeySchemaLabel()
      • getResultSetPrimaryKeyTableLabel

        protected String getResultSetPrimaryKeyTableLabel()
      • getResultSetColumnNameLabel

        protected String getResultSetColumnNameLabel()
      • getResultSetSqlTypeCodeLabel

        protected String getResultSetSqlTypeCodeLabel()
      • getResultSetTypeNameLabel

        protected String getResultSetTypeNameLabel()
      • getResultSetColumnSizeLabel

        protected String getResultSetColumnSizeLabel()
      • getResultSetDecimalDigitsLabel

        protected String getResultSetDecimalDigitsLabel()
      • getResultSetIsNullableLabel

        protected String getResultSetIsNullableLabel()
      • getResultSetIndexTypeLabel

        protected String getResultSetIndexTypeLabel()
      • getResultSetIndexNameLabel

        protected String getResultSetIndexNameLabel()
      • getResultSetForeignKeyLabel

        protected String getResultSetForeignKeyLabel()
      • getResultSetPrimaryKeyNameLabel

        protected String getResultSetPrimaryKeyNameLabel()
      • getResultSetColumnPositionColumn

        protected String getResultSetColumnPositionColumn()
      • getResultSetPrimaryKeyColumnNameLabel

        protected String getResultSetPrimaryKeyColumnNameLabel()
      • getResultSetForeignKeyColumnNameLabel

        protected String getResultSetForeignKeyColumnNameLabel()
      • processCatalogsResultSet

        protected abstract <T> T processCatalogsResultSet​(ExtractionContext.ResultSetProcessor<T> processor)
                                                   throws SQLException
        Must do the following:
        1. obtain a ResultSet containing a column of existing catalog names. The column label must be the same as returned by getResultSetCatalogLabel().
        2. execute processor.process( resultSet );
        3. release resources whether processor.process( resultSet ) executes successfully or not.
        Type Parameters:
        T - - defined by processor
        Parameters:
        processor - - the provided ResultSetProcessor.
        Returns:
        - defined by processor
        Throws:
        SQLException - - if a database error occurs
      • catalogExists

        public boolean catalogExists​(Identifier catalog)
        Description copied from interface: InformationExtractor
        Does the given catalog exist yet?
        Specified by:
        catalogExists in interface InformationExtractor
        Parameters:
        catalog - The name of the catalog to look for.
        Returns:
        true if the catalog does exist; false otherwise
      • processSchemaResultSet

        protected abstract <T> T processSchemaResultSet​(String catalog,
                                                        String schemaPattern,
                                                        ExtractionContext.ResultSetProcessor<T> processor)
                                                 throws SQLException
        Must do the following:
        1. obtain a ResultSet containing a row for any existing catalog/schema combination as specified by the catalog and schemaPattern parameters described below. The row contents will not be examined by processor.process( resultSet ), so column label names are not specified;
        2. execute processor.process( resultSet );
        3. release resources whether processor.process( resultSet ) executes successfully or not.

        The catalog and schemaPattern parameters are as specified by DatabaseMetaData.getSchemas(String, String), and are copied here:

        Type Parameters:
        T - - defined by processor
        Parameters:
        catalog - – a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means catalog name should not be used to narrow down the search.
        schemaPattern - – a schema name; must match the schema name as it is stored in the database; null means schema name should not be used to narrow down the search.
        processor - - the provided ResultSetProcessor.
        Returns:
        - defined by processor
        Throws:
        SQLException - - if a database error occurs
      • schemaExists

        public boolean schemaExists​(Identifier catalog,
                                    Identifier schema)
        Description copied from interface: InformationExtractor
        The the given schema exist yet?
        Specified by:
        schemaExists in interface InformationExtractor
        Parameters:
        catalog - The name of the catalog to look in.
        schema - The name of the schema to look for.
        Returns:
        true if the schema does exist; false otherwise
      • determineCatalogFilter

        protected String determineCatalogFilter​(Identifier catalog)
      • determineSchemaFilter

        protected String determineSchemaFilter​(Identifier schema)
      • getTable

        public TableInformation getTable​(Identifier catalog,
                                         Identifier schema,
                                         Identifier tableName)
        Description copied from interface: InformationExtractor
        Look for a matching table.
        Specified by:
        getTable in interface InformationExtractor
        Parameters:
        catalog - Can be null, indicating that any catalog may be considered a match. A non-null value indicates that search should be limited to the passed catalog.
        schema - Can be null, indicating that any schema may be considered a match. A non-null value indicates that search should be limited to the passed schema .
        tableName - The name of the table to look for.
        Returns:
        table info for the matching table
      • getTables

        public NameSpaceTablesInformation getTables​(Identifier catalog,
                                                    Identifier schema)
        Description copied from interface: InformationExtractor
        Extract all the tables information.
        Specified by:
        getTables in interface InformationExtractor
        Parameters:
        catalog - Can be null, indicating that any catalog may be considered a match. A non-null value indicates that search should be limited to the passed catalog.
        schema - Can be null, indicating that any schema may be considered a match. A non-null value indicates that search should be limited to the passed schema .
        Returns:
        a NameSpaceTablesInformation
      • processColumnsResultSet

        protected abstract <T> T processColumnsResultSet​(String catalog,
                                                         String schemaPattern,
                                                         String tableNamePattern,
                                                         String columnNamePattern,
                                                         ExtractionContext.ResultSetProcessor<T> processor)
                                                  throws SQLException
        Must do the following:
        1. obtain a ResultSet containing a row for any existing catalog/schema/table/column combination as specified by the catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String) Rows must be ordered by catalog, schema, table name, and column position.
        2. execute processor.process( resultSet );
        3. release resources whether processor.process( resultSet ) executes successfully or not.

        The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData.getColumns(String, String, String, String), and are copied here:

        Type Parameters:
        T - - defined by processor
        Parameters:
        catalog - – a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
        schemaPattern - – a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
        tableNamePattern - – a table name pattern; must match the table name as it is stored in the database
        columnNamePattern - – a column name pattern; must match the column name as it is stored in the database
        processor - - the provided ResultSetProcessor.
        Returns:
        - defined by processor
        Throws:
        SQLException - - if a database error occurs
      • processTableResultSet

        protected abstract <T> T processTableResultSet​(String catalog,
                                                       String schemaPattern,
                                                       String tableNamePattern,
                                                       String[] types,
                                                       ExtractionContext.ResultSetProcessor<T> processor)
                                                throws SQLException
        Must do the following:
        1. obtain a ResultSet containing a row for any existing catalog/schema/table/table type combination as specified by the catalogFilter, schemaFilter, tableNameFilter, and tableTypes parameters described below. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData.getTables(String, String, String, String[])
        2. execute processor.process( resultSet );
        3. release resources whether processor.process( resultSet ) executes successfully or not.

        The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData.getTables(String, String, String, String[]), and are copied here:

        Type Parameters:
        T - - defined by processor
        Parameters:
        catalog - - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
        schemaPattern - - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
        tableNamePattern - - a table name pattern; must match the table name as it is stored in the database
        types - - a list of table types
        processor - - the provided ResultSetProcessor.
        Returns:
        - defined by processor
        Throws:
        SQLException - - if a database error occurs
      • getResultSetTableTypesPhysicalTableConstant

        protected abstract String getResultSetTableTypesPhysicalTableConstant()
      • isPhysicalTableType

        protected boolean isPhysicalTableType​(String tableType)
      • interpretNullable

        protected TruthValue interpretNullable​(int nullable)
      • processIndexInfoResultSet

        protected abstract <T> T processIndexInfoResultSet​(String catalog,
                                                           String schema,
                                                           String table,
                                                           boolean unique,
                                                           boolean approximate,
                                                           ExtractionContext.ResultSetProcessor<T> processor)
                                                    throws SQLException
        Must do the following:
        1. obtain a ResultSet containing a row for each column defined in an index. The ResultSet must contain the following, consistent with the corresponding columns returned by DatabaseMetaData.getIndexInfo(String, String, String, boolean, boolean) The ResultSet must be ordered so that the columns for a particular index are in contiguous rows in order of column position.
        2. execute processor.process( resultSet );
        3. release resources whether processor.process( resultSet ) executes successfully or not.

        The catalog, schemaPattern, tableNamePattern, and columnNamePattern parameters are as specified by DatabaseMetaData.getIndexInfo(String, String, String, boolean, boolean), and are copied here:

        Type Parameters:
        T - - defined by processor
        Parameters:
        catalog - – a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
        schema - – a schema name; must match the schema name as it is stored in this database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
        table - – a table name; must match the table name as it is stored in this database
        unique - – when true, return only indices for unique values; when false, return indices regardless of whether unique or not
        approximate - – when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate
        processor - - the provided ResultSetProcessor.
        Returns:
        - defined by processor
        Throws:
        SQLException - - if a database error occurs
      • getIndexes

        public Iterable<IndexInformation> getIndexes​(TableInformation tableInformation)
        Description copied from interface: InformationExtractor
        Extract information about indexes defined against the given table. Typically called from the TableInformation itself as part of on-demand initialization of its state.
        Specified by:
        getIndexes in interface InformationExtractor
        Parameters:
        tableInformation - The table for which to locate indexes
        Returns:
        The extracted index information
      • getForeignKeys

        public Iterable<ForeignKeyInformation> getForeignKeys​(TableInformation tableInformation)
        Description copied from interface: InformationExtractor
        Extract information about foreign keys defined on the given table (targeting or point-at other tables). Typically called from the TableInformation itself as part of on-demand initialization of its state.
        Specified by:
        getForeignKeys in interface InformationExtractor
        Parameters:
        tableInformation - The table for which to locate foreign-keys
        Returns:
        The extracted foreign-key information