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.
  • Field Details

  • Method Details

    • getDatastoreAdapter

      DatastoreAdapter getDatastoreAdapter()
      Accessor for the datastore adapter that we are creating identifiers for.
      Returns:
      The datastore adapter
    • getNamingCase

      org.datanucleus.store.schema.naming.NamingCase getNamingCase()
      Accessor for the identifier case being used.
      Returns:
      The identifier case
    • getIdentifierInAdapterCase

      String getIdentifierInAdapterCase(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
    • getIdentifierTruncatedToAdapterColumnLength

      String getIdentifierTruncatedToAdapterColumnLength(String identifier)
      Method to truncate the provided identifier as required to the datastore adapter column length (if required)
      Parameters:
      identifier - The identifier
      Returns:
      The truncated variant (if the length was longer than the max column identifier length);
    • newIdentifier

      DatastoreIdentifier newIdentifier(IdentifierType identifierType, 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
    • newTableIdentifier

      DatastoreIdentifier newTableIdentifier(String identifierName)
      Method to use to generate an identifier for a table with the supplied name in the default catalog/schema. 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 table identifier.
      Parameters:
      identifierName - The identifier name
      Returns:
      The DatastoreIdentifier for the table
    • newTableIdentifier

      DatastoreIdentifier newTableIdentifier(String identifierName, String catalogName, String schemaName)
      Method to use to generate an identifier for a table 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 table identifier.
      Parameters:
      identifierName - The identifier name for the table
      catalogName - Optional catalog name
      schemaName - Optional schema name
      Returns:
      The DatastoreIdentifier for the table
    • newTableIdentifier

      DatastoreIdentifier newTableIdentifier(org.datanucleus.metadata.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
    • newTableIdentifier

      DatastoreIdentifier newTableIdentifier(org.datanucleus.metadata.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
    • newColumnIdentifier

      DatastoreIdentifier newColumnIdentifier(String identifierName)
      Method to use to generate an identifier for a column 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 column identifier.
      Parameters:
      identifierName - The identifier name
      Returns:
      The DatastoreIdentifier
    • newColumnIdentifier

      DatastoreIdentifier newColumnIdentifier(String javaName, boolean embedded, org.datanucleus.metadata.FieldRole fieldRole, boolean custom)
      Method to create an identifier for a column 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 ?
      custom - Whether this has a user-defined name
      Returns:
      The DatastoreIdentifier
    • newReferenceFieldIdentifier

      DatastoreIdentifier newReferenceFieldIdentifier(org.datanucleus.metadata.AbstractMemberMetaData refMetaData, org.datanucleus.metadata.AbstractClassMetaData implMetaData, DatastoreIdentifier implIdentifier, boolean embedded, org.datanucleus.metadata.FieldRole 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 column.
      Returns:
      The discriminator column identifier
    • newVersionFieldIdentifier

      DatastoreIdentifier newVersionFieldIdentifier()
      Method to return an identifier for a version column.
      Returns:
      The version column identifier
    • newIdentifier

      DatastoreIdentifier newIdentifier(DatastoreIdentifier identifier, 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(org.datanucleus.metadata.AbstractMemberMetaData ownerFmd, org.datanucleus.metadata.AbstractMemberMetaData relatedFmd, DatastoreIdentifier destinationId, boolean embedded, org.datanucleus.metadata.FieldRole 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(org.datanucleus.metadata.AbstractMemberMetaData ownerFmd, org.datanucleus.metadata.AbstractMemberMetaData relatedFmd, DatastoreIdentifier destinationId, boolean embedded, org.datanucleus.metadata.FieldRole 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(org.datanucleus.metadata.AbstractMemberMetaData mmd)
      Method to return an identifier for an index (ordering) column.
      Parameters:
      mmd - Metadata for the field/property that we require to add an index(order) column for
      Returns:
      The index column identifier
    • newAdapterIndexFieldIdentifier

      DatastoreIdentifier newAdapterIndexFieldIdentifier()
      Method to return an identifier for an adapter index column. 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 column identifier
    • newSequenceIdentifier

      DatastoreIdentifier newSequenceIdentifier(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(Table table)
      Method to generate an identifier for a primary key.
      Parameters:
      table - the table
      Returns:
      The DatastoreIdentifier
    • newIndexIdentifier

      DatastoreIdentifier newIndexIdentifier(Table 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(Table 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(Table table, int seq)
      Method to create an identifier for a foreign key.
      Parameters:
      table - the table
      seq - the sequential number
      Returns:
      The DatastoreIdentifier