Class JDBCMetadataProcessor

    • Field Detail

      • useFullSchemaName

        protected boolean useFullSchemaName
    • Constructor Detail

      • JDBCMetadataProcessor

        public JDBCMetadataProcessor()
    • Method Detail

      • isUnsignedTypeName

        protected boolean isUnsignedTypeName​(String name)
        Determine if the type name represents an unsigned type
        Parameters:
        name -
        Returns:
      • modifyProcedureNameInSource

        protected String modifyProcedureNameInSource​(String nameInSource)
        Override to modify the nameInSource for a procedure
        Parameters:
        nameInSource -
        Returns:
      • shouldExclude

        protected boolean shouldExclude​(String fullName)
      • getCatalogTerm

        protected String getCatalogTerm()
      • getSchemaTerm

        protected String getSchemaTerm()
      • getTableTerm

        protected String getTableTerm()
      • addTable

        protected Table addTable​(MetadataFactory metadataFactory,
                                 String tableCatalog,
                                 String tableSchema,
                                 String tableName,
                                 String remarks,
                                 String fullName)
        Parameters:
        metadataFactory -
        tableCatalog -
        tableSchema -
        tableName -
        remarks -
        fullName -
        Returns:
      • addColumn

        protected Column addColumn​(ResultSet columns,
                                   Table table,
                                   MetadataFactory metadataFactory,
                                   int rsColumns)
                            throws SQLException
        Add a column to the given table based upon the current row of the columns resultset
        Parameters:
        columns -
        table -
        metadataFactory -
        rsColumns -
        Returns:
        the column added
        Throws:
        SQLException
      • getRuntimeType

        protected String getRuntimeType​(int type,
                                        String typeName,
                                        int precision,
                                        int scale)
      • getNativeComponentType

        protected String getNativeComponentType​(String typeName)
        Extract the native component type from the typeName, or return null if that is not possible.
        Parameters:
        typeName -
        Returns:
      • getRuntimeType

        protected String getRuntimeType​(int type,
                                        String typeName,
                                        int precision)
      • executeSequenceQuery

        protected ResultSet executeSequenceQuery​(Connection conn)
                                          throws SQLException
        Return a result set with three columns - sequence_catalog, sequence_schema, and sequence_name or null if sequences are not supported
        Parameters:
        conn -
        Returns:
        Throws:
        SQLException
      • getSequenceNextSQL

        protected String getSequenceNextSQL​(String fullyQualifiedName)
        Return the native sql for getting the next value or null if not supported
        Parameters:
        fullyQualifiedName -
        Returns:
      • getIndexInfoForTable

        protected boolean getIndexInfoForTable​(String catalogName,
                                               String schemaName,
                                               String tableName,
                                               boolean uniqueOnly,
                                               boolean approximateIndexes,
                                               String tableType)
        Override to control or disable the default index logic
        Parameters:
        catalogName -
        schemaName -
        tableName -
        uniqueOnly -
        approximateIndexes -
        tableType -
        Returns:
        true if the default logic should still be used, or false if the default index logic should not run
      • getFullyQualifiedName

        protected String getFullyQualifiedName​(String catalogName,
                                               String schemaName,
                                               String objectName,
                                               boolean quoted)
      • setTableNamePattern

        public void setTableNamePattern​(String tableNamePattern)
      • setTableTypes

        public void setTableTypes​(String[] tableTypes)
      • setUseFullSchemaName

        public void setUseFullSchemaName​(boolean useFullSchemaName)
      • setProcedureNamePattern

        public void setProcedureNamePattern​(String procedureNamePattern)
      • setImportIndexes

        public void setImportIndexes​(boolean importIndexes)
      • setImportKeys

        public void setImportKeys​(boolean importKeys)
      • setImportProcedures

        public void setImportProcedures​(boolean importProcedures)
      • setImportApproximateIndexes

        public void setImportApproximateIndexes​(boolean importApproximateIndexes)
      • setWidenUnsignedTypes

        public void setWidenUnsignedTypes​(boolean widenUnsignedTypes)
      • setQuoteNameInSource

        public void setQuoteNameInSource​(boolean quoteIdentifiers)
      • setCatalog

        public void setCatalog​(String catalog)
      • setSchemaPattern

        public void setSchemaPattern​(String schema)
      • setSchemaName

        public void setSchemaName​(String schema)
      • setUseProcedureSpecificName

        public void setUseProcedureSpecificName​(boolean useProcedureSpecificName)
      • setUseCatalogName

        public void setUseCatalogName​(boolean useCatalog)
      • setAutoCreateUniqueConstraints

        public void setAutoCreateUniqueConstraints​(boolean autoCreateUniqueConstraints)
      • setExcludeProcedures

        public void setExcludeProcedures​(String excludeProcedures)
      • setExcludeTables

        public void setExcludeTables​(String excludeTables)
      • setUseQualifiedName

        public void setUseQualifiedName​(boolean useQualifiedName)
      • setUseAnyIndexCardinality

        public void setUseAnyIndexCardinality​(boolean useAnyIndexCardinality)
      • setImportStatistics

        public void setImportStatistics​(boolean importStatistics)
      • setImportForeignKeys

        public void setImportForeignKeys​(boolean importForeignKeys)
      • setColumnNamePattern

        public void setColumnNamePattern​(String columnNamePattern)
      • isImportProcedures

        @TranslatorProperty(display="Import Procedures",
                            category=IMPORT,
                            description="true to import procedures and procedure columns - Note that it is not always possible to import procedure result set columns due to database limitations. It is also not currently possible to import overloaded procedures.")
        public boolean isImportProcedures()
      • isUseFullSchemaName

        @TranslatorProperty(display="Use Full Schema Name",
                            category=IMPORT,
                            description="When false, directs the importer to drop the source catalog/schema from the Teiid object name, so that the Teiid fully qualified name will be in the form of <model name>.<table name> - Note: when false this may lead to objects with duplicate names when importing from multiple schemas, which results in an exception.  This option does not affect the name in source property.")
        public boolean isUseFullSchemaName()
      • getCatalog

        @TranslatorProperty(display="catalog",
                            category=IMPORT,
                            description="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")
        public String getCatalog()
      • getSchemaPattern

        @TranslatorProperty(display="Schema Pattern",
                            category=IMPORT,
                            description="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")
        public String getSchemaPattern()
      • isImportApproximateIndexes

        @TranslatorProperty(display="Import Approximate Indexes",
                            category=IMPORT,
                            description="true to import approximate index information. when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate")
        public boolean isImportApproximateIndexes()
      • isWidenUnsingedTypes

        @TranslatorProperty(display="Widen unSigned Types",
                            category=IMPORT,
                            description="true to convert unsigned types to the next widest type. For example SQL Server reports tinyint as an unsigned type. With this option enabled, tinyint would be imported as a short instead of a byte.")
        public boolean isWidenUnsingedTypes()
      • isUseProcedureSpecificName

        @TranslatorProperty(display="Use Procedure Specific Name",
                            category=IMPORT,
                            description="true will allow the import of overloaded procedures (which will normally result in a duplicate procedure error) by using the unique procedure specific name as the Teiid name. This option will only work with JDBC 4.0 compatible drivers that report specific names.")
        public boolean isUseProcedureSpecificName()
      • isUseCatalogName

        @TranslatorProperty(display="Use Catalog Name",
                            category=IMPORT,
                            description="true will use any non-null/non-empty catalog name as part of the name in source, e.g. \"catalog\".\"schema\".\"table\".\"column\", and in the Teiid runtime name if useFullSchemaName is also true. false will not use the catalog name in either the name in source or the Teiid runtime name. Should be set to false for sources that do not fully support a catalog concept, but return a non-null catalog name in their metadata - such as HSQL.")
        public boolean isUseCatalogName()
      • isUseQualifiedName

        @TranslatorProperty(display="use Qualified Name",
                            category=IMPORT,
                            description="true will use name qualification for both the Teiid name and name in source as dictated by the useCatalogName and useFullSchemaName properties.  Set to false to disable all qualification for both the Teiid name and the name in source, which effectively ignores the useCatalogName and useFullSchemaName properties.  Note: when false this may lead to objects with duplicate names when importing from multiple schemas, which results in an exception.")
        public boolean isUseQualifiedName()
      • isUseAnyIndexCardinality

        @TranslatorProperty(display="Use Any Index Cardinality",
                            category=IMPORT,
                            description="true will use the maximum cardinality returned from DatabaseMetaData.getIndexInfo. importKeys or importIndexes needs to be enabled for this setting to have an effect. This allows for better stats gathering from sources that don\'t support returning a statistical index.")
        public boolean isUseAnyIndexCardinality()
      • isImportStatistics

        @TranslatorProperty(display="Import Statistics",
                            category=IMPORT,
                            description="true will use database dependent logic to determine the cardinality if none is determined. Not yet supported by all database types - currently only supported by Oracle and MySQL.")
        public boolean isImportStatistics()
      • getExcludeTables

        @TranslatorProperty(display="Exclude Tables",
                            category=IMPORT,
                            description="A case-insensitive regular expression that when matched against a fully qualified Teiid table name will exclude it from import.  Applied after table names are retrieved.  Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter")
        public String getExcludeTables()
      • getExcludeProcedures

        @TranslatorProperty(display="Exclude Procedures",
                            category=IMPORT,
                            description="A case-insensitive regular expression that when matched against a fully qualified Teiid procedure name will exclude it from import.  Applied after procedure names are retrieved.  Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter")
        public String getExcludeProcedures()
      • setQuoteString

        public void setQuoteString​(String quoteString)
      • setStartQuoteString

        public void setStartQuoteString​(String quoteString)
      • setEndQuoteString

        public void setEndQuoteString​(String quoteString)
      • setImportRowIdAsBinary

        public void setImportRowIdAsBinary​(boolean importRowIdAsBinary)
      • setImportLargeAsLob

        public void setImportLargeAsLob​(boolean importLargeAsLob)
      • setImportSequences

        public void setImportSequences​(boolean importSequences)
      • getExcludeSequences

        @TranslatorProperty(display="Exclude Tables",
                            category=IMPORT,
                            description="A case-insensitive regular expression that when matched against a fully qualified Teiid sequence name will exclude it from import.  Applied after table names are retrieved.  Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter")
        public String getExcludeSequences()
      • setExcludeSequences

        public void setExcludeSequences​(String excludeSequences)
      • setSequenceNamePattern

        public void setSequenceNamePattern​(String sequenceNamePattern)
      • setUseIntegralTypes

        public void setUseIntegralTypes​(boolean useIntegralTypes)
      • isHiddenSchema

        protected boolean isHiddenSchema​(String catalog,
                                         String schema)
        If the schema is hidden regardless of the specified schema pattern
        Parameters:
        catalog -
        schema -
        Returns:
        true if no objects should be imported from the given schema
      • getGeometryMetadata

        protected void getGeometryMetadata​(Column c,
                                           Connection conn,
                                           String tableCatalog,
                                           String tableSchema,
                                           String tableName,
                                           String columnName)
        Get the geospatial metadata for the column, including srid, type, and dimensionality
        Parameters:
        c -
        conn -
        tableCatalog -
        tableSchema -
        tableName -
        columnName -
      • getGeographyMetadata

        protected void getGeographyMetadata​(Column c,
                                            Connection conn,
                                            String tableCatalog,
                                            String tableSchema,
                                            String tableName,
                                            String columnName)
        Get the geospatial metadata for the column, including srid, type, and dimensionality
        Parameters:
        c -
        conn -
        tableCatalog -
        tableSchema -
        tableName -
        columnName -
      • getGeographyMetadataTableName

        protected String getGeographyMetadataTableName()
        Return the name of the metadata table or view for geography metadata that conforms to the simple features specification or null if none exists
        Returns:
      • getGeometryMetadataTableName

        protected String getGeometryMetadataTableName()
        Return the name of the metadata table or view for geometry metadata that conforms to the simple features specification or null if none exists
        Returns:
      • isUseTypeInfo

        @TranslatorProperty(display="Use Type Info",
                            category=IMPORT,
                            description="If JDBC DatabaseMetaData getTypeInfo should be used.  If false, array component types and unsigned types may not be able to be determined.")
        public boolean isUseTypeInfo()
      • setUseTypeInfo

        public void setUseTypeInfo​(boolean useTypeInfo)