|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.store.AbstractIdentifierFactory
org.jpox.store.rdbms.sqlidentifier.AbstractRDBMSIdentifierFactory
public abstract class AbstractRDBMSIdentifierFactory
Abstract representation of an identifier factory for RDBMS datastores. To be extended to generate the identifiers.
| Field Summary | |
|---|---|
protected java.util.Map |
candidates
|
protected java.util.Map |
columns
|
protected java.lang.String |
defaultCatalogName
Default catalog name for any created identifiers. |
protected java.lang.String |
defaultSchemaName
Default schema name for any created identifiers. |
protected java.util.Map |
foreignkeys
|
protected java.util.Map |
indexes
|
protected java.util.Map |
primarykeys
|
protected RDBMSAdapter |
rdba
Convenience RDBMSAdapter variable to save casting. |
protected java.util.Map |
references
|
protected java.util.Map |
sequences
|
protected java.util.Map |
tables
|
protected java.lang.String |
wordSeparator
Separator to use for words in the identifiers. |
| Fields inherited from class org.jpox.store.AbstractIdentifierFactory |
|---|
CASE_LOWER, CASE_PRESERVE, CASE_UPPER, dba, identifierCase, LOCALISER |
| Fields inherited from interface org.jpox.store.IdentifierFactory |
|---|
CANDIDATE_KEY, COLUMN, FOREIGN_KEY, IDENTIFIER_LOWER_CASE, IDENTIFIER_LOWER_CASE_QUOTED, IDENTIFIER_MIXED_CASE, IDENTIFIER_MIXED_CASE_QUOTED, IDENTIFIER_UPPER_CASE, IDENTIFIER_UPPER_CASE_QUOTED, INDEX, PRIMARY_KEY, SEQUENCE, TABLE |
| Constructor Summary | |
|---|---|
AbstractRDBMSIdentifierFactory(DatastoreAdapter dba,
java.lang.String requiredCase,
java.lang.String defaultCatalog,
java.lang.String defaultSchema)
Constructor. |
|
| Method Summary | |
|---|---|
protected abstract java.lang.String |
generateIdentifierNameForJavaName(java.lang.String javaName)
Generate a datastore identifier from a Java identifier. |
protected abstract java.lang.String |
getColumnIdentifierSuffix(int role,
boolean embedded)
Accessor for the suffix to add to any column identifier, based on the role type. |
java.lang.String |
getIdentifierInAdapterCase(java.lang.String identifier)
Convenience method to convert the passed identifier into an identifier in the correct case, and with any required quoting for the datastore adapter. |
protected java.lang.String[] |
getIdentifierNamePartsFromName(java.lang.String name)
Convenience method to split a fully-specified identifier name (inc catalog/schema) into its constituent parts. |
protected int |
getMaxLengthForIdentifierType(int identifierType)
Method to return the maximum permitted length of an identifier of the specified type. |
java.lang.String |
getWordSeparator()
Accessor for the word separator for identifiers. |
DatastoreIdentifier |
newCandidateKeyIdentifier(DatastoreContainerObject table,
int seq)
Method to generate an identifier for a candidate key in the supplied table. |
DatastoreIdentifier |
newDatastoreContainerIdentifier(java.lang.String identifierName)
Method to use to generate an identifier for a datastore field. |
DatastoreIdentifier |
newDatastoreFieldIdentifier(java.lang.String identifierName)
Method to use to generate an identifier for a datastore field. |
DatastoreIdentifier |
newDatastoreFieldIdentifier(java.lang.String javaName,
boolean embedded,
int fieldRole)
Method to create an identifier for a datastore field where we want the name based on the supplied java name, and the field has a particular role (and so could have its naming set according to the role). |
DatastoreIdentifier |
newForeignKeyIdentifier(DatastoreContainerObject table,
int seq)
Method to create a new identifier for a foreign key in the supplied table. |
DatastoreIdentifier |
newIdentifier(DatastoreIdentifier identifier,
java.lang.String suffix)
Method to return a new Identifier based on the passed identifier, but adding on the passed suffix |
DatastoreIdentifier |
newIdentifier(int identifierType,
java.lang.String name)
Method to generate an identifier based on the supplied name for the requested type of identifier. |
DatastoreIdentifier |
newIndexIdentifier(DatastoreContainerObject table,
boolean isUnique,
int seq)
Method to create an identifier for an Index in the supplied table. |
DatastoreIdentifier |
newPrimaryKeyIdentifier(DatastoreContainerObject table)
Method to generate an identifier for a primary key for the supplied table. |
DatastoreIdentifier |
newSequenceIdentifier(java.lang.String sequenceName)
Method to generate an identifier for a sequence using the passed name. |
protected void |
setCatalogSchemaForTable(org.jpox.store.rdbms.sqlidentifier.TableIdentifier identifier)
Convenience method to set the catalog/schema on the passed TableIdentifier. |
| Methods inherited from class org.jpox.store.AbstractIdentifierFactory |
|---|
getDatastoreAdapter, getIdentifierCase, getNameOfIdentifierCase, truncate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory |
|---|
newAdapterIndexFieldIdentifier, newForeignKeyFieldIdentifier, newIndexFieldIdentifier, newJoinTableFieldIdentifier |
| Methods inherited from interface org.jpox.store.IdentifierFactory |
|---|
getDatastoreAdapter, getIdentifierCase, getNameOfIdentifierCase, newDatastoreContainerIdentifier, newDatastoreContainerIdentifier, newDiscriminatorFieldIdentifier, newReferenceFieldIdentifier, newVersionFieldIdentifier |
| Field Detail |
|---|
protected java.util.Map tables
protected java.util.Map columns
protected java.util.Map foreignkeys
protected java.util.Map indexes
protected java.util.Map candidates
protected java.util.Map primarykeys
protected java.util.Map sequences
protected java.util.Map references
protected java.lang.String wordSeparator
protected RDBMSAdapter rdba
protected java.lang.String defaultCatalogName
protected java.lang.String defaultSchemaName
| Constructor Detail |
|---|
public AbstractRDBMSIdentifierFactory(DatastoreAdapter dba,
java.lang.String requiredCase,
java.lang.String defaultCatalog,
java.lang.String defaultSchema)
dba - Database adapterrequiredCase - The case the user requiresdefaultCatalog - Name of the default catalog (if any)defaultSchema - Name of the default schema (if any)| Method Detail |
|---|
public java.lang.String getWordSeparator()
public java.lang.String getIdentifierInAdapterCase(java.lang.String identifier)
getIdentifierInAdapterCase in interface IdentifierFactoryidentifier - The identifier
public DatastoreIdentifier newIdentifier(int identifierType,
java.lang.String name)
newIdentifier in interface IdentifierFactoryidentifierType - the type of identifier to be createdname - The Java or SQL identifier name
public DatastoreIdentifier newIdentifier(DatastoreIdentifier identifier,
java.lang.String suffix)
newIdentifier in interface IdentifierFactoryidentifier - The current identifiersuffix - The suffix
public DatastoreIdentifier newDatastoreContainerIdentifier(java.lang.String identifierName)
newDatastoreContainerIdentifier in interface IdentifierFactoryidentifierName - The identifier name
public DatastoreIdentifier newDatastoreFieldIdentifier(java.lang.String identifierName)
newDatastoreFieldIdentifier in interface IdentifierFactoryidentifierName - The identifier name
public DatastoreIdentifier newDatastoreFieldIdentifier(java.lang.String javaName,
boolean embedded,
int fieldRole)
newDatastoreFieldIdentifier in interface IdentifierFactoryjavaName - The java field nameembedded - Whether the identifier is for a field embeddedfieldRole - The role to be performed by this column e.g FK, Index ?
public DatastoreIdentifier newSequenceIdentifier(java.lang.String sequenceName)
newSequenceIdentifier in interface RDBMSIdentifierFactorysequenceName - the name of the sequence to use
public DatastoreIdentifier newPrimaryKeyIdentifier(DatastoreContainerObject table)
newPrimaryKeyIdentifier in interface RDBMSIdentifierFactorytable - the table
public DatastoreIdentifier newCandidateKeyIdentifier(DatastoreContainerObject table,
int seq)
newCandidateKeyIdentifier in interface RDBMSIdentifierFactorytable - the tableseq - the sequential number
public DatastoreIdentifier newForeignKeyIdentifier(DatastoreContainerObject table,
int seq)
newForeignKeyIdentifier in interface RDBMSIdentifierFactorytable - the tableseq - the sequential number
public DatastoreIdentifier newIndexIdentifier(DatastoreContainerObject table,
boolean isUnique,
int seq)
newIndexIdentifier in interface RDBMSIdentifierFactorytable - the tableisUnique - if the index is uniqueseq - the sequential number
protected abstract java.lang.String getColumnIdentifierSuffix(int role,
boolean embedded)
role - Datastore field roleembedded - Whether the DatastoreField is stored embedded
protected abstract java.lang.String generateIdentifierNameForJavaName(java.lang.String javaName)
javaName - the Java identifier.
protected void setCatalogSchemaForTable(org.jpox.store.rdbms.sqlidentifier.TableIdentifier identifier)
identifier - The TableIdentifierprotected java.lang.String[] getIdentifierNamePartsFromName(java.lang.String name)
name - Name
protected int getMaxLengthForIdentifierType(int identifierType)
getMaxLengthForIdentifierType in class AbstractIdentifierFactoryidentifierType - Type of identifier
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||