Package com.exasol.dbbuilder.dialects
Class AbstractDatabaseObject
- java.lang.Object
-
- com.exasol.dbbuilder.dialects.AbstractDatabaseObject
-
- All Implemented Interfaces:
DatabaseObject
- Direct Known Subclasses:
AbstractSchema,AbstractSchemaChild,AbstractUser,ConnectionDefinition,VirtualSchema
public abstract class AbstractDatabaseObject extends Object implements DatabaseObject
Base class for database objects.Database objects in integration tests are in most cases owned by the TDDB. This means the TDDB created them and is also responsible for cleaning them up.
On the other hand the TDDB can also attach to objects that already exist in the database. In that case the TDDB has a control object, but does not own the database object.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDatabaseObject(com.exasol.db.Identifier name, boolean owned)Create a database object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddrop()Remove this database object from database incl.protected abstract voiddropInternally()This is called bydrop()to actually execute the DROP statement.StringgetFullyQualifiedName()Get the name including the parent object names.StringgetName()Get the name of the database object.booleanisOwned()Check whether the script is a control object for a database object that already existed in the database.protected voidmarkDeleted()Mark this object as deleted.protected voidverifyNotDeleted()Checks if this object wasdeletedand throws an exception in case it was deleted.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exasol.dbbuilder.dialects.DatabaseObject
getParent, getType, hasParent
-
-
-
-
Constructor Detail
-
AbstractDatabaseObject
protected AbstractDatabaseObject(com.exasol.db.Identifier name, boolean owned)Create a database object.- Parameters:
name- name of the database objectowned-trueif the object is owned by the TDDB,falseif the TDDB attached to a database object that already existed
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:DatabaseObjectGet the name of the database object.- Specified by:
getNamein interfaceDatabaseObject- Returns:
- object name
-
getFullyQualifiedName
public String getFullyQualifiedName()
Description copied from interface:DatabaseObjectGet the name including the parent object names.- Specified by:
getFullyQualifiedNamein interfaceDatabaseObject- Returns:
- fully qualified name
-
drop
public void drop()
Description copied from interface:DatabaseObjectRemove this database object from database incl. all contained objects and mark it as deleted. Later operations on this object will throw aDatabaseObjectDeletedExceptionException.- Specified by:
dropin interfaceDatabaseObject
-
markDeleted
protected void markDeleted()
Mark this object as deleted.
-
dropInternally
protected abstract void dropInternally()
This is called bydrop()to actually execute the DROP statement.
-
verifyNotDeleted
protected void verifyNotDeleted()
Checks if this object wasdeletedand throws an exception in case it was deleted. This method must be called before each operation that assumes the object still exists in the database.
-
isOwned
public boolean isOwned()
Description copied from interface:DatabaseObjectCheck whether the script is a control object for a database object that already existed in the database.- Specified by:
isOwnedin interfaceDatabaseObject- Returns:
trueif this is a control object attached to an existing database object
-
-