Package org.apache.openjpa.persistence
Class PersistenceMetaDataFactory
java.lang.Object
org.apache.openjpa.meta.AbstractMetaDataFactory
org.apache.openjpa.meta.AbstractCFMetaDataFactory
org.apache.openjpa.persistence.PersistenceMetaDataFactory
- All Implemented Interfaces:
Configurable,GenericConfigurable,MetaDataFactory,MetaDataModes
- Direct Known Subclasses:
PersistenceMappingFactory
public class PersistenceMetaDataFactory
extends AbstractCFMetaDataFactory
implements Configurable, GenericConfigurable
MetaDataFactory for JPA metadata.- Since:
- 0.4.0
- Author:
- Steve Kim
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.openjpa.meta.AbstractCFMetaDataFactory
AbstractCFMetaDataFactory.Parser, AbstractCFMetaDataFactory.Serializer -
Field Summary
FieldsFields inherited from class org.apache.openjpa.meta.AbstractCFMetaDataFactory
cpath, files, JAR_FILE_URLS, MAPPING_FILE_NAMES, PERSISTENCE_UNIT_ROOT_URL, rsrcs, urlsFields inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory
dir, log, repos, store, strict, typesFields inherited from interface org.apache.openjpa.meta.MetaDataFactory
STORE_DEFAULT, STORE_PER_CLASS, STORE_VERBOSEFields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear any internal caches.protected FileReturn the default file for the given metadata.protected FiledefaultSourceFile(QueryMetaData query, Map clsNames) Return a default file for the given query.protected FiledefaultSourceFile(SequenceMetaData seq, Map clsNames) Return a default file for the given sequence.voidInvoked upon completion of bean property configuration for this object.Return metadata parser, creating it if it does not already exist.Return the metadata defaults for this factory.booleanWhether to use field-level override or class-level override.Class<?>getManagedClass(Class<?> c) Gets the managed class corresponding to the given meta-class.getManagedClassName(String mmClassName) 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.Class<?>getQueryScope(String queryName, ClassLoader loader) Return the type defining the given query name, if any.Class<?>getResultSetMappingScope(String rsMappingName, ClassLoader loader) Return the type defining the given result set mapping name, if any.Return JAXB XML annotation parser, creating it if it does not already exist.Return XML metadata parser, creating it if it does not already exist or if the existing parser is parsing.booleanisMetaClass(Class<?> c) Affirms if the given class is a meta-class.voidload(Class<?> cls, int mode, ClassLoader envLoader) Load metadata for the given class in the given mode(s).voidloadXMLMetaData(Class<?> cls) Load XMLClassMetadata for the given class.protected voidmapPersistentTypeNames(Object rsrc, String[] names) Implement this method to map metadata resources to the persistent types contained within them.protected AnnotationPersistenceMetaDataParserCreate a new metadata parser.protected AnnotationPersistenceMetaDataSerializerCreate a new annotation serializer.Return a properly-configured class arg parser for our expected metadata format.protected MetaDataFilterReturn a metadata filter that identifies metadata resources when performing jar and classpath scans.protected AbstractCFMetaDataFactory.ParsernewParser(boolean loading) Create a new metadata parser.protected AbstractCFMetaDataFactory.SerializerCreate a new metadata serializer.protected AnnotationPersistenceXMLMetaDataParserCreate a new JAXB XML annotation parser.protected XMLPersistenceMetaDataParsernewXMLParser(boolean loading) Create a new metadata parser.protected XMLPersistenceMetaDataSerializerCreate a new serializerprotected voidparse(MetaDataParser parser, Class[] cls) Parse all given classses.voidvoidSet the metadata parser.voidInvoked prior to setting bean properties.voidsetFieldOverride(boolean field) Whether to use field-level override or class-level override.voidPerform any generic configuration based on the data inopts.voidSet the JAXB XML annotation parser.voidSet the metadata parser.voidInvoked before bean property configuration is begun on this object.Methods inherited from class org.apache.openjpa.meta.AbstractCFMetaDataFactory
backupAndDelete, clearMapping, decode, drop, getDefiningMetaData, getPersistentTypeNames, getSourceFile, getSourceFile, isMappingOnlyFactory, isParseTopDown, parse, parsePersistentTypeNames, serialize, setClasspathScan, setClasspathScan, setFiles, setFiles, setResources, setResources, setSourceFile, setSourceFile, setURLs, setURLs, storeMethods inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory
addClassExtensionKeys, addFieldExtensionKeys, setRepository, setStoreDirectory, setStoreMode, setStrict, setTypes, setTypes
-
Field Details
-
_stack
-
-
Constructor Details
-
PersistenceMetaDataFactory
public PersistenceMetaDataFactory()
-
-
Method Details
-
setFieldOverride
public void setFieldOverride(boolean field) Whether to use field-level override or class-level override. Defaults to true. -
getFieldOverride
public boolean getFieldOverride()Whether to use field-level override or class-level override. Defaults to true. -
getAnnotationParser
Return metadata parser, creating it if it does not already exist. -
setAnnotationParser
Set the metadata parser. -
newAnnotationParser
Create a new metadata parser. -
newAnnotationSerializer
Create a new annotation serializer.- Specified by:
newAnnotationSerializerin classAbstractCFMetaDataFactory
-
getXMLParser
Return XML metadata parser, creating it if it does not already exist or if the existing parser is parsing. -
resetXMLParser
public void resetXMLParser() -
setXMLParser
Set the metadata parser. -
newXMLParser
Create a new metadata parser. -
newXMLSerializer
Create a new serializer -
load
Description copied from interface:MetaDataFactoryLoad 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).- Specified by:
loadin interfaceMetaDataFactorymode- 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 thestrictproperty hasn't been set
-
mapPersistentTypeNames
Description copied from class:AbstractCFMetaDataFactoryImplement this method to map metadata resources to the persistent types contained within them. The method will be called whenAbstractCFMetaDataFactory.getPersistentTypeNames(boolean, java.lang.ClassLoader)is invoked.- Overrides:
mapPersistentTypeNamesin classAbstractCFMetaDataFactory
-
getQueryScope
Description copied from interface:MetaDataFactoryReturn the type defining the given query name, if any.- Specified by:
getQueryScopein interfaceMetaDataFactory- Overrides:
getQueryScopein classAbstractMetaDataFactory
-
getResultSetMappingScope
Description copied from interface:MetaDataFactoryReturn the type defining the given result set mapping name, if any.- Specified by:
getResultSetMappingScopein interfaceMetaDataFactory- Overrides:
getResultSetMappingScopein classAbstractMetaDataFactory
-
newMetaDataFilter
Description copied from class:AbstractCFMetaDataFactoryReturn a metadata filter that identifies metadata resources when performing jar and classpath scans.- Specified by:
newMetaDataFilterin classAbstractCFMetaDataFactory
-
getDefaults
Description copied from interface:MetaDataFactoryReturn the metadata defaults for this factory.- Specified by:
getDefaultsin interfaceMetaDataFactory
-
newClassArgParser
Description copied from interface:MetaDataFactoryReturn a properly-configured class arg parser for our expected metadata format.- Specified by:
newClassArgParserin interfaceMetaDataFactory- Overrides:
newClassArgParserin classAbstractMetaDataFactory
-
clear
public void clear()Description copied from interface:MetaDataFactoryClear any internal caches.- Specified by:
clearin interfaceMetaDataFactory- Overrides:
clearin classAbstractCFMetaDataFactory
-
newParser
Description copied from class:AbstractCFMetaDataFactoryCreate a new metadata parser.- Specified by:
newParserin classAbstractCFMetaDataFactory- Parameters:
loading- if true, this will be the cached parser used for loading metadata
-
newSerializer
Description copied from class:AbstractCFMetaDataFactoryCreate a new metadata serializer.- Specified by:
newSerializerin classAbstractCFMetaDataFactory
-
parse
Description copied from class:AbstractCFMetaDataFactoryParse all given classses.- Overrides:
parsein classAbstractCFMetaDataFactory
-
defaultSourceFile
Description copied from class:AbstractCFMetaDataFactoryReturn the default file for the given metadata.- Specified by:
defaultSourceFilein classAbstractCFMetaDataFactory
-
defaultSourceFile
Description copied from class:AbstractCFMetaDataFactoryReturn a default file for the given query.- Specified by:
defaultSourceFilein classAbstractCFMetaDataFactory
-
defaultSourceFile
Description copied from class:AbstractCFMetaDataFactoryReturn a default file for the given sequence.- Specified by:
defaultSourceFilein classAbstractCFMetaDataFactory
-
setConfiguration
Description copied from interface:ConfigurableInvoked prior to setting bean properties.- Specified by:
setConfigurationin interfaceConfigurable
-
startConfiguration
public void startConfiguration()Description copied from interface:ConfigurableInvoked before bean property configuration is begun on this object.- Specified by:
startConfigurationin interfaceConfigurable
-
endConfiguration
public void endConfiguration()Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable
-
setInto
Description copied from interface:GenericConfigurablePerform any generic configuration based on the data inopts. This method should remove any values inoptsthat have been successfully processed; if any values remain inoptsafter this method is executed, an exception will be thrown identifying those key-value pairs as invalid.- Specified by:
setIntoin interfaceGenericConfigurable
-
getXMLAnnotationParser
Return JAXB XML annotation parser, creating it if it does not already exist. -
setXMLAnnotationParser
Set the JAXB XML annotation parser. -
newXMLAnnotationParser
Create a new JAXB XML annotation parser. -
loadXMLMetaData
Description copied from interface:MetaDataFactoryLoad XMLClassMetadata for the given class. Loaded metadata should be added directly to the repository.- Specified by:
loadXMLMetaDatain interfaceMetaDataFactory
-
getManagedClassName
Description copied from interface:MetaDataFactoryGets the name of the managed class for the given fully-qualified meta-model class name.- Specified by:
getManagedClassNamein interfaceMetaDataFactory
-
getMetaModelClassName
Description copied from interface:MetaDataFactoryGets the name of the meta-model class for the given fully-qualified managed class name.- Specified by:
getMetaModelClassNamein interfaceMetaDataFactory
-
isMetaClass
Description copied from interface:MetaDataFactoryAffirms if the given class is a meta-class.- Specified by:
isMetaClassin interfaceMetaDataFactory
-
getManagedClass
Description copied from interface:MetaDataFactoryGets the managed class corresponding to the given meta-class.- Specified by:
getManagedClassin interfaceMetaDataFactory- Returns:
- null if the given input is not a meta-class.
-