Interface SnapshotGenerator

All Known Implementing Classes:
CatalogSnapshotGenerator, ColumnSnapshotGenerator, ColumnSnapshotGeneratorH2, ColumnSnapshotGeneratorInformix, ColumnSnapshotGeneratorOracle, DataSnapshotGenerator, ForeignKeySnapshotGenerator, IndexSnapshotGenerator, JdbcSnapshotGenerator, PrimaryKeySnapshotGenerator, SchemaSnapshotGenerator, SchemaSnapshotGeneratorSnowflake, SequenceSnapshotGenerator, SequenceSnapshotGeneratorSnowflake, TableSnapshotGenerator, UniqueConstraintSnapshotGenerator, UniqueConstraintSnapshotGeneratorSnowflake, ViewSnapshotGenerator

public interface SnapshotGenerator
  • Field Details

  • Method Details

    • getPriority

      int getPriority(Class<? extends DatabaseObject> objectType, Database database)
      Inquire if this SnapshotGenerator is capable of snapshotting objects of type objectType (e.g. Table, Index, View etc.) in the DBMS database (e.g. Oracle, Postgres, HyperSQL etc.) A return priority of > 0 will be interpreted as capable. The highest priority for an objectType-database combination wins.
      Parameters:
      objectType - The object type we are asked to snapshot
      database - The DBMS for which the snapshotting should be done
      Returns:
      An integer of PRIORITY_... constants indicating our capability and willingness to snapshot
    • snapshot

      <T extends DatabaseObject> T snapshot(T example, DatabaseSnapshot snapshot, SnapshotGeneratorChain chain) throws DatabaseException, InvalidExampleException
      Commands the SnapshotGenerator to create a snapshot (a representation of a database object in Java object form) of a specific database object.
      Type Parameters:
      T - The Java object type in which we are to return the snapshot result
      Parameters:
      example - The object we should try to snapshot
      snapshot - The Snapshot object representing the result of the snapshot operations so far
      chain - A list of other SnapshotGenerators that might be asked to try the same
      Returns:
      An object of type T if our snapshot attempt is successful
      Throws:
      DatabaseException - If an operation on the database fails
      InvalidExampleException - If, for some reason, we cannot work on the example object (ambiguous naming etc.)
    • addsTo

      Class<? extends DatabaseObject>[] addsTo()
      When snapshotting a certain object type (e.g. a table), different types of objects might be discovered in the process. (TODO: Which ones? Needs a more precise description.)
      Returns:
      an array of classes that this SnapshotGenerator might return upon snapshotting a given DatabaseObject type.
    • replaces

      Class<? extends SnapshotGenerator>[] replaces()
      Returns classes (and superclasses) that this SnapshotGenerator replaces. Return null or empty array to not affect the SnapshotGeneratorChain.