org.jpox.store.rdbms.sqlidentifier
Class RDBMSIdentifierFactory

java.lang.Object
  extended byorg.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory
All Implemented Interfaces:
IdentifierFactory

public class RDBMSIdentifierFactory
extends java.lang.Object
implements IdentifierFactory

Factory that creates immutable instances of DatastoreIdentifier for RDBMS datastores

Version:
$Revision: 1.2 $

Field Summary
 
Fields inherited from interface org.jpox.store.IdentifierFactory
CANDIDATE_KEY, COLUMN, FOREIGN_KEY, INDEX, PRIMARY_KEY, REFERENCE, TABLE
 
Constructor Summary
RDBMSIdentifierFactory(StoreManager storeMgr)
          Constructor.
 
Method Summary
 DatastoreIdentifier newColumnIdentifier(java.lang.String javaName, java.lang.String sqlIdentifier)
          Method to generate an identifier for a COLUMN.
 DatastoreIdentifier newIdentifier(int identifierType, AbstractPropertyMetaData refMetaData, AbstractClassMetaData implMetaData, DatastoreIdentifier implIdentifier)
          Method to generate an identifier name based on the FieldMetaData and ClassMetaData for reference fields.
 DatastoreIdentifier newIdentifier(int identifierType, DatastoreContainerObject table)
          To be called when we want an identifier name creating based on the table.
 DatastoreIdentifier newIdentifier(int identifierType, DatastoreContainerObject table, boolean isUnique, int seq)
          To be called when we want an identifier name.
 DatastoreIdentifier newIdentifier(int identifierType, DatastoreContainerObject table, int seq)
          To be called when we want an identifier name.
 DatastoreIdentifier newIdentifier(int identifierType, DatastoreIdentifier baseSQLID, boolean embedded, DatastoreFieldRole role)
          To be called when you already have an existing identifier and want to use it as a base for the new one, applying a particular "role".
 DatastoreIdentifier newIdentifier(int identifierType, java.lang.String sqlIdentifier)
          To be called when we want an identifier name creating based on the identifier.
 DatastoreIdentifier newIdentifier(int identifierType, java.lang.String javaName, boolean embedded, DatastoreFieldRole role)
          To be called when we want an identifier name creating based on the java field name, and a particular "role".
 DatastoreIdentifier newTableIdentifier(java.lang.String javaName, java.lang.String sqlIdentifier)
          Method to generate an identifier for a TABLE.
 DatastoreIdentifier newTableIdentifierForMetaData(ClassLoaderResolver clr, ExtendableMetaData md)
          Method to return a Table identifier for the specified class or field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RDBMSIdentifierFactory

public RDBMSIdentifierFactory(StoreManager storeMgr)
Constructor.

Parameters:
storeMgr - Manager for the store
Method Detail

newIdentifier

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

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
sqlIdentifier - The SQL identifier name
Returns:
The DatastoreIdentifier

newColumnIdentifier

public DatastoreIdentifier newColumnIdentifier(java.lang.String javaName,
                                               java.lang.String sqlIdentifier)
Method to generate an identifier for a COLUMN. Can generate identifiers using the specified name or using the specified java name as a basis for the identifier name.

Specified by:
newColumnIdentifier in interface IdentifierFactory
Parameters:
javaName - The java name of the field
sqlIdentifier - The identifier (this is optional)
Returns:
The DatastoreIdentifier

newTableIdentifier

public DatastoreIdentifier newTableIdentifier(java.lang.String javaName,
                                              java.lang.String sqlIdentifier)
Method to generate an identifier for a TABLE. Can generate identifiers using the specified name or using the specified java name as a basis for the identifier name.

Specified by:
newTableIdentifier in interface IdentifierFactory
Parameters:
javaName - The java name of the class (used for auto-generation if no sqlIdentifier)
sqlIdentifier - The identifier (this is optional)
Returns:
The DatastoreIdentifier for the table

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         java.lang.String javaName,
                                         boolean embedded,
                                         DatastoreFieldRole role)
To be called when we want an identifier name creating based on the java field name, and a particular "role". Creates identifier for COLUMN

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
javaName - The java field name
embedded - Whether the identifier is for a field embedded
role - The role to be performed by this column e.g FK, Index ?
Returns:
The DatastoreIdentifier

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         DatastoreIdentifier baseSQLID,
                                         boolean embedded,
                                         DatastoreFieldRole role)
To be called when you already have an existing identifier and want to use it as a base for the new one, applying a particular "role". Creates identifier for COLUMN

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
baseSQLID - The base identifier
embedded - Whether the identifier is for a field embedded
role - The role to use
Returns:
The DatastoreIdentifier

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         DatastoreContainerObject table,
                                         int seq)
To be called when we want an identifier name. Creates identifier for CANDIDATE KEY and FOREIGN KEY

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
table - the table
seq - the sequential number
Returns:
The DatastoreIdentifier

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         DatastoreContainerObject table,
                                         boolean isUnique,
                                         int seq)
To be called when we want an identifier name. Creates identifier for INDEX.

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
table - the table
isUnique - if the index is unique
seq - the sequential number
Returns:
The DatastoreIdentifier

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         AbstractPropertyMetaData refMetaData,
                                         AbstractClassMetaData implMetaData,
                                         DatastoreIdentifier implIdentifier)
Method to generate an identifier name based on the FieldMetaData and ClassMetaData for reference fields. A reference field is a field with a set of possible implementations.

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
refMetaData - the AbstractPropertyMetaData for the reference field
implMetaData - the AbstractClassMetaData
Returns:
The DatastoreIdentifier

newIdentifier

public DatastoreIdentifier newIdentifier(int identifierType,
                                         DatastoreContainerObject table)
To be called when we want an identifier name creating based on the table. Creates identifier for PRIMARY KEY

Specified by:
newIdentifier in interface IdentifierFactory
Parameters:
identifierType - the type of identifier to be created
table - the table
Returns:
The DatastoreIdentifier

newTableIdentifierForMetaData

public DatastoreIdentifier newTableIdentifierForMetaData(ClassLoaderResolver clr,
                                                         ExtendableMetaData md)
Method to return a Table identifier for the specified class or field.

Specified by:
newTableIdentifierForMetaData in interface IdentifierFactory
Parameters:
clr - the ClassLoaderResolver
md - Meta data for the class/field
Returns:
The identifier for the table


Copyright © -2007 . All Rights Reserved.