org.jpox.metadata
Class AbstractClassMetaData

java.lang.Object
  extended byorg.jpox.metadata.MetaData
      extended byorg.jpox.metadata.ExtendableMetaData
          extended byorg.jpox.metadata.AbstractClassMetaData
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ClassMetaData, InterfaceMetaData

public abstract class AbstractClassMetaData
extends ExtendableMetaData

Abstract representation of the MetaData of a class/interface. Has a parent PackageMetaData that can contain the metadata for several classes/interfaces. Is extended by ClassMetaData and InterfaceMetaData.

Since:
1.1
Version:
$Revision: 1.28 $
See Also:
Serialized Form

Field Summary
protected  int[] allFieldNumbers
          Field numbers of all fields (inc superclasses).
protected  java.lang.String catalog
          Catalog name (O/R mapping).
protected  boolean[] defaultFetchGroupFieldFlags
          Flags of the default fetch group state for all fields.
protected  int[] defaultFetchGroupFieldNumbers
          Field numbers of the default fetch group fields (inc superclasses).
protected  boolean detachable
          detachable tag value.
protected  boolean embeddedOnly
          embedded-only tag value.
protected  FetchGroupMetaData[] fetchGroupMetaData
          A contained fetch-group element indicates that the named group is to be included in the group being defined.
protected  java.util.Map fetchGroupMetaDataByName
           
protected  java.util.List fetchGroups
          List of fetch-group
protected  java.util.Map fieldNumbersByName
          Field numbers mapped by the name of the field.
protected  ForeignKeyMetaData[] foreignKeyMetaData
          ForeignKeyMetaData
protected  java.util.List foreignKeys
          List of foreign-key
protected  java.lang.String fullName
          Full name.
protected  IdentityMetaData identityMetaData
          Identity MetaData
protected  boolean identitySpecified
          Flag whether the identity was specified by the user.
protected  IdentityType identityType
          Identity-type tag value.
protected  java.util.List indexes
          List of indexes
protected  IndexMetaData[] indexMetaData
          IndexMetaData
protected  InheritanceMetaData inheritanceMetaData
          Inheritance MetaData
protected  JoinMetaData[] joinMetaData
          JoinMetaData
protected  java.util.List joins
          List of joins
protected  AbstractPropertyMetaData[] managedFields
          JDO managed fields.
protected  java.lang.String name
          Class name
protected  boolean[] nonPrimaryKeyFieldFlags
          Field numbers of the non-primary key fields (inc superclasses).
protected  int[] nonPrimaryKeyFieldNumbers
          Field numbers of the non-primary key fields (inc superclasses).
protected  int noOfInheritedManagedFields
          No of managed fields in superclasses, that are inherited by this class.
protected  java.lang.String objectidClass
          objectid-class tag value.
protected  AbstractPropertyMetaData[] overriddenFields
          Fields for superclasse sthat are overridden in this class.
protected  AbstractClassMetaData pcSuperclassMetaData
          Class MetaData for the Persistence-Capable superclass (if any)
protected  int[] persistenceCapableFieldNumbers
          Field numbers of the PersistenceCapable fields (inc superclasses).
protected  java.lang.String persistenceCapableSuperclass
          persistence-capable-superclas tag value.
protected  ClassPersistenceModifier persistenceModifier
          persistence-modifier tag value.
protected  boolean persistentInterfaceImplNeedingTableFromSubclass
          Implementation of "persistent-interface" needing table setting from subclass.
protected  boolean persistentInterfaceImplNeedingTableFromSuperclass
          Implementation of "persistent-interface" needing table setting from superclass.
protected  int[] primaryKeyFieldNumbers
          Field numbers of the primary key fields (inc superclasses).
protected  PrimaryKeyMetaData primaryKeyMetaData
          PrimaryKey MetaData
protected  java.util.List properties
          List of properties
protected  AbstractPropertyMetaData[] propertyMetaData
          convenience PropertyMetaData
protected  java.util.List queries
          List of named queries
protected  boolean requiresExtent
          requires-extent tag value.
protected  java.lang.String schema
          Schema name (O/R mapping).
protected  boolean[] secondClassMutableFieldFlags
          Flags of the second class mutable state for all fields.
protected  int[] secondClassMutableFieldNumbers
          Field numbers of the second class mutable fields (inc superclasses).
protected  java.lang.String table
          Table name (O/R mapping).
protected  java.util.List uniqueConstraints
          List of uniqueConstraints
protected  UniqueMetaData[] uniqueMetaData
          UniqueMetaData
protected  java.util.List unmappedColumns
          The columns that are present in the datastore yet not mapped to fields in this class.
protected  boolean usesSingleFieldIdentityClass
          if this PersistenceCapable class uses SingleFieldIdentity
protected  VersionMetaData versionMetaData
          Version MetaData
 
Fields inherited from class org.jpox.metadata.ExtendableMetaData
extensions, JPOX_VENDOR_NAME
 
Fields inherited from class org.jpox.metadata.MetaData
LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent
 
Constructor Summary
  AbstractClassMetaData(InterfaceMetaData imd, java.lang.String implClassName, boolean copyFields)
          Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".
protected AbstractClassMetaData(PackageMetaData parent, java.lang.String name, java.lang.String identityType, java.lang.String objectidClass, java.lang.String requiresExtent, java.lang.String detachable, java.lang.String embeddedOnly, java.lang.String modifier, java.lang.String persistenceCapableSuperclass, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Constructor.
 
Method Summary
 void addFetchGroup(FetchGroupMetaData fgmd)
          Method to add a fetch-group to this class.
 void addForeignKey(ForeignKeyMetaData fkmd)
          Method to add an foreign-key to this class.
 void addIndex(IndexMetaData idxmd)
          Method to add an index to this class.
 void addJoin(JoinMetaData jnmd)
          Method to add a join to this class.
protected  void addPropertiesNotInMetaData(java.lang.Class cls)
          Add PropertyMetaData of properties not declared in MetaData
 void addProperty(AbstractPropertyMetaData pmd)
          Method to add a property (field) to this interface.
 void addQuery(QueryMetaData qmd)
          Method to add a named query to this class.
 void addUniqueConstraint(UniqueMetaData unimd)
          Method to add a unique constraint to this class.
 void addUnmappedColumn(ColumnMetaData colmd)
          Method to add an unmapped column.
protected  void checkInitialised()
          Method to check whether the Meta-Data has been initialised.
protected  void checkPopulated()
          Method to check whether the Meta-Data has been populated.
protected  void copyFieldsFromInterface(InterfaceMetaData imd)
          Convenience method to copy the fields from an existing interface
protected  void determineIdentity()
          Determines the identity based on MetaData defaults or user defined MetaData
protected  void determineInheritanceMetaData()
          Impose a default inheritance strategy to match the JDO 2 spec
protected  void determineObjectIdClass(ClassLoaderResolver clr)
          Determine the object id class
protected  void determineSuperClassName(ClassLoaderResolver clr, java.lang.Class cls)
          Determine the super PersistenceCapable class.
 int getAbsoluteFieldNumberForRelativeFieldNumber(int relativeFieldNo)
          Accessor for the Absolute field number for a relative field number
 int[] getAllFieldNumbers()
          Accessor for all field numbers.
 AbstractClassMetaData getBaseAbstractClassMetaData()
          Convenience accessor for the AbstractClassMetaData of the base object in this hierarchy.
 java.lang.String getCatalog()
          Accessor for the catalog name.
 boolean[] getDefaultFetchGroupFieldFlags()
          Accessor for the flags of the default fetch group fields (inc superclass fields).
 int[] getDefaultFetchGroupFieldNumbers()
          Accessor for the absolute field numbers of the default fetch group fields (inc superclasses).
 DiscriminatorStrategy getDiscriminatorStrategy()
          Convenience accessor for the discriminator strategy applying to this class.
 FetchGroupMetaData[] getFetchGroupMetaData()
          Accessor for all MetaData defined for fetch groups for this class.
 FetchGroupMetaData[] getFetchGroupMetaData(java.util.Collection groupNames)
          Accessor for fetch group metadata for the specified groups (if present).
 FetchGroupMetaData getFetchGroupMetaData(java.lang.String groupname)
          Accessor for the fetch group metadata for the group specified.
 AbstractPropertyMetaData getField(int index)
          Accessor for the metadata of a field.
 AbstractPropertyMetaData getField(java.lang.String name)
          Accessor for the Meta-Data for a field.
 int getFieldNumber(java.lang.String field_name)
          Accessor for the position of the field with the specified name.
 int getFieldNumberAbsolute(java.lang.String field_name)
          Accessor for the absolute position of the field with the specified name.
 int getFieldNumberAbsolute(java.lang.String class_name, java.lang.String field_name)
          Accessor for the absolute position of the field with the specified name.
 ForeignKeyMetaData[] getForeignKeyMetaData()
          Accessor for foreignKeyMetaData
 java.lang.String getFullClassName()
          Accessor for the full class name.
 IdentityMetaData getIdentityMetaData()
          Accessor for identityMetaData
 IdentityType getIdentityType()
          Accessor for the identity-type.
 IndexMetaData[] getIndexMetaData()
          Accessor for indexMetaData
 InheritanceMetaData getInheritanceMetaData()
          Accessor for inheritanceMetaData
 JoinMetaData[] getJoinMetaData()
          Accessor for joinMetaData
 AbstractPropertyMetaData getManagedField(int position)
          Accessor for a managed field in this class.
 AbstractPropertyMetaData getManagedFieldAbsolute(int abs_position)
          Accessor for a managed field including superclass fields.
protected  AbstractPropertyMetaData getManagedFieldAbsoluteInternal(int abs_position)
          Internal method to get the field for an absolute field number.
 AbstractPropertyMetaData[] getManagedFields()
          Accessor for the managed fields in this class (not including superclass).
 MetaDataManager getMetaDataManager()
          Convenience accessor for the MetaData Manager in use.
 java.lang.String getName()
          Accessor for the class name.
 boolean[] getNonPrimaryKeyFieldFlags()
          Accessor for the flags of the non primary key fields (inc superclass fields).
 int[] getNonPrimaryKeyFieldNumbers()
          Accessor for the field numbers of the non primary key fields (inc superclass fields).
 int getNoOfFields()
          Accessor for the number of fields.
 int getNoOfInheritedManagedFields()
          Accessor for the number of inherited managed fields in superclasses.
 int getNoOfManagedFields()
          Accessor for the number of JDO managed fields.
 int getNoOfOverriddenFields()
          Accessor for the number of JDO overridden fields.
 int getNoOfPrimaryKeyFields()
          Accessor for the number of primary key fields.
 int getNoOfProperties()
          Accessor for the number of properties
 int getNoOfQueries()
          Accessor for the number of named queries.
 java.lang.String getObjectidClass()
          Accessor for the objectid-class tag value.
 AbstractPropertyMetaData getOverriddenField(int position)
          Accessor for an overridden field in this class.
 AbstractPropertyMetaData getOverriddenField(java.lang.String name)
          Accessor for an overridden field with the specified name.
 AbstractPropertyMetaData[] getOverriddenFields()
          Accessor for the overridden fields in this class.
 PackageMetaData getPackageMetaData()
          Convenience accessor for the parent Package MetaData.
 java.lang.String getPackageName()
          Convenience accessor for the package name.
 int[] getPersistenceCapableFieldNumbers()
          Accessor for the absolute field numbers of the PersistenceCapable fields
 java.lang.String getPersistenceCapableSuperclass()
          Accessor for the persistence-capable-superclass tag value.
 ClassPersistenceModifier getPersistenceModifier()
          Accessor for the persistence-modifier
 int[] getPrimaryKeyFieldNumbers()
          Accessor for the field numbers of the primary key fields.
 PrimaryKeyMetaData getPrimaryKeyMetaData()
          Accessor for primaryKeyMetaData
 QueryMetaData getQuery(int index)
          Accessor for the metadata of a named query.
 java.lang.String getSchema()
          Accessor for the schema name.
 boolean[] getSecondClassMutableFieldFlags()
          Accessor for the flags of the second class mutable fields (inc superclass fields).
 int[] getSecondClassMutableFieldNumbers()
          Accessor for the absolute field numbers of the second class mutable fields
 AbstractClassMetaData getSuperAbstractClassMetaData()
          Accessor for the Meta-Data for the superclass of this class.
 java.lang.String getTable()
          Accessor for the table name.
 UniqueMetaData[] getUniqueMetaData()
          Accessor for UniqueMetaData
 java.util.List getUnmappedColumns()
          Accessor for the unmapped columns require for the datastore table.
 VersionMetaData getVersionMetaData()
          Accessor for versionMetaData
 boolean hasField(java.lang.String fieldName)
          Method to check if a field exists in this classes definition.
protected  void inheritDetachableSettings()
          Inherit detach settings from super classes.
protected  void inheritIdentity()
          Inherit the identity definition from super classes.
 void initialise()
          Method to initialise the object, creating internal convenience arrays.
 boolean isDetachable()
          Accessor for the detachable tag value.
 boolean isEmbeddedOnly()
          Accessor for the embedded-only tag value.
 boolean isRequiresExtent()
          Accessor for the requires-extent tag value.
 boolean isSameOrAncestorOf(AbstractClassMetaData cmd)
          Check if the argument cmd is the same as this or a descedent.
protected  java.lang.Class loadClass(ClassLoaderResolver clr)
          Load the persistent interface/class
 void mergeORMData(AbstractClassMetaData ormCmd)
          Method to merge in the associated metadata from the ORM definition
protected  PropertyMetaData newDefaultedProperty(java.lang.String name)
          Utility to add a defaulted PropertyMetaData to the class.
abstract  void populate(ClassLoaderResolver clr)
          Method to provide the details of the class being represented by this MetaData.
protected  void populatePropertyMetaData(ClassLoaderResolver clr, java.lang.Class cls)
          Populate PropertyMetaData
 void setIdentityMetaData(IdentityMetaData identityMetaData)
          Mutator for the identity MetaData.
 void setInheritanceMetaData(InheritanceMetaData inheritanceMetaData)
          Mutator for the inheritance MetaData.
 void setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
          Mutator for the PrimaryKey MetaData.
 void setTable(java.lang.String table_name)
          Mutator for the table name.
 void setVersionMetaData(VersionMetaData versionMetaData)
          Mutator for the Version MetaData.
 boolean usesSingleFieldIdentityClass()
          Whether this PersistenceCapable class uses SingleFieldIdentity
protected  void validateDeprecatedMetaData()
          Check usage of deprecated MetaData
protected  void validateUserInputForIdentity()
          Check for conflicts on super class and this class MetaData identity
protected  void validateUserInputForInheritanceMetaData()
          Check if the inheritance MetaData is credible
 
Methods inherited from class org.jpox.metadata.ExtendableMetaData
addExtension, addExtension, getExtension, getExtensions, getNoOfExtensions, getValueForExtension, getValuesForExtension, getValuesForExtensionStartingWith, hasExtension, removeExtension, toString, toString
 
Methods inherited from class org.jpox.metadata.MetaData
getParent, isCreated, isInitialised, isPopulated, isUsed, populate, setInitialised, setPopulated, setUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queries

protected java.util.List queries
List of named queries


joinMetaData

protected JoinMetaData[] joinMetaData
JoinMetaData


indexMetaData

protected IndexMetaData[] indexMetaData
IndexMetaData


foreignKeyMetaData

protected ForeignKeyMetaData[] foreignKeyMetaData
ForeignKeyMetaData


uniqueMetaData

protected UniqueMetaData[] uniqueMetaData
UniqueMetaData


identityType

protected IdentityType identityType
Identity-type tag value.


name

protected final java.lang.String name
Class name


persistenceModifier

protected ClassPersistenceModifier persistenceModifier
persistence-modifier tag value.


persistenceCapableSuperclass

protected java.lang.String persistenceCapableSuperclass
persistence-capable-superclas tag value.


objectidClass

protected java.lang.String objectidClass
objectid-class tag value.


requiresExtent

protected boolean requiresExtent
requires-extent tag value.


detachable

protected boolean detachable
detachable tag value.


embeddedOnly

protected boolean embeddedOnly
embedded-only tag value.


catalog

protected java.lang.String catalog
Catalog name (O/R mapping).


schema

protected java.lang.String schema
Schema name (O/R mapping).


table

protected java.lang.String table
Table name (O/R mapping). This may be of the form "[database].[catalog].[schema].table"


fullName

protected final java.lang.String fullName
Full name. (e.g org.jpox.MyClass)


versionMetaData

protected VersionMetaData versionMetaData
Version MetaData


identityMetaData

protected IdentityMetaData identityMetaData
Identity MetaData


identitySpecified

protected boolean identitySpecified
Flag whether the identity was specified by the user.


inheritanceMetaData

protected InheritanceMetaData inheritanceMetaData
Inheritance MetaData


primaryKeyMetaData

protected PrimaryKeyMetaData primaryKeyMetaData
PrimaryKey MetaData


properties

protected java.util.List properties
List of properties


unmappedColumns

protected java.util.List unmappedColumns
The columns that are present in the datastore yet not mapped to fields in this class.


joins

protected java.util.List joins
List of joins


fetchGroups

protected java.util.List fetchGroups
List of fetch-group


foreignKeys

protected java.util.List foreignKeys
List of foreign-key


indexes

protected java.util.List indexes
List of indexes


uniqueConstraints

protected java.util.List uniqueConstraints
List of uniqueConstraints


fetchGroupMetaData

protected FetchGroupMetaData[] fetchGroupMetaData
A contained fetch-group element indicates that the named group is to be included in the group being defined. Nested fetch group elements are limited to only the name attribute.


fetchGroupMetaDataByName

protected java.util.Map fetchGroupMetaDataByName

pcSuperclassMetaData

protected AbstractClassMetaData pcSuperclassMetaData
Class MetaData for the Persistence-Capable superclass (if any)


propertyMetaData

protected AbstractPropertyMetaData[] propertyMetaData
convenience PropertyMetaData


managedFields

protected AbstractPropertyMetaData[] managedFields
JDO managed fields. Contains the same AbstractPropertyMetaData objects as are in "fields".


overriddenFields

protected AbstractPropertyMetaData[] overriddenFields
Fields for superclasse sthat are overridden in this class.


fieldNumbersByName

protected java.util.Map fieldNumbersByName
Field numbers mapped by the name of the field.


allFieldNumbers

protected int[] allFieldNumbers
Field numbers of all fields (inc superclasses).


primaryKeyFieldNumbers

protected int[] primaryKeyFieldNumbers
Field numbers of the primary key fields (inc superclasses).


nonPrimaryKeyFieldNumbers

protected int[] nonPrimaryKeyFieldNumbers
Field numbers of the non-primary key fields (inc superclasses).


nonPrimaryKeyFieldFlags

protected boolean[] nonPrimaryKeyFieldFlags
Field numbers of the non-primary key fields (inc superclasses).


defaultFetchGroupFieldNumbers

protected int[] defaultFetchGroupFieldNumbers
Field numbers of the default fetch group fields (inc superclasses).


defaultFetchGroupFieldFlags

protected boolean[] defaultFetchGroupFieldFlags
Flags of the default fetch group state for all fields.


secondClassMutableFieldNumbers

protected int[] secondClassMutableFieldNumbers
Field numbers of the second class mutable fields (inc superclasses).


secondClassMutableFieldFlags

protected boolean[] secondClassMutableFieldFlags
Flags of the second class mutable state for all fields.


persistenceCapableFieldNumbers

protected int[] persistenceCapableFieldNumbers
Field numbers of the PersistenceCapable fields (inc superclasses).


noOfInheritedManagedFields

protected int noOfInheritedManagedFields
No of managed fields in superclasses, that are inherited by this class.


usesSingleFieldIdentityClass

protected boolean usesSingleFieldIdentityClass
if this PersistenceCapable class uses SingleFieldIdentity


persistentInterfaceImplNeedingTableFromSuperclass

protected transient boolean persistentInterfaceImplNeedingTableFromSuperclass
Implementation of "persistent-interface" needing table setting from superclass.


persistentInterfaceImplNeedingTableFromSubclass

protected transient boolean persistentInterfaceImplNeedingTableFromSubclass
Implementation of "persistent-interface" needing table setting from subclass.

Constructor Detail

AbstractClassMetaData

protected AbstractClassMetaData(PackageMetaData parent,
                                java.lang.String name,
                                java.lang.String identityType,
                                java.lang.String objectidClass,
                                java.lang.String requiresExtent,
                                java.lang.String detachable,
                                java.lang.String embeddedOnly,
                                java.lang.String modifier,
                                java.lang.String persistenceCapableSuperclass,
                                java.lang.String catalog,
                                java.lang.String schema,
                                java.lang.String table)
Constructor. Takes the basic string information found in the MetaData file.

Parameters:
parent - The package to which this class/interface belongs
name - Name of class
identityType - identity-type flag
objectidClass - Primary key class name
requiresExtent - Whether the class requires an extent
detachable - Whether the class can be detached
embeddedOnly - embedded-only tag
modifier - persistence-modifier tag
catalog - The catalog name default for this class
schema - The schema name default for this class
table - RDBMS table to store the class in

AbstractClassMetaData

public AbstractClassMetaData(InterfaceMetaData imd,
                             java.lang.String implClassName,
                             boolean copyFields)
Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".

Parameters:
imd - MetaData for the "persistent-interface"
implClassName - Name of the implementation class
copyFields - Whether to copy the fields of the interface too
Method Detail

copyFieldsFromInterface

protected void copyFieldsFromInterface(InterfaceMetaData imd)
Convenience method to copy the fields from an existing interface

Parameters:
imd - The class/interface that we copy from

checkInitialised

protected void checkInitialised()
Method to check whether the Meta-Data has been initialised.

Throws:
javax.jdo.JDOFatalInternalException - Thrown if the Meta-Data hasn't been initialised.

checkPopulated

protected void checkPopulated()
                       throws javax.jdo.JDOFatalInternalException
Method to check whether the Meta-Data has been populated.

Throws:
javax.jdo.JDOFatalInternalException - Thrown if the Meta-Data hasn't been populated.

loadClass

protected java.lang.Class loadClass(ClassLoaderResolver clr)
Load the persistent interface/class

Parameters:
clr - the ClassLoader
Returns:
the loaded class

determineIdentity

protected void determineIdentity()
Determines the identity based on MetaData defaults or user defined MetaData


addPropertiesNotInMetaData

protected void addPropertiesNotInMetaData(java.lang.Class cls)
Add PropertyMetaData of properties not declared in MetaData

Parameters:
cls - This class

determineSuperClassName

protected void determineSuperClassName(ClassLoaderResolver clr,
                                       java.lang.Class cls)
Determine the super PersistenceCapable class. The persistence-capable-superclass attribute is deprecated for JDO2.0. The attribute will be ignored so metadata files from previous releases can be used. The persistenceCapableSuperclass we use will be retrieved from the class itself.

Parameters:
clr - The ClassLoaderResolver
cls - This class
Throws:
InvalidMetaDataException - if the declared persistence-capable-superclass super class cannot be loaded by the clr.
InvalidMetaDataException - if the declared persistence-capable-superclass has no reachable MetaData

validateUserInputForIdentity

protected void validateUserInputForIdentity()
Check for conflicts on super class and this class MetaData identity

Throws:
InvalidMetaDataException - if the user tries to overwrite a super class identity / strategy

getBaseAbstractClassMetaData

public AbstractClassMetaData getBaseAbstractClassMetaData()
Convenience accessor for the AbstractClassMetaData of the base object in this hierarchy.

Returns:
The AbstractClassMetaData for the base object.

inheritDetachableSettings

protected void inheritDetachableSettings()
Inherit detach settings from super classes. This class is forced to be detachable if the super classes is.


inheritIdentity

protected void inheritIdentity()
Inherit the identity definition from super classes.

Throws:
InvalidMetaDataException - if the MetaData of this class conflicts with super classes definition

newDefaultedProperty

protected PropertyMetaData newDefaultedProperty(java.lang.String name)
Utility to add a defaulted PropertyMetaData to the class. Provided as a method since then any derived classes can override it (e.g JDOConfigClass can create a JDOConfigField)

Parameters:
name - name of field
Returns:
the new PropertyMetaData

mergeORMData

public void mergeORMData(AbstractClassMetaData ormCmd)
Method to merge in the associated metadata from the ORM definition

Parameters:
ormCmd - The ORM Class definition

populatePropertyMetaData

protected void populatePropertyMetaData(ClassLoaderResolver clr,
                                        java.lang.Class cls)
Populate PropertyMetaData

Parameters:
clr - The ClassLoader
cls - This class
Throws:
InvalidMetaDataException - if the Class for a declared type in a field cannot be loaded by the clr
InvalidMetaDataException - if a field declared in the MetaData does not exist in the Class

validateUserInputForInheritanceMetaData

protected void validateUserInputForInheritanceMetaData()
Check if the inheritance MetaData is credible

Throws:
InvalidMetaDataException - if the strategy is superclass-table, yet there are no super class
InvalidMetaDataException - if the strategy is superclass-table, yet the super class has not specified a discriminator
InvalidMetaDataException - if the strategy is superclass-table and discriminator is "value-map", yet no value for the discriminator has been specified

getSuperAbstractClassMetaData

public AbstractClassMetaData getSuperAbstractClassMetaData()
Accessor for the Meta-Data for the superclass of this class.

Returns:
MetaData of the superclass

getDiscriminatorStrategy

public final DiscriminatorStrategy getDiscriminatorStrategy()
Convenience accessor for the discriminator strategy applying to this class. This is specified on the class managing the table if at all.

Returns:
The discriminator strategy

determineObjectIdClass

protected void determineObjectIdClass(ClassLoaderResolver clr)
Determine the object id class

Parameters:
clr - the ClassLoader
Throws:
InvalidMetaDataException - if the class 0 or more that one primary key field and no objectid-class has been declared in the MetaData
InvalidMetaDataException - if the objectid-class has not been set and the primary key field does not match a supported SingleFieldIdentity
InvalidMetaDataException - if the identity type is APPLICATION but not primary key fields have been set
InvalidMetaDataException - if the objectid-class cannot be loaded by the clr

populate

public abstract void populate(ClassLoaderResolver clr)
Method to provide the details of the class being represented by this MetaData. This can be used to firstly provide defaults for attributes that aren't specified in the MetaData, and secondly to report any errors with attributes that have been specifed that are inconsistent with the class being represented.

This method must be invoked by subclasses during populate operations

Parameters:
clr - ClassLoaderResolver to use in loading any classes

initialise

public void initialise()
Method to initialise the object, creating internal convenience arrays. Initialises all sub-objects. If populate() is going to be used it should be used BEFORE calling this method. Subclasses must overwrite this method and invoke this

Overrides:
initialise in class MetaData

determineInheritanceMetaData

protected void determineInheritanceMetaData()
Impose a default inheritance strategy to match the JDO 2 spec


validateDeprecatedMetaData

protected void validateDeprecatedMetaData()
Check usage of deprecated MetaData

Throws:
InvalidMetaDataException - if deprecated MetaData is used

getNoOfQueries

public int getNoOfQueries()
Accessor for the number of named queries.

Returns:
no of named queries

getQuery

public QueryMetaData getQuery(int index)
Accessor for the metadata of a named query.

Parameters:
index - query index
Returns:
Meta-Data for the named query.

getVersionMetaData

public final VersionMetaData getVersionMetaData()
Accessor for versionMetaData

Returns:
Returns the versionMetaData.

getJoinMetaData

public final JoinMetaData[] getJoinMetaData()
Accessor for joinMetaData

Returns:
Returns the joinMetaData.

getFetchGroupMetaData

public final FetchGroupMetaData[] getFetchGroupMetaData()
Accessor for all MetaData defined for fetch groups for this class. This doesn't include superclasses.

Returns:
Returns the fetchGroupMetaData.

getFullClassName

public java.lang.String getFullClassName()
Accessor for the full class name.

Returns:
full class name.

getFetchGroupMetaData

public FetchGroupMetaData[] getFetchGroupMetaData(java.util.Collection groupNames)
Accessor for fetch group metadata for the specified groups (if present). The returned metadata is what is defined for this class that matches any of the names in the input set.

Parameters:
groupNames - Names of the fetch groups
Returns:
MetaData for the groups

getIdentityType

public IdentityType getIdentityType()
Accessor for the identity-type.

Returns:
identity-type tag value

getIndexMetaData

public final IndexMetaData[] getIndexMetaData()
Accessor for indexMetaData

Returns:
Returns the indexMetaData.

getForeignKeyMetaData

public final ForeignKeyMetaData[] getForeignKeyMetaData()
Accessor for foreignKeyMetaData

Returns:
Returns the foreignKeyMetaData.

getUniqueMetaData

public final UniqueMetaData[] getUniqueMetaData()
Accessor for UniqueMetaData

Returns:
Returns the UniqueMetaData.

getUnmappedColumns

public final java.util.List getUnmappedColumns()
Accessor for the unmapped columns require for the datastore table.

Returns:
The list of unmapped columns

getNoOfProperties

public int getNoOfProperties()
Accessor for the number of properties

Returns:
no of properties

getName

public java.lang.String getName()
Accessor for the class name.

Returns:
class name

getObjectidClass

public java.lang.String getObjectidClass()
Accessor for the objectid-class tag value.

Returns:
the fully qualified objectid class name

getCatalog

public java.lang.String getCatalog()
Accessor for the catalog name.

Returns:
catalog name

getSchema

public java.lang.String getSchema()
Accessor for the schema name.

Returns:
schema name

getTable

public java.lang.String getTable()
Accessor for the table name.

Returns:
table name

isRequiresExtent

public boolean isRequiresExtent()
Accessor for the requires-extent tag value.

Returns:
requires-extent tag value

isDetachable

public boolean isDetachable()
Accessor for the detachable tag value.

Returns:
detachable tag value

isEmbeddedOnly

public boolean isEmbeddedOnly()
Accessor for the embedded-only tag value.

Returns:
embedded-only tag value

getIdentityMetaData

public final IdentityMetaData getIdentityMetaData()
Accessor for identityMetaData

Returns:
Returns the identityMetaData.

getInheritanceMetaData

public final InheritanceMetaData getInheritanceMetaData()
Accessor for inheritanceMetaData

Returns:
Returns the inheritanceMetaData.

getPrimaryKeyMetaData

public final PrimaryKeyMetaData getPrimaryKeyMetaData()
Accessor for primaryKeyMetaData

Returns:
Returns the primaryKey MetaData.

getMetaDataManager

public MetaDataManager getMetaDataManager()
Convenience accessor for the MetaData Manager in use.

Returns:
MetaDataManager.

getPackageMetaData

public PackageMetaData getPackageMetaData()
Convenience accessor for the parent Package MetaData.

Returns:
MetaData for parent package.

getPackageName

public java.lang.String getPackageName()
Convenience accessor for the package name.

Returns:
package name.

getNoOfFields

public int getNoOfFields()
Accessor for the number of fields. This is the total number of fields (inc static, final etc) in this class

Returns:
no of fields

getField

public AbstractPropertyMetaData getField(int index)
Accessor for the metadata of a field. Does not include superclasses

Parameters:
index - field index relative to this class only starting from 0
Returns:
Meta-Data for the field.

getPersistenceModifier

public ClassPersistenceModifier getPersistenceModifier()
Accessor for the persistence-modifier

Returns:
persistence-modifier tag value

getPersistenceCapableSuperclass

public java.lang.String getPersistenceCapableSuperclass()
Accessor for the persistence-capable-superclass tag value.

Returns:
persistence-capable-superclass tag value

isSameOrAncestorOf

public boolean isSameOrAncestorOf(AbstractClassMetaData cmd)
Check if the argument cmd is the same as this or a descedent.

Parameters:
cmd - the AbstractClassMetaData to be verify if this is an ancestor
Returns:
true if the argument is a child or same as this

getFetchGroupMetaData

public FetchGroupMetaData getFetchGroupMetaData(java.lang.String groupname)
Accessor for the fetch group metadata for the group specified. Overrides the version in AbstractClassMetaData so that we can allow for superclasses.

Parameters:
groupname - Name of the fetch group
Returns:
MetaData for this group

hasField

public boolean hasField(java.lang.String fieldName)
Method to check if a field exists in this classes definition.

Parameters:
fieldName - Nme of field
Returns:
return true if exists.

getField

public AbstractPropertyMetaData getField(java.lang.String name)
Accessor for the Meta-Data for a field. Include superclasses

Parameters:
name - the name of the field
Returns:
Meta-Data for the field.

getNoOfManagedFields

public int getNoOfManagedFields()
Accessor for the number of JDO managed fields. The number of fields is for this class only.

Returns:
no of JDO managed fields in this class

getManagedFields

public AbstractPropertyMetaData[] getManagedFields()
Accessor for the managed fields in this class (not including superclass).

Returns:
The JDO managed fields in this class

getManagedField

public AbstractPropertyMetaData getManagedField(int position)
Accessor for a managed field in this class. The position is relative to the first field in this class (ignores superclasses).

Parameters:
position - The position of the managed field. 0 = first in the class
Returns:
The JDO managed field at that position

getNoOfOverriddenFields

public int getNoOfOverriddenFields()
Accessor for the number of JDO overridden fields. The number of fields is for this class only.

Returns:
no of JDO overridden fields in this class

getOverriddenFields

public AbstractPropertyMetaData[] getOverriddenFields()
Accessor for the overridden fields in this class.

Returns:
The JDO overridden fields in this class

getOverriddenField

public AbstractPropertyMetaData getOverriddenField(int position)
Accessor for an overridden field in this class.

Parameters:
position - The position of the overridden field.
Returns:
The JDO managed field at that position

getOverriddenField

public AbstractPropertyMetaData getOverriddenField(java.lang.String name)
Accessor for an overridden field with the specified name.

Parameters:
name - Name of the field
Returns:
The MetaData for the field

getNoOfInheritedManagedFields

public int getNoOfInheritedManagedFields()
Accessor for the number of inherited managed fields in superclasses.

Returns:
No of inherited managed fields in superclasses.

getManagedFieldAbsolute

public AbstractPropertyMetaData getManagedFieldAbsolute(int abs_position)
Accessor for a managed field including superclass fields.

Parameters:
abs_position - The position of the managed field including the superclass. Fields are numbered from 0 in the root superclass.
Returns:
The JDO managed field at this "absolute" position.

getManagedFieldAbsoluteInternal

protected AbstractPropertyMetaData getManagedFieldAbsoluteInternal(int abs_position)
Internal method to get the field for an absolute field number. If the field for that absolute field position is overridden by a field in this class then this field will be returned.

Parameters:
abs_position - The position of the managed field including the superclass. Fields are numbered from 0 in the root superclass.
Returns:
The JDO managed field at this "absolute" position.

getAbsoluteFieldNumberForRelativeFieldNumber

public int getAbsoluteFieldNumberForRelativeFieldNumber(int relativeFieldNo)
Accessor for the Absolute field number for a relative field number

Parameters:
relativeFieldNo - The relative field number
Returns:
The absolute field number

getFieldNumber

public int getFieldNumber(java.lang.String field_name)
Accessor for the position of the field with the specified name. The returned position is relative to this class only.

Parameters:
field_name - Name of the field
Returns:
Position of the field in this class.

getFieldNumberAbsolute

public int getFieldNumberAbsolute(java.lang.String field_name)
Accessor for the absolute position of the field with the specified name. The absolute position has origin of the root superclass, starting at 0.

Parameters:
field_name - Name of the field
Returns:
Absolute position of the field.

getFieldNumberAbsolute

public int getFieldNumberAbsolute(java.lang.String class_name,
                                  java.lang.String field_name)
Accessor for the absolute position of the field with the specified name. The absolute position has origin of the root superclass, starting at 0. Will only retrieve the absolute field number if the field_name is of type given by class_name.

Parameters:
class_name - Name of the class
field_name - Name of the field
Returns:
Absolute position of the field.

getNoOfPrimaryKeyFields

public int getNoOfPrimaryKeyFields()
Accessor for the number of primary key fields.

Returns:
no of primary key fields

getAllFieldNumbers

public int[] getAllFieldNumbers()
Accessor for all field numbers. These are absolute numbers and include superclasses and are really just 0, 1, 2, ... n.

Returns:
The field numbers of all (managed) fields.

getPrimaryKeyFieldNumbers

public int[] getPrimaryKeyFieldNumbers()
Accessor for the field numbers of the primary key fields. These are absolute numbers (including superclasses).

Returns:
The field numbers of the primary key fields

getNonPrimaryKeyFieldNumbers

public int[] getNonPrimaryKeyFieldNumbers()
Accessor for the field numbers of the non primary key fields (inc superclass fields).

Returns:
The field numbers

getNonPrimaryKeyFieldFlags

public boolean[] getNonPrimaryKeyFieldFlags()
Accessor for the flags of the non primary key fields (inc superclass fields).

Returns:
The flags whether the field is non primary key

getDefaultFetchGroupFieldNumbers

public int[] getDefaultFetchGroupFieldNumbers()
Accessor for the absolute field numbers of the default fetch group fields (inc superclasses).

Returns:
The field numbers of the DFG fields (inc superclasses).

getDefaultFetchGroupFieldFlags

public boolean[] getDefaultFetchGroupFieldFlags()
Accessor for the flags of the default fetch group fields (inc superclass fields).

Returns:
The flags whether the field is in the DFG

getSecondClassMutableFieldNumbers

public int[] getSecondClassMutableFieldNumbers()
Accessor for the absolute field numbers of the second class mutable fields

Returns:
The field numbers of the second class mutable fields (inc superclasses).

getPersistenceCapableFieldNumbers

public int[] getPersistenceCapableFieldNumbers()
Accessor for the absolute field numbers of the PersistenceCapable fields

Returns:
The field numbers of the PersistenceCapable fields (inc superclasses).

getSecondClassMutableFieldFlags

public boolean[] getSecondClassMutableFieldFlags()
Accessor for the flags of the second class mutable fields (inc superclass fields).

Returns:
The flags whether the field is second class mutable

usesSingleFieldIdentityClass

public boolean usesSingleFieldIdentityClass()
Whether this PersistenceCapable class uses SingleFieldIdentity

Returns:
true if using SingleFieldIdentity as objectid class

addQuery

public void addQuery(QueryMetaData qmd)
Method to add a named query to this class. Rejects the addition of duplicate named queries.

Parameters:
qmd - Meta-Data for the query.

addIndex

public void addIndex(IndexMetaData idxmd)
Method to add an index to this class.

Parameters:
idxmd - Meta-Data for the index.

addForeignKey

public void addForeignKey(ForeignKeyMetaData fkmd)
Method to add an foreign-key to this class.

Parameters:
fkmd - Meta-Data for the foreign-key.

addUniqueConstraint

public void addUniqueConstraint(UniqueMetaData unimd)
Method to add a unique constraint to this class.

Parameters:
unimd - Meta-Data for the unique constraint.

addUnmappedColumn

public final void addUnmappedColumn(ColumnMetaData colmd)
Method to add an unmapped column.

Parameters:
colmd - The metadata for the unmapped column

addProperty

public void addProperty(AbstractPropertyMetaData pmd)
Method to add a property (field) to this interface. Rejects the addition of duplicate named properties (fields).

Parameters:
pmd - Property

addFetchGroup

public void addFetchGroup(FetchGroupMetaData fgmd)
Method to add a fetch-group to this class.

Parameters:
fgmd - Meta-Data for the fetch-group.

addJoin

public void addJoin(JoinMetaData jnmd)
Method to add a join to this class. Rejects the addition of duplicate named fields.

Parameters:
jnmd - Meta-Data for the join.

setVersionMetaData

public final void setVersionMetaData(VersionMetaData versionMetaData)
Mutator for the Version MetaData.

Parameters:
versionMetaData - The versionMetaData to set.

setIdentityMetaData

public final void setIdentityMetaData(IdentityMetaData identityMetaData)
Mutator for the identity MetaData.

Parameters:
identityMetaData - The identityMetaData to set.

setInheritanceMetaData

public final void setInheritanceMetaData(InheritanceMetaData inheritanceMetaData)
Mutator for the inheritance MetaData.

Parameters:
inheritanceMetaData - The inheritanceMetaData to set.

setPrimaryKeyMetaData

public final void setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
Mutator for the PrimaryKey MetaData.

Parameters:
primaryKeyMetaData - The PrimaryKey MetaData to set.

setTable

public final void setTable(java.lang.String table_name)
Mutator for the table name.

Parameters:
table_name - Name of the table


Copyright © -2007 . All Rights Reserved.