Package org.apache.openjpa.meta
Class AbstractCFMetaDataFactory
java.lang.Object
org.apache.openjpa.meta.AbstractMetaDataFactory
org.apache.openjpa.meta.AbstractCFMetaDataFactory
- All Implemented Interfaces:
MetaDataFactory,MetaDataModes
- Direct Known Subclasses:
PersistenceMetaDataFactory
Base class for factory implementations built around XML metadata files
in the common format.
- Since:
- 0.4.0
- Author:
- Abe White
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInternal parser interface.static interfaceInternal serializer interface. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<String>protected Collection<File>static final Stringstatic final Stringstatic final Stringprotected Collection<String>protected Collection<URL>Fields 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 TypeMethodDescriptionprotected voidbackupAndDelete(Collection files) Backup and delete the source files for the given metadatas.voidclear()Clear any internal caches.protected voidclearMapping(ClassMetaData meta) Clear mapping information from the given metadata.static StringDecodes a URL-encoded path string.protected abstract FileReturn the default file for the given metadata.protected abstract FiledefaultSourceFile(QueryMetaData query, Map clsNames) Return a default file for the given query.protected abstract FiledefaultSourceFile(SequenceMetaData seq, Map clsNames) Return a default file for the given sequence.booleandrop(Class[] cls, int mode, ClassLoader envLoader) Drop the metadata for the given classes in the given mode(s).protected ClassMetaDatagetDefiningMetaData(QueryMetaData query, Map clsNames) Return the metadata that defines the given query, if any.getPersistentTypeNames(boolean devpath, ClassLoader envLoader) Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath.protected FilegetSourceFile(ClassMetaData meta) Return the current source file of the given metadata.protected FileReturn the current source file of the given metadata.protected booleanReturn true if this factory deals only with mapping data, and relies on a separate factory for metadata.protected booleanWhether to parse classes top down.protected voidmapPersistentTypeNames(Object rsrc, String[] names) Implement this method to map metadata resources to the persistent types contained within them.protected abstract AbstractCFMetaDataFactory.SerializerCreate a new annotation metadata serializer.protected abstract MetaDataFilterReturn a metadata filter that identifies metadata resources when performing jar and classpath scans.protected abstract AbstractCFMetaDataFactory.ParsernewParser(boolean loading) Create a new metadata parser.protected abstract AbstractCFMetaDataFactory.SerializerCreate a new metadata serializer.protected voidparse(MetaDataParser parser, Class[] cls) Parse all given classses.protected voidparse(MetaDataParser parser, Collection files) Parse all given files.parsePersistentTypeNames(ClassLoader loader) Parse persistent type names.protected voidserialize(MetaDataSerializer ser, Map<File, String> output, int flags) Tell the given serialier to write its metadatas.voidsetClasspathScan(String cpath) Set of classpath directories or jars to scan for metadata supplied by user via auto-configuration.voidsetClasspathScan(Collection<String> cpath) Set of classpath directories or jars to scan for metadata supplied by user.voidSet of semicolon-separatedFiles of metadata files or directories supplied by user via auto-configuration.voidsetFiles(Collection<File> files) Set ofFiles of metadata files or directories supplied by user.voidsetResources(String rsrcs) Set of semicolon-separated resource paths of metadata files or jars supplied by user via auto-configuration.voidsetResources(Collection<String> rsrcs) Set of resource paths of metadata files or jars supplied by user.protected voidsetSourceFile(ClassMetaData meta, File sourceFile) Set the current source file of the given metadata.protected voidsetSourceFile(SequenceMetaData meta, File sourceFile) Set the current source file of the given metadata.voidSet of semicolon-separatedURLs of metadata files or jars supplied by user via auto-configuration.voidsetURLs(Collection<URL> urls) Set ofURLs of metadata files or jars supplied by user.booleanstore(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File, String> output) Store the given metadata.Methods inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory
addClassExtensionKeys, addFieldExtensionKeys, getQueryScope, getResultSetMappingScope, newClassArgParser, setRepository, setStoreDirectory, setStoreMode, setStrict, setTypes, setTypesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.openjpa.meta.MetaDataFactory
getDefaults, getManagedClass, getManagedClassName, getMetaModelClassName, isMetaClass, load, loadXMLMetaData
-
Field Details
-
files
-
urls
-
rsrcs
-
cpath
-
PERSISTENCE_UNIT_ROOT_URL
- See Also:
-
MAPPING_FILE_NAMES
- See Also:
-
JAR_FILE_URLS
- See Also:
-
-
Constructor Details
-
AbstractCFMetaDataFactory
public AbstractCFMetaDataFactory()
-
-
Method Details
-
setFiles
Set ofFiles of metadata files or directories supplied by user. -
setFiles
Set of semicolon-separatedFiles of metadata files or directories supplied by user via auto-configuration. -
setURLs
Set ofURLs of metadata files or jars supplied by user. -
setURLs
Set of semicolon-separatedURLs of metadata files or jars supplied by user via auto-configuration. -
setResources
Set of resource paths of metadata files or jars supplied by user. -
setResources
Set of semicolon-separated resource paths of metadata files or jars supplied by user via auto-configuration. -
setClasspathScan
Set of classpath directories or jars to scan for metadata supplied by user. -
setClasspathScan
Set of classpath directories or jars to scan for metadata supplied by user via auto-configuration. -
store
public boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File, String> output) Description copied from interface:MetaDataFactoryStore the given metadata.- Specified by:
storein interfaceMetaDataFactory- Overrides:
storein classAbstractMetaDataFactorymode- 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 aFileto the planned output for that destination in string form- Returns:
- false if this factory is unable to store metadata
-
drop
Description copied from interface:MetaDataFactoryDrop the metadata for the given classes in the given mode(s).- Specified by:
dropin interfaceMetaDataFactory- Overrides:
dropin classAbstractMetaDataFactory- Returns:
- false if any metadata could not be dropped
-
isMappingOnlyFactory
protected boolean isMappingOnlyFactory()Return true if this factory deals only with mapping data, and relies on a separate factory for metadata. -
parse
Parse all given files. -
parse
Parse all given classses. -
isParseTopDown
protected boolean isParseTopDown()Whether to parse classes top down. Defaults to false. -
serialize
Tell the given serialier to write its metadatas. -
backupAndDelete
Backup and delete the source files for the given metadatas. -
clearMapping
Clear mapping information from the given metadata. -
getSourceFile
Return the current source file of the given metadata. -
setSourceFile
Set the current source file of the given metadata. -
getSourceFile
Return the current source file of the given metadata. -
setSourceFile
Set the current source file of the given metadata. -
defaultSourceFile
Return the default file for the given metadata. -
defaultSourceFile
Return a default file for the given query. -
defaultSourceFile
Return a default file for the given sequence. -
newParser
Create a new metadata parser.- Parameters:
loading- if true, this will be the cached parser used for loading metadata
-
newSerializer
Create a new metadata serializer. -
newAnnotationSerializer
Create a new annotation metadata serializer. -
getDefiningMetaData
Return the metadata that defines the given query, if any.- Parameters:
clsNames- map of class names to metadatas
-
getPersistentTypeNames
Description copied from interface:MetaDataFactoryReturn 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.- Specified by:
getPersistentTypeNamesin interfaceMetaDataFactory- Overrides:
getPersistentTypeNamesin classAbstractMetaDataFactory- See Also:
-
parsePersistentTypeNames
Parse persistent type names.- Throws:
IOException
-
decode
Decodes a URL-encoded path string. For example, an encoded space (%20) is decoded into a normal space (' ') character. Added via OPENJPA-2102.- Parameters:
s- - the encoded URL string- Returns:
- String decoded - the decoded string.
-
mapPersistentTypeNames
Implement this method to map metadata resources to the persistent types contained within them. The method will be called whengetPersistentTypeNames(boolean, java.lang.ClassLoader)is invoked. -
newMetaDataFilter
Return a metadata filter that identifies metadata resources when performing jar and classpath scans. -
clear
public void clear()Description copied from interface:MetaDataFactoryClear any internal caches.- Specified by:
clearin interfaceMetaDataFactory- Overrides:
clearin classAbstractMetaDataFactory
-