org.jpox.metadata
Class MetaDataManager

java.lang.Object
  extended by org.jpox.metadata.MetaDataManager
Direct Known Subclasses:
JDOMetaDataManager, JPAMetaDataManager

public abstract class MetaDataManager
extends java.lang.Object

Manager of MetaData information in JPOX.

Acts as a registry of metadata so that metadata files don't need to be parsed multiple times. MetaData is stored as a FileMetaData, which contains PackageMetaData, which contains ClassMetaData, and so on. This maps exactly to the users model of their metadata. The users access point is getMetaDataForClass() which will check the known classes without metadata, then check the existing registered metdata, then check the valid locations for metdata files. This way, the metadata is managed from this single point.

Maintains a list of all classes that have been checked for MetaData and don't have any available. This avoids the needs to look up MetaData multiple times finding the same result. Currently this list is for all ClassMetaData objects keyed by the class name.

Version:
$Revision: 1.102.2.2 $

Field Summary
protected  AnnotationManager annotationManager
          Manager for annotations.
protected  java.util.Map classMetaDataByClass
          Map of ClassMetaData, keyed by the class name.
protected  boolean enhancing
          Indicator for whether this manager is managing the enhancement process, else it's runtime.
protected  java.util.Map fileMetaDataByURLString
          Map of FileMetaData for the parsed files, keyed by the URL string.
protected static Localiser LOCALISER
          Localiser for messages.
protected  MetaDataParser metaDataParser
          Parser for MetaData.
protected  PMFContext pmfContext
          The PMF Context that this metadata manager is operating in.
protected  java.util.Map queryMetaDataByName
          Map of QueryMetaData, keyed by the (class name + query name).
protected  java.util.Map sequenceMetaDataByPackageSequence
          Map of SequenceMetaData, keyed by the package name and sequence name.
protected  java.util.Map tableGeneratorMetaDataByPackageSequence
          Map of TableGeneratorMetaData, keyed by the package name and generator name.
protected  boolean validateMetaData
          Flag whether we should validate the metadata files when parsing.
 
Constructor Summary
MetaDataManager(PMFContext pmfContext)
          Constructor, specifying the PMFContext used.
 
Method Summary
 void addORMDataToClass(java.lang.Class c, ClassLoaderResolver clr)
          Load up and add any O/R mapping info for the specified class to the stored ClassMetaData (if supported).
 void close()
          Clear resources
 java.lang.String[] getClassesImplementingInterface(java.lang.String interfaceName, ClassLoaderResolver clr)
          Accessor for the list of names of classes that are declared to implement the specified interface (using <implements> in the MetaData).
 java.util.Collection getClassesWithMetaData()
          Accessor for the names of the classes with MetaData currently registered with this manager.
 ClassMetaData getClassMetaDataForImplementationOfPersistentInterface(java.lang.String interfaceName)
          Accessor for the metadata for the implementation of the specified "persistent-interface".
 java.lang.String getImplementationNameForPersistentInterface(java.lang.String interfaceName)
          Accessor for the implementation name for the specified "persistent-interface".
 AbstractClassMetaData getMetaDataForClass(java.lang.Class c, ClassLoaderResolver clr)
          Main accessor for the MetaData for a class.
 AbstractClassMetaData getMetaDataForClass(java.lang.String className, ClassLoaderResolver clr)
          Accessor for the MetaData for a class given the name and a loader.
abstract  AbstractClassMetaData getMetaDataForClassInternal(java.lang.Class c, ClassLoaderResolver clr)
          Internal convenience method for accessing the MetaData for a class.
 AbstractClassMetaData getMetaDataForEntityName(java.lang.String entityName)
          Accessor for the MetaData for a class.
 AbstractPropertyMetaData getMetaDataForField(java.lang.Class c, ClassLoaderResolver clr, java.lang.String field_name)
          Accessor for the MetaData for a field of a class.
 AbstractPropertyMetaData getMetaDataForField(java.lang.String className, java.lang.String fieldName, ClassLoaderResolver clr)
          Accessor for the MetaData for a field of a class.
 ClassMetaData getMetaDataForImplementationOfReference(java.lang.Class referenceClass, java.lang.Object implValue, ClassLoaderResolver clr)
          Accessor for the MetaData for an implementation of a reference type.
 InterfaceMetaData getMetaDataForInterface(java.lang.Class c, ClassLoaderResolver clr)
          Accessor for the MetaData for an interface.
 QueryMetaData getMetaDataForQuery(java.lang.Class cls, ClassLoaderResolver clr, java.lang.String queryName)
          Accessor for the MetaData for a named query for a class.
 SequenceMetaData getMetaDataForSequence(ClassLoaderResolver clr, java.lang.String seqName)
          Accessor for the MetaData for a Sequence in a package.
 TableGeneratorMetaData getMetaDataForTableGenerator(ClassLoaderResolver clr, java.lang.String genName)
          Accessor for the MetaData for a TableGenerator in a package.
 PMFContext getPMFContext()
          Accessor for the PMF Context that this manager is running in.
 java.util.List getReferencedClassMetaData(AbstractClassMetaData cmd, java.lang.String dba_vendor_id, ClassLoaderResolver clr)
          Utility to return all ClassMetaData that is referenced from the supplier class.
 java.lang.String[] getSubclassesForClass(java.lang.String className, boolean includeDescendents)
          Accessor for the subclasses of a particular class
abstract  boolean hasMetaDataForClass(java.lang.String className)
          Convenience method to check if we have metadata for the specified class
protected  void initialiseClassMetaData(ClassMetaData cmd, java.lang.Class cls, ClassLoaderResolver clr)
          Utility to initialise the MetaData for a class, using the specified class.
protected  void initialiseFileMetaData(FileMetaData filemd, ClassLoaderResolver clr, java.lang.ClassLoader primary)
          Initialise all classes/interfaces in a Meta-Data file.
protected  void initialiseInterfaceMetaData(InterfaceMetaData imd, ClassLoaderResolver clr, java.lang.ClassLoader primary)
          Utility to initialise the MetaData for a interface, using the specified class.
protected abstract  boolean isClassWithoutMetaData(java.lang.String class_name)
          Accessor for whether a class doesn't have MetaData.
 boolean isEnhancing()
          Accessor for whether we are managing the enhancement process.
 boolean isPersistentInterface(java.lang.String name)
          Convenience method to return if the passed class name is a "persistent-interface".
 boolean isPersistentInterfaceImplementation(java.lang.String interfaceName, java.lang.String implName)
          Convenience method to return if the passed class name is an implementation of the passed "persistent-interface".
protected  FileMetaData loadAnnotationsForClass(java.lang.Class cls, ClassLoaderResolver clr, boolean populate)
          Method to load the annotations for the specified class and return the FileMetaData containing the class.
 ClassMetaData newClassObject(PackageMetaData pmd, 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, java.lang.String entityName)
          Utility to create a new class component.
 FieldMetaData newFieldObject(MetaData md, java.lang.String name, java.lang.String pk, java.lang.String modifier, java.lang.String defaultFetchGroup, java.lang.String nullValue, java.lang.String embedded, java.lang.String serialized, java.lang.String dependent, java.lang.String mappedBy, java.lang.String column, java.lang.String table, java.lang.String deleteAction, java.lang.String indexed, java.lang.String unique, java.lang.String recursionDepth, java.lang.String loadFetchGroup, java.lang.String valueStrategy, java.lang.String sequence, java.lang.String fieldType)
          Utility to create a new field component.
 PropertyMetaData newPropertyObject(MetaData md, java.lang.String name, java.lang.String pk, java.lang.String modifier, java.lang.String defaultFetchGroup, java.lang.String nullValue, java.lang.String embedded, java.lang.String serialized, java.lang.String dependent, java.lang.String mappedBy, java.lang.String column, java.lang.String table, java.lang.String deleteAction, java.lang.String indexed, java.lang.String unique, java.lang.String recursionDepth, java.lang.String loadFetchGroup, java.lang.String valueStrategy, java.lang.String sequence, java.lang.String fieldType, java.lang.String fieldName)
          Utility to create a new property component.
protected abstract  FileMetaData parseFile(java.net.URL file_url)
          Utility to parse a MetaData file.
 PersistenceFileMetaData[] parsePersistenceFiles()
          Method to parse the available "persistence.xml" files returning the metadata for all found.
protected  void populateFileMetaData(FileMetaData filemd, ClassLoaderResolver clr, java.lang.ClassLoader primary)
          Convenience method to populate all classes/interfaces in a Meta-Data file.
 ClassMetaData readMetaDataForClass(java.lang.String className)
          Method to access the (already known) metadata for the specified class.
 AbstractPropertyMetaData readMetaDataForField(java.lang.String className, java.lang.String fieldName)
          Method to access the (already known) metadata for the field of the specified class.
protected abstract  void registerFile(java.lang.String fileURLString, FileMetaData filemd)
          Method to take the FileMetaData and register the relevant parts of it with the assorted caches provided.
 void registerPersistentInterface(InterfaceMetaData imd, java.lang.Class implClass, ClassLoaderResolver clr)
          Method to register a persistent interface and its implementation with the MetaData system.
protected  void registerQueriesForFile(FileMetaData filemd)
          Convenience method to register all queries found in the passed file.
protected  void registerSequencesForFile(FileMetaData filemd)
          Convenience method to register all sequences found in the passed file.
protected  void registerTableGeneratorsForFile(FileMetaData filemd)
          Convenience method to register all table generators found in the passed file.
 void setValidate(boolean validate)
          Mutator for whether to validate the MetaData files for XML compliance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.


pmfContext

protected PMFContext pmfContext
The PMF Context that this metadata manager is operating in.


annotationManager

protected AnnotationManager annotationManager
Manager for annotations.


metaDataParser

protected MetaDataParser metaDataParser
Parser for MetaData.


validateMetaData

protected boolean validateMetaData
Flag whether we should validate the metadata files when parsing.


fileMetaDataByURLString

protected java.util.Map fileMetaDataByURLString
Map of FileMetaData for the parsed files, keyed by the URL string.


classMetaDataByClass

protected java.util.Map classMetaDataByClass
Map of ClassMetaData, keyed by the class name.


queryMetaDataByName

protected java.util.Map queryMetaDataByName
Map of QueryMetaData, keyed by the (class name + query name).


sequenceMetaDataByPackageSequence

protected java.util.Map sequenceMetaDataByPackageSequence
Map of SequenceMetaData, keyed by the package name and sequence name.


tableGeneratorMetaDataByPackageSequence

protected java.util.Map tableGeneratorMetaDataByPackageSequence
Map of TableGeneratorMetaData, keyed by the package name and generator name.


enhancing

protected boolean enhancing
Indicator for whether this manager is managing the enhancement process, else it's runtime.

Constructor Detail

MetaDataManager

public MetaDataManager(PMFContext pmfContext)
Constructor, specifying the PMFContext used.

Parameters:
pmfContext - PMF Context that this metadata manager operates in
Method Detail

newClassObject

public ClassMetaData newClassObject(PackageMetaData pmd,
                                    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,
                                    java.lang.String entityName)
Utility to create a new class component. This method exists so that the Enhancer can create its own ClassMetaData objects using its class.

Parameters:
pmd - MetaData for package
name - Name of class
identityType - identity type
objectidClass - name of objectid class
requiresExtent - Whether an extent is required
detachable - Whether it is detachable
embeddedOnly - Whether it is embedded only
modifier - persistence modifier
persistenceCapableSuperclass - PC superclass (deprecated)
catalog - catalog to use
schema - schema to use
table - table to use
entityName - the entity name required by JPA §4.3.1
Returns:
The MetaData for the class

newFieldObject

public FieldMetaData newFieldObject(MetaData md,
                                    java.lang.String name,
                                    java.lang.String pk,
                                    java.lang.String modifier,
                                    java.lang.String defaultFetchGroup,
                                    java.lang.String nullValue,
                                    java.lang.String embedded,
                                    java.lang.String serialized,
                                    java.lang.String dependent,
                                    java.lang.String mappedBy,
                                    java.lang.String column,
                                    java.lang.String table,
                                    java.lang.String deleteAction,
                                    java.lang.String indexed,
                                    java.lang.String unique,
                                    java.lang.String recursionDepth,
                                    java.lang.String loadFetchGroup,
                                    java.lang.String valueStrategy,
                                    java.lang.String sequence,
                                    java.lang.String fieldType)
Utility to create a new field component. This method exists so that the Enhancer can create its own FieldMetaData objects using its class.

Parameters:
md - Parent metadata
name - Name of field
pk - Whether it is PK
modifier - persistence modifier
defaultFetchGroup - Whether it is in DFG
nullValue - Behaviour on null value
embedded - Whether it is embedded
serialized - Whether it is serialised
dependent - Whether it is dependent
mappedBy - Field that it is mapped into
column - column to use
table - table to use
deleteAction - Action on FK delete
indexed - whether the column is indexed
unique - Whether the column is unique
recursionDepth - Recursion depth
loadFetchGroup - Whether to load the fetch group
valueStrategy - Value strategy for generating field values
sequence - Sequence name if required
fieldType - Type of the field
Returns:
FieldMetaData

newPropertyObject

public PropertyMetaData newPropertyObject(MetaData md,
                                          java.lang.String name,
                                          java.lang.String pk,
                                          java.lang.String modifier,
                                          java.lang.String defaultFetchGroup,
                                          java.lang.String nullValue,
                                          java.lang.String embedded,
                                          java.lang.String serialized,
                                          java.lang.String dependent,
                                          java.lang.String mappedBy,
                                          java.lang.String column,
                                          java.lang.String table,
                                          java.lang.String deleteAction,
                                          java.lang.String indexed,
                                          java.lang.String unique,
                                          java.lang.String recursionDepth,
                                          java.lang.String loadFetchGroup,
                                          java.lang.String valueStrategy,
                                          java.lang.String sequence,
                                          java.lang.String fieldType,
                                          java.lang.String fieldName)
Utility to create a new property component. This method exists so that the Enhancer can create its own PropertyMetaData objects using its class.

Parameters:
md - Parent metadata
name - Name of field
pk - Whether it is PK
modifier - persistence modifier
defaultFetchGroup - Whether it is in DFG
nullValue - Behaviour on null value
embedded - Whether it is embedded
serialized - Whether it is serialised
dependent - Whether it is dependent
mappedBy - Field that it is mapped into
column - column to use
table - table to use
deleteAction - Action on FK delete
indexed - whether the column is indexed
unique - Whether the column is unique
recursionDepth - Recursion depth
loadFetchGroup - Whether to load the fetch group
valueStrategy - Value strategy for generating field values
sequence - Sequence name if required
fieldType - Type of the field
fieldName - Name of the field
Returns:
PropertyMetaData

setValidate

public void setValidate(boolean validate)
Mutator for whether to validate the MetaData files for XML compliance.

Parameters:
validate - Whether to validate

getPMFContext

public PMFContext getPMFContext()
Accessor for the PMF Context that this manager is running in.

Returns:
The PMF Context

close

public void close()
Clear resources


isEnhancing

public boolean isEnhancing()
Accessor for whether we are managing the enhancement process.

Returns:
Whether we are enhancing

getClassesWithMetaData

public java.util.Collection getClassesWithMetaData()
Accessor for the names of the classes with MetaData currently registered with this manager.

Returns:
Names of classes with MetaData

hasMetaDataForClass

public abstract boolean hasMetaDataForClass(java.lang.String className)
Convenience method to check if we have metadata for the specified class

Parameters:
className - The name of the class to check
Returns:
Whether the metadata is already registered for this class

isClassWithoutMetaData

protected abstract boolean isClassWithoutMetaData(java.lang.String class_name)
Accessor for whether a class doesn't have MetaData.

Parameters:
class_name - Name of the class
Returns:
Whether it has no metadata.

getMetaDataForClass

public AbstractClassMetaData getMetaDataForClass(java.lang.String className,
                                                 ClassLoaderResolver clr)
Accessor for the MetaData for a class given the name and a loader. All MetaData returned from this method will be initialised and ready for full use. If the class can't be loaded, null will be returned.

Parameters:
className - Name of the class to find MetaData for
clr - ClassLoaderResolver resolver for use in loading the class.
Returns:
The ClassMetaData for this class (or null if not found)

getMetaDataForClass

public AbstractClassMetaData getMetaDataForClass(java.lang.Class c,
                                                 ClassLoaderResolver clr)
Main accessor for the MetaData for a class. All MetaData returned from this method will be initialised and ready for full use.

Parameters:
c - The class to find MetaData for
clr - the ClassLoaderResolver
Returns:
The ClassMetaData for this class (or null if not found)

getMetaDataForEntityName

public AbstractClassMetaData getMetaDataForEntityName(java.lang.String entityName)
Accessor for the MetaData for a class.

Parameters:
entityName - The entity name to find MetaData for
Returns:
The ClassMetaData for this entity name (or null if not found)

readMetaDataForClass

public ClassMetaData readMetaDataForClass(java.lang.String className)
Method to access the (already known) metadata for the specified class. If the class is not yet known about it returns null.

Parameters:
className - Name of the class
Returns:
MetaData for the class

readMetaDataForField

public AbstractPropertyMetaData readMetaDataForField(java.lang.String className,
                                                     java.lang.String fieldName)
Method to access the (already known) metadata for the field of the specified class. If the class (or this field) is not yet known about it returns null.

Parameters:
className - Name of the class
fieldName - Name of the field
Returns:
MetaData for the field

getMetaDataForClassInternal

public abstract AbstractClassMetaData getMetaDataForClassInternal(java.lang.Class c,
                                                                  ClassLoaderResolver clr)
Internal convenience method for accessing the MetaData for a class. MetaData returned by this method may be uninitialised so should only really be used in initialisation processes. To be implemented by the implementing class.

Parameters:
c - The class to find MetaData for
Returns:
The ClassMetaData for this class (or null if not found)

getSubclassesForClass

public java.lang.String[] getSubclassesForClass(java.lang.String className,
                                                boolean includeDescendents)
Accessor for the subclasses of a particular class

Parameters:
className - Name of the class that we want the known subclasses for.
includeDescendents - Whether to include subclasses of subclasses etc
Returns:
Names of the subclasses. return null if there are no subclasses

getClassesImplementingInterface

public java.lang.String[] getClassesImplementingInterface(java.lang.String interfaceName,
                                                          ClassLoaderResolver clr)
Accessor for the list of names of classes that are declared to implement the specified interface (using <implements> in the MetaData). Ignore abstract classes

Parameters:
interfaceName - Name of the interface
clr - The ClassLoaderResolver
Returns:
The names of the classes declared as implementing that interface. return null if no classes

addORMDataToClass

public void addORMDataToClass(java.lang.Class c,
                              ClassLoaderResolver clr)
Load up and add any O/R mapping info for the specified class to the stored ClassMetaData (if supported). This implementation does nothing so if ORM files are supported then this should be overridden by subclasses

Parameters:
c - The class
clr - the ClassLoaderResolver

getMetaDataForImplementationOfReference

public ClassMetaData getMetaDataForImplementationOfReference(java.lang.Class referenceClass,
                                                             java.lang.Object implValue,
                                                             ClassLoaderResolver clr)
Accessor for the MetaData for an implementation of a reference type. Finds the metadata for the implementation of this reference.

Parameters:
referenceClass - The reference class to find MetaData for
implValue - Object of an implementation class, to return if possible (null=ignore)
clr - ClassLoader resolver
Returns:
The ClassMetaData for an implementation of a reference type

getMetaDataForField

public AbstractPropertyMetaData getMetaDataForField(java.lang.String className,
                                                    java.lang.String fieldName,
                                                    ClassLoaderResolver clr)
Accessor for the MetaData for a field of a class. Utilises getMetaDataForClass, and then finds the relevant field.

Parameters:
className - The name of the class owning the field
fieldName - The name of the field to find MetaData for
clr - ClassLoaderResolver resolver for any loading of classes
Returns:
The AbstractPropertyMetaData for this field (or null if not found)

getMetaDataForField

public AbstractPropertyMetaData getMetaDataForField(java.lang.Class c,
                                                    ClassLoaderResolver clr,
                                                    java.lang.String field_name)
Accessor for the MetaData for a field of a class. Utilises getMetaDataForClass, and then finds the relevant field.

Parameters:
c - The class owning the field
clr - the ClassLoaderResolver
field_name - The name of the field to find MetaData for
Returns:
The AbstractPropertyMetaData for this field (or null if not found)

getMetaDataForQuery

public QueryMetaData getMetaDataForQuery(java.lang.Class cls,
                                         ClassLoaderResolver clr,
                                         java.lang.String queryName)
Accessor for the MetaData for a named query for a class. If the class is not specified, searches for the query with this name for any class. Will only return metadata for queries already registered in this implementation.

Parameters:
cls - The class which has the query defined for it
clr - the ClassLoaderResolver
queryName - Name of the query
Returns:
The QueryMetaData for the query for this class

getMetaDataForSequence

public SequenceMetaData getMetaDataForSequence(ClassLoaderResolver clr,
                                               java.lang.String seqName)
Accessor for the MetaData for a Sequence in a package. This implementation simply checks what is already loaded and returns if found

Parameters:
clr - the ClassLoaderResolver
seqName - Name of the package (fully qualified if necessary)
Returns:
The SequenceMetaData for this named sequence

getMetaDataForTableGenerator

public TableGeneratorMetaData getMetaDataForTableGenerator(ClassLoaderResolver clr,
                                                           java.lang.String genName)
Accessor for the MetaData for a TableGenerator in a package. This implementation simply checks what is already loaded and returns if found

Parameters:
clr - the ClassLoaderResolver
genName - Name of the package (fully qualified if necessary)
Returns:
The TableGenerator for this named generator

getMetaDataForInterface

public InterfaceMetaData getMetaDataForInterface(java.lang.Class c,
                                                 ClassLoaderResolver clr)
Accessor for the MetaData for an interface. Part of the support for "persistent-interface". This defaults to returning null since interfaces are only supported by JDO.

Parameters:
c - The interface to find MetaData for
clr - the ClassLoaderResolver
Returns:
The InterfaceMetaData for this interface (or null if not found)

isPersistentInterface

public boolean isPersistentInterface(java.lang.String name)
Convenience method to return if the passed class name is a "persistent-interface".

Parameters:
name - Name if the interface
Returns:
Whether it is a "persistent-interface"

isPersistentInterfaceImplementation

public boolean isPersistentInterfaceImplementation(java.lang.String interfaceName,
                                                   java.lang.String implName)
Convenience method to return if the passed class name is an implementation of the passed "persistent-interface".

Parameters:
interfaceName - Name of the persistent interface
implName - The implementation name
Returns:
Whether it is a (JPOX-generated) impl of the persistent interface

getImplementationNameForPersistentInterface

public java.lang.String getImplementationNameForPersistentInterface(java.lang.String interfaceName)
Accessor for the implementation name for the specified "persistent-interface".

Parameters:
interfaceName - The name of the persistent interface
Returns:
The name of the implementation class

getClassMetaDataForImplementationOfPersistentInterface

public ClassMetaData getClassMetaDataForImplementationOfPersistentInterface(java.lang.String interfaceName)
Accessor for the metadata for the implementation of the specified "persistent-interface".

Parameters:
interfaceName - The name of the persistent interface
Returns:
The ClassMetaData of the implementation class

registerPersistentInterface

public void registerPersistentInterface(InterfaceMetaData imd,
                                        java.lang.Class implClass,
                                        ClassLoaderResolver clr)
Method to register a persistent interface and its implementation with the MetaData system.

Parameters:
imd - MetaData for the interface
implClass - The implementation class
clr - ClassLoader Resolver to use

parsePersistenceFiles

public PersistenceFileMetaData[] parsePersistenceFiles()
Method to parse the available "persistence.xml" files returning the metadata for all found. Searches for all files "META-INF/persistence.xml" in the CLASSPATH of the current thread.

Returns:
The metadata for all "persistence.xml" files

parseFile

protected abstract FileMetaData parseFile(java.net.URL file_url)
Utility to parse a MetaData file.

Parameters:
file_url - URL of the file
Returns:
The FileMetaData for this file

registerFile

protected abstract void registerFile(java.lang.String fileURLString,
                                     FileMetaData filemd)
Method to take the FileMetaData and register the relevant parts of it with the assorted caches provided.

Parameters:
fileURLString - URL of the metadata file
filemd - The File MetaData

registerSequencesForFile

protected void registerSequencesForFile(FileMetaData filemd)
Convenience method to register all sequences found in the passed file.

Parameters:
filemd - MetaData for the file

registerTableGeneratorsForFile

protected void registerTableGeneratorsForFile(FileMetaData filemd)
Convenience method to register all table generators found in the passed file.

Parameters:
filemd - MetaData for the file

registerQueriesForFile

protected void registerQueriesForFile(FileMetaData filemd)
Convenience method to register all queries found in the passed file.

Parameters:
filemd - MetaData for the file

populateFileMetaData

protected void populateFileMetaData(FileMetaData filemd,
                                    ClassLoaderResolver clr,
                                    java.lang.ClassLoader primary)
Convenience method to populate all classes/interfaces in a Meta-Data file.

Parameters:
filemd - The MetaData file
clr - Class Loader to use in population
primary - the primary ClassLoader to use (or null)

initialiseFileMetaData

protected void initialiseFileMetaData(FileMetaData filemd,
                                      ClassLoaderResolver clr,
                                      java.lang.ClassLoader primary)
Initialise all classes/interfaces in a Meta-Data file.

Parameters:
filemd - the FileMetaData
clr - ClassLoader resolver to use
primary - the primary ClassLoader to use (or null)

initialiseClassMetaData

protected void initialiseClassMetaData(ClassMetaData cmd,
                                       java.lang.Class cls,
                                       ClassLoaderResolver clr)
Utility to initialise the MetaData for a class, using the specified class. This assigns defaults to tags that haven't been assigned. If the class that is being used to populate the MetaData is not enhanced, this will throw a JDOUserException informing them of this.

Parameters:
cmd - The classes metadata
cls - The class to use as a basis for initialisation
clr - ClassLoader resolver to use

initialiseInterfaceMetaData

protected void initialiseInterfaceMetaData(InterfaceMetaData imd,
                                           ClassLoaderResolver clr,
                                           java.lang.ClassLoader primary)
Utility to initialise the MetaData for a interface, using the specified class. This assigns defaults to tags that haven't been assigned. If the class that is being used to populate the MetaData is not enhanced, this will throw a JDOUserException informing them of this.

Parameters:
imd - The interface metadata
clr - The loader of the interface
primary - the primary ClassLoader to use (or null)

loadAnnotationsForClass

protected FileMetaData loadAnnotationsForClass(java.lang.Class cls,
                                               ClassLoaderResolver clr,
                                               boolean populate)
Method to load the annotations for the specified class and return the FileMetaData containing the class. The FileMetaData, PackageMetaData will be dummy records.

Parameters:
cls - The class
clr - ClassLoader resolver
populate - Whether to populate the data
Returns:
The FileMetaData

getReferencedClassMetaData

public java.util.List getReferencedClassMetaData(AbstractClassMetaData cmd,
                                                 java.lang.String dba_vendor_id,
                                                 ClassLoaderResolver clr)
Utility to return all ClassMetaData that is referenced from the supplier class.

Parameters:
cmd - The origin class's MetaData.
dba_vendor_id - The Vendor id of the database adapter in use. (Used in handling "views" support)
clr - ClassLoaderResolver resolver for loading any classes.
Returns:
List of ClassMetaData referenced by the origin


Copyright © -2008 . All Rights Reserved.