liquibase.change
Class AbstractChange

java.lang.Object
  extended by liquibase.change.AbstractChange
All Implemented Interfaces:
Change
Direct Known Subclasses:
AbstractSQLChange, AddAutoIncrementChange, AddColumnChange, AddDefaultValueChange, AddForeignKeyConstraintChange, AddLookupTableChange, AddNotNullConstraintChange, AddPrimaryKeyChange, AddUniqueConstraintChange, AlterSequenceChange, AnonymousChange, CreateIndexChange, CreateProcedureChange, CreateSequenceChange, CreateTableChange, CreateViewChange, CustomChangeWrapper, DeleteDataChange, DropAllForeignKeyConstraintsChange, DropColumnChange, DropDefaultValueChange, DropForeignKeyConstraintChange, DropIndexChange, DropNotNullConstraintChange, DropPrimaryKeyChange, DropSequenceChange, DropTableChange, DropUniqueConstraintChange, DropViewChange, EmptyChange, ExecuteShellCommandChange, InsertDataChange, LoadDataChange, MergeColumnChange, ModifyDataTypeChange, RenameColumnChange, RenameTableChange, RenameViewChange, StopChange, TagDatabaseChange, UpdateDataChange

public abstract class AbstractChange
extends Object
implements Change

Standard superclass for Changes to implement. This is a skeletal implementation, as defined in Effective Java#16.

See Also:
Change

Constructor Summary
protected AbstractChange(String changeName, String changeDescription, int priority)
          Constructor with tag name and name
 
Method Summary
protected  Change[] createInverses()
           
 CheckSum generateCheckSum()
          Calculates the checksum (currently MD5 hash) for the current configuration of this change.
 SqlStatement[] generateRollbackStatements(Database database)
          Generates the SQL statements required to roll back the change
 Set<DatabaseObject> getAffectedDatabaseObjects(Database database)
           
protected  ChangeLogParameters getChangeLogParameters()
           
 ChangeMetaData getChangeMetaData()
           
 ChangeSet getChangeSet()
           
 ResourceAccessor getResourceAccessor()
          Returns the FileOpen as provided by the creating ChangeLog.
 void init()
          Most Changes don't need to do any setup.
 boolean requiresUpdatedDatabaseMetadata(Database database)
          Does this change require access to the database metadata? If true, the change cannot be used in an updateSql-style command.
 void setChangeLogParameters(ChangeLogParameters changeLogParameters)
           
 void setChangeSet(ChangeSet changeSet)
           
protected  void setPriority(int newPriority)
           
 void setResourceAccessor(ResourceAccessor resourceAccessor)
          Default implementation that stores the file opener provided when the Change was created.
 boolean supports(Database database)
           
 boolean supportsRollback(Database database)
          Can this change be rolled back
 ValidationErrors validate(Database database)
           
 Warnings warn(Database database)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface liquibase.change.Change
generateStatements, getConfirmationMessage
 

Constructor Detail

AbstractChange

protected AbstractChange(String changeName,
                         String changeDescription,
                         int priority)
Constructor with tag name and name

Parameters:
changeName - the tag name for this change
changeDescription - the name for this change
Method Detail

getChangeMetaData

public ChangeMetaData getChangeMetaData()
Specified by:
getChangeMetaData in interface Change

setPriority

protected void setPriority(int newPriority)

getChangeSet

public ChangeSet getChangeSet()
Specified by:
getChangeSet in interface Change

setChangeSet

public void setChangeSet(ChangeSet changeSet)
Specified by:
setChangeSet in interface Change

requiresUpdatedDatabaseMetadata

public boolean requiresUpdatedDatabaseMetadata(Database database)
Description copied from interface: Change
Does this change require access to the database metadata? If true, the change cannot be used in an updateSql-style command.

Specified by:
requiresUpdatedDatabaseMetadata in interface Change

supports

public boolean supports(Database database)
Specified by:
supports in interface Change

warn

public Warnings warn(Database database)
Specified by:
warn in interface Change

validate

public ValidationErrors validate(Database database)
Specified by:
validate in interface Change

generateRollbackStatements

public SqlStatement[] generateRollbackStatements(Database database)
                                          throws UnsupportedChangeException,
                                                 RollbackImpossibleException
Description copied from interface: Change
Generates the SQL statements required to roll back the change

Specified by:
generateRollbackStatements in interface Change
Parameters:
database - database databasethe target Database associated to this change's rollback statements
Returns:
an array of Strings with the rollback statements
Throws:
UnsupportedChangeException - if this change is not supported by the Database passed as argument
RollbackImpossibleException - if rollback is not supported for this change
See Also:
Change.generateRollbackStatements(liquibase.database.Database)

supportsRollback

public boolean supportsRollback(Database database)
Description copied from interface: Change
Can this change be rolled back

Specified by:
supportsRollback in interface Change
Parameters:
database -
Returns:
true if rollback is supported, false otherwise
See Also:
Change.supportsRollback(liquibase.database.Database)

generateCheckSum

public CheckSum generateCheckSum()
Description copied from interface: Change
Calculates the checksum (currently MD5 hash) for the current configuration of this change.

Specified by:
generateCheckSum in interface Change
See Also:
Change.generateCheckSum()

createInverses

protected Change[] createInverses()

setResourceAccessor

public void setResourceAccessor(ResourceAccessor resourceAccessor)
Default implementation that stores the file opener provided when the Change was created.

Specified by:
setResourceAccessor in interface Change

getResourceAccessor

public ResourceAccessor getResourceAccessor()
Returns the FileOpen as provided by the creating ChangeLog.

Returns:
The file opener

init

public void init()
          throws SetupException
Most Changes don't need to do any setup. This implements a no-op

Specified by:
init in interface Change
Throws:
SetupException

getAffectedDatabaseObjects

public Set<DatabaseObject> getAffectedDatabaseObjects(Database database)
Specified by:
getAffectedDatabaseObjects in interface Change

getChangeLogParameters

protected ChangeLogParameters getChangeLogParameters()

setChangeLogParameters

public void setChangeLogParameters(ChangeLogParameters changeLogParameters)
Specified by:
setChangeLogParameters in interface Change


Copyright © 2012 Liquibase.org. All Rights Reserved.