|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.meta.AbstractMetaDataFactory org.apache.openjpa.meta.AbstractCFMetaDataFactory
public abstract class AbstractCFMetaDataFactory
Base class for factory implementations built around XML metadata files in the common fomat.
Nested Class Summary | |
---|---|
static interface |
AbstractCFMetaDataFactory.Parser
Internal parser interface. |
static interface |
AbstractCFMetaDataFactory.Serializer
Internal serializer interface. |
Field Summary | |
---|---|
protected Collection<String> |
cpath
|
protected Collection<File> |
files
|
static String |
JAR_FILE_URLS
|
static String |
MAPPING_FILE_NAMES
|
static String |
PERSISTENCE_UNIT_ROOT_URL
|
protected Collection<String> |
rsrcs
|
protected Collection<URL> |
urls
|
Fields inherited from class org.apache.openjpa.meta.AbstractMetaDataFactory |
---|
dir, log, repos, store, strict, types |
Fields inherited from interface org.apache.openjpa.meta.MetaDataFactory |
---|
STORE_DEFAULT, STORE_PER_CLASS, STORE_VERBOSE |
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 |
Constructor Summary | |
---|---|
AbstractCFMetaDataFactory()
|
Method Summary | |
---|---|
protected void |
backupAndDelete(Collection files)
Backup and delete the source files for the given metadatas. |
void |
clear()
Clear any internal caches. |
protected void |
clearMapping(ClassMetaData meta)
Clear mapping information from the given metadata. |
static String |
decode(String s)
Decodes a URL-encoded path string. |
protected abstract File |
defaultSourceFile(ClassMetaData meta)
Return the default file for the given metadata. |
protected abstract File |
defaultSourceFile(QueryMetaData query,
Map clsNames)
Return a default file for the given query. |
protected abstract File |
defaultSourceFile(SequenceMetaData seq,
Map clsNames)
Return a default file for the given sequence. |
boolean |
drop(Class[] cls,
int mode,
ClassLoader envLoader)
Drop the metadata for the given classes in the given mode(s). |
protected ClassMetaData |
getDefiningMetaData(QueryMetaData query,
Map clsNames)
Return the metadata that defines the given query, if any. |
Set<String> |
getPersistentTypeNames(boolean devpath,
ClassLoader envLoader)
Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath. |
protected File |
getSourceFile(ClassMetaData meta)
Return the current source file of the given metadata. |
protected File |
getSourceFile(SequenceMetaData meta)
Return the current source file of the given metadata. |
protected boolean |
isMappingOnlyFactory()
Return true if this factory deals only with mapping data, and relies on a separate factory for metadata. |
protected boolean |
isParseTopDown()
Whether to parse classes top down. |
protected void |
mapPersistentTypeNames(Object rsrc,
String[] names)
Implement this method to map metadata resources to the persistent types contained within them. |
protected abstract AbstractCFMetaDataFactory.Serializer |
newAnnotationSerializer()
Create a new annotation metadata serializer. |
protected abstract MetaDataFilter |
newMetaDataFilter()
Return a metadata filter that identifies metadata resources when performing jar and classpath scans. |
protected abstract AbstractCFMetaDataFactory.Parser |
newParser(boolean loading)
Create a new metadata parser. |
protected abstract AbstractCFMetaDataFactory.Serializer |
newSerializer()
Create a new metadata serializer. |
protected void |
parse(MetaDataParser parser,
Class[] cls)
Parse all given classses. |
protected void |
parse(MetaDataParser parser,
Collection files)
Parse all given files. |
protected Set<String> |
parsePersistentTypeNames(ClassLoader loader)
Parse persistent type names. |
protected void |
serialize(MetaDataSerializer ser,
Map<File,String> output,
int flags)
Tell the given serialier to write its metadatas. |
void |
setClasspathScan(Collection<String> cpath)
Set of classpath directories or jars to scan for metadata supplied by user. |
void |
setClasspathScan(String cpath)
Set of classpath directories or jars to scan for metadata supplied by user via auto-configuration. |
void |
setFiles(Collection<File> files)
Set of File s of metadata files or directories supplied by user. |
void |
setFiles(String files)
Set of semicolon-separated File s of metadata files or
directories supplied by user via auto-configuration. |
void |
setResources(Collection<String> rsrcs)
Set of resource paths of metadata files or jars supplied by user. |
void |
setResources(String rsrcs)
Set of semicolon-separated resource paths of metadata files or jars supplied by user via auto-configuration. |
protected void |
setSourceFile(ClassMetaData meta,
File sourceFile)
Set the current source file of the given metadata. |
protected void |
setSourceFile(SequenceMetaData meta,
File sourceFile)
Set the current source file of the given metadata. |
void |
setURLs(Collection<URL> urls)
Set of URL s of metadata files or jars supplied by user. |
void |
setURLs(String urls)
Set of semicolon-separated URL s of metadata files or jars
supplied by user via auto-configuration. |
boolean |
store(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, setTypes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.openjpa.meta.MetaDataFactory |
---|
getDefaults, getManagedClass, getManagedClassName, getMetaModelClassName, isMetaClass, load, loadXMLMetaData |
Field Detail |
---|
protected Collection<File> files
protected Collection<URL> urls
protected Collection<String> rsrcs
protected Collection<String> cpath
public static final String PERSISTENCE_UNIT_ROOT_URL
public static final String MAPPING_FILE_NAMES
public static final String JAR_FILE_URLS
Constructor Detail |
---|
public AbstractCFMetaDataFactory()
Method Detail |
---|
public void setFiles(Collection<File> files)
File
s of metadata files or directories supplied by user.
public void setFiles(String files)
File
s of metadata files or
directories supplied by user via auto-configuration.
public void setURLs(Collection<URL> urls)
URL
s of metadata files or jars supplied by user.
public void setURLs(String urls)
URL
s of metadata files or jars
supplied by user via auto-configuration.
public void setResources(Collection<String> rsrcs)
public void setResources(String rsrcs)
public void setClasspathScan(Collection<String> cpath)
public void setClasspathScan(String cpath)
public boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File,String> output)
MetaDataFactory
store
in interface MetaDataFactory
store
in class AbstractMetaDataFactory
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 a File
to the planned output for that
destination in string form
public boolean drop(Class[] cls, int mode, ClassLoader envLoader)
MetaDataFactory
drop
in interface MetaDataFactory
drop
in class AbstractMetaDataFactory
protected boolean isMappingOnlyFactory()
protected void parse(MetaDataParser parser, Collection files)
protected void parse(MetaDataParser parser, Class[] cls)
protected boolean isParseTopDown()
protected void serialize(MetaDataSerializer ser, Map<File,String> output, int flags)
protected void backupAndDelete(Collection files)
protected void clearMapping(ClassMetaData meta)
protected File getSourceFile(ClassMetaData meta)
protected void setSourceFile(ClassMetaData meta, File sourceFile)
protected File getSourceFile(SequenceMetaData meta)
protected void setSourceFile(SequenceMetaData meta, File sourceFile)
protected abstract File defaultSourceFile(ClassMetaData meta)
protected abstract File defaultSourceFile(QueryMetaData query, Map clsNames)
protected abstract File defaultSourceFile(SequenceMetaData seq, Map clsNames)
protected abstract AbstractCFMetaDataFactory.Parser newParser(boolean loading)
loading
- if true, this will be the cached parser used for
loading metadataprotected abstract AbstractCFMetaDataFactory.Serializer newSerializer()
protected abstract AbstractCFMetaDataFactory.Serializer newAnnotationSerializer()
protected ClassMetaData getDefiningMetaData(QueryMetaData query, Map clsNames)
clsNames
- map of class names to metadataspublic Set<String> getPersistentTypeNames(boolean devpath, ClassLoader envLoader)
MetaDataFactory
MetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader)
instead.
getPersistentTypeNames
in interface MetaDataFactory
getPersistentTypeNames
in class AbstractMetaDataFactory
MetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader)
,
MetaDataRepository.loadPersistentTypes(boolean, java.lang.ClassLoader)
protected Set<String> parsePersistentTypeNames(ClassLoader loader) throws IOException
IOException
public static String decode(String s)
String
- encoded - the encoded URL string
protected void mapPersistentTypeNames(Object rsrc, String[] names)
getPersistentTypeNames(boolean, java.lang.ClassLoader)
is invoked.
protected abstract MetaDataFilter newMetaDataFilter()
public void clear()
MetaDataFactory
clear
in interface MetaDataFactory
clear
in class AbstractMetaDataFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |