org.datanucleus.store.mapped
Interface IdentifierFactory

All Known Implementing Classes:
AbstractIdentifierFactory, DN2IdentifierFactory, DNIdentifierFactory, JPAIdentifierFactory, JPOXIdentifierFactory

public interface IdentifierFactory

Factory that creates immutable instances of DatastoreIdentifier. Identifiers are of a particular type. Each datastore could invent its own particular types as required, just that the ones here should be the principal types required.


Method Summary
 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)
          Accessor for an identifier for use in the datastore adapter
 DatastoreIdentifier newAdapterIndexFieldIdentifier()
          Method to return an identifier for an adapter index datastore field.
 DatastoreIdentifier newCandidateKeyIdentifier(DatastoreContainerObject table, int seq)
          Method to generate an identifier for a candidate key.
 DatastoreIdentifier newDatastoreContainerIdentifier(AbstractClassMetaData md)
          Method to return a Table identifier for the specified class.
 DatastoreIdentifier newDatastoreContainerIdentifier(AbstractMemberMetaData fmd)
          Method to return a Table identifier for the specified field.
 DatastoreIdentifier newDatastoreContainerIdentifier(java.lang.String identifierName)
          Method to use to generate an identifier for a datastore field with the supplied name.
 DatastoreIdentifier newDatastoreFieldIdentifier(java.lang.String identifierName)
          Method to use to generate an identifier for a datastore field with the supplied name.
 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 newDiscriminatorFieldIdentifier()
          Method to return an identifier for a discriminator datastore field.
 DatastoreIdentifier newForeignKeyFieldIdentifier(AbstractMemberMetaData ownerFmd, AbstractMemberMetaData relatedFmd, DatastoreIdentifier destinationId, boolean embedded, int fieldRole)
          Method to generate a FK/FK-index field identifier.
 DatastoreIdentifier newForeignKeyIdentifier(DatastoreContainerObject table, int seq)
          Method to create an identifier for a foreign key.
 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 identifierName)
          To be called when we want an identifier name creating based on the identifier.
 DatastoreIdentifier newIndexFieldIdentifier(AbstractMemberMetaData mmd)
          Method to return an identifier for an index (ordering) datastore field.
 DatastoreIdentifier newIndexIdentifier(DatastoreContainerObject table, boolean isUnique, int seq)
          Method to generate an identifier for an index.
 DatastoreIdentifier newJoinTableFieldIdentifier(AbstractMemberMetaData ownerFmd, AbstractMemberMetaData relatedFmd, DatastoreIdentifier destinationId, boolean embedded, int fieldRole)
          Method to generate a join-table identifier.
 DatastoreIdentifier newPrimaryKeyIdentifier(DatastoreContainerObject table)
          Method to generate an identifier for a primary key.
 DatastoreIdentifier newReferenceFieldIdentifier(AbstractMemberMetaData refMetaData, AbstractClassMetaData implMetaData, DatastoreIdentifier implIdentifier, boolean embedded, int fieldRole)
          Method to generate an identifier name for reference field, based on the metadata for the field, and the ClassMetaData for the implementation.
 DatastoreIdentifier newSequenceIdentifier(java.lang.String sequenceName)
          Method to generate an identifier for a sequence using the passed name.
 DatastoreIdentifier newVersionFieldIdentifier()
          Method to return an identifier for a version datastore field.
 

Method Detail

getDatastoreAdapter

DatastoreAdapter getDatastoreAdapter()
Accessor for the datastore adapter that we are creating identifiers for.

Returns:
The datastore adapter

getIdentifierCase

IdentifierCase getIdentifierCase()
Accessor for the identifier case being used.

Returns:
The identifier case

getIdentifierInAdapterCase

java.lang.String getIdentifierInAdapterCase(java.lang.String identifier)
Accessor for an identifier for use in the datastore adapter

Parameters:
identifier - The identifier name
Returns:
Identifier name for use with the datastore adapter

newIdentifier

DatastoreIdentifier newIdentifier(IdentifierType identifierType,
                                  java.lang.String identifierName)
To be called when we want an identifier name creating based on the identifier. Creates identifier for COLUMN, FOREIGN KEY, INDEX and TABLE

Parameters:
identifierType - the type of identifier to be created
identifierName - The identifier name
Returns:
The DatastoreIdentifier

newDatastoreContainerIdentifier

DatastoreIdentifier newDatastoreContainerIdentifier(java.lang.String identifierName)
Method to use to generate an identifier for a datastore field with the supplied name. The passed name will not be changed (other than in its case) although it may be truncated to fit the maximum length permitted for a datastore field identifier.

Parameters:
identifierName - The identifier name
Returns:
The DatastoreIdentifier for the table

newDatastoreContainerIdentifier

DatastoreIdentifier newDatastoreContainerIdentifier(AbstractClassMetaData md)
Method to return a Table identifier for the specified class.

Parameters:
md - Meta data for the class
Returns:
The identifier for the table

newDatastoreContainerIdentifier

DatastoreIdentifier newDatastoreContainerIdentifier(AbstractMemberMetaData fmd)
Method to return a Table identifier for the specified field.

Parameters:
fmd - Meta data for the field
Returns:
The identifier for the table

newDatastoreFieldIdentifier

DatastoreIdentifier newDatastoreFieldIdentifier(java.lang.String identifierName)
Method to use to generate an identifier for a datastore field with the supplied name. The passed name will not be changed (other than in its case) although it may be truncated to fit the maximum length permitted for a datastore field identifier.

Parameters:
identifierName - The identifier name
Returns:
The DatastoreIdentifier

newDatastoreFieldIdentifier

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).

Parameters:
javaName - The java field name
embedded - Whether the identifier is for a field embedded
fieldRole - The role to be performed by this column e.g FK, Index ?
Returns:
The DatastoreIdentifier

newReferenceFieldIdentifier

DatastoreIdentifier newReferenceFieldIdentifier(AbstractMemberMetaData refMetaData,
                                                AbstractClassMetaData implMetaData,
                                                DatastoreIdentifier implIdentifier,
                                                boolean embedded,
                                                int fieldRole)
Method to generate an identifier name for reference field, based on the metadata for the field, and the ClassMetaData for the implementation.

Parameters:
refMetaData - the MetaData for the reference field
implMetaData - the AbstractClassMetaData for this implementation
implIdentifier - PK identifier for the implementation
embedded - Whether the identifier is for a field embedded
fieldRole - The role to be performed by this column e.g FK, collection element ?
Returns:
The DatastoreIdentifier

newDiscriminatorFieldIdentifier

DatastoreIdentifier newDiscriminatorFieldIdentifier()
Method to return an identifier for a discriminator datastore field.

Returns:
The discriminator datastore field identifier

newVersionFieldIdentifier

DatastoreIdentifier newVersionFieldIdentifier()
Method to return an identifier for a version datastore field.

Returns:
The version datastore field identifier

newIdentifier

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

Parameters:
identifier - The current identifier
suffix - The suffix
Returns:
The new identifier

newJoinTableFieldIdentifier

DatastoreIdentifier newJoinTableFieldIdentifier(AbstractMemberMetaData ownerFmd,
                                                AbstractMemberMetaData relatedFmd,
                                                DatastoreIdentifier destinationId,
                                                boolean embedded,
                                                int fieldRole)
Method to generate a join-table identifier. The identifier could be for a foreign-key to another table (if the destinationId is provided), or could be for a simple column in the join table.

Parameters:
ownerFmd - MetaData for the owner field
relatedFmd - MetaData for the related field (if bidirectional)
destinationId - Identifier for the identity field of the destination table
embedded - Whether the identifier is for a field embedded
fieldRole - The role to be performed by this column e.g FK, collection element ?
Returns:
The identifier.

newForeignKeyFieldIdentifier

DatastoreIdentifier newForeignKeyFieldIdentifier(AbstractMemberMetaData ownerFmd,
                                                 AbstractMemberMetaData relatedFmd,
                                                 DatastoreIdentifier destinationId,
                                                 boolean embedded,
                                                 int fieldRole)
Method to generate a FK/FK-index field identifier. The identifier could be for the FK field itself, or for a related index for the FK.

Parameters:
ownerFmd - MetaData for the owner field
relatedFmd - MetaData for the related field (if bidirectional)
destinationId - Identifier for the identity field of the destination table (if strict FK)
embedded - Whether the identifier is for a field embedded
fieldRole - The role to be performed by this column e.g owner, index ?
Returns:
The identifier

newIndexFieldIdentifier

DatastoreIdentifier newIndexFieldIdentifier(AbstractMemberMetaData mmd)
Method to return an identifier for an index (ordering) datastore field.

Parameters:
mmd - Metadata for the field/property that we require to add an index(order) column for
Returns:
The index datastore field identifier

newAdapterIndexFieldIdentifier

DatastoreIdentifier newAdapterIndexFieldIdentifier()
Method to return an identifier for an adapter index datastore field. An "adapter index" is a column added to be part of a primary key when some other column cant perform that role.

Returns:
The index datastore field identifier

newSequenceIdentifier

DatastoreIdentifier newSequenceIdentifier(java.lang.String sequenceName)
Method to generate an identifier for a sequence using the passed name.

Parameters:
sequenceName - the name of the sequence to use
Returns:
The DatastoreIdentifier

newPrimaryKeyIdentifier

DatastoreIdentifier newPrimaryKeyIdentifier(DatastoreContainerObject table)
Method to generate an identifier for a primary key.

Parameters:
table - the table
Returns:
The DatastoreIdentifier

newIndexIdentifier

DatastoreIdentifier newIndexIdentifier(DatastoreContainerObject table,
                                       boolean isUnique,
                                       int seq)
Method to generate an identifier for an index.

Parameters:
table - the table
isUnique - if the index is unique
seq - the sequential number
Returns:
The DatastoreIdentifier

newCandidateKeyIdentifier

DatastoreIdentifier newCandidateKeyIdentifier(DatastoreContainerObject table,
                                              int seq)
Method to generate an identifier for a candidate key.

Parameters:
table - the table
seq - Sequence number
Returns:
The DatastoreIdentifier

newForeignKeyIdentifier

DatastoreIdentifier newForeignKeyIdentifier(DatastoreContainerObject table,
                                            int seq)
Method to create an identifier for a foreign key.

Parameters:
table - the table
seq - the sequential number
Returns:
The DatastoreIdentifier


Copyright © 2011. All Rights Reserved.