Package org.apache.openjpa.meta
Class MetaDataRepository
- java.lang.Object
-
- org.apache.openjpa.meta.MetaDataRepository
-
- All Implemented Interfaces:
java.io.Serializable
,PCRegistry.RegisterClassListener
,Configurable
,Closeable
,MetaDataModes
- Direct Known Subclasses:
MappingRepository
public class MetaDataRepository extends java.lang.Object implements PCRegistry.RegisterClassListener, Configurable, Closeable, MetaDataModes, java.io.Serializable
Repository of and factory for persistent metadata.- Since:
- 0.3.0
- Author:
- Abe White, Steve Kim (query metadata)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_locking
protected boolean
_preload
protected boolean
_preloadComplete
protected static java.lang.Class<?>[]
EMPTY_CLASSES
protected FieldMetaData[]
EMPTY_FIELDS
protected ClassMetaData[]
EMPTY_METAS
protected static NonPersistentMetaData[]
EMPTY_NON_PERSISTENT
protected Order[]
EMPTY_ORDERS
protected XMLMetaData[]
EMPTY_XMLMETAS
static int
VALIDATE_MAPPING
Bit flag to validate mappings.static int
VALIDATE_META
Bit flag to validate metadata.static int
VALIDATE_NONE
Constant to not validate any metadata.static int
VALIDATE_RUNTIME
Bit flag for runtime validation.static int
VALIDATE_UNENHANCED
Bit flag to validate unenhanced metadata only.-
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
Constructors Constructor Description MetaDataRepository()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassMetaData
addMetaData(java.lang.Class<?> cls)
Create a new metadata, populate it with default information, add it to the repository, and return it.ClassMetaData
addMetaData(java.lang.Class<?> cls, int access)
Create a new metadata, populate it with default information, add it to the repository, and return it.ClassMetaData
addMetaData(java.lang.Class<?> cls, int access, boolean ignoreTransient)
Create a new metadata, populate it with default information, add it to the repository, and return it.NonPersistentMetaData
addNonMappedInterface(java.lang.Class<?> iface)
Add the given non-mapped interface to the repository.NonPersistentMetaData
addPersistenceAware(java.lang.Class<?> cls)
Add the given class as persistence-aware.QueryMetaData
addQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Add a new query metadata to the repository and return it.QueryMetaData
addQueryMetaData(QueryMetaData meta)
SequenceMetaData
addSequenceMetaData(java.lang.String name)
Add a new sequence metadata to the repository and return it.void
addSystemListener(java.lang.Object listener)
Add the given system lifecycle listener.XMLClassMetaData
addXMLClassMetaData(java.lang.Class<?> type)
Create a new metadata, populate it with default information, add it to the repository, and return it.void
clear()
Clear the cache of parsed metadata.void
close()
Free the resources used by this repository.void
endConfiguration()
Invoked upon completion of bean property configuration for this object.java.util.Collection<java.lang.String>
getAliasNames()
ClassMetaData
getCachedMetaData(java.lang.Class<?> cls)
Return the cached metadata for the given class, without any resolution.ClassMetaData
getCachedMetaData(java.lang.String typeName)
This method returns the ClassMetaData whose described type name matches the typeName parameter.QueryMetaData
getCachedQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
QueryMetaData
getCachedQueryMetaData(java.lang.String name)
Return the cached query metadata for the given name.SequenceMetaData
getCachedSequenceMetaData(java.lang.String name)
Return the cached a sequence metadata for the given name.XMLMetaData
getCachedXMLMetaData(java.lang.Class<?> cls)
Return the cached XMLClassMetaData for the given class Return null if none.java.lang.String
getClosestAliasName(java.lang.String alias)
OpenJPAConfiguration
getConfiguration()
Return the configuration for the repository.ClassMetaData[]
getImplementorMetaDatas(java.lang.Class<?> cls, java.lang.ClassLoader envLoader, boolean mustExist)
Return all least-derived metadatas with some mapped assignable type that implement the given class.Log
getLog()
Return the metadata log.ClassMetaData
getMetaData(java.lang.Class<?> cls, java.lang.ClassLoader envLoader, boolean mustExist)
Return the metadata for the given class.ClassMetaData
getMetaData(java.lang.Object oid, java.lang.ClassLoader envLoader, boolean mustExist)
Return the least-derived class metadata for the given application identity object.ClassMetaData
getMetaData(java.lang.String alias, java.lang.ClassLoader envLoader, boolean mustExist)
Return the metadata for the given alias name.MetaDataFactory
getMetaDataFactory()
The I/O used to load metadata.ClassMetaData[]
getMetaDatas()
Return all the metadata instances currently in the repository.java.lang.Class<?>
getMetaModel(java.lang.Class<?> entity, boolean load)
Gets the meta class corresponding to the given class.java.lang.Class<?>
getMetaModel(ClassMetaData meta, boolean load)
Gets the meta class corresponding to the given persistent class.NonPersistentMetaData
getNonMappedInterface(java.lang.Class<?> iface)
Gets the metadata corresponding to the given non-mapped interface.NonPersistentMetaData[]
getNonMappedInterfaces()
Gets the corresponding metadatas for all registered, non-mapped interfacesFieldMetaData
getOrderByField(ClassMetaData meta, java.lang.String orderBy)
NonPersistentMetaData
getPersistenceAware(java.lang.Class<?> cls)
Gets the metadata corresponding to the given persistence-aware class.NonPersistentMetaData[]
getPersistenceAwares()
Gets all the metadatas for persistence-aware classesjava.util.Set<java.lang.String>
getPersistentTypeNames(boolean devpath, java.lang.ClassLoader envLoader)
Return the set of configured persistent classes, or null if the user did not configure any.boolean
getPreload()
Sets whether this repository will load all known persistent classes at initialization.protected static java.lang.Object
getQueryKey(java.lang.Class<?> cls, java.lang.String name)
Return a unique key for a given class / name.QueryMetaData
getQueryMetaData(java.lang.Class<?> cls, java.lang.String name, java.lang.ClassLoader envLoader, boolean mustExist)
Return query metadata for the given class, name, and classloader.QueryMetaData[]
getQueryMetaDatas()
Return the cached query metadata.int
getResolve()
The metadata resolution mode.SequenceMetaData
getSequenceMetaData(java.lang.String name, java.lang.ClassLoader envLoader, boolean mustExist)
Return sequence metadata for the given name and classloader.SequenceMetaData[]
getSequenceMetaDatas()
Return the cached sequence metadata.int
getSourceMode()
The source mode determining what metadata to load.LifecycleEventManager.ListenerList
getSystemListeners()
Return the system lifecycle listenersint
getValidate()
The metadata validation level.XMLMetaData
getXMLMetaData(java.lang.Class<?> cls)
Return XML metadata for a given field metadataboolean
is_systemListenersActivated()
Whether any system (default) listeners have been registered.java.util.Collection<java.lang.Class<?>>
loadPersistentTypes(boolean devpath, java.lang.ClassLoader envLoader)
Load the persistent classes named in configuration.java.util.Collection<java.lang.Class<?>>
loadPersistentTypes(boolean devpath, java.lang.ClassLoader envLoader, boolean mustExist)
Load the persistent classes named in configuration.static boolean
needsPreload(OpenJPAConfiguration conf)
protected ClassMetaData
newClassMetaData(java.lang.Class<?> type)
Create a new class metadata instance.protected ClassMetaData[]
newClassMetaDataArray(int length)
Create a new array of the proper class metadata subclass.protected ClassMetaData
newEmbeddedClassMetaData(ValueMetaData owner)
Create a new embedded class metadata instance.protected FieldMetaData
newFieldMetaData(java.lang.String name, java.lang.Class<?> type, ClassMetaData owner)
Create a new field metadata instance.protected FieldMetaData[]
newFieldMetaDataArray(int length)
Create a new array of the proper field metadata subclass.protected Order
newOrder(FieldMetaData owner, java.lang.String name, boolean asc)
Create anOrder
for the given field and declaration.protected Order[]
newOrderArray(int size)
Create an array of orders of the given size.QueryMetaData
newQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Create a new query metadata instance.protected Order
newRelatedFieldOrder(FieldMetaData owner, FieldMetaData rel, boolean asc)
Order by a field of the related type.protected SequenceMetaData
newSequenceMetaData(java.lang.String name)
Create a new sequence metadata instance.protected ValueMetaData
newValueMetaData(FieldMetaData owner)
Create a new value metadata instance.protected Order
newValueOrder(FieldMetaData owner, boolean asc)
Order by the field value.protected XMLClassMetaData
newXMLClassMetaData(java.lang.Class<?> type)
Create a new xml class metadataprotected XMLMetaData[]
newXMLClassMetaDataArray(int length)
Create a new array of the proper xml class metadata subclass.XMLFieldMetaData
newXMLFieldMetaData(java.lang.Class<?> type, java.lang.String name)
Create a new xml field meta, add it to the fieldMap in the given xml class metadatavoid
preload()
If the openjpa.MetaDataRepository plugin value Preload=true is set, this method will load all MetaData for all persistent classes and will remove locking from this class.protected void
prepareMapping(ClassMetaData meta)
Prepare metadata for mapping resolution.void
register(java.lang.Class<?> cls)
void
registerAlias(java.lang.String alias, java.lang.Class<?> cls)
boolean
removeMetaData(java.lang.Class<?> cls)
Remove a metadata instance from the repository.boolean
removeMetaData(ClassMetaData meta)
Remove a metadata instance from the repository.boolean
removeNonMappedInterface(java.lang.Class<?> iface)
Remove a non-mapped interface from the repositoryboolean
removePersistenceAware(java.lang.Class<?> cls)
Remove a persitence-aware class from the repositoryboolean
removeQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Remove query metadata for the given class name if in the repository.boolean
removeQueryMetaData(QueryMetaData meta)
Remove the given query metadata from the repository.boolean
removeSequenceMetaData(java.lang.String name)
Remove sequence metadata for the name if in the repository.boolean
removeSequenceMetaData(SequenceMetaData meta)
Remove the given sequence metadata from the repository.boolean
removeSystemListener(java.lang.Object listener)
Remove the given system lifecycle listener.QueryMetaData
searchQueryMetaDataByName(java.lang.String name)
Searches all cached query metadata by name.void
setConfiguration(Configuration conf)
Invoked prior to setting bean properties.void
setMetaDataFactory(MetaDataFactory factory)
The I/O used to load metadata.void
setMetaModel(java.lang.Class<?> m2)
Puts the meta class corresponding to the given entity class.void
setMetaModel(ClassMetaData meta, java.lang.Class<?> m2)
Puts the meta class corresponding to the given persistent class.void
setPreload(boolean l)
Sets whether this repository will load all known persistent classes at initialization.void
setResolve(int mode)
The metadata resolution mode.void
setResolve(int mode, boolean on)
The metadata resolution mode.void
setSourceMode(int mode)
The source mode determining what metadata to load.void
setSourceMode(int mode, boolean on)
The source mode determining what metadata to load.void
setValidate(int validate)
The metadata validation level.void
setValidate(int validate, boolean on)
The metadata validation level.boolean
skipMetadata(java.lang.Class<?> cls)
void
startConfiguration()
Invoked before bean property configuration is begun on this object.
-
-
-
Field Detail
-
VALIDATE_NONE
public static final int VALIDATE_NONE
Constant to not validate any metadata.- See Also:
- Constant Field Values
-
VALIDATE_META
public static final int VALIDATE_META
Bit flag to validate metadata.- See Also:
- Constant Field Values
-
VALIDATE_MAPPING
public static final int VALIDATE_MAPPING
Bit flag to validate mappings.- See Also:
- Constant Field Values
-
VALIDATE_UNENHANCED
public static final int VALIDATE_UNENHANCED
Bit flag to validate unenhanced metadata only.- See Also:
- Constant Field Values
-
VALIDATE_RUNTIME
public static final int VALIDATE_RUNTIME
Bit flag for runtime validation. Requires that all classes are enhanced, and performs extra field resolution steps.- See Also:
- Constant Field Values
-
EMPTY_CLASSES
protected static final java.lang.Class<?>[] EMPTY_CLASSES
-
EMPTY_NON_PERSISTENT
protected static final NonPersistentMetaData[] EMPTY_NON_PERSISTENT
-
EMPTY_METAS
protected final ClassMetaData[] EMPTY_METAS
-
EMPTY_FIELDS
protected final FieldMetaData[] EMPTY_FIELDS
-
EMPTY_ORDERS
protected final Order[] EMPTY_ORDERS
-
EMPTY_XMLMETAS
protected final XMLMetaData[] EMPTY_XMLMETAS
-
_preload
protected boolean _preload
-
_preloadComplete
protected boolean _preloadComplete
-
_locking
protected boolean _locking
-
-
Constructor Detail
-
MetaDataRepository
public MetaDataRepository()
Default constructor. Configure viaConfigurable
.
-
-
Method Detail
-
getConfiguration
public OpenJPAConfiguration getConfiguration()
Return the configuration for the repository.
-
getLog
public Log getLog()
Return the metadata log.
-
getMetaDataFactory
public MetaDataFactory getMetaDataFactory()
The I/O used to load metadata.
-
setMetaDataFactory
public void setMetaDataFactory(MetaDataFactory factory)
The I/O used to load metadata.
-
getValidate
public int getValidate()
The metadata validation level. Defaults toVALIDATE_META | VALIDATE_UNENHANCED
.
-
setValidate
public void setValidate(int validate)
The metadata validation level. Defaults toVALIDATE_META | VALIDATE_UNENHANCED
.
-
setValidate
public void setValidate(int validate, boolean on)
The metadata validation level. Defaults toVALIDATE_META | VALIDATE_MAPPING | VALIDATE_UNENHANCED
.
-
getResolve
public int getResolve()
The metadata resolution mode. Defaults toMODE_META | MODE_MAPPING
.
-
setResolve
public void setResolve(int mode)
The metadata resolution mode. Defaults toMODE_META | MODE_MAPPING
.
-
setResolve
public void setResolve(int mode, boolean on)
The metadata resolution mode. Defaults toMODE_META | MODE_MAPPING
.
-
getSourceMode
public int getSourceMode()
The source mode determining what metadata to load. Defaults toMODE_META | MODE_MAPPING | MODE_QUERY
.
-
setSourceMode
public void setSourceMode(int mode)
The source mode determining what metadata to load. Defaults toMODE_META | MODE_MAPPING | MODE_QUERY
.
-
setSourceMode
public void setSourceMode(int mode, boolean on)
The source mode determining what metadata to load. Defaults toMODE_META | MODE_MAPPING | MODE_QUERY
.
-
getPreload
public boolean getPreload()
Sets whether this repository will load all known persistent classes at initialization. Defaults to false.
-
setPreload
public void setPreload(boolean l)
Sets whether this repository will load all known persistent classes at initialization. Defaults to false.
-
preload
public void preload()
If the openjpa.MetaDataRepository plugin value Preload=true is set, this method will load all MetaData for all persistent classes and will remove locking from this class.
-
getMetaData
public ClassMetaData getMetaData(java.lang.Class<?> cls, java.lang.ClassLoader envLoader, boolean mustExist)
Return the metadata for the given class.- Parameters:
cls
- the class to retrieve metadata forenvLoader
- the environmental class loader, if anymustExist
- if true, throws aMetaDataException
if no metadata is found
-
getMetaData
public ClassMetaData getMetaData(java.lang.String alias, java.lang.ClassLoader envLoader, boolean mustExist)
Return the metadata for the given alias name.- Parameters:
alias
- the alias to class to retrieve metadata forenvLoader
- the environmental class loader, if anymustExist
- if true, throws aMetaDataException
if no metadata is found- See Also:
ClassMetaData.getTypeAlias()
-
getClosestAliasName
public java.lang.String getClosestAliasName(java.lang.String alias)
- Returns:
- the nearest match to the specified alias name
- Since:
- 1.1.0
-
getAliasNames
public java.util.Collection<java.lang.String> getAliasNames()
- Returns:
- the registered alias names
- Since:
- 1.1.0
-
prepareMapping
protected void prepareMapping(ClassMetaData meta)
Prepare metadata for mapping resolution. This method might map parts of the metadata that don't rely on other classes being mapped, but that other classes might rely on during their own mapping (for example, primary key fields). By default, this method only callsClassMetaData.defineSuperclassFields(boolean)
.
-
getMetaDatas
public ClassMetaData[] getMetaDatas()
Return all the metadata instances currently in the repository.
-
getCachedMetaData
public ClassMetaData getCachedMetaData(java.lang.Class<?> cls)
Return the cached metadata for the given class, without any resolution. Return null if none.
-
addMetaData
public ClassMetaData addMetaData(java.lang.Class<?> cls)
Create a new metadata, populate it with default information, add it to the repository, and return it. Use the default access type.
-
addMetaData
public ClassMetaData addMetaData(java.lang.Class<?> cls, int access)
Create a new metadata, populate it with default information, add it to the repository, and return it.- Parameters:
access
- the access type to use in populating metadata
-
addMetaData
public ClassMetaData addMetaData(java.lang.Class<?> cls, int access, boolean ignoreTransient)
Create a new metadata, populate it with default information, add it to the repository, and return it.- Parameters:
access
- the access type to use in populating metadata
-
newClassMetaData
protected ClassMetaData newClassMetaData(java.lang.Class<?> type)
Create a new class metadata instance.
-
newClassMetaDataArray
protected ClassMetaData[] newClassMetaDataArray(int length)
Create a new array of the proper class metadata subclass.
-
newFieldMetaData
protected FieldMetaData newFieldMetaData(java.lang.String name, java.lang.Class<?> type, ClassMetaData owner)
Create a new field metadata instance.
-
newFieldMetaDataArray
protected FieldMetaData[] newFieldMetaDataArray(int length)
Create a new array of the proper field metadata subclass.
-
newXMLClassMetaDataArray
protected XMLMetaData[] newXMLClassMetaDataArray(int length)
Create a new array of the proper xml class metadata subclass.
-
newEmbeddedClassMetaData
protected ClassMetaData newEmbeddedClassMetaData(ValueMetaData owner)
Create a new embedded class metadata instance.
-
newValueMetaData
protected ValueMetaData newValueMetaData(FieldMetaData owner)
Create a new value metadata instance.
-
newOrder
protected Order newOrder(FieldMetaData owner, java.lang.String name, boolean asc)
Create anOrder
for the given field and declaration. This method delegates tonewRelatedFieldOrder(org.apache.openjpa.meta.FieldMetaData, org.apache.openjpa.meta.FieldMetaData, boolean)
andnewValueOrder(FieldMetaData, boolean)
by default.
-
getOrderByField
public FieldMetaData getOrderByField(ClassMetaData meta, java.lang.String orderBy)
-
newValueOrder
protected Order newValueOrder(FieldMetaData owner, boolean asc)
Order by the field value.
-
newRelatedFieldOrder
protected Order newRelatedFieldOrder(FieldMetaData owner, FieldMetaData rel, boolean asc)
Order by a field of the related type.
-
newOrderArray
protected Order[] newOrderArray(int size)
Create an array of orders of the given size.
-
removeMetaData
public boolean removeMetaData(ClassMetaData meta)
Remove a metadata instance from the repository.- Returns:
- true if removed, false if not in this repository
-
removeMetaData
public boolean removeMetaData(java.lang.Class<?> cls)
Remove a metadata instance from the repository.- Returns:
- true if removed, false if not in this repository
-
getMetaData
public ClassMetaData getMetaData(java.lang.Object oid, java.lang.ClassLoader envLoader, boolean mustExist)
Return the least-derived class metadata for the given application identity object.- Parameters:
oid
- the oid to get the metadata forenvLoader
- the environmental class loader, if anymustExist
- if true, throws aMetaDataException
if no metadata is found
-
getImplementorMetaDatas
public ClassMetaData[] getImplementorMetaDatas(java.lang.Class<?> cls, java.lang.ClassLoader envLoader, boolean mustExist)
Return all least-derived metadatas with some mapped assignable type that implement the given class.- Parameters:
cls
- the class or interface to retrieve implementors forenvLoader
- the environmental class loader, if anymustExist
- if true, throws aMetaDataException
if no metadata is found
-
getPersistenceAware
public NonPersistentMetaData getPersistenceAware(java.lang.Class<?> cls)
Gets the metadata corresponding to the given persistence-aware class. Returns null, if the given class is not registered as persistence-aware.
-
skipMetadata
public boolean skipMetadata(java.lang.Class<?> cls)
-
getPersistenceAwares
public NonPersistentMetaData[] getPersistenceAwares()
Gets all the metadatas for persistence-aware classes- Returns:
- empty array if no class has been registered as pers-aware
-
addPersistenceAware
public NonPersistentMetaData addPersistenceAware(java.lang.Class<?> cls)
Add the given class as persistence-aware.- Parameters:
cls
- non-null and must not alreaddy be added as persitence-capable
-
removePersistenceAware
public boolean removePersistenceAware(java.lang.Class<?> cls)
Remove a persitence-aware class from the repository- Returns:
- true if removed
-
getNonMappedInterface
public NonPersistentMetaData getNonMappedInterface(java.lang.Class<?> iface)
Gets the metadata corresponding to the given non-mapped interface. Returns null, if the given interface is not registered as persistence-aware.
-
getNonMappedInterfaces
public NonPersistentMetaData[] getNonMappedInterfaces()
Gets the corresponding metadatas for all registered, non-mapped interfaces- Returns:
- empty array if no non-mapped interface has been registered.
-
addNonMappedInterface
public NonPersistentMetaData addNonMappedInterface(java.lang.Class<?> iface)
Add the given non-mapped interface to the repository.- Parameters:
iface
- the non-mapped interface
-
removeNonMappedInterface
public boolean removeNonMappedInterface(java.lang.Class<?> iface)
Remove a non-mapped interface from the repository- Returns:
- true if removed
-
clear
public void clear()
Clear the cache of parsed metadata. This method also clears the internalMetaDataFactory
's cache.
-
getPersistentTypeNames
public java.util.Set<java.lang.String> getPersistentTypeNames(boolean devpath, java.lang.ClassLoader envLoader)
Return the set of configured persistent classes, or null if the user did not configure any.- Parameters:
devpath
- if true, search for metadata files in directories in the classpath if no classes are configured explicitlyenvLoader
- the class loader to use, or null for default
-
loadPersistentTypes
public java.util.Collection<java.lang.Class<?>> loadPersistentTypes(boolean devpath, java.lang.ClassLoader envLoader)
Load the persistent classes named in configuration. This ensures that all subclasses and application identity classes of each type are known in advance, without having to rely on the application loading the classes before performing operations that might involve them.- Parameters:
devpath
- if true, search for metadata files in directories in the classpath if the no classes are configured explicitlyenvLoader
- the class loader to use, or null for default- Returns:
- the loaded classes, or empty collection if none
-
loadPersistentTypes
public java.util.Collection<java.lang.Class<?>> loadPersistentTypes(boolean devpath, java.lang.ClassLoader envLoader, boolean mustExist)
Load the persistent classes named in configuration. This ensures that all subclasses and application identity classes of each type are known in advance, without having to rely on the application loading the classes before performing operations that might involve them.- Parameters:
devpath
- if true, search for metadata files in directories in the classpath if the no classes are configured explicitlyenvLoader
- the class loader to use, or null for defaultmustExist
- if true then empty list of classes or any unloadable but specified class will raise an exception.- Returns:
- the loaded classes, or empty collection if none
-
register
public void register(java.lang.Class<?> cls)
- Specified by:
register
in interfacePCRegistry.RegisterClassListener
-
registerAlias
public void registerAlias(java.lang.String alias, java.lang.Class<?> cls)
-
setMetaModel
public void setMetaModel(java.lang.Class<?> m2)
Puts the meta class corresponding to the given entity class.
-
setMetaModel
public void setMetaModel(ClassMetaData meta, java.lang.Class<?> m2)
Puts the meta class corresponding to the given persistent class.
-
getMetaModel
public java.lang.Class<?> getMetaModel(ClassMetaData meta, boolean load)
Gets the meta class corresponding to the given persistent class.
-
getMetaModel
public java.lang.Class<?> getMetaModel(java.lang.Class<?> entity, boolean load)
Gets the meta class corresponding to the given class. If load is false, returns the meta class if has been set for the given persistent class earlier. If the load is true then also attempts to apply the current naming policy to derive meta class name and attempts to load the meta class.
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:Configurable
Invoked before bean property configuration is begun on this object.- Specified by:
startConfiguration
in interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:Configurable
Invoked upon completion of bean property configuration for this object.- Specified by:
endConfiguration
in interfaceConfigurable
-
getQueryMetaData
public QueryMetaData getQueryMetaData(java.lang.Class<?> cls, java.lang.String name, java.lang.ClassLoader envLoader, boolean mustExist)
Return query metadata for the given class, name, and classloader.
-
getQueryMetaDatas
public QueryMetaData[] getQueryMetaDatas()
Return the cached query metadata.
-
getCachedQueryMetaData
public QueryMetaData getCachedQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
-
getCachedQueryMetaData
public QueryMetaData getCachedQueryMetaData(java.lang.String name)
Return the cached query metadata for the given name.
-
addQueryMetaData
public QueryMetaData addQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Add a new query metadata to the repository and return it.
-
addQueryMetaData
public QueryMetaData addQueryMetaData(QueryMetaData meta)
-
newQueryMetaData
public QueryMetaData newQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Create a new query metadata instance.
-
removeQueryMetaData
public boolean removeQueryMetaData(QueryMetaData meta)
Remove the given query metadata from the repository.
-
removeQueryMetaData
public boolean removeQueryMetaData(java.lang.Class<?> cls, java.lang.String name)
Remove query metadata for the given class name if in the repository.
-
searchQueryMetaDataByName
public QueryMetaData searchQueryMetaDataByName(java.lang.String name)
Searches all cached query metadata by name.
-
getQueryKey
protected static java.lang.Object getQueryKey(java.lang.Class<?> cls, java.lang.String name)
Return a unique key for a given class / name. The class argument can be null.
-
getSequenceMetaData
public SequenceMetaData getSequenceMetaData(java.lang.String name, java.lang.ClassLoader envLoader, boolean mustExist)
Return sequence metadata for the given name and classloader.
-
getSequenceMetaDatas
public SequenceMetaData[] getSequenceMetaDatas()
Return the cached sequence metadata.
-
getCachedSequenceMetaData
public SequenceMetaData getCachedSequenceMetaData(java.lang.String name)
Return the cached a sequence metadata for the given name.
-
addSequenceMetaData
public SequenceMetaData addSequenceMetaData(java.lang.String name)
Add a new sequence metadata to the repository and return it.
-
newSequenceMetaData
protected SequenceMetaData newSequenceMetaData(java.lang.String name)
Create a new sequence metadata instance.
-
removeSequenceMetaData
public boolean removeSequenceMetaData(SequenceMetaData meta)
Remove the given sequence metadata from the repository.
-
removeSequenceMetaData
public boolean removeSequenceMetaData(java.lang.String name)
Remove sequence metadata for the name if in the repository.
-
is_systemListenersActivated
public boolean is_systemListenersActivated()
Whether any system (default) listeners have been registered. Used as a quick test to determine whether the callback/listener mechanism has been enabled.- Returns:
- boolean
-
addSystemListener
public void addSystemListener(java.lang.Object listener)
Add the given system lifecycle listener.
-
removeSystemListener
public boolean removeSystemListener(java.lang.Object listener)
Remove the given system lifecycle listener.
-
getSystemListeners
public LifecycleEventManager.ListenerList getSystemListeners()
Return the system lifecycle listeners
-
close
public void close()
Free the resources used by this repository. Closes all user sequences.
-
getXMLMetaData
public XMLMetaData getXMLMetaData(java.lang.Class<?> cls)
Return XML metadata for a given field metadata- Returns:
- XML metadata
-
addXMLClassMetaData
public XMLClassMetaData addXMLClassMetaData(java.lang.Class<?> type)
Create a new metadata, populate it with default information, add it to the repository, and return it.- Parameters:
type
- the access type to use in populating metadata
-
getCachedXMLMetaData
public XMLMetaData getCachedXMLMetaData(java.lang.Class<?> cls)
Return the cached XMLClassMetaData for the given class Return null if none.
-
newXMLClassMetaData
protected XMLClassMetaData newXMLClassMetaData(java.lang.Class<?> type)
Create a new xml class metadata- Returns:
- a XMLClassMetaData
-
newXMLFieldMetaData
public XMLFieldMetaData newXMLFieldMetaData(java.lang.Class<?> type, java.lang.String name)
Create a new xml field meta, add it to the fieldMap in the given xml class metadata- Returns:
- a XMLFieldMetaData
-
needsPreload
public static boolean needsPreload(OpenJPAConfiguration conf)
-
getCachedMetaData
public ClassMetaData getCachedMetaData(java.lang.String typeName)
This method returns the ClassMetaData whose described type name matches the typeName parameter. It ONLY operates against MetaData that is currently known by this repository. Note: This method call WILL NOT resolve any metadata.
-
-