Package org.apache.openjpa.persistence
Class PersistenceProductDerivation
java.lang.Object
org.apache.openjpa.lib.conf.AbstractProductDerivation
org.apache.openjpa.persistence.PersistenceProductDerivation
- All Implemented Interfaces:
OpenJPAProductDerivation,ProductDerivation
public class PersistenceProductDerivation
extends AbstractProductDerivation
implements OpenJPAProductDerivation
Sets JPA specification defaults and parses JPA specification XML files.
For globals, looks in
openjpa.properties system property for
the location of a file to parse. If no system property is defined, the
default resource location of META-INF/openjpa.xml is used.
For defaults, looks for META-INF/persistence.xml.
Within persistence.xml, look for the named persistence unit, or
if no name given, an OpenJPA unit (preferring an unnamed OpenJPA unit to
a named one).- Author:
- Abe White
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSAX handler capable of parsing an JPA persistence.xml file.static classCustom configuration provider. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringstatic final Specificationstatic final Stringstatic final Stringstatic final Stringstatic final Specificationstatic final BigDecimalFields inherited from interface org.apache.openjpa.conf.OpenJPAProductDerivation
TYPE_PRODUCT_STORE, TYPE_SPEC, TYPE_SPEC_STORE, TYPE_STOREFields inherited from interface org.apache.openjpa.lib.conf.ProductDerivation
TYPE_FEATURE, TYPE_PRODUCT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCalled after the specification has been set.booleanProvides the instance with the opportunity to mutateconfbefore the user configuration is applied.booleancheckPuNameCollisions(Log logger, String puName) This method checks to see if the providedpuNamewas detected in multiple resources.getAnchorsInFile(File file) Return a Listof all the anchors defined in file.getAnchorsInResource(String resource) Return a Listof all the anchors defined in resource.Return the configuration prefix for properties of this product.Return a string identifying the default resource location for this product derivation, if one exists.Return set of Query hint keys recognized by this receiver.intgetType()Return the type of derivation.Load configuration from the given persistence unit with the specified user properties.Load given file, or return null if it is not a file this receiver understands.load(String rsrc, String anchor, ClassLoader loader) Load the given given resource into the returned ConfigurationProvider, or return null if it is not a resource this receiver understands.Load configuration from the given resource and unit names, which may be null.loadDefaults(ClassLoader loader) Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.loadGlobals(ClassLoader loader) Load globals into the returned ConfigurationProvider, or return null if no globals are found.voidLoad default alias options into the given map.voidvalidate()Ensure that this derivation is valid.Methods inherited from class org.apache.openjpa.lib.conf.AbstractProductDerivation
beforeConfigurationClose, beforeConfigurationConstructMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.openjpa.lib.conf.ProductDerivation
beforeConfigurationClose, beforeConfigurationConstruct
-
Field Details
-
SPEC_JPA
-
ALIAS_EJB
-
RSRC_GLOBAL
- See Also:
-
RSRC_DEFAULT
- See Also:
-
VERSION_1_0
-
PREFIX
- See Also:
-
_providerImplName
-
-
Constructor Details
-
PersistenceProductDerivation
public PersistenceProductDerivation()
-
-
Method Details
-
putBrokerFactoryAliases
Description copied from interface:OpenJPAProductDerivationLoad default alias options into the given map. Each entry maps an alias to a broker factory class name. Replace anything previously under the desired keys.- Specified by:
putBrokerFactoryAliasesin interfaceOpenJPAProductDerivation
-
getType
public int getType()Description copied from interface:ProductDerivationReturn the type of derivation.- Specified by:
getTypein interfaceProductDerivation
-
getConfigurationPrefix
Description copied from interface:ProductDerivationReturn the configuration prefix for properties of this product.- Specified by:
getConfigurationPrefixin interfaceProductDerivation- Overrides:
getConfigurationPrefixin classAbstractProductDerivation
-
getSupportedQueryHints
Description copied from interface:ProductDerivationReturn set of Query hint keys recognized by this receiver.- Specified by:
getSupportedQueryHintsin interfaceProductDerivation- Overrides:
getSupportedQueryHintsin classAbstractProductDerivation
-
validate
Description copied from interface:ProductDerivationEnsure that this derivation is valid. This action might consist of loading classes for the product this derivation represents to be sure they exist. Throw any throwable to indicate an invalid derivation. Invalid derivations will not be used.- Specified by:
validatein interfaceProductDerivation- Overrides:
validatein classAbstractProductDerivation- Throws:
Exception
-
beforeConfigurationLoad
Description copied from interface:ProductDerivationProvides the instance with the opportunity to mutateconfbefore the user configuration is applied.- Specified by:
beforeConfigurationLoadin interfaceProductDerivation- Overrides:
beforeConfigurationLoadin classAbstractProductDerivation- Returns:
- true if given Configuration has been mutated.
-
afterSpecificationSet
Description copied from interface:ProductDerivationCalled after the specification has been set.- Specified by:
afterSpecificationSetin interfaceProductDerivation- Overrides:
afterSpecificationSetin classAbstractProductDerivation- Returns:
- true if given Configuration has been mutated.
-
load
public ConfigurationProvider load(jakarta.persistence.spi.PersistenceUnitInfo pinfo, Map m) throws IOException Load configuration from the given persistence unit with the specified user properties.- Throws:
IOException
-
load
Load configuration from the given resource and unit names, which may be null.- Throws:
IOException
-
load
public ConfigurationProvider load(String rsrc, String anchor, ClassLoader loader) throws IOException Description copied from interface:ProductDerivationLoad the given given resource into the returned ConfigurationProvider, or return null if it is not a resource this receiver understands. The given class loader may be null.- Specified by:
loadin interfaceProductDerivation- Overrides:
loadin classAbstractProductDerivationanchor- optional named anchor within a multiple-configuration resource- Throws:
IOException
-
load
Description copied from interface:ProductDerivationLoad given file, or return null if it is not a file this receiver understands.- Specified by:
loadin interfaceProductDerivation- Overrides:
loadin classAbstractProductDerivationanchor- optional named anchor within a multiple-configuration file- Throws:
IOException
-
getDefaultResourceLocation
Description copied from interface:ProductDerivationReturn a string identifying the default resource location for this product derivation, if one exists. If there is no default location, returnsnull.- Specified by:
getDefaultResourceLocationin interfaceProductDerivation- Overrides:
getDefaultResourceLocationin classAbstractProductDerivation
-
getAnchorsInFile
Description copied from interface:ProductDerivationReturn a Listof all the anchors defined in file. The returned names are not fully-qualified, so must be used in conjunction withfilein calls toProductDerivation.load(java.io.File, String). Returnsnullor an empty list if no anchors could be found.- Specified by:
getAnchorsInFilein interfaceProductDerivation- Overrides:
getAnchorsInFilein classAbstractProductDerivation- Throws:
IOException
-
getAnchorsInResource
Description copied from interface:ProductDerivationReturn a Listof all the anchors defined in resource. The returned names are not fully-qualified, so must be used in conjunction withresourcein calls toProductDerivation.load(java.io.File, String). Returnsnullor an empty list if no anchors could be found.- Specified by:
getAnchorsInResourcein interfaceProductDerivation- Overrides:
getAnchorsInResourcein classAbstractProductDerivation- Throws:
Exception
-
loadGlobals
Description copied from interface:ProductDerivationLoad globals into the returned ConfigurationProvider, or return null if no globals are found.- Specified by:
loadGlobalsin interfaceProductDerivation- Overrides:
loadGlobalsin classAbstractProductDerivation- Throws:
IOException
-
loadDefaults
Description copied from interface:ProductDerivationLoad defaults into the returned ConfigurationProvider, or return null if no defaults are found.- Specified by:
loadDefaultsin interfaceProductDerivation- Overrides:
loadDefaultsin classAbstractProductDerivation- Throws:
IOException
-
checkPuNameCollisions
This method checks to see if the providedpuNamewas detected in multiple resources. If a collision is detected, a warning will be logged and this method will returntrue.
-