com.sun.jdo.api.persistence.mapping.ejb
Class AbstractNameMapper

java.lang.Object
  extended by com.sun.jdo.api.persistence.mapping.ejb.AbstractNameMapper

public abstract class AbstractNameMapper
extends java.lang.Object

This is a class which helps translate between the various names of the CMP (ejb name, abstract schema, abstract bean, concrete bean, local interface, remote interface) and the persistence-capable class name. It also has methods for translation of field names. The basic entry point is ejb name or persistence-capable class name.

Author:
Rochelle Raccah

Field Summary
protected static java.lang.String GENERATED_CMR_FIELD_PREFIX
           
static java.lang.String GENERATED_KEY_FIELD_NAME
          Defines key field name for unknown primary key
static java.lang.String GENERATED_VERSION_FIELD_PREFIX
          Defines version field name prefix for version consistency
static int PRIMARY_KEY_FIELD
           
static int UNKNOWN_KEY_CLASS
           
static int USER_DEFINED_KEY_CLASS
           
 
Constructor Summary
AbstractNameMapper()
           
 
Method Summary
abstract  java.lang.String getAbstractBeanClassForEjbName(java.lang.String name)
          Gets the name of the abstract bean class which corresponds to the specified ejb name.
abstract  java.lang.String getAbstractSchemaForEjbName(java.lang.String name)
          Gets the name of the abstract schema which corresponds to the specified ejb.
 java.lang.String[] getEjbFieldForGeneratedField(java.lang.String name, java.lang.String fieldName)
          Gets the name of the ejb field which corresponds to the specified generated ejb name and field name pair.
abstract  java.lang.String getEjbFieldForPersistenceField(java.lang.String className, java.lang.String fieldName)
          Gets the name of the field in the ejb which corresponds to the specified persistence-capable class name and field name pair.
abstract  java.lang.String getEjbNameForLocalInterface(java.lang.String ejbName, java.lang.String fieldName, java.lang.String interfaceName)
          Gets the name of the ejb which corresponds to the specified local interface name.
abstract  java.lang.String getEjbNameForPersistenceClass(java.lang.String className)
          Gets the name of the ejb name which corresponds to the specified persistence-capable class name.
 java.lang.String getEjbNameForPersistenceKeyClass(java.lang.String className)
          Gets the name of the ejb name which corresponds to the specified persistence-capable key class name.
abstract  java.lang.String getEjbNameForRemoteInterface(java.lang.String ejbName, java.lang.String fieldName, java.lang.String interfaceName)
          Gets the name of the ejb which corresponds to the specified remote interface name.
 java.lang.String[] getGeneratedFieldForEjbField(java.lang.String name, java.lang.String fieldName)
          Gets the name of the generated field in the ejb which corresponds to the specified ejb name and field name pair.
protected abstract  java.util.Map getGeneratedFieldsMap()
           
 java.util.List getGeneratedRelationshipsForEjbName(java.lang.String name)
          The list contains generated relationship field names.
protected abstract  java.util.Map getInverseFieldsMap()
           
abstract  java.lang.String getKeyClassForEjbName(java.lang.String name)
          Gets the name of the key class which corresponds to the specified ejb name.
 java.lang.String getKeyClassForPersistenceKeyClass(java.lang.String className)
          Gets the name of the key class which corresponds to the specified persistence-capable key class name.
abstract  int getKeyClassTypeForEjbName(java.lang.String name)
          Get the type of key class of this ejb.
abstract  java.lang.String getLocalInterfaceForEjbName(java.lang.String name)
          Gets the name of the local interface which corresponds to the specified ejb name.
abstract  java.lang.String getPersistenceClassForEjbName(java.lang.String name)
          Gets the name of the persistence-capable class which corresponds to the specified ejb name.
 java.lang.String getPersistenceClassForLocalInterface(java.lang.String className, java.lang.String fieldName, java.lang.String interfaceName)
          Gets the name of the persistence-capable class which corresponds to the specified local interface name.
 java.lang.String getPersistenceClassForRemoteInterface(java.lang.String className, java.lang.String fieldName, java.lang.String interfaceName)
          Gets the name of the persistence-capable class which corresponds to the specified remote interface name.
abstract  java.lang.String getPersistenceFieldForEjbField(java.lang.String name, java.lang.String fieldName)
          Gets the name of the field in the persistence-capable class which corresponds to the specified ejb name and field name pair.
abstract  java.lang.String getRemoteInterfaceForEjbName(java.lang.String name)
          Gets the name of the remote interface which corresponds to the specified ejb name.
abstract  boolean isEjbName(java.lang.String name)
          Determines if the specified name represents an ejb.
 boolean isGeneratedEjbRelationship(java.lang.String name, java.lang.String fieldName)
          Returns true if the field in the persistence-capable class which corresponds to the specified ejb name and field name pair is one which was generated automatically for 2 way managed relationships in the case that the ejb specifies one way relationships.
 boolean isGeneratedField(java.lang.String name, java.lang.String fieldName)
          Returns true if the field is a generated field.
abstract  boolean isLocalInterface(java.lang.String name)
          Determines if the specified name represents a local interface.
abstract  boolean isRemoteInterface(java.lang.String name)
          Determines if the specified name represents a remote interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_DEFINED_KEY_CLASS

public static final int USER_DEFINED_KEY_CLASS
See Also:
Constant Field Values

PRIMARY_KEY_FIELD

public static final int PRIMARY_KEY_FIELD
See Also:
Constant Field Values

UNKNOWN_KEY_CLASS

public static final int UNKNOWN_KEY_CLASS
See Also:
Constant Field Values

GENERATED_KEY_FIELD_NAME

public static final java.lang.String GENERATED_KEY_FIELD_NAME
Defines key field name for unknown primary key

See Also:
Constant Field Values

GENERATED_VERSION_FIELD_PREFIX

public static final java.lang.String GENERATED_VERSION_FIELD_PREFIX
Defines version field name prefix for version consistency

See Also:
Constant Field Values

GENERATED_CMR_FIELD_PREFIX

protected static final java.lang.String GENERATED_CMR_FIELD_PREFIX
See Also:
Constant Field Values
Constructor Detail

AbstractNameMapper

public AbstractNameMapper()
Method Detail

getGeneratedFieldsMap

protected abstract java.util.Map getGeneratedFieldsMap()

getInverseFieldsMap

protected abstract java.util.Map getInverseFieldsMap()

isEjbName

public abstract boolean isEjbName(java.lang.String name)
Determines if the specified name represents an ejb.

Parameters:
name - the fully qualified name to be checked
Returns:
true if this name represents an ejb; false otherwise.

getAbstractBeanClassForEjbName

public abstract java.lang.String getAbstractBeanClassForEjbName(java.lang.String name)
Gets the name of the abstract bean class which corresponds to the specified ejb name.

Parameters:
name - the name of the ejb
Returns:
the name of the abstract bean for the specified ejb

getKeyClassForEjbName

public abstract java.lang.String getKeyClassForEjbName(java.lang.String name)
Gets the name of the key class which corresponds to the specified ejb name.

Parameters:
name - the name of the ejb
Returns:
the name of the key class for the ejb

getKeyClassForPersistenceKeyClass

public java.lang.String getKeyClassForPersistenceKeyClass(java.lang.String className)
Gets the name of the key class which corresponds to the specified persistence-capable key class name. Returns null if the supplied className is not a persistence-capable key class name.

Parameters:
className - the name of the persistence-capable key class
Returns:
the name of the key class for the ejb

getEjbNameForPersistenceKeyClass

public java.lang.String getEjbNameForPersistenceKeyClass(java.lang.String className)
Gets the name of the ejb name which corresponds to the specified persistence-capable key class name. Returns null if the supplied className is not a persistence-capable key class name.

Parameters:
className - the name of the persistence-capable key class
Returns:
the name of the ejb for the specified persistence-capable key class

getKeyClassTypeForEjbName

public abstract int getKeyClassTypeForEjbName(java.lang.String name)
Get the type of key class of this ejb.

Returns:
the key class type, one of USER_DEFINED_KEY_CLASS, PRIMARY_KEY_FIELD, or UNKNOWN_KEY_CLASS

getAbstractSchemaForEjbName

public abstract java.lang.String getAbstractSchemaForEjbName(java.lang.String name)
Gets the name of the abstract schema which corresponds to the specified ejb.

Parameters:
name - the name of the ejb
Returns:
the name of the abstract schema for the specified ejb

getEjbNameForPersistenceClass

public abstract java.lang.String getEjbNameForPersistenceClass(java.lang.String className)
Gets the name of the ejb name which corresponds to the specified persistence-capable class name.

Parameters:
className - the name of the persistence-capable
Returns:
the name of the ejb for the specified persistence-capable

getPersistenceClassForEjbName

public abstract java.lang.String getPersistenceClassForEjbName(java.lang.String name)
Gets the name of the persistence-capable class which corresponds to the specified ejb name.

Parameters:
name - the name of the ejb
Returns:
the name of the persistence-capable for the specified ejb

isLocalInterface

public abstract boolean isLocalInterface(java.lang.String name)
Determines if the specified name represents a local interface.

Parameters:
name - the fully qualified name to be checked
Returns:
true if this name represents a local interface; false otherwise.

getPersistenceClassForLocalInterface

public java.lang.String getPersistenceClassForLocalInterface(java.lang.String className,
                                                             java.lang.String fieldName,
                                                             java.lang.String interfaceName)
Gets the name of the persistence-capable class which corresponds to the specified local interface name.

Parameters:
className - the name of the persistence-capable class which contains fieldName from which to find relationship and therefore the local interface
fieldName - the name of the field in the persistence-capable class
interfaceName - the name of the local interface
Returns:
the name of the persistence-capable for the specified local interface which is related to the specified class name, field name pair

getEjbNameForLocalInterface

public abstract java.lang.String getEjbNameForLocalInterface(java.lang.String ejbName,
                                                             java.lang.String fieldName,
                                                             java.lang.String interfaceName)
Gets the name of the ejb which corresponds to the specified local interface name.

Parameters:
ejbName - the name of the ejb which contains fieldName from which to find relationship and therefore the local interface
fieldName - the name of the field in the ejb
interfaceName - the name of the local interface
Returns:
the name of the ejb for the specified local interface

getLocalInterfaceForEjbName

public abstract java.lang.String getLocalInterfaceForEjbName(java.lang.String name)
Gets the name of the local interface which corresponds to the specified ejb name.

Parameters:
name - the name of the ejb
Returns:
the name of the local interface for the specified ejb

isRemoteInterface

public abstract boolean isRemoteInterface(java.lang.String name)
Determines if the specified name represents a remote interface.

Parameters:
name - the fully qualified name to be checked
Returns:
true if this name represents a remote interface; false otherwise.

getPersistenceClassForRemoteInterface

public java.lang.String getPersistenceClassForRemoteInterface(java.lang.String className,
                                                              java.lang.String fieldName,
                                                              java.lang.String interfaceName)
Gets the name of the persistence-capable class which corresponds to the specified remote interface name.

Parameters:
className - the name of the persistence-capable class which contains fieldName from which to find relationship and therefore the remote interface
fieldName - the name of the field in the persistence-capable class
interfaceName - the name of the remote interface
Returns:
the name of the persistence-capable for the specified remote interface which is related to the specified class name, field name pair

getEjbNameForRemoteInterface

public abstract java.lang.String getEjbNameForRemoteInterface(java.lang.String ejbName,
                                                              java.lang.String fieldName,
                                                              java.lang.String interfaceName)
Gets the name of the ejb which corresponds to the specified remote interface name.

Parameters:
ejbName - the name of the ejb which contains fieldName from which to find relationship and therefore the remote interface
fieldName - the name of the field in the ejb
interfaceName - the name of the remote interface
Returns:
the name of the ejb for the specified remote interface

getRemoteInterfaceForEjbName

public abstract java.lang.String getRemoteInterfaceForEjbName(java.lang.String name)
Gets the name of the remote interface which corresponds to the specified ejb name.

Parameters:
name - the name of the ejb
Returns:
the name of the remote interface for the specified ejb

getEjbFieldForPersistenceField

public abstract java.lang.String getEjbFieldForPersistenceField(java.lang.String className,
                                                                java.lang.String fieldName)
Gets the name of the field in the ejb which corresponds to the specified persistence-capable class name and field name pair.

Parameters:
className - the name of the persistence-capable
fieldName - the name of the field in the persistence-capable
Returns:
the name of the field in the ejb for the specified persistence-capable field

getPersistenceFieldForEjbField

public abstract java.lang.String getPersistenceFieldForEjbField(java.lang.String name,
                                                                java.lang.String fieldName)
Gets the name of the field in the persistence-capable class which corresponds to the specified ejb name and field name pair.

Parameters:
name - the name of the ejb
fieldName - the name of the field in the ejb
Returns:
the name of the field in the persistence-capable for the specified ejb field

isGeneratedField

public boolean isGeneratedField(java.lang.String name,
                                java.lang.String fieldName)
Returns true if the field is a generated field. That includes: relationships generated for 2 way managed relationships, key fields generated for use with UNKNOWN_KEY_CLASS, or version fields generated to hold a version consistency column.

Parameters:
name - the name of the ejb
fieldName - the name of the field in the ejb
Returns:
true if the field is generated;false otherwise

isGeneratedEjbRelationship

public boolean isGeneratedEjbRelationship(java.lang.String name,
                                          java.lang.String fieldName)
Returns true if the field in the persistence-capable class which corresponds to the specified ejb name and field name pair is one which was generated automatically for 2 way managed relationships in the case that the ejb specifies one way relationships.

Parameters:
name - the name of the ejb
fieldName - the name of the field in the ejb
Returns:
true if the field is generated;false otherwise

getGeneratedRelationshipsForEjbName

public java.util.List getGeneratedRelationshipsForEjbName(java.lang.String name)
The list contains generated relationship field names.

Parameters:
name - the name of the ejb
Returns:
a List of generated relationship names

getGeneratedFieldForEjbField

public java.lang.String[] getGeneratedFieldForEjbField(java.lang.String name,
                                                       java.lang.String fieldName)
Gets the name of the generated field in the ejb which corresponds to the specified ejb name and field name pair.

Parameters:
name - the name of the ejb
fieldName - the name of the field in the ejb
Returns:
a String array of the form {, } which represents the generated field for the ejb field

getEjbFieldForGeneratedField

public java.lang.String[] getEjbFieldForGeneratedField(java.lang.String name,
                                                       java.lang.String fieldName)
Gets the name of the ejb field which corresponds to the specified generated ejb name and field name pair.

Parameters:
name - the name of the ejb
fieldName - the name of the field in the ejb
Returns:
a String array of the form {, } which represents the inverse field for the generated field


Copyright © 2012 GlassFish Community. All Rights Reserved.