Top Fields Constructors Methods
liquibase.snapshot.jvm

public abstract Class JdbcSnapshotGenerator

extends Object
implements SnapshotGenerator
Class Inheritance
All Implemented Interfaces
liquibase.snapshot.SnapshotGenerator
Known Direct Subclasses
liquibase.snapshot.jvm.PrimaryKeySnapshotGenerator, liquibase.snapshot.jvm.SchemaSnapshotGenerator, liquibase.snapshot.jvm.SequenceSnapshotGenerator, liquibase.snapshot.jvm.TableSnapshotGenerator, liquibase.snapshot.jvm.UniqueConstraintSnapshotGenerator, liquibase.snapshot.jvm.ViewSnapshotGenerator, liquibase.snapshot.jvm.CatalogSnapshotGenerator, liquibase.snapshot.jvm.ColumnSnapshotGenerator, liquibase.snapshot.jvm.DataSnapshotGenerator, liquibase.snapshot.jvm.ForeignKeySnapshotGenerator, liquibase.snapshot.jvm.IndexSnapshotGenerator
Imports
liquibase.Scope, liquibase.database.AbstractJdbcDatabase, .Database, liquibase.database.core.InformixDatabase, .PostgresDatabase, liquibase.database.jvm.JdbcConnection, liquibase.diff.DiffStatusListener, liquibase.exception.DatabaseException, liquibase.snapshot.DatabaseSnapshot, .InvalidExampleException, .SnapshotGenerator, .SnapshotGeneratorChain, liquibase.structure.DatabaseObject, java.sql.ResultSet, .SQLException, java.util.ArrayList, .HashSet, .List, .Set

Field Summary

Modifier and TypeField and Description
private Class<? extends DatabaseObject>[]
private final Class<? extends DatabaseObject>
private final Set<DiffStatusListener>

Constructor Summary

AccessConstructor and Description
protected
protected
JdbcSnapshotGenerator(Class<? extends DatabaseObject> defaultFor, Class<? extends DatabaseObject>[] addsTo)

Method Summary

Modifier and TypeMethod and Description
public void
public Class<? extends DatabaseObject>[]
addsTo()

Implements liquibase.snapshot.SnapshotGenerator.addsTo.

When snapshotting a certain object type (e.g. a table), different types of objects might be discovered in the process.

protected abstract void
addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot)

protected String
cleanNameFromDatabase(String objectName, Database database)

protected String[]

Returns:

An array of catalog name Strings (May be an empty array)
getDatabaseCatalogNames
(Database
The database from which to get the schema names
database
)

Fetches an array of Strings with the catalog names in the database.

public int
getPriority(Class<? extends DatabaseObject>
The object type we are asked to snapshot
objectType
,
Database
The DBMS for which the snapshotting should be done
database
)

Implements liquibase.snapshot.SnapshotGenerator.getPriority.

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.

public Class<? extends SnapshotGenerator>[]
replaces()

Implements liquibase.snapshot.SnapshotGenerator.replaces.

Returns classes (and superclasses) that this SnapshotGenerator replaces.

protected boolean
shouldAddTo(Class<? extends DatabaseObject> databaseObjectType, DatabaseSnapshot snapshot)

public DatabaseObject
snapshot(DatabaseObject
The object we should try to snapshot
example
,
DatabaseSnapshot
The Snapshot object representing the result of the snapshot operations so far
snapshot
,
SnapshotGeneratorChain
A list of other SnapshotGenerators that might be asked to try the same
chain
)

Implements liquibase.snapshot.SnapshotGenerator.snapshot.

Commands the SnapshotGenerator to create a snapshot (a representation of a database object in Java object form) of a specific database object.

protected abstract DatabaseObject
protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addsToback to summary
private Class<? extends DatabaseObject>[] addsTo
defaultForback to summary
private final Class<? extends DatabaseObject> defaultFor
statusListenersback to summary
private final Set<DiffStatusListener> statusListeners

Constructor Detail

JdbcSnapshotGeneratorback to summary
protected JdbcSnapshotGenerator(Class<? extends DatabaseObject> defaultFor)
JdbcSnapshotGeneratorback to summary
protected JdbcSnapshotGenerator(Class<? extends DatabaseObject> defaultFor, Class<? extends DatabaseObject>[] addsTo)

Method Detail

addStatusListenerback to summary
public void addStatusListener(DiffStatusListener listener)
addsToback to summary
public Class<? extends DatabaseObject>[] addsTo()

Implements liquibase.snapshot.SnapshotGenerator.addsTo.

Doc from liquibase.snapshot.SnapshotGenerator.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:Class<? extends DatabaseObject>[]

an array of classes that this SnapshotGenerator might return upon snapshotting a given DatabaseObject type.

Annotations
@Override
addToback to summary
protected abstract void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException
cleanNameFromDatabaseback to summary
protected String cleanNameFromDatabase(String objectName, Database database)
getDatabaseCatalogNamesback to summary
protected String[] getDatabaseCatalogNames(Database database) throws SQLException, DatabaseException

Fetches an array of Strings with the catalog names in the database.

Parameters
database:Database

The database from which to get the schema names

Returns:String[]

An array of catalog name Strings (May be an empty array)

Exceptions
SQLException:
propagated java.sql.SQLException
DatabaseException:
if a different problem occurs during the DBMS-specific code
getPriorityback to summary
public int getPriority(Class<? extends DatabaseObject> objectType, Database database)

Implements liquibase.snapshot.SnapshotGenerator.getPriority.

Doc from liquibase.snapshot.SnapshotGenerator.getPriority.

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:Class<? extends DatabaseObject>

The object type we are asked to snapshot

database:Database

The DBMS for which the snapshotting should be done

Returns:int

An integer of PRIORITY_... constants indicating our capability and willingness to snapshot

Annotations
@Override
replacesback to summary
public Class<? extends SnapshotGenerator>[] replaces()

Implements liquibase.snapshot.SnapshotGenerator.replaces.

Doc from liquibase.snapshot.SnapshotGenerator.replaces.

Returns classes (and superclasses) that this SnapshotGenerator replaces. Return null or empty array to not affect the SnapshotGeneratorChain.

Annotations
@Override
shouldAddToback to summary
protected boolean shouldAddTo(Class<? extends DatabaseObject> databaseObjectType, DatabaseSnapshot snapshot)
snapshotback to summary
public DatabaseObject snapshot(DatabaseObject example, DatabaseSnapshot snapshot, SnapshotGeneratorChain chain) throws DatabaseException, InvalidExampleException

Implements liquibase.snapshot.SnapshotGenerator.snapshot.

Doc from liquibase.snapshot.SnapshotGenerator.snapshot.

Commands the SnapshotGenerator to create a snapshot (a representation of a database object in Java object form) of a specific database object.

Parameters
example:DatabaseObject

The object we should try to snapshot

snapshot:DatabaseSnapshot

The Snapshot object representing the result of the snapshot operations so far

chain:SnapshotGeneratorChain

A list of other SnapshotGenerators that might be asked to try the same

Returns:DatabaseObject

An object of type T if our snapshot attempt is successful

Annotations
@Override
Exceptions
DatabaseException:
If an operation on the database fails
InvalidExampleException:
If, for some reason, we cannot work on the example object (ambiguous naming etc.)
snapshotObjectback to summary
protected abstract DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException
updateListenersback to summary
protected void updateListeners(String message)