Package org.apache.openjpa.meta
Interface MetaDataFactory
- All Superinterfaces:
MetaDataModes
- All Known Implementing Classes:
AbstractCFMetaDataFactory
,AbstractMetaDataFactory
,DelegatingMetaDataFactory
,MetaDataPlusMappingFactory
,NoneMetaDataFactory
,PersistenceMappingFactory
,PersistenceMetaDataFactory
The
MetaDataRepository
uses implementations of this interface
to load and store metadata. Implementations need not be threadsafe.- Author:
- Patrick Linskey, Abe White, Pinaki Poddar
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassExtensionKeys
(Collection<?> exts) Add any extension keys used by this instance to the given set.void
addFieldExtensionKeys
(Collection<?> exts) Add any extension keys used by this instance to the given set.void
clear()
Clear any internal caches.boolean
drop
(Class<?>[] cls, int mode, ClassLoader envLoader) Drop the metadata for the given classes in the given mode(s).Return the metadata defaults for this factory.Class<?>
getManagedClass
(Class<?> c) Gets the managed class corresponding to the given meta-class.getManagedClassName
(String metamodelClassName) Gets the name of the managed class for the given fully-qualified meta-model class name.getMetaModelClassName
(String managedClassName) Gets the name of the meta-model class for the given fully-qualified managed class name.getPersistentTypeNames
(boolean devpath, ClassLoader envLoader) Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath.Class<?>
getQueryScope
(String queryName, ClassLoader loader) Return the type defining the given query name, if any.Class<?>
getResultSetMappingScope
(String resultSetMappingName, ClassLoader loader) Return the type defining the given result set mapping name, if any.boolean
isMetaClass
(Class<?> c) Affirms if the given class is a meta-class.void
load
(Class<?> cls, int mode, ClassLoader envLoader) Load metadata for the given class in the given mode(s).void
loadXMLMetaData
(Class<?> cls) Load XMLClassMetadata for the given class.Return a properly-configured class arg parser for our expected metadata format.void
setRepository
(MetaDataRepository repos) Set the repository to load metadata into.void
setStoreDirectory
(File dir) Base directory for storing metadata.void
setStoreMode
(int store) Storage mode.void
setStrict
(boolean strict) If true, I/O's must exactly obey the mode directives given, and may not load additional information.boolean
store
(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File, String> output) Store the given metadata.
-
Field Details
-
STORE_DEFAULT
static final int STORE_DEFAULT- See Also:
-
STORE_PER_CLASS
static final int STORE_PER_CLASS- See Also:
-
STORE_VERBOSE
static final int STORE_VERBOSE- See Also:
-
-
Method Details
-
setRepository
Set the repository to load metadata into. This method will be called before use. -
setStoreDirectory
Base directory for storing metadata. May not be called. -
setStoreMode
void setStoreMode(int store) Storage mode. May not be called. -
setStrict
void setStrict(boolean strict) If true, I/O's must exactly obey the mode directives given, and may not load additional information. -
load
Load metadata for the given class in the given mode(s). If loading inMetaDataModes.MODE_QUERY
, the class may be null. Loaded metadata should be added directly to the repository. It should have its source mode set appropriately viaClassMetaData.setSourceMode(int)
.- Parameters:
mode
- the mode to load metadata in: if mapping information is stored together with metadata, then you can load mapping data even if this mode only includesMODE_META
, so long as thestrict
property hasn't been set
-
store
boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File, String> output) Store the given metadata.- Parameters:
mode
- hint about what aspects of the metadata have changedoutput
- if non-null, rather than storing metadata directly, add entries mapping each output destination such as aFile
to the planned output for that destination in string form- Returns:
- false if this factory is unable to store metadata
-
drop
Drop the metadata for the given classes in the given mode(s).- Returns:
- false if any metadata could not be dropped
-
getDefaults
MetaDataDefaults getDefaults()Return the metadata defaults for this factory. -
getPersistentTypeNames
Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath. Return null if no types are supplied and this factory is unable to scan the classpath. This method should not be used directly by outside code; useMetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader)
instead. -
getQueryScope
Return the type defining the given query name, if any. -
getResultSetMappingScope
Return the type defining the given result set mapping name, if any. -
newClassArgParser
ClassArgParser newClassArgParser()Return a properly-configured class arg parser for our expected metadata format. -
clear
void clear()Clear any internal caches. -
addClassExtensionKeys
Add any extension keys used by this instance to the given set. -
addFieldExtensionKeys
Add any extension keys used by this instance to the given set. -
loadXMLMetaData
Load XMLClassMetadata for the given class. Loaded metadata should be added directly to the repository. -
getMetaModelClassName
Gets the name of the meta-model class for the given fully-qualified managed class name.- Since:
- 2.0.0
-
getManagedClassName
Gets the name of the managed class for the given fully-qualified meta-model class name.- Since:
- 2.0.0
-
isMetaClass
Affirms if the given class is a meta-class.- Since:
- 2.0.0
-
getManagedClass
Gets the managed class corresponding to the given meta-class.- Returns:
- null if the given input is not a meta-class.
- Since:
- 2.0.0
-