ca.sqlpower.architect.ddl
Class ConflictResolver

java.lang.Object
  extended by ca.sqlpower.architect.ddl.ConflictResolver
All Implemented Interfaces:
ca.sqlpower.util.Monitorable

public class ConflictResolver
extends java.lang.Object
implements ca.sqlpower.util.Monitorable

A ConflictResolver performs "seek" and "destroy" operations on objects in existing databases whose names conflict with the execution of a DDL script.

To use a conflict resolver, just use the public constructor to point it at an existing database and give it your DDL script. After that, you must call findConflicts() to set up the internal state of the object. Finally, you can then examine the conflicts that were found, and choose to run the dropConflicting() method.

Author:
fuerth

Nested Class Summary
 class ConflictResolver.Conflict
          A Conflict represents an existing database object which needs to be removed for some operation to continue.
 
Constructor Summary
ConflictResolver(SQLDatabase target, DDLGenerator ddlg, java.util.List ddlStatements)
          Creates a new ConflictResolver.
 
Method Summary
 void aboutToCallDropConflicting()
           
 void dropConflicting()
          Drops the conflicting objects which findConflicting() found in the target database.
 void findConflicting()
          Searches for objects in the database pointed to by con that would conflict with the execution of any of the given DDL statements.
 java.lang.Integer getJobSize()
           
 java.lang.String getLastSQLStatement()
           
 java.lang.String getMessage()
           
 int getProgress()
           
 boolean hasStarted()
           
 boolean isCancelled()
          Not implemented.
 boolean isEmpty()
           
 boolean isFinished()
           
 void setCancelled(boolean cancelled)
          Not implemented.
 java.lang.String toConflictTree()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConflictResolver

public ConflictResolver(SQLDatabase target,
                        DDLGenerator ddlg,
                        java.util.List ddlStatements)
Creates a new ConflictResolver. You should call findConflicting() after you get this new object.

Method Detail

aboutToCallDropConflicting

public void aboutToCallDropConflicting()

findConflicting

public void findConflicting()
                     throws java.sql.SQLException,
                            ArchitectException
Searches for objects in the database pointed to by con that would conflict with the execution of any of the given DDL statements.

Throws:
ArchitectException
java.sql.SQLException

dropConflicting

public void dropConflicting()
                     throws java.sql.SQLException,
                            ArchitectException
Drops the conflicting objects which findConflicting() found in the target database.

Throws:
java.sql.SQLException
ArchitectException

isEmpty

public boolean isEmpty()
Returns:
True if and only if no conflicts were found.

toConflictTree

public java.lang.String toConflictTree()
Returns:
A multi-line String representation of the conflicting objects.

getLastSQLStatement

public java.lang.String getLastSQLStatement()
Returns:
The text of the SQL statement most recently attempted by this class.

getProgress

public int getProgress()
Specified by:
getProgress in interface ca.sqlpower.util.Monitorable

getJobSize

public java.lang.Integer getJobSize()
Specified by:
getJobSize in interface ca.sqlpower.util.Monitorable

isFinished

public boolean isFinished()
Specified by:
isFinished in interface ca.sqlpower.util.Monitorable

setCancelled

public void setCancelled(boolean cancelled)
Not implemented. Throws a RuntimeException when called.

Specified by:
setCancelled in interface ca.sqlpower.util.Monitorable

isCancelled

public boolean isCancelled()
Not implemented. Always returns false.

Specified by:
isCancelled in interface ca.sqlpower.util.Monitorable

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface ca.sqlpower.util.Monitorable

hasStarted

public boolean hasStarted()
Specified by:
hasStarted in interface ca.sqlpower.util.Monitorable
Returns:
Returns the hasStarted.


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca