Top Fields Constructors Methods
liquibase.snapshot

public abstract Class DatabaseSnapshot

extends Object
implements LiquibaseSerializable
Class Inheritance
All Implemented Interfaces
liquibase.serializer.LiquibaseSerializable
Known Direct Subclasses
liquibase.snapshot.EmptyDatabaseSnapshot, liquibase.snapshot.JdbcDatabaseSnapshot, liquibase.snapshot.RestoredDatabaseSnapshot
Imports
liquibase.CatalogAndSchema, .Scope, .GlobalConfiguration, liquibase.database.Database, .DatabaseConnection, .OfflineConnection, liquibase.diff.compare.CompareControl, .DatabaseObjectComparatorFactory, liquibase.exception.DatabaseException, .UnexpectedLiquibaseException, liquibase.logging.Logger, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.resource.ResourceAccessor, liquibase.serializer.LiquibaseSerializable, liquibase.structure.DatabaseObject, .DatabaseObjectCollection, liquibase.structure.core.*, liquibase.util.BooleanUtil, .ISODateFormat, .ObjectUtil, .StringUtil, java.sql.Timestamp, java.util.*, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList

Field Summary

Modifier and TypeField and Description
public static final String
private final DatabaseObjectCollection
private final Database
private final Map<Class<? extends DatabaseObject>, Set<DatabaseObject>>
private static final Logger
private Map<String, Object>
private final DatabaseObject[]
private final DatabaseObjectCollection
private final Map<String, ResultSetCache>
private CompareControl.SchemaComparison[]
private final HashSet<String>
private final SnapshotControl
private final Map<String, Object>

Constructor Summary

AccessConstructor and Description
pack-priv
DatabaseSnapshot(DatabaseObject[] examples, Database database, SnapshotControl snapshotControl)

public

Method Summary

Modifier and TypeMethod and Description
public DatabaseSnapshot

Returns:

a new DatabaseSnapshot object with the clones of the desired objects. If no object is found, an empty DatabaseSnapshot will be returned.
clone
(DatabaseObject[]
The array of snapshot objects to search and clone
examples
)

Searches the current snapshot content for the given examples.

protected SnapshotGeneratorChain
createGeneratorChain(Class<? extends DatabaseObject> databaseObjectType, Database database)

private boolean
public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType
get(DatabaseObjectType example)

Returns the object described by the passed example if it is already included in this snapshot.

public <DatabaseObjectType extends DatabaseObject> Set<DatabaseObjectType>
get(Class<DatabaseObjectType> type)

Returns all objects of the given type that are already included in this snapshot.

public Database
public Map<String, Object>
public ResultSetCache
public CompareControl.SchemaComparison[]
public Object
getScratchData(String key)
Deprecated Will be removed with 4.0

Used to get and store misc data that should be scoped to the snapshot.

public String
public Set<String>
public LiquibaseSerializable.SerializationType
public Object
public String
public String
public SnapshotControl
protected <T extends DatabaseObject> T
include(T example)

Include the object described by the passed example object in this snapshot.

private void
protected void
init(DatabaseObject[] examples)

private boolean
protected boolean
protected boolean
public void
protected void
loadObjects(Map<String, DatabaseObject> objectMap, Map<String, DatabaseObject> allObjects, ParsedNode node, ResourceAccessor resourceAccessor)

public DatabaseSnapshot

Returns:

DatabaseSnapshot Merged object model
merge
(DatabaseSnapshot
Another object snapshot model
snapshotToMerge
)

Method which merges two object snapshot models into one

private Object
replaceObject(Object fieldValue)

public ParsedNode
public void
public void
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALL_CATALOGS_STRING_SCRATCH_KEYback to summary
public static final String ALL_CATALOGS_STRING_SCRATCH_KEY
allFoundback to summary
private final DatabaseObjectCollection allFound
databaseback to summary
private final Database database
knownNullback to summary
private final Map<Class<? extends DatabaseObject>, Set<DatabaseObject>> knownNull
LOGGERback to summary
private static final Logger LOGGER
metadataback to summary
private Map<String, Object> metadata
originalExamplesback to summary
private final DatabaseObject[] originalExamples
referencedObjectsback to summary
private final DatabaseObjectCollection referencedObjects
resultSetCachesback to summary
private final Map<String, ResultSetCache> resultSetCaches
schemaComparisonsback to summary
private CompareControl.SchemaComparison[] schemaComparisons
serializableFieldsback to summary
private final HashSet<String> serializableFields
snapshotControlback to summary
private final SnapshotControl snapshotControl
snapshotScratchPadback to summary
private final Map<String, Object> snapshotScratchPad

Constructor Detail

DatabaseSnapshotback to summary
pack-priv DatabaseSnapshot(DatabaseObject[] examples, Database database, SnapshotControl snapshotControl) throws DatabaseException, InvalidExampleException
DatabaseSnapshotback to summary
public DatabaseSnapshot(DatabaseObject[] examples, Database database) throws DatabaseException, InvalidExampleException

Method Detail

cloneback to summary
public DatabaseSnapshot clone(DatabaseObject[] examples)

Searches the current snapshot content for the given examples. Returns a new DatabaseSnapshot containing a clone of every object from the examples array that was found.

Parameters
examples:DatabaseObject[]

The array of snapshot objects to search and clone

Returns:DatabaseSnapshot

a new DatabaseSnapshot object with the clones of the desired objects. If no object is found, an empty DatabaseSnapshot will be returned.

createGeneratorChainback to summary
protected SnapshotGeneratorChain createGeneratorChain(Class<? extends DatabaseObject> databaseObjectType, Database database)
descendingColumnExistsback to summary
private boolean descendingColumnExists(Collection<Column> fieldValue)
getback to summary
public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType get(DatabaseObjectType example)

Returns the object described by the passed example if it is already included in this snapshot.

getback to summary
public <DatabaseObjectType extends DatabaseObject> Set<DatabaseObjectType> get(Class<DatabaseObjectType> type)

Returns all objects of the given type that are already included in this snapshot.

getDatabaseback to summary
public Database getDatabase()
getMetadataback to summary
public Map<String, Object> getMetadata()
getResultSetCacheback to summary
public ResultSetCache getResultSetCache(String key)
getSchemaComparisonsback to summary
public CompareControl.SchemaComparison[] getSchemaComparisons()
getScratchDataback to summary
public Object getScratchData(String key)

Deprecated

Will be removed with 4.0

Used to get and store misc data that should be scoped to the snapshot. Helpful for caching snapshot results.

getSerializableFieldNamespaceback to summary
public String getSerializableFieldNamespace(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldNamespace.

Annotations
@Override
getSerializableFieldsback to summary
public Set<String> getSerializableFields()

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFields.

Annotations
@Override
getSerializableFieldTypeback to summary
public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldType.

Annotations
@Override
getSerializableFieldValueback to summary
public Object getSerializableFieldValue(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldValue.

Annotations
@Override
getSerializedObjectNameback to summary
public String getSerializedObjectName()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectName.

Annotations
@Override
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
getSnapshotControlback to summary
public SnapshotControl getSnapshotControl()
includeback to summary
protected <T extends DatabaseObject> T include(T example) throws DatabaseException, InvalidExampleException

Include the object described by the passed example object in this snapshot. Returns the object snapshot or null if the object does not exist in the database. If the same object was returned by an earlier include() call, the same object instance will be returned.

includeNestedObjectsback to summary
private void includeNestedObjects(DatabaseObject object) throws DatabaseException, InvalidExampleException, ReflectiveOperationException
initback to summary
protected void init(DatabaseObject[] examples) throws DatabaseException, InvalidExampleException
isKnownNullback to summary
private boolean isKnownNull(DatabaseObject example)
isWrongCatalogback to summary
protected boolean isWrongCatalog(DatabaseObject fieldValue)
isWrongSchemaback to summary
protected boolean isWrongSchema(DatabaseObject fieldValue)
loadback to summary
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException

Implements liquibase.serializer.LiquibaseSerializable.load.

Annotations
@Override
loadObjectsback to summary
protected void loadObjects(Map<String, DatabaseObject> objectMap, Map<String, DatabaseObject> allObjects, ParsedNode node, ResourceAccessor resourceAccessor) throws ReflectiveOperationException, ParsedNodeException
mergeback to summary
public DatabaseSnapshot merge(DatabaseSnapshot snapshotToMerge)

Method which merges two object snapshot models into one

Parameters
snapshotToMerge:DatabaseSnapshot

Another object snapshot model

Returns:DatabaseSnapshot

DatabaseSnapshot Merged object model

replaceObjectback to summary
private Object replaceObject(Object fieldValue) throws DatabaseException, InvalidExampleException, ReflectiveOperationException
serializeback to summary
public ParsedNode serialize()

Implements liquibase.serializer.LiquibaseSerializable.serialize.

Annotations
@Override
setMetadataback to summary
public void setMetadata(Map<String, Object> metadata)
setSchemaComparisonsback to summary
public void setSchemaComparisons(CompareControl.SchemaComparison[] schemaComparisons)
setScratchDataback to summary
public Object setScratchData(String key, Object data)