org.jpox.store
Interface IdentifierFactory

All Known Implementing Classes:
RDBMSIdentifierFactory

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.

Version:
$Revision: 1.1 $

Field Summary
static int CANDIDATE_KEY
          candidate key - unique index constraint
static int COLUMN
          column
static int FOREIGN_KEY
          foreign key
static int INDEX
          index
static int PRIMARY_KEY
          primary key
static int REFERENCE
          identifier for reference (interface/Object) fields
static int TABLE
          identifier for table names
 
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.
 

Field Detail

CANDIDATE_KEY

public static final int CANDIDATE_KEY
candidate key - unique index constraint

See Also:
Constant Field Values

COLUMN

public static final int COLUMN
column

See Also:
Constant Field Values

FOREIGN_KEY

public static final int FOREIGN_KEY
foreign key

See Also:
Constant Field Values

INDEX

public static final int INDEX
index

See Also:
Constant Field Values

REFERENCE

public static final int REFERENCE
identifier for reference (interface/Object) fields

See Also:
Constant Field Values

PRIMARY_KEY

public static final int PRIMARY_KEY
primary key

See Also:
Constant Field Values

TABLE

public static final int TABLE
identifier for table names

See Also:
Constant Field Values
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

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.

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.

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

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

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

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.

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.

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

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.

Parameters:
clr - the ClassLoaderResolver
md - Meta data for the class/field
Returns:
The identifier for the table


Copyright © -2007 . All Rights Reserved.