Class AbstractSchema

java.lang.Object
org.reldb.wrapd.schema.AbstractSchema
Direct Known Subclasses:
SQLSchema

public abstract class AbstractSchema
extends java.lang.Object
An abstract schema definition that can handle updates on anything definable as a schema.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  AbstractSchema.Update
    Definition of a schema update.
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractSchema()  
  • Method Summary

    Modifier and Type Method Description
    protected abstract Result create()
    Create and initialise a new schema, which usually only contains version store, because it is assumed that updates will be run to create other content.
    protected UpdateTransaction getTransaction()
    Obtain a new transaction.
    protected abstract AbstractSchema.Update[] getUpdates()
    A collection of schema updates.
    abstract Version getVersion()
    Return VersionNewDatabase instance for new database.
    Result setup()
    Verify schema exists and is up-to-date.
    Result setup​(org.reldb.toolbox.progress.ProgressIndicator progressIndicator)
    Verify schema exists and is up-to-date.
    protected abstract Result setVersion​(VersionNumber number)
    Set new version number after successful update.

    Methods inherited from class java.lang.Object

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

    • AbstractSchema

      public AbstractSchema()
  • Method Details

    • getVersion

      public abstract Version getVersion()
      Return VersionNewDatabase instance for new database. Return VersionIndeterminate instance for database where version can't be determined. Return VersionNumber instance for database version.
      Returns:
      The Version.
    • setVersion

      protected abstract Result setVersion​(VersionNumber number)
      Set new version number after successful update. Normally not called directly; only by setup(...)
      Parameters:
      number - - version number
      Returns:
      Result
    • create

      protected abstract Result create()
      Create and initialise a new schema, which usually only contains version store, because it is assumed that updates will be run to create other content.
      Returns:
      Result
    • getUpdates

      protected abstract AbstractSchema.Update[] getUpdates()
      A collection of schema updates. Only add new updates to the end.
      Returns:
      array of UpdateS.
    • getTransaction

      protected UpdateTransaction getTransaction()
      Obtain a new transaction. Within setup(...), each update obtained from @getUpdates() will run, followed by updating version via setVersion(...) in its own UpdateTransaction.
      Returns:
      UpdateTransaction.
    • setup

      public Result setup​(org.reldb.toolbox.progress.ProgressIndicator progressIndicator)
      Verify schema exists and is up-to-date. Otherwise, create it and/or apply updates if necessary.
      Parameters:
      progressIndicator - ProgressIndicator
      Returns:
      Result
    • setup

      public Result setup()
      Verify schema exists and is up-to-date. Otherwise, create it and/or apply updates if necessary.
      Returns:
      Result