Class ModelMetaData


  • public class ModelMetaData
    extends java.lang.Object
    The whole metadata for the connected database.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelMetaData​(Backend backend, java.sql.DatabaseMetaData[] metaData, java.lang.String[] schemas)
      Creates a database meta instance.
    • Constructor Detail

      • ModelMetaData

        public ModelMetaData​(Backend backend,
                             java.sql.DatabaseMetaData[] metaData,
                             java.lang.String[] schemas)
        Creates a database meta instance.
        Parameters:
        backend - the backend
        metaData - the connections meta data
        schemas - optional schemas, null if no schema check
    • Method Detail

      • getProperties

        public java.util.Properties getProperties()
        Gets the migration properties.
        Used to remember settings of the migration process.
        Returns:
        the properties
      • getAllTablesInDatabase

        public java.util.List<DatabaseMetaDataTableHeader> getAllTablesInDatabase()
                                                                           throws java.sql.SQLException
        Gets the header info of all tables in the database.
        Returns:
        the table headers
        Throws:
        java.sql.SQLException - if cannot retrieve meta data from database
      • getTableInDatabase

        public java.util.List<DatabaseMetaDataTableHeader> getTableInDatabase​(java.lang.String tableName)
                                                                       throws java.sql.SQLException
        Gets the header infos for given tablename.
        May return more than one entry if the same tablename is used in more than one schema.
        Parameters:
        tableName - the tablename
        Returns:
        the non-empty list of header infos, null if no such table in database
        Throws:
        java.sql.SQLException - if cannot retrieve meta data from database
      • addTableMetaData

        public boolean addTableMetaData​(TableMetaData tableMetaData)
        Adds a table to this model.
        If schemas are set, only tables belonging to one of given schemas will be appended.
        Parameters:
        tableMetaData - the table
        Returns:
        true if added, false if wrong schema
      • getTables

        public java.util.Collection<TableMetaData> getTables()
        Gets the tables of this model.
        Returns:
        the tables
      • getBackend

        public Backend getBackend()
        Gets the backend.
        Returns:
        the backend
      • getSchemas

        public java.lang.String[] getSchemas()
        Gets the valid schemas.
        Returns:
        the optional schemas, null if no schema check
      • getMetaData

        public java.sql.DatabaseMetaData[] getMetaData()
        Gets the JDBC-connection's meta data.
        May be more than one if different schemas and schema-option was given in BackendInfo.
        Returns:
        the meta data
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object