liquibase.snapshot
Class DatabaseSnapshot

java.lang.Object
  extended by liquibase.snapshot.DatabaseSnapshot
All Implemented Interfaces:
LiquibaseSerializable
Direct Known Subclasses:
EmptyDatabaseSnapshot, JdbcDatabaseSnapshot, RestoredDatabaseSnapshot

public abstract class DatabaseSnapshot
extends Object
implements LiquibaseSerializable


Nested Class Summary
 
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
 
Field Summary
 
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
 
Constructor Summary
DatabaseSnapshot(DatabaseObject[] examples, Database database)
           
 
Method Summary
 DatabaseSnapshot clone(DatabaseObject[] examples)
           
protected  SnapshotGeneratorChain createGeneratorChain(Class<? extends DatabaseObject> databaseObjectType, Database database)
           
<DatabaseObjectType extends DatabaseObject>
Set<DatabaseObjectType>
get(Class<DatabaseObjectType> type)
          Returns all objects of the given type that are already included in this snapshot.
<DatabaseObjectType extends DatabaseObject>
DatabaseObjectType
get(DatabaseObjectType example)
          Returns the object described by the passed example if it is already included in this snapshot.
 Database getDatabase()
           
 Map<String,Object> getMetadata()
           
 liquibase.snapshot.ResultSetCache getResultSetCache(String key)
           
 CompareControl.SchemaComparison[] getSchemaComparisons()
           
 Object getScratchData(String key)
          Deprecated. Will be removed with 4.0
 String getSerializableFieldNamespace(String field)
           
 Set<String> getSerializableFields()
           
 LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
           
 Object getSerializableFieldValue(String field)
           
 String getSerializedObjectName()
           
 String getSerializedObjectNamespace()
           
 SnapshotControl getSnapshotControl()
           
protected
<T extends DatabaseObject>
T
include(T example)
          Include the object described by the passed example object in this snapshot.
protected  void init(DatabaseObject[] examples)
           
protected  boolean isWrongSchema(DatabaseObject fieldValue)
           
 void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor)
           
protected  void loadObjects(Map<String,DatabaseObject> objectMap, Map<String,DatabaseObject> allObjects, ParsedNode node, ResourceAccessor resourceAccessor)
           
 ParsedNode serialize()
           
 void setMetadata(Map<String,Object> metadata)
           
 void setSchemaComparisons(CompareControl.SchemaComparison[] schemaComparisons)
           
 Object setScratchData(String key, Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseSnapshot

public DatabaseSnapshot(DatabaseObject[] examples,
                        Database database)
                 throws DatabaseException,
                        InvalidExampleException
Throws:
DatabaseException
InvalidExampleException
Method Detail

init

protected void init(DatabaseObject[] examples)
             throws DatabaseException,
                    InvalidExampleException
Throws:
DatabaseException
InvalidExampleException

clone

public DatabaseSnapshot clone(DatabaseObject[] examples)

getSnapshotControl

public SnapshotControl getSnapshotControl()

getSerializedObjectName

public String getSerializedObjectName()
Specified by:
getSerializedObjectName in interface LiquibaseSerializable

getSerializedObjectNamespace

public String getSerializedObjectNamespace()
Specified by:
getSerializedObjectNamespace in interface LiquibaseSerializable

getSerializableFieldNamespace

public String getSerializableFieldNamespace(String field)
Specified by:
getSerializableFieldNamespace in interface LiquibaseSerializable

getSerializableFields

public Set<String> getSerializableFields()
Specified by:
getSerializableFields in interface LiquibaseSerializable

getSerializableFieldValue

public Object getSerializableFieldValue(String field)
Specified by:
getSerializableFieldValue in interface LiquibaseSerializable

getSerializableFieldType

public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
Specified by:
getSerializableFieldType in interface LiquibaseSerializable

getDatabase

public Database getDatabase()

getResultSetCache

public liquibase.snapshot.ResultSetCache getResultSetCache(String key)

include

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.

Throws:
DatabaseException
InvalidExampleException

isWrongSchema

protected boolean isWrongSchema(DatabaseObject fieldValue)

get

public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType get(DatabaseObjectType example)
Returns the object described by the passed example if it is already included in this snapshot.


get

public <DatabaseObjectType extends DatabaseObject> Set<DatabaseObjectType> get(Class<DatabaseObjectType> type)
Returns all objects of the given type that are already included in this snapshot.


createGeneratorChain

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

load

public void load(ParsedNode parsedNode,
                 ResourceAccessor resourceAccessor)
          throws ParsedNodeException
Specified by:
load in interface LiquibaseSerializable
Throws:
ParsedNodeException

loadObjects

protected void loadObjects(Map<String,DatabaseObject> objectMap,
                           Map<String,DatabaseObject> allObjects,
                           ParsedNode node,
                           ResourceAccessor resourceAccessor)
                    throws ClassNotFoundException,
                           InstantiationException,
                           IllegalAccessException,
                           ParsedNodeException
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
ParsedNodeException

serialize

public ParsedNode serialize()
Specified by:
serialize in interface LiquibaseSerializable

getScratchData

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.


setScratchData

public Object setScratchData(String key,
                             Object data)

setSchemaComparisons

public void setSchemaComparisons(CompareControl.SchemaComparison[] schemaComparisons)

getSchemaComparisons

public CompareControl.SchemaComparison[] getSchemaComparisons()

getMetadata

public Map<String,Object> getMetadata()

setMetadata

public void setMetadata(Map<String,Object> metadata)


Copyright © 2016 Liquibase.org. All rights reserved.