| java.lang.Object org.jpox.metadata.MetaDataManager org.jpox.jdo.metadata.JDOMetaDataManager
JDOMetaDataManager | public class JDOMetaDataManager extends MetaDataManager (Code) | | Manager of JDO MetaData information in JPOX.
Acts as a registry of JDO 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.
When the MetaData is requested for a class, if it isnt already found, the valid
file locations are checked for that class and the file containing it will be
read. The MetaData for all classes, queries, sequences etc in that file are
loaded at that point. In addition, all classes will be "populated" (meaning that
their superclasses are assigned, and unspecified fields are added, and any related
objects are linked). The MetaData of these classes are only initialised when
they are absolutely needed - to avoid generating circular references in the
initialisation process.
Each PMFContext typically will have its own MetaDataManager so allowing
Meta-Data to be for different datastores. In addition, each PMF can allow
MetaData files to use a particular suffix, hence we allow the JDO/ORM file
suffices to be specifiable at construction.
version: $Revision: 1.31 $ |
Method Summary | |
public void | addORMDataToClass(Class c, ClassLoaderResolver clr) Load up and add the O/R mapping info for the specified class to the stored JDO ClassMetaData. | public void | close() | public ClassMetaData | getClassMetaDataForImplementationOfPersistentInterface(String interfaceName) Accessor for the metadata for the implementation of the specified "persistent-interface". | public String | getImplementationNameForPersistentInterface(String interfaceName) Accessor for the implementation name for the specified "persistent-interface". | public String | getJDOFileSuffix() Convenience accessor for the JDO file suffix. | public String | getJDOQueryFileSuffix() Convenience accessor for the JDOQuery file suffix. | public synchronized AbstractClassMetaData | getMetaDataForClassInternal(Class c, ClassLoaderResolver clr) Internal method for accessing the MetaData for a class. | public InterfaceMetaData | getMetaDataForInterface(Class c, ClassLoaderResolver clr) Main accessor for the MetaData for a "persistent-interface". | public QueryMetaData | getMetaDataForQuery(Class cls, ClassLoaderResolver clr, String queryName) Accessor for the MetaData for a named query for a class. | public SequenceMetaData | getMetaDataForSequence(ClassLoaderResolver clr, String packageSequenceName) Accessor for the MetaData for a Sequence in a package. | public String | getORMFileSuffix() Convenience accessor for the ORM file suffix. | protected String | getORMMappingName() Convenience accessor for the mapping name. | public List | getValidMetaDataLocationsForClass(String fileExtension, String fileModifier, String className) Method to return the valid metadata locations to contain a particular class. | List | getValidMetaDataLocationsForItem(String fileExtension, String fileModifier, String itemName, boolean isClass) Method to return the valid metadata locations to contain a particular item. | public List | getValidMetaDataLocationsForPackage(String fileExtension, String fileModifier, String packageName) Method to return the valid metadata locations to contain a particular package. | public boolean | hasMetaDataForClass(String className) Convenience method to check if we have metadata present for the specified class. | public boolean | isPersistentDefinitionImplementation(String implName) Convenience method to return if the passed class name is an implementation of a "persistent definition". | public boolean | isPersistentInterface(String name) Convenience method to return if the passed class name is a "persistent-interface". | public boolean | isPersistentInterfaceImplementation(String interfaceName, String implName) Convenience method to return if the passed class name is an implementation of the passed "persistent-interface". | protected FileMetaData | loadMetaDataForClass(Class pc_class, ClassLoaderResolver clr, String metadata_file_modifier, String metadata_file_extension, boolean populate) Method to find the Meta-Data file for a specified class.
Checks the locations one-by-one, and checks for existence of the
specified class in the file. | protected void | logConfiguration() Method to log the configuration of this manager. | protected FileMetaData | parseFile(URL fileURL) Utility to parse a file, using the "jdo" MetaData handler. | public void | registerFile(String fileURLString, FileMetaData filemd, ClassLoaderResolver clr) Method to take the FileMetaData and register the relevant parts of it with the assorted caches provided. | public void | registerImplementationOfAbstractClass(ClassMetaData cmd, Class implClass, ClassLoaderResolver clr) Method to register the metadata for an implementation of a persistent abstract class. | public void | registerPersistentInterface(InterfaceMetaData imd, Class implClass, ClassLoaderResolver clr) Method to register a persistent interface and its implementation with the MetaData system. |
ALL_JDO_LOCATIONS | final public static int ALL_JDO_LOCATIONS(Code) | | MetaData files will be searched in all possible locations defined in JDO 1.0, JDO 1.0.1, JDO 2.0 or later *
|
JDO_1_0_0_LOCATIONS | final public static int JDO_1_0_0_LOCATIONS(Code) | | MetaData files will be searched in all locations defined in JDO 1.0 *
|
JDO_1_0_1_LOCATIONS | final public static int JDO_1_0_1_LOCATIONS(Code) | | MetaData files will be searched in all locations defined in JDO 1.0.1 *
|
classMetaDataByInterface | protected Map classMetaDataByInterface(Code) | | Map of ClassMetaData, keyed by the interface class name (for "persistent-interface"s).
Keyed by the persistent-interface name.
|
locationDefinition | protected int locationDefinition(Code) | | Definition of which locations we accept for MetaData files.
|
ormClassMetaDataByClass | protected Map ormClassMetaDataByClass(Code) | | Map of ClassMetaData from ORM files, keyed by the class name.
|
JDOMetaDataManager | public JDOMetaDataManager(OMFContext ctxt)(Code) | | Constructor.
Parameters: ctxt - ObjectManagerFactory Context that this metadata manager operates in |
addORMDataToClass | public void addORMDataToClass(Class c, ClassLoaderResolver clr)(Code) | | Load up and add the O/R mapping info for the specified class to the stored JDO ClassMetaData.
Parameters: c - The class Parameters: clr - the ClassLoaderResolver |
close | public void close()(Code) | | Clear resources
|
getClassMetaDataForImplementationOfPersistentInterface | public ClassMetaData getClassMetaDataForImplementationOfPersistentInterface(String interfaceName)(Code) | | Accessor for the metadata for the implementation of the specified "persistent-interface".
Parameters: interfaceName - The name of the persistent interface The ClassMetaData of the implementation class |
getImplementationNameForPersistentInterface | public String getImplementationNameForPersistentInterface(String interfaceName)(Code) | | Accessor for the implementation name for the specified "persistent-interface".
Parameters: interfaceName - The name of the persistent interface The name of the implementation class |
getJDOFileSuffix | public String getJDOFileSuffix()(Code) | | Convenience accessor for the JDO file suffix.
JDO file suffix |
getJDOQueryFileSuffix | public String getJDOQueryFileSuffix()(Code) | | Convenience accessor for the JDOQuery file suffix.
JDOQuery file suffix |
getMetaDataForClassInternal | public synchronized AbstractClassMetaData getMetaDataForClassInternal(Class c, ClassLoaderResolver clr)(Code) | | Internal method for accessing the MetaData for a class.
The MetaData returned can be uninitialised.
Runs through the following process
- Checks if the class is known not to have metata
- Check if we have metadata for the class in one of the files that has
been parsed.
- If we have metadata, check that it is initialised
- If we don't have metadata, find the file for this class.
- If we cant find a file for it, add it to the list of classes known
to have no metadata
Parameters: c - The class to find MetaData for The ClassMetaData for this class (or null if not found) |
getMetaDataForInterface | public InterfaceMetaData getMetaDataForInterface(Class c, ClassLoaderResolver clr)(Code) | | Main accessor for the MetaData for a "persistent-interface".
All MetaData returned from this method will be initialised and ready for full use.
Parameters: c - The interface to find MetaData for Parameters: clr - the ClassLoaderResolver The InterfaceMetaData for this interface (or null if not found) |
getMetaDataForQuery | public QueryMetaData getMetaDataForQuery(Class cls, ClassLoaderResolver clr, String queryName)(Code) | | Accessor for the MetaData for a named query for a class.
If the query is not found, will check all valid JDO file locations and try to load it.
Parameters: cls - The class which has the query defined for it Parameters: clr - the ClassLoaderResolver Parameters: queryName - Name of the query The QueryMetaData for the query for this class |
getMetaDataForSequence | public SequenceMetaData getMetaDataForSequence(ClassLoaderResolver clr, String packageSequenceName)(Code) | | Accessor for the MetaData for a Sequence in a package.
If the sequence is not yet known will search the valid locations for the passed name.
Parameters: clr - the ClassLoaderResolver Parameters: packageSequenceName - Fully qualified name of the sequence (inc package name) The SequenceMetaData for this named sequence |
getORMFileSuffix | public String getORMFileSuffix()(Code) | | Convenience accessor for the ORM file suffix.
ORM file suffix |
getORMMappingName | protected String getORMMappingName()(Code) | | Convenience accessor for the mapping name.
ORM mapping name |
getValidMetaDataLocationsForClass | public List getValidMetaDataLocationsForClass(String fileExtension, String fileModifier, String className)(Code) | | Method to return the valid metadata locations to contain a particular class.
Parameters: fileExtension - File extension (e.g "jdo") Parameters: fileModifier - Any modifier (for use when using ORM files package-mysql.orm, this is the "mysql" part) Parameters: className - The class name to look for The list of valid locations |
getValidMetaDataLocationsForItem | List getValidMetaDataLocationsForItem(String fileExtension, String fileModifier, String itemName, boolean isClass)(Code) | | Method to return the valid metadata locations to contain a particular item. The
"item" can be a package or a class. Will look in the locations appropriate for the
setting of "locationDefintion".
Parameters: fileExtension - File extension (e.g "jdo") accepts comma separated list Parameters: fileModifier - Any modifier (for use when using ORM files package-mysql.orm, this is the "mysql" part) Parameters: itemName - The name of the item (package or class) Parameters: isClass - Whether this is a class The list of valid locations |
getValidMetaDataLocationsForPackage | public List getValidMetaDataLocationsForPackage(String fileExtension, String fileModifier, String packageName)(Code) | | Method to return the valid metadata locations to contain a particular package.
Parameters: fileExtension - File extension (e.g "jdo") Parameters: fileModifier - Any modifier (for use when using ORM files package-mysql.orm, this is the "mysql" part) Parameters: packageName - The package name to look for The list of valid locations |
hasMetaDataForClass | public boolean hasMetaDataForClass(String className)(Code) | | Convenience method to check if we have metadata present for the specified class.
Parameters: className - The name of the class to check Whether the metadata is already registered for this class |
isPersistentDefinitionImplementation | public boolean isPersistentDefinitionImplementation(String implName)(Code) | | Convenience method to return if the passed class name is an implementation of a "persistent definition".
Parameters: implName - The implementation name Whether it is a (JPOX-generated) impl of the persistent interface or abstract class |
isPersistentInterface | public boolean isPersistentInterface(String name)(Code) | | Convenience method to return if the passed class name is a "persistent-interface".
Parameters: name - Name if the interface Whether it is a "persistent-interface" |
isPersistentInterfaceImplementation | public boolean isPersistentInterfaceImplementation(String interfaceName, String implName)(Code) | | Convenience method to return if the passed class name is an implementation of the passed "persistent-interface".
Parameters: interfaceName - Name of the persistent interface Parameters: implName - The implementation name Whether it is a (JPOX-generated) impl of the persistent interface |
loadMetaDataForClass | protected FileMetaData loadMetaDataForClass(Class pc_class, ClassLoaderResolver clr, String metadata_file_modifier, String metadata_file_extension, boolean populate)(Code) | | Method to find the Meta-Data file for a specified class.
Checks the locations one-by-one, and checks for existence of the
specified class in the file. If a valid file is found it is loaded no matter
if the file contains the actual class. When a file is found containing the class
the process stops and the FileMetaData for that file (containing the class) returned.
Allows 2 variations on the naming above. The first is a modifier which
caters for a JDO 2.0 requirement whereby the user can specify a modifier
such as "mysql", which would mean that this should search for filenames
"package-mysql.jdo". The second variation is the suffix of the file.
This is "jdo" by default, but JDO 2.0 has situations where "orm", or
"jdoquery" are required as a suffix.
Parameters: pc_class - The class/interface to retrieve the Meta-Data file for Parameters: clr - the ClassLoaderResolver Parameters: metadata_file_modifier - Any modifier for the filename Parameters: metadata_file_extension - File extension of MetaData files (e.g "jdo") Parameters: populate - Whether to populate any loaded MetaData classes FileMetaData for the file containing the class |
logConfiguration | protected void logConfiguration()(Code) | | Method to log the configuration of this manager.
|
parseFile | protected FileMetaData parseFile(URL fileURL)(Code) | | Utility to parse a file, using the "jdo" MetaData handler.
Parameters: fileURL - URL of the file The FileMetaData for this file |
registerFile | public void registerFile(String fileURLString, FileMetaData filemd, ClassLoaderResolver clr)(Code) | | Method to take the FileMetaData and register the relevant parts of it with the assorted caches provided.
Parameters: fileURLString - URL of the metadata file Parameters: filemd - The File MetaData |
registerImplementationOfAbstractClass | public void registerImplementationOfAbstractClass(ClassMetaData cmd, Class implClass, ClassLoaderResolver clr)(Code) | | Method to register the metadata for an implementation of a persistent abstract class.
Parameters: cmd - MetaData for the abstract class Parameters: implClass - The implementation class Parameters: clr - ClassLoader resolver |
registerPersistentInterface | public void registerPersistentInterface(InterfaceMetaData imd, Class implClass, ClassLoaderResolver clr)(Code) | | Method to register a persistent interface and its implementation with the MetaData system.
Parameters: imd - MetaData for the interface Parameters: implClass - The implementation class Parameters: clr - ClassLoader Resolver to use |
Methods inherited from org.jpox.metadata.MetaDataManager | protected void addORMDataToClass(Class c, ClassLoaderResolver clr)(Code)(Java Doc) public void close()(Code)(Java Doc) public ApiAdapter getApiAdapter()(Code)(Java Doc) public ClassMetaData getClassMetaDataForImplementationOfPersistentInterface(String interfaceName)(Code)(Java Doc) public String[] getClassesImplementingInterface(String interfaceName, ClassLoaderResolver clr)(Code)(Java Doc) public Collection getClassesWithMetaData()(Code)(Java Doc) public FileMetaData[] getFileMetaData()(Code)(Java Doc) public String getImplementationNameForPersistentInterface(String interfaceName)(Code)(Java Doc) public List getListeners()(Code)(Java Doc) public MetaDataFactory getMetaDataFactory()(Code)(Java Doc) public synchronized AbstractClassMetaData getMetaDataForClass(String className, ClassLoaderResolver clr)(Code)(Java Doc) public synchronized AbstractClassMetaData getMetaDataForClass(Class c, ClassLoaderResolver clr)(Code)(Java Doc) abstract public AbstractClassMetaData getMetaDataForClassInternal(Class c, ClassLoaderResolver clr)(Code)(Java Doc) public synchronized AbstractClassMetaData getMetaDataForEntityName(String entityName)(Code)(Java Doc) public FetchPlanMetaData getMetaDataForFetchPlan(String name)(Code)(Java Doc) public ClassMetaData getMetaDataForImplementationOfReference(Class referenceClass, Object implValue, ClassLoaderResolver clr)(Code)(Java Doc) public InterfaceMetaData getMetaDataForInterface(Class c, ClassLoaderResolver clr)(Code)(Java Doc) public AbstractMemberMetaData getMetaDataForMember(String className, String memberName, ClassLoaderResolver clr)(Code)(Java Doc) public AbstractMemberMetaData getMetaDataForMember(Class c, ClassLoaderResolver clr, String memberName)(Code)(Java Doc) public PersistenceUnitMetaData getMetaDataForPersistenceUnit(String unitName)(Code)(Java Doc) public QueryMetaData getMetaDataForQuery(Class cls, ClassLoaderResolver clr, String queryName)(Code)(Java Doc) public QueryResultMetaData getMetaDataForQueryResult(String name)(Code)(Java Doc) public SequenceMetaData getMetaDataForSequence(ClassLoaderResolver clr, String seqName)(Code)(Java Doc) public TableGeneratorMetaData getMetaDataForTableGenerator(ClassLoaderResolver clr, String genName)(Code)(Java Doc) public OMFContext getOMFContext()(Code)(Java Doc) public List getReferencedClassMetaData(AbstractClassMetaData cmd, String dba_vendor_id, ClassLoaderResolver clr)(Code)(Java Doc) public String[] getSubclassesForClass(String className, boolean includeDescendents)(Code)(Java Doc) public boolean hasMetaDataForClass(String className)(Code)(Java Doc) public FileMetaData[] initialise(String[] metadataFiles, String[] classNames, ClassLoaderResolver clr)(Code)(Java Doc) public FileMetaData[] initialise(String persistenceUnitName, ClassLoaderResolver clr)(Code)(Java Doc) public FileMetaData[] initialise(PersistenceUnitMetaData pumd, ClassLoaderResolver clr)(Code)(Java Doc) protected void initialiseClassMetaData(ClassMetaData cmd, Class cls, ClassLoaderResolver clr)(Code)(Java Doc) protected void initialiseFileMetaData(FileMetaData filemd, ClassLoaderResolver clr, ClassLoader primary)(Code)(Java Doc) protected void initialiseInterfaceMetaData(InterfaceMetaData imd, ClassLoaderResolver clr, ClassLoader primary)(Code)(Java Doc) public boolean isClassPersistable(String className)(Code)(Java Doc) protected boolean isClassWithoutPersistenceInfo(String className)(Code)(Java Doc) public boolean isEnhancing()(Code)(Java Doc) public boolean isPersistentDefinitionImplementation(String implName)(Code)(Java Doc) public boolean isPersistentInterface(String name)(Code)(Java Doc) public boolean isPersistentInterfaceImplementation(String interfaceName, String implName)(Code)(Java Doc) protected FileMetaData loadAnnotationsForClass(Class cls, ClassLoaderResolver clr, boolean register, boolean populate)(Code)(Java Doc) protected void logConfiguration()(Code)(Java Doc) abstract protected FileMetaData parseFile(URL file_url)(Code)(Java Doc) public PersistenceFileMetaData[] parsePersistenceFiles()(Code)(Java Doc) protected void populateFileMetaData(FileMetaData filemd, ClassLoaderResolver clr, ClassLoader primary)(Code)(Java Doc) public AbstractClassMetaData readMetaDataForClass(String className)(Code)(Java Doc) public AbstractMemberMetaData readMetaDataForMember(String className, String memberName)(Code)(Java Doc) protected void registerFetchPlansForFile(FileMetaData filemd)(Code)(Java Doc) abstract public void registerFile(String fileURLString, FileMetaData filemd, ClassLoaderResolver clr)(Code)(Java Doc) public void registerImplementationOfAbstractClass(ClassMetaData cmd, Class implClass, ClassLoaderResolver clr)(Code)(Java Doc) public void registerPersistentInterface(InterfaceMetaData imd, Class implClass, ClassLoaderResolver clr)(Code)(Java Doc) protected void registerQueriesForFile(FileMetaData filemd)(Code)(Java Doc) protected void registerQueryResultMetaDataForFile(FileMetaData filemd)(Code)(Java Doc) protected void registerSequencesForFile(FileMetaData filemd)(Code)(Java Doc) protected void registerTableGeneratorsForFile(FileMetaData filemd)(Code)(Java Doc) public void setEnhancing()(Code)(Java Doc) public void setMetaDataFactory(MetaDataFactory factory)(Code)(Java Doc) public void setValidate(boolean validate)(Code)(Java Doc) public boolean supportsORM()(Code)(Java Doc) public void unsetEnhancing()(Code)(Java Doc)
|
|
|