Class OracleMetaDataProvider

  • All Implemented Interfaces:
    org.alfasoftware.morf.metadata.Schema

    public class OracleMetaDataProvider
    extends java.lang.Object
    implements org.alfasoftware.morf.metadata.Schema
    Oracle-specific meta data provision for databases.
    Author:
    Copyright (c) Alfa Financial Software 2010
    • Constructor Summary

      Constructors 
      Constructor Description
      OracleMetaDataProvider​(java.sql.Connection connection, java.lang.String schemaName)
      Construct a new meta data provider.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.alfasoftware.morf.metadata.Table getTable​(java.lang.String name)
      org.alfasoftware.morf.metadata.View getView​(java.lang.String name)  
      boolean isEmptyDatabase()
      Reading all the table metadata is slow on Oracle, so we can optimise the empty database check by just seeing if there are any tables.
      boolean tableExists​(java.lang.String name)  
      java.util.Collection<java.lang.String> tableNames()  
      java.util.Collection<org.alfasoftware.morf.metadata.Table> tables()
      boolean viewExists​(java.lang.String name)  
      java.util.Collection<java.lang.String> viewNames()  
      java.util.Collection<org.alfasoftware.morf.metadata.View> views()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OracleMetaDataProvider

        public OracleMetaDataProvider​(java.sql.Connection connection,
                                      java.lang.String schemaName)
        Construct a new meta data provider.

        Converts the schema name to upper case, otherwise the provider cannot connect to it.

        Parameters:
        connection - Connection details.
        schemaName - Schema name.
    • Method Detail

      • isEmptyDatabase

        public boolean isEmptyDatabase()
        Reading all the table metadata is slow on Oracle, so we can optimise the empty database check by just seeing if there are any tables.
        Specified by:
        isEmptyDatabase in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        DatabaseMetaDataProvider.isEmptyDatabase()
      • tableExists

        public boolean tableExists​(java.lang.String name)
        Specified by:
        tableExists in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.tableExists(java.lang.String)
      • getTable

        public org.alfasoftware.morf.metadata.Table getTable​(java.lang.String name)

        The Table implementation returned may contain Column implementations which evaluate the metadata elements (ColumnType.getType(), ColumnType.getWidth() etc.) lazily. If the database column type is not supported, this may throw an DatabaseMetaDataProvider.UnexpectedDataTypeException when evaluated. This allows tables with unsupported data types to be enumerated (and thus co-exist in the database schema) but not be supported by the application.

        Specified by:
        getTable in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.getTable(java.lang.String)
      • tableNames

        public java.util.Collection<java.lang.String> tableNames()
        Specified by:
        tableNames in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.tableNames()
      • tables

        public java.util.Collection<org.alfasoftware.morf.metadata.Table> tables()

        The Table implementation returned may contain Column implementations which evaluate the metadata elements (ColumnType.getType(), ColumnType.getWidth() etc.) lazily. If the database column type is not supported, this may throw an DatabaseMetaDataProvider.UnexpectedDataTypeException when evaluated. This allows tables with unsupported data types to be enumerated (and thus co-exist in the database schema) but not be supported by the application.

        Specified by:
        tables in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.tables()
      • viewExists

        public boolean viewExists​(java.lang.String name)
        Specified by:
        viewExists in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.viewExists(java.lang.String)
      • getView

        public org.alfasoftware.morf.metadata.View getView​(java.lang.String name)
        Specified by:
        getView in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.getView(java.lang.String)
      • viewNames

        public java.util.Collection<java.lang.String> viewNames()
        Specified by:
        viewNames in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.viewNames()
      • views

        public java.util.Collection<org.alfasoftware.morf.metadata.View> views()
        Specified by:
        views in interface org.alfasoftware.morf.metadata.Schema
        See Also:
        Schema.views()