|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.javatools.db.DatabaseDescriptor<T>
public abstract class DatabaseDescriptor<T extends Database>
Interface used to describe the behaviour of a Database. This class abstracts out any behaviour from Database that does not require a physical connection.
DatabaseFactory.getDatabaseDescriptor(Class)
, DBObjectProvider.getDescriptor()
Field Summary | |
---|---|
static java.lang.String |
FEATURE_BITMAP_INDEXING |
static java.lang.String |
FEATURE_COLUMN_SEQUENCES |
static java.lang.String |
FEATURE_FREEPOOLS |
static java.lang.String |
FEATURE_GLOBAL_HASH_INDEX_PARTITIONING |
static java.lang.String |
FEATURE_LOB_PARAMETERS |
static java.lang.String |
FEATURE_MAXTRANS |
static java.lang.String |
FEATURE_RETENTION |
static java.lang.String |
FEATURE_STORAGE_OPTIONS |
static java.lang.String |
FEATURE_TABLE_PARTITIONING |
static java.lang.String |
FEATURE_XMLTYPE_COL_PROPS |
Constructor Summary | |
---|---|
protected |
DatabaseDescriptor(java.lang.Class<? extends T> clz) |
protected |
DatabaseDescriptor(DatabaseDescriptor base) |
Method Summary | |
---|---|
DataTypeUsage |
createDefaultTypeUsage() Creates a default usage of a data type for use in a new Column, PlSqlMethod etc. |
protected DatabaseDescriptor |
getBaseDescriptor() If this descriptor is a customisation of a base descriptor, this method returns that base descriptor. |
abstract int |
getCasePolicy() Returns the case policy for unquoted names of the Database being described |
protected java.lang.Class<? extends T> |
getDatabaseClass() Implementations must return the database class they are describing here for the data type support to work. |
abstract java.lang.String |
getDatabaseType() Gets a String representing the type of database. |
abstract int |
getDatabaseVersion() Gets an int representing the version of the database type. |
DataType |
getDataType(java.lang.String typeName) Gets the datatype with given name. |
DDLGenerator |
getDDLGenerator(DBObjectProvider pro) Gets a DDLGenerator that will generate DDL for the type of Database represented by this descriptor, setup to work with the given provider. |
java.lang.String |
getExternalName(java.lang.String name, java.lang.String objectType) Converts the specified name into the format used externally to represent the identifier. |
abstract java.util.List<PropertyInitializer> |
getExternalPropertyDefaulters(DBObjectProvider pro) Gets a list of PropertyInitializers responsible for defining the default value for properties when generated to an external database represented by the given provider. |
java.nio.charset.Charset |
getIdeCharset() |
abstract java.lang.String |
getIdentifierQuoteString() Returns the identifier quote string for the Database being described. |
java.lang.String |
getInternalName(java.lang.String name, java.lang.String objectType) Converts the specified name into the format used internally within the metadata. |
abstract int |
getMaxNameLength(java.lang.String type) Returns the maximum length for a name of the given type . |
abstract java.util.List<PropertyInitializer> |
getPropertyInitializers(DBObjectProvider pro) Gets a list of PropertyInitializers responsible for defining the initial value for properties in the given provider. |
int |
getQuotedNameCasePolicy() Returns the case policy for quoted names of the Database being described. |
SQLQueryBuilderFactory |
getSQLQueryBuilderFactory() Gets the SQLQueryBuilderFactory implementation for creating a SQLQueryBuilder for this database type. |
abstract java.util.Map<java.lang.String,DBObjectValidator> |
getValidators(DBObjectProvider pro) Gets a map of object type (e.g. |
abstract boolean |
isCompatibleUpgrade(java.lang.Class<? extends Database> dbClz, java.lang.Class<? extends Database> testClz) Returns true if the given testClz is a compatible upgrade path for a user of the given dbClz. |
boolean |
isValidFKDataType(DataType fktype, DataType reftype) Assesses if the datatype of a foreign key column is valid given the datatype of the column which it references. |
protected boolean |
isValidFKDataTypeImpl(DataType fktype, DataType reftype) |
boolean |
isValidName(java.lang.String type, java.lang.String name) Checks to see whether a name is valid. |
java.util.Collection<java.lang.String> |
listPreferredDataTypeNames() Override to provide the names of the prefered types for the described database. |
java.util.Collection<DataType> |
listPreferredDataTypes() Lists the preferred datatypes of this provider. |
java.util.Collection<DataType> |
listSupportedDataTypes() Lists the datatypes supported by the described database type. |
abstract void |
makeNameValidAndUnique(DBObject object, DBObjectProvider pro) Attempts to set a valid unique name for the given object. |
protected boolean |
needsQuoting(java.lang.String internalName) Determines whether internalName needs quoting to make it a valid external name. |
java.lang.String |
quoteIdentifier(java.lang.String internalName, boolean force) Determines if internalName needs quoting to make it a valid external name, and if so returns a quoted copy of it. |
void |
setIdeCharset(java.nio.charset.Charset charSet) |
boolean |
supportsFeature(java.lang.String feature) Returns true if feature is supported by the Database described by this DatabaseDescriptor. |
void |
validateEncoding(java.lang.String string, java.lang.Object property) Tests whether the given string is encoded property for the given property. |
static void |
validateIdentifier(java.lang.String identifier, char quoter, int maxLength, java.lang.String allowedChars, boolean alphaStart, java.util.Set reservedWords, int casePolicy) Validates that name is a valid external name such that : If the name is unquoted (does not start with quoter ), it only contains alphanumeric and allowedChars characters. If the name is unquoted, and alphaStart is true, it starts with a letter. If the name is unquoted, it does not contain any reservedWords . If the name is quoted (starts with quoter ), it is correctly quoted, and does not include any excludedChars . If the name is quoted, and quoter is not in excludedChars , that any occurences of quoter are escaped (doubled-up). The name does not exceed maxLength, taking quotes into account. Used by the more specific validate*Identifier() methods on the Database implementations. |
static void |
validateIdentifier(java.lang.String identifier, char quoter, int maxLength, java.lang.String allowedChars, java.lang.String excludedChars, boolean alphaStart, java.util.Set reservedWords, int casePolicy) Validates that name is a valid external name such that : If the name is unquoted (does not start with quoter ), it only contains alphanumeric and allowedChars characters. If the name is unquoted, and alphaStart is true, it starts with a letter. If the name is unquoted, it does not contain any reservedWords . If the name is quoted (starts with quoter ), it is correctly quoted, and does not include any excludedChars . If the name is quoted, and quoter is not in excludedChars , that any occurences of quoter are escaped (doubled-up). The name does not exceed maxLength, taking quotes into account. Used by the more specific validate*Identifier() methods on the Database implementations. |
abstract void |
validateName(java.lang.String type, java.lang.String name) Validates the given object name and throws an InvalidNameExcpetion if it isn't valid for the Database being described. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FEATURE_TABLE_PARTITIONING
public static final java.lang.String FEATURE_GLOBAL_HASH_INDEX_PARTITIONING
public static final java.lang.String FEATURE_COLUMN_SEQUENCES
public static final java.lang.String FEATURE_STORAGE_OPTIONS
public static final java.lang.String FEATURE_BITMAP_INDEXING
public static final java.lang.String FEATURE_LOB_PARAMETERS
public static final java.lang.String FEATURE_RETENTION
public static final java.lang.String FEATURE_FREEPOOLS
public static final java.lang.String FEATURE_MAXTRANS
public static final java.lang.String FEATURE_XMLTYPE_COL_PROPS
Constructor Detail |
---|
protected DatabaseDescriptor(java.lang.Class<? extends T> clz)
protected DatabaseDescriptor(DatabaseDescriptor base)
Method Detail |
---|
protected final java.lang.Class<? extends T> getDatabaseClass()
public abstract java.lang.String getDatabaseType()
public abstract int getDatabaseVersion()
protected DatabaseDescriptor getBaseDescriptor()
public void setIdeCharset(java.nio.charset.Charset charSet)
public java.nio.charset.Charset getIdeCharset()
public abstract boolean isCompatibleUpgrade(java.lang.Class<? extends Database> dbClz, java.lang.Class<? extends Database> testClz)
e.g. if testClz is Oracle9i and dbClz is Oracle11g this will return true because 11g is an upgrade to 9i.
This will only work reliably if called on the descriptor appropriate to dbClz (i.e. returned by DatabaseFactory.getDatabaseDescriptor(Class)
;
dbClz
- the current database classtestClz
- the class to test as a compatible upgradepublic final boolean isValidName(java.lang.String type, java.lang.String name)
name
- the name to checkpublic abstract void validateName(java.lang.String type, java.lang.String name) throws InvalidNameException
InvalidNameException
DBObjectProvider.getExternalName(java.lang.String)
, DBObjectProvider.getInternalName(java.lang.String)
public abstract int getCasePolicy()
AbstractDBObjectProvider.LOWER_CASE_NAME_POLICY
, AbstractDBObjectProvider.MIXED_CASE_NAME_POLICY
, AbstractDBObjectProvider.UPPER_CASE_NAME_POLICY
, AbstractDBObjectProvider.CASE_SENSITIVE_NAME_POLICY
public int getQuotedNameCasePolicy()
AbstractDBObjectProvider.LOWER_CASE_NAME_POLICY
, AbstractDBObjectProvider.MIXED_CASE_NAME_POLICY
, AbstractDBObjectProvider.UPPER_CASE_NAME_POLICY
, AbstractDBObjectProvider.CASE_SENSITIVE_NAME_POLICY
public abstract java.lang.String getIdentifierQuoteString()
public abstract int getMaxNameLength(java.lang.String type)
type
.public boolean supportsFeature(java.lang.String feature)
feature
- : name of featurepublic void validateEncoding(java.lang.String string, java.lang.Object property) throws ValidationException
string
- the string to testproperty
- the property identifier that the string is a value forValidationException
- if the encoding is invalidprotected boolean needsQuoting(java.lang.String internalName)
internalName
-public java.lang.String quoteIdentifier(java.lang.String internalName, boolean force) throws DBException
internalName
-force
- Always quote the nameDBException
public java.lang.String getInternalName(java.lang.String name, java.lang.String objectType)
name
- a String containing the name to convertobjectType
- the type of object the name is forpublic java.lang.String getExternalName(java.lang.String name, java.lang.String objectType)
quoteIdentifier
, specifying false
for the force argument. Note, however, that exceptions are not thrown; rather, the original name will be returned.name
- a String containing the name to externalizepublic abstract java.util.Map<java.lang.String,DBObjectValidator> getValidators(DBObjectProvider pro)
public abstract java.util.List<PropertyInitializer> getPropertyInitializers(DBObjectProvider pro)
public abstract java.util.List<PropertyInitializer> getExternalPropertyDefaulters(DBObjectProvider pro)
public DDLGenerator getDDLGenerator(DBObjectProvider pro)
Note the parameter is a DBObjectProvider. All DDLGenerator implementations must be instantiable with a DBObjectProvider so that generic features (like the offline database) can leverage DDL generation for all supported databases.
pro
- the provider to initialise the DDLGenerator withpublic SQLQueryBuilderFactory getSQLQueryBuilderFactory()
SQLQueryBuilder
for this database type.public java.util.Collection<DataType> listSupportedDataTypes()
public final java.util.Collection<DataType> listPreferredDataTypes()
public java.util.Collection<java.lang.String> listPreferredDataTypeNames()
listPreferredDataTypes()
public DataTypeUsage createDefaultTypeUsage()
listPreferredDataTypes()
returns any types, this will be a usage of the first type in that list. Otherwise a VARCHAR or CHAR type will be searched for and a usage of that returned.public DataType getDataType(java.lang.String typeName)
typeName
- the type to getpublic final boolean isValidFKDataType(DataType fktype, DataType reftype)
fktype
- the datatype of the column in the foreign keyreftype
- the datatype of the column in the parent table's referenced constraintprotected boolean isValidFKDataTypeImpl(DataType fktype, DataType reftype)
public static void validateIdentifier(java.lang.String identifier, char quoter, int maxLength, java.lang.String allowedChars, java.lang.String excludedChars, boolean alphaStart, java.util.Set reservedWords, int casePolicy) throws InvalidNameException
quoter
), it only contains alphanumeric and allowedChars
characters.alphaStart
is true, it starts with a letter.reservedWords
.quoter
), it is correctly quoted, and does not include any excludedChars
.quoter
is not in excludedChars
, that any occurences of quoter
are escaped (doubled-up).identifier
- the external name to checkquoter
- the quote string (e.g. " )maxLength
- the maximum length a name can be (not including quotes)allowedChars
- characters that are allowed in an unquoted identifier (aswell as alphanumerics)excludedChars
- characters that are not allowed in quoted identifiers.alphaStart
- whether to enforce that the unquoted identifiers must start with an alphabet character.reservedWords
- Set of words that are reserved in the databasecasePolicy
- the case policy to useInvalidNameException
- with an appropriate message if the identifier isn't valid.public static void validateIdentifier(java.lang.String identifier, char quoter, int maxLength, java.lang.String allowedChars, boolean alphaStart, java.util.Set reservedWords, int casePolicy) throws InvalidNameException
quoter
), it only contains alphanumeric and allowedChars
characters.alphaStart
is true, it starts with a letter.reservedWords
.quoter
), it is correctly quoted, and does not include any excludedChars
.quoter
is not in excludedChars
, that any occurences of quoter
are escaped (doubled-up).identifier
- the external name to checkquoter
- the quote string (e.g. " )maxLength
- the maximum length a name can be (not including quotes)allowedChars
- characters that are allowed in an unquoted identifier (aswell as alphanumerics)alphaStart
- whether to enforce that the unquoted identifiers must start with an alphabet character.reservedWords
- Set of words that are reserved in the databasecasePolicy
- the case policy to useInvalidNameException
- with an appropraite message if the identifier isn't valid.public abstract void makeNameValidAndUnique(DBObject object, DBObjectProvider pro) throws InvalidNameException
InvalidNameException
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |