|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.identifier.AbstractIdentifierFactory
public abstract class AbstractIdentifierFactory
Abstract representation of an identifier factory for ORM datastores. To be extended to generate the identifiers.
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
candidates
|
static int |
CASE_LOWER
|
static int |
CASE_PRESERVE
|
static int |
CASE_UPPER
|
protected ClassLoaderResolver |
clr
Resolver for any class loading. |
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
columns
|
protected DatastoreAdapter |
dba
Adapter for the datastore. |
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<java.lang.String,DatastoreIdentifier> |
foreignkeys
|
protected IdentifierCase |
identifierCase
Case to use for identifiers. |
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
indexes
|
protected static Localiser |
LOCALISER
Localiser for messages. |
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
primarykeys
|
protected java.lang.String |
quoteString
|
protected DatastoreAdapter |
rdba
Convenience RDBMSAdapter variable to save casting. |
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
references
|
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
sequences
|
protected java.util.Map<java.lang.String,DatastoreIdentifier> |
tables
|
protected java.lang.String |
wordSeparator
Separator to use for words in the identifiers. |
| Constructor Summary | |
|---|---|
AbstractIdentifierFactory(DatastoreAdapter dba,
ClassLoaderResolver clr,
java.util.Map props)
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. |
DatastoreAdapter |
getDatastoreAdapter()
Accessor for the datastore adapter that we are creating identifiers for. |
IdentifierCase |
getIdentifierCase()
Accessor for the identifier case being used. |
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. |
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(IdentifierType 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.datanucleus.store.mapped.identifier.TableIdentifier identifier)
Convenience method to set the catalog/schema on the passed TableIdentifier. |
protected java.lang.String |
truncate(java.lang.String identifier,
int length)
Method to truncate an identifier to fit within the specified identifier length. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.mapped.IdentifierFactory |
|---|
newAdapterIndexFieldIdentifier, newDatastoreContainerIdentifier, newDatastoreContainerIdentifier, newDiscriminatorFieldIdentifier, newForeignKeyFieldIdentifier, newIndexFieldIdentifier, newJoinTableFieldIdentifier, newReferenceFieldIdentifier, newVersionFieldIdentifier |
| Field Detail |
|---|
protected static final Localiser LOCALISER
public static final int CASE_PRESERVE
public static final int CASE_UPPER
public static final int CASE_LOWER
protected DatastoreAdapter dba
protected ClassLoaderResolver clr
protected IdentifierCase identifierCase
protected java.lang.String quoteString
protected java.util.Map<java.lang.String,DatastoreIdentifier> tables
protected java.util.Map<java.lang.String,DatastoreIdentifier> columns
protected java.util.Map<java.lang.String,DatastoreIdentifier> foreignkeys
protected java.util.Map<java.lang.String,DatastoreIdentifier> indexes
protected java.util.Map<java.lang.String,DatastoreIdentifier> candidates
protected java.util.Map<java.lang.String,DatastoreIdentifier> primarykeys
protected java.util.Map<java.lang.String,DatastoreIdentifier> sequences
protected java.util.Map<java.lang.String,DatastoreIdentifier> references
protected java.lang.String wordSeparator
protected DatastoreAdapter rdba
protected java.lang.String defaultCatalogName
protected java.lang.String defaultSchemaName
| Constructor Detail |
|---|
public AbstractIdentifierFactory(DatastoreAdapter dba,
ClassLoaderResolver clr,
java.util.Map props)
dba - Database adapterclr - ClassLoader resolverprops - Any properties controlling identifier generation| Method Detail |
|---|
public DatastoreAdapter getDatastoreAdapter()
getDatastoreAdapter in interface IdentifierFactorypublic IdentifierCase getIdentifierCase()
getIdentifierCase in interface IdentifierFactory
protected java.lang.String truncate(java.lang.String identifier,
int length)
HASH_LENGTH) (at the end) to attempt to create uniqueness.
identifier - The identifierlength - The (max) length to use
public java.lang.String getWordSeparator()
public java.lang.String getIdentifierInAdapterCase(java.lang.String identifier)
getIdentifierInAdapterCase in interface IdentifierFactoryidentifier - The identifier
public DatastoreIdentifier newIdentifier(IdentifierType 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 IdentifierFactorysequenceName - the name of the sequence to use
public DatastoreIdentifier newPrimaryKeyIdentifier(DatastoreContainerObject table)
newPrimaryKeyIdentifier in interface IdentifierFactorytable - the table
public DatastoreIdentifier newCandidateKeyIdentifier(DatastoreContainerObject table,
int seq)
newCandidateKeyIdentifier in interface IdentifierFactorytable - the tableseq - the sequential number
public DatastoreIdentifier newForeignKeyIdentifier(DatastoreContainerObject table,
int seq)
newForeignKeyIdentifier in interface IdentifierFactorytable - the tableseq - the sequential number
public DatastoreIdentifier newIndexIdentifier(DatastoreContainerObject table,
boolean isUnique,
int seq)
newIndexIdentifier in interface IdentifierFactorytable - 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.datanucleus.store.mapped.identifier.TableIdentifier identifier)
identifier - The TableIdentifierprotected java.lang.String[] getIdentifierNamePartsFromName(java.lang.String name)
name - Name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||