public abstract class BundleDDLGenerator<T extends DDLType> extends TokenDDLGenerator<T>
If the a key in a bundle is of the form:
TYPE.ACTION.DDLTYPE
TABLE.CREATE.TAB
or SEQUENCE.ALTER.SEQ
getDDLType(java.lang.String)
method which should return a
DDLType appropriate to this generator.
TYPE.ACTION.DDLTYPE.1
GLOBAL.myToken
myToken
can then be reused in token code globally. If
myToken
is an object type (e.g. COLUMN
) that
registers a global token against that object type.
When processing the entries of the resoure bundle, if any key contains two
"."s and doesn't match a type, action or ddltype a
severe
message will be logged on the
logger
.
Constructor and Description |
---|
BundleDDLGenerator(java.lang.Class<? extends Database> databaseClass,
DBObjectProvider pro,
java.lang.String... resourceNames)
Note the second parameter is a DBObjectProvider, not a Database.
|
BundleDDLGenerator(DBObjectProvider pro,
java.lang.String... resourceNames)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBundles(java.util.ResourceBundle... bundles)
Adds the given bundles to this generator.
|
protected void |
addResourceNames(java.lang.String... resourceNames)
Adds the given resource names to this generator.
|
protected DDL |
append(DDL ddl1,
DDL ddl2)
Appends the two ddls together and returns the result coping with either
being null.
|
protected boolean |
canCreate(java.lang.Class<? extends SystemObject> objClass,
java.lang.String prop)
Tests whether the given property is supported for create on the given
object type.
|
protected void |
copyGenerators(oracle.javatools.db.ddl.DDLGeneratorImpl other,
java.lang.String type,
boolean incAlter)
Copies the ddl generators for the given object type from this generator
to another generator implementation.
|
protected java.lang.String |
findResource(java.lang.String key) |
protected DDL<T> |
finish(DDLOptions options,
DDL<T> ddl)
This method is called on every DDL created before it is returned.
|
DDL<T> |
getCreateDDL(DDLOptions options,
DBObject... objects)
Gets CREATE statements for the given objects.
|
Ddl |
getCreateDDL(Schema schema)
Deprecated.
|
Ddl |
getCreateDDL(SchemaObject[] objects,
boolean replace,
boolean cascade)
Deprecated.
|
Ddl |
getCreateDDL(SchemaObject obj,
boolean replace,
boolean cascade)
Deprecated.
|
protected DDL<T> |
getCreateDDLImpl(DDLOptions options,
DBObject... objects) |
protected abstract T |
getDDLType(java.lang.String type)
Implement in subclasses to return the right DDLType implementation for the
given string.
|
DDL<T> |
getDeleteDDL(DDLOptions options,
DBObject... objects)
Gets DROP statements for the given objects.
|
Ddl |
getDeleteDDL(Schema schema,
boolean cascade)
Deprecated.
|
Ddl |
getDeleteDDL(SchemaObject[] objects,
boolean cascade)
Deprecated.
|
Ddl |
getDeleteDDL(SchemaObject object,
boolean cascade)
Deprecated.
|
protected DDL<T> |
getDeleteDDLImpl(DDLOptions options,
DBObject... objects) |
protected java.lang.Class<? extends DBObjectProvider> |
getProviderClass()
Gets the provider class for the property support to test properties
against.
|
DDL<T> |
getUndeleteDDL(DDLOptions options,
DBObject... objects)
Gets statements to undelete (e.g.
|
DDL<T> |
getUpdateDDL(DDLOptions options,
Difference resultSet)
Gets ALTER statements for the given objects where possible, or DROP/CREATE,
or CREATE AND REPLACE where appropriate/necessary.
|
Ddl[] |
getUpdateDDL(Difference resultSet,
boolean replace,
boolean cascade)
Deprecated.
|
Ddl[] |
getUpdateDDL(SchemaObject[] oldObjects,
SchemaObject[] newObjects)
Deprecated.
|
Ddl[] |
getUpdateDDL(SchemaObject oldObject,
SchemaObject newObject)
Deprecated.
|
protected DDL<T> |
getUpdateDDLImpl(DDLOptions options,
Difference rs)
Gets the update DDL for the given Difference.
|
protected void |
registerAlterGenerator(java.lang.String type,
AlterDDLGenerator deletor) |
protected void |
registerBundleAlterDDL(java.lang.String type,
java.lang.String resName,
T ddlType)
Registers alter DDL code from the ResourceBundle by the resource name
of the code in that bundle.
|
protected void |
registerBundleCreateDDL(java.lang.String type,
java.lang.String resName,
T ddlType)
Registers create DDL code from the ResourceBundle by the resource name
of the code in that bundle.
|
protected void |
registerBundleDropDDL(java.lang.String type,
java.lang.String resName,
T ddlType)
Registers drop DDL code from the ResourceBundle by the resource name
of the code in that bundle.
|
protected void |
registerBundleEntry(java.lang.String key,
java.lang.String code)
Registers an entry from an underlying bundle (or property file).
|
protected void |
registerBundleTokens()
Registers all the tokens in the underyling resource bundles.
|
protected void |
registerBundleUndeleteDDL(java.lang.String type,
java.lang.String resName,
T ddlType)
Registers undelete DDL code from the ResourceBundle by the resource name
of the code in that bundle.
|
protected void |
registerCreateGenerator(java.lang.String type,
CreateDDLGenerator creator) |
protected void |
registerDropGenerator(java.lang.String type,
DropDDLGenerator dropper) |
protected void |
registerTopLevelChild(java.lang.String type,
java.lang.String propPath,
java.lang.String childType)
Registers a child object property, that can be treated as a top level
object in the ddl, and therefore when encountered the generator should
recurse onto the object.
|
protected void |
registerUndeleteGenerator(java.lang.String type,
UndeleteDDLGenerator undeletor) |
boolean |
supportsAction(java.lang.String type,
PropertyAction.Type actionType)
Asks whether a given action is supported for the specified object type
in this provider.
|
boolean |
supportsProperty(java.lang.Class<? extends DBObject> objClz,
java.lang.String prop)
Tests whether the given property is supported for the given object type.
|
PropertyAction |
supportsPropertyChange(java.lang.Class<? extends SystemObject> objClass,
java.lang.String prop)
Tests whether the given property can be changed on the given system
object type.
|
createDDL, createUpdateDDL, getAllowedPropertyValues, getDDLFragment, includeSyntax, registerAlterDDL, registerCreateDDL, registerDropDDL, registerTokenGenerator, registerUndeleteDDL
canAlterProperty, canChangeProperty, canChangeWithAlter, canChangeWithReplace, canCreate, canCreate, canCreateProperty, canUpdateObject, canUpdateObject, findPropertyInfo, getAllowedReferenceParentTypes, getAllowedReferenceTypes, getAllowedReferenceTypes, getAllowedReferenceTypes, getDelegate, getImplicitDefaultValue, getLogger, getNullBehaviour, getNullBehaviour, getPropertyHelper, getProvider, getRestrictingProperties, isProcessorProperty, supportsProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canAlterProperty, canChangeProperty, canCreateProperty, canUpdateObject, canUpdateObject, findPropertyInfo, getAllowedReferenceParentTypes, getAllowedReferenceTypes, getAllowedReferenceTypes, getAllowedReferenceTypes, getImplicitDefaultValue, getNullBehaviour, getRestrictingProperties, supportsProperty
@Deprecated public BundleDDLGenerator(DBObjectProvider pro, java.lang.String... resourceNames)
BundleDDLGenerator(Class,DBObjectProvider,String[])
BundleDDLGenerator(Class,DBObjectProvider,String[])
to
provide the database class which this DDLGenerator is designed for
(which might not be pro.getClass()
).java.lang.NullPointerException
- if pro is null - to use a null
provider you must provide a Class extends Database> using the
new constructor.java.lang.ClassCastException
- if this constructor is used with a
non-Database DBObjectProvider (as subclasses must be switched to the
new constructor).public BundleDDLGenerator(java.lang.Class<? extends Database> databaseClass, DBObjectProvider pro, java.lang.String... resourceNames)
If the resourceNames parameter is non-null this will call
addResourceNames(java.lang.String...)
and therefore initialise the generator. If
resourceNames is omitted, addResourceNames(java.lang.String...)
or
addBundles(java.util.ResourceBundle...)
must be called for the generator to function.
dbClz
- the Database implementation that this DDLGenerator
produces syntax for. When constructed by a DatabaseDescriptor this
is simply
getDatabaseClass()
.pro
- the provider for this generator to use for name
externalisation etc.bundles
- either Strings (for properties files) or ResourceBundles
that contains the ddl token syntax.protected void addResourceNames(java.lang.String... resourceNames)
addBundles(java.util.ResourceBundle...)
should be called only once for a
given generator to avoid duplicate registration of resources.resourceNames
- the names of properties files containing the resourcesprotected void addBundles(java.util.ResourceBundle... bundles)
addResourceNames(java.lang.String...)
should be called only once for a given generator to avoid duplicate
registration of resources.bundles
- the ResourceBundles containing the ddl token strings.protected final java.lang.String findResource(java.lang.String key)
protected final void registerBundleTokens()
protected void registerBundleEntry(java.lang.String key, java.lang.String code)
key
- code
- protected abstract T getDDLType(java.lang.String type)
protected final void registerBundleCreateDDL(java.lang.String type, java.lang.String resName, T ddlType)
protected final void registerBundleDropDDL(java.lang.String type, java.lang.String resName, T ddlType)
protected final void registerBundleUndeleteDDL(java.lang.String type, java.lang.String resName, T ddlType)
protected final void registerBundleAlterDDL(java.lang.String type, java.lang.String resName, T ddlType)
protected final void registerCreateGenerator(java.lang.String type, CreateDDLGenerator creator)
protected final void registerDropGenerator(java.lang.String type, DropDDLGenerator dropper)
protected final void registerAlterGenerator(java.lang.String type, AlterDDLGenerator deletor)
protected final void registerUndeleteGenerator(java.lang.String type, UndeleteDDLGenerator undeletor)
protected final void copyGenerators(oracle.javatools.db.ddl.DDLGeneratorImpl other, java.lang.String type, boolean incAlter)
other
- the ddl generator to copy syntax totype
- the object type to copyincAlter
- whether to include alter ddl statements, or just create
and drop.protected final void registerTopLevelChild(java.lang.String type, java.lang.String propPath, java.lang.String childType)
type
- the parent object type (e.g. Table.TYPE
)propPath
- the path to the child property (e.g. indexes
)childType
- the child object type that can be treated in its own right
in the ddl generator (e.g. Index.TYPE
)protected DDL<T> getCreateDDLImpl(DDLOptions options, DBObject... objects)
protected DDL<T> getDeleteDDLImpl(DDLOptions options, DBObject... objects)
public DDL<T> getUndeleteDDL(DDLOptions options, DBObject... objects)
DDLGenerator
protected DDL<T> getUpdateDDLImpl(DDLOptions options, Difference rs)
options
- the options for generationrs
- the Difference for the object to alterprotected boolean canCreate(java.lang.Class<? extends SystemObject> objClass, java.lang.String prop)
AbstractPropertyManager
objClass
- the SystemObject subclass the property is defined
against.prop
- the property (or property path) to testpublic boolean supportsProperty(java.lang.Class<? extends DBObject> objClz, java.lang.String prop)
PropertyManager
supportsProperty
in interface PropertyManager
supportsProperty
in class AbstractPropertyManager
objClz
- the object class (e.g. Table.class or Column.class ).prop
- the property name / path.public boolean supportsAction(java.lang.String type, PropertyAction.Type actionType)
PropertyManager
supportsAction
in interface PropertyManager
public PropertyAction supportsPropertyChange(java.lang.Class<? extends SystemObject> objClass, java.lang.String prop)
PropertyManager
If the property is a child property, and ALTER is supported then the
action may contain child information (e.g. whether children can be
added/removed/modified) via the supportsChildAction
method.
supportsPropertyChange
in interface PropertyManager
supportsPropertyChange
in class AbstractPropertyManager
objClass
- the type of system object to testprop
- the property (can be a path) that we want to changePropertyAction.supportsChildAction(oracle.javatools.db.property.PropertyAction.ChildAction)
protected java.lang.Class<? extends DBObjectProvider> getProviderClass()
AbstractPropertyManager
getProviderClass
in class AbstractPropertyManager
public final DDL<T> getCreateDDL(DDLOptions options, DBObject... objects)
DDLGenerator
getCreateDDL
in interface DDLGenerator<T extends DDLType>
public final DDL<T> getDeleteDDL(DDLOptions options, DBObject... objects)
DDLGenerator
getDeleteDDL
in interface DDLGenerator<T extends DDLType>
public final DDL<T> getUpdateDDL(DDLOptions options, Difference resultSet)
DDLGenerator
getUpdateDDL
in interface DDLGenerator<T extends DDLType>
protected DDL<T> finish(DDLOptions options, DDL<T> ddl)
options
- the options for the current generationddl
- the ddl we've generated and are about to return - can be
nullprotected DDL append(DDL ddl1, DDL ddl2)
@Deprecated public final Ddl getCreateDDL(SchemaObject obj, boolean replace, boolean cascade)
@Deprecated public final Ddl getCreateDDL(SchemaObject[] objects, boolean replace, boolean cascade)
@Deprecated public final Ddl getDeleteDDL(SchemaObject object, boolean cascade)
@Deprecated public final Ddl getDeleteDDL(SchemaObject[] objects, boolean cascade)
@Deprecated public final Ddl[] getUpdateDDL(SchemaObject oldObject, SchemaObject newObject)
@Deprecated public final Ddl[] getUpdateDDL(SchemaObject[] oldObjects, SchemaObject[] newObjects)
@Deprecated public final Ddl[] getUpdateDDL(Difference resultSet, boolean replace, boolean cascade)