org.apache.openjpa.persistence.jdbc
Class AnnotationPersistenceMappingParser

java.lang.Object
  extended by org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser
      extended by org.apache.openjpa.persistence.jdbc.AnnotationPersistenceMappingParser
All Implemented Interfaces:
MetaDataModes

public class AnnotationPersistenceMappingParser
extends AnnotationPersistenceMetaDataParser

Persistence annotation mapping parser.

Author:
Pinaki Poddar, Steve Kim, Abe White

Field Summary
protected static int FALSE
           
protected static int TRUE
           
 
Fields inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser
_cls, _stack
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
 
Constructor Summary
AnnotationPersistenceMappingParser(JDBCConfiguration conf)
           
 
Method Summary
(package private)  void addUniqueConstraints(String table, MetaDataContext ctx, MappingInfo info, UniqueConstraint... uniqueConstraints)
           
(package private)  void assertDefault(ForeignKey fk)
           
(package private)  Unique createUniqueConstraint(MetaDataContext ctx, UniqueConstraint anno)
           
static FieldMapping getAttributeOverrideField(String attrName, FieldMapping fm, ClassMapping embed)
           
static Class<?> getEmbeddedClassType(FieldMapping fm, String attrName)
           
static FieldMapping getEmbeddedFieldMapping(FieldMapping fm, String attrName)
           
static FieldMapping getEmbeddedFieldMapping(FieldMapping fm, String attrName, boolean mustExist)
           
static ClassMapping getEmbeddedMapping(ValueMapping val)
           
static ClassMapping getEmbeddedMapping(ValueMapping val, boolean createNew)
           
protected  boolean handleUnknownClassMappingAnnotation(ClassMapping cls, Annotation anno)
          Allow subclasses to handle unknown annotations.
protected  boolean handleUnknownMemberMappingAnnotation(FieldMapping fm, Annotation anno)
          Allow subclasses to handle unknown annotations.
protected  boolean handleUnknownPackageMappingAnnotation(Package pkg, Annotation anno)
          Allow subclasses to handle unknown annotations.
protected  String normalizeCatalogName(String catName)
           
protected  String normalizeSchemaName(String schName)
           
protected  String normalizeSequenceName(String seqName)
           
protected  void parseClassMappingAnnotations(ClassMetaData meta)
          Parse class mapping annotations.
protected  void parseCollectionTable(FieldMapping fm, CollectionTable ctbl)
          Parse @CollectionTable.
protected  void parseColumns(FieldMapping fm, Column... pcols)
          Parse @Column(s).
protected  void parseContainerTable(FieldMapping fm, ContainerTable ctbl)
          Parse @ContainerTable.
protected  void parseElementJoinColumns(FieldMapping fm, ElementJoinColumn... joins)
          Parse @ElementJoinColumn(s).
protected  void parseForeignKey(MappingInfo info, String name, boolean enabled, boolean deferred, ForeignKeyAction deleteAction, ForeignKeyAction updateAction)
          Set foreign key data on the given mapping info.
protected  void parseIndex(MappingInfo info, String name, boolean enabled, boolean unique)
          Set index data on the given mapping info.
protected  void parseLobMapping(FieldMetaData fmd)
          Setup the field as a LOB mapping.
protected  void parseMapKeyColumn(FieldMapping fm, MapKeyColumn anno)
          Parse @MapKeyColumn.
protected  void parseMemberMappingAnnotations(FieldMetaData fmd)
          Parse member mapping components.
protected  void parsePackageMappingAnnotations(Package pkg)
          Parse package mapping annotations.
protected  void parseXJoinColumns(FieldMapping fm, MappingInfo info, boolean secondaryAllowed, XJoinColumn... joins)
          Parse given @XJoinColumn annotations.
protected  void setColumns(FieldMapping fm, MappingInfo info, List<Column> cols, int unique)
          Set the given columns as the columns for fm.
protected  void setMapKeyColumn(FieldMapping fm, MappingInfo info, Column col, int unique)
          Set the given map key column as the map key column for fm.
protected static int toPolymorphicConstant(NonpolymorphicType val)
          Return the ValueMapping POLY_* constant for the given enum value.
 
Methods inherited from class org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser
clear, getConfiguration, getEnvClassLoader, getLog, getMappingOverride, getMode, getRepository, getSourceFile, handleUnknownClassAnnotation, handleUnknownMemberAnnotation, handleUnknownPackageAnnotation, isMappingMode, isMappingOverrideMode, isMetaDataMode, isQueryMode, parse, parseCallbackMethods, setEnvClassLoader, setMappingOverride, setMode, setMode, setRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

protected static final int TRUE
See Also:
Constant Field Values

FALSE

protected static final int FALSE
See Also:
Constant Field Values
Constructor Detail

AnnotationPersistenceMappingParser

public AnnotationPersistenceMappingParser(JDBCConfiguration conf)
Method Detail

parsePackageMappingAnnotations

protected void parsePackageMappingAnnotations(Package pkg)
Description copied from class: AnnotationPersistenceMetaDataParser
Parse package mapping annotations.

Overrides:
parsePackageMappingAnnotations in class AnnotationPersistenceMetaDataParser

handleUnknownPackageMappingAnnotation

protected boolean handleUnknownPackageMappingAnnotation(Package pkg,
                                                        Annotation anno)
Allow subclasses to handle unknown annotations.


parseClassMappingAnnotations

protected void parseClassMappingAnnotations(ClassMetaData meta)
Description copied from class: AnnotationPersistenceMetaDataParser
Parse class mapping annotations.

Overrides:
parseClassMappingAnnotations in class AnnotationPersistenceMetaDataParser

handleUnknownClassMappingAnnotation

protected boolean handleUnknownClassMappingAnnotation(ClassMapping cls,
                                                      Annotation anno)
Allow subclasses to handle unknown annotations.


createUniqueConstraint

Unique createUniqueConstraint(MetaDataContext ctx,
                              UniqueConstraint anno)

addUniqueConstraints

void addUniqueConstraints(String table,
                          MetaDataContext ctx,
                          MappingInfo info,
                          UniqueConstraint... uniqueConstraints)

parseForeignKey

protected void parseForeignKey(MappingInfo info,
                               String name,
                               boolean enabled,
                               boolean deferred,
                               ForeignKeyAction deleteAction,
                               ForeignKeyAction updateAction)
Set foreign key data on the given mapping info.


assertDefault

void assertDefault(ForeignKey fk)

parseIndex

protected void parseIndex(MappingInfo info,
                          String name,
                          boolean enabled,
                          boolean unique)
Set index data on the given mapping info.


parseLobMapping

protected void parseLobMapping(FieldMetaData fmd)
Description copied from class: AnnotationPersistenceMetaDataParser
Setup the field as a LOB mapping.

Overrides:
parseLobMapping in class AnnotationPersistenceMetaDataParser

parseMemberMappingAnnotations

protected void parseMemberMappingAnnotations(FieldMetaData fmd)
Description copied from class: AnnotationPersistenceMetaDataParser
Parse member mapping components.

Overrides:
parseMemberMappingAnnotations in class AnnotationPersistenceMetaDataParser

handleUnknownMemberMappingAnnotation

protected boolean handleUnknownMemberMappingAnnotation(FieldMapping fm,
                                                       Annotation anno)
Allow subclasses to handle unknown annotations.


toPolymorphicConstant

protected static int toPolymorphicConstant(NonpolymorphicType val)
Return the ValueMapping POLY_* constant for the given enum value.


getEmbeddedFieldMapping

public static FieldMapping getEmbeddedFieldMapping(FieldMapping fm,
                                                   String attrName)

getEmbeddedFieldMapping

public static FieldMapping getEmbeddedFieldMapping(FieldMapping fm,
                                                   String attrName,
                                                   boolean mustExist)

getEmbeddedClassType

public static Class<?> getEmbeddedClassType(FieldMapping fm,
                                            String attrName)

getEmbeddedMapping

public static ClassMapping getEmbeddedMapping(ValueMapping val,
                                              boolean createNew)

getEmbeddedMapping

public static ClassMapping getEmbeddedMapping(ValueMapping val)

getAttributeOverrideField

public static FieldMapping getAttributeOverrideField(String attrName,
                                                     FieldMapping fm,
                                                     ClassMapping embed)

parseColumns

protected void parseColumns(FieldMapping fm,
                            Column... pcols)
Parse @Column(s).


setColumns

protected void setColumns(FieldMapping fm,
                          MappingInfo info,
                          List<Column> cols,
                          int unique)
Set the given columns as the columns for fm.

Parameters:
unique - bitwise combination of TRUE and FALSE for the unique attribute of each column

parseXJoinColumns

protected void parseXJoinColumns(FieldMapping fm,
                                 MappingInfo info,
                                 boolean secondaryAllowed,
                                 XJoinColumn... joins)
Parse given @XJoinColumn annotations.


parseContainerTable

protected void parseContainerTable(FieldMapping fm,
                                   ContainerTable ctbl)
Parse @ContainerTable.


parseCollectionTable

protected void parseCollectionTable(FieldMapping fm,
                                    CollectionTable ctbl)
Parse @CollectionTable.


parseElementJoinColumns

protected void parseElementJoinColumns(FieldMapping fm,
                                       ElementJoinColumn... joins)
Parse @ElementJoinColumn(s).


parseMapKeyColumn

protected void parseMapKeyColumn(FieldMapping fm,
                                 MapKeyColumn anno)
Parse @MapKeyColumn.


setMapKeyColumn

protected void setMapKeyColumn(FieldMapping fm,
                               MappingInfo info,
                               Column col,
                               int unique)
Set the given map key column as the map key column for fm.

Parameters:
unique - bitwise combination of TRUE and FALSE for the unique attribute of the column

normalizeSequenceName

protected String normalizeSequenceName(String seqName)
Overrides:
normalizeSequenceName in class AnnotationPersistenceMetaDataParser

normalizeSchemaName

protected String normalizeSchemaName(String schName)
Overrides:
normalizeSchemaName in class AnnotationPersistenceMetaDataParser

normalizeCatalogName

protected String normalizeCatalogName(String catName)
Overrides:
normalizeCatalogName in class AnnotationPersistenceMetaDataParser


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.