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 inopenjpa.propertiessystem property for the location of a file to parse. If no system property is defined, the default resource location ofMETA-INF/openjpa.xmlis used. For defaults, looks forMETA-INF/persistence.xml. Withinpersistence.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 SummaryNested Classes Modifier and Type Class Description static classPersistenceProductDerivation.ConfigurationParserSAX handler capable of parsing an JPA persistence.xml file.static classPersistenceProductDerivation.ConfigurationProviderImplCustom configuration provider.
 - 
Field SummaryFields Modifier and Type Field Description protected java.lang.String_providerImplNamestatic SpecificationALIAS_EJBstatic java.lang.StringPREFIXstatic java.lang.StringRSRC_DEFAULTstatic java.lang.StringRSRC_GLOBALstatic SpecificationSPEC_JPAstatic java.math.BigDecimalVERSION_1_0- 
Fields inherited from interface org.apache.openjpa.conf.OpenJPAProductDerivationTYPE_PRODUCT_STORE, TYPE_SPEC, TYPE_SPEC_STORE, TYPE_STORE
 - 
Fields inherited from interface org.apache.openjpa.lib.conf.ProductDerivationTYPE_FEATURE, TYPE_PRODUCT
 
- 
 - 
Constructor SummaryConstructors Constructor Description PersistenceProductDerivation()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanafterSpecificationSet(Configuration c)Called after the specification has been set.booleanbeforeConfigurationLoad(Configuration c)Provides the instance with the opportunity to mutateconfbefore the user configuration is applied.booleancheckPuNameCollisions(Log logger, java.lang.String puName)This method checks to see if the providedpuNamewas detected in multiple resources.java.util.List<java.lang.String>getAnchorsInFile(java.io.File file)Return a Listof all the anchors defined in file.java.util.ListgetAnchorsInResource(java.lang.String resource)Return a Listof all the anchors defined in resource.java.lang.StringgetConfigurationPrefix()Return the configuration prefix for properties of this product.java.lang.StringgetDefaultResourceLocation()Return a string identifying the default resource location for this product derivation, if one exists.java.util.Set<java.lang.String>getSupportedQueryHints()Return set of Query hint keys recognized by this receiver.intgetType()Return the type of derivation.ConfigurationProviderload(jakarta.persistence.spi.PersistenceUnitInfo pinfo, java.util.Map m)Load configuration from the given persistence unit with the specified user properties.ConfigurationProviderload(java.io.File file, java.lang.String anchor)Load given file, or return null if it is not a file this receiver understands.ConfigurationProviderload(java.lang.String rsrc, java.lang.String anchor, java.lang.ClassLoader loader)Load the given given resource into the returned ConfigurationProvider, or return null if it is not a resource this receiver understands.ConfigurationProviderload(java.lang.String rsrc, java.lang.String name, java.util.Map m)Load configuration from the given resource and unit names, which may be null.ConfigurationProviderloadDefaults(java.lang.ClassLoader loader)Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.ConfigurationProviderloadGlobals(java.lang.ClassLoader loader)Load globals into the returned ConfigurationProvider, or return null if no globals are found.voidputBrokerFactoryAliases(java.util.Map<java.lang.String,java.lang.String> m)Load default alias options into the given map.voidvalidate()Ensure that this derivation is valid.- 
Methods inherited from class org.apache.openjpa.lib.conf.AbstractProductDerivationbeforeConfigurationClose, beforeConfigurationConstruct
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.openjpa.lib.conf.ProductDerivationbeforeConfigurationClose, beforeConfigurationConstruct
 
- 
 
- 
- 
- 
Field Detail- 
SPEC_JPApublic static final Specification SPEC_JPA 
 - 
ALIAS_EJBpublic static final Specification ALIAS_EJB 
 - 
RSRC_GLOBALpublic static final java.lang.String RSRC_GLOBAL - See Also:
- Constant Field Values
 
 - 
RSRC_DEFAULTpublic static final java.lang.String RSRC_DEFAULT - See Also:
- Constant Field Values
 
 - 
VERSION_1_0public static final java.math.BigDecimal VERSION_1_0 
 - 
PREFIXpublic static final java.lang.String PREFIX - See Also:
- Constant Field Values
 
 - 
_providerImplNameprotected java.lang.String _providerImplName 
 
- 
 - 
Method Detail- 
putBrokerFactoryAliasespublic void putBrokerFactoryAliases(java.util.Map<java.lang.String,java.lang.String> m) 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 interface- OpenJPAProductDerivation
 
 - 
getTypepublic int getType() Description copied from interface:ProductDerivationReturn the type of derivation.- Specified by:
- getTypein interface- ProductDerivation
 
 - 
getConfigurationPrefixpublic java.lang.String getConfigurationPrefix() Description copied from interface:ProductDerivationReturn the configuration prefix for properties of this product.- Specified by:
- getConfigurationPrefixin interface- ProductDerivation
- Overrides:
- getConfigurationPrefixin class- AbstractProductDerivation
 
 - 
getSupportedQueryHintspublic java.util.Set<java.lang.String> getSupportedQueryHints() Description copied from interface:ProductDerivationReturn set of Query hint keys recognized by this receiver.- Specified by:
- getSupportedQueryHintsin interface- ProductDerivation
- Overrides:
- getSupportedQueryHintsin class- AbstractProductDerivation
 
 - 
validatepublic void validate() throws java.lang.ExceptionDescription 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 interface- ProductDerivation
- Overrides:
- validatein class- AbstractProductDerivation
- Throws:
- java.lang.Exception
 
 - 
beforeConfigurationLoadpublic boolean beforeConfigurationLoad(Configuration c) Description copied from interface:ProductDerivationProvides the instance with the opportunity to mutateconfbefore the user configuration is applied.- Specified by:
- beforeConfigurationLoadin interface- ProductDerivation
- Overrides:
- beforeConfigurationLoadin class- AbstractProductDerivation
- Returns:
- true if given Configuration has been mutated.
 
 - 
afterSpecificationSetpublic boolean afterSpecificationSet(Configuration c) Description copied from interface:ProductDerivationCalled after the specification has been set.- Specified by:
- afterSpecificationSetin interface- ProductDerivation
- Overrides:
- afterSpecificationSetin class- AbstractProductDerivation
- Returns:
- true if given Configuration has been mutated.
 
 - 
loadpublic ConfigurationProvider load(jakarta.persistence.spi.PersistenceUnitInfo pinfo, java.util.Map m) throws java.io.IOException Load configuration from the given persistence unit with the specified user properties.- Throws:
- java.io.IOException
 
 - 
loadpublic ConfigurationProvider load(java.lang.String rsrc, java.lang.String name, java.util.Map m) throws java.io.IOException Load configuration from the given resource and unit names, which may be null.- Throws:
- java.io.IOException
 
 - 
loadpublic ConfigurationProvider load(java.lang.String rsrc, java.lang.String anchor, java.lang.ClassLoader loader) throws java.io.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 interface- ProductDerivation
- Overrides:
- loadin class- AbstractProductDerivation
- anchor- optional named anchor within a multiple-configuration resource
- Throws:
- java.io.IOException
 
 - 
loadpublic ConfigurationProvider load(java.io.File file, java.lang.String anchor) throws java.io.IOException Description copied from interface:ProductDerivationLoad given file, or return null if it is not a file this receiver understands.- Specified by:
- loadin interface- ProductDerivation
- Overrides:
- loadin class- AbstractProductDerivation
- anchor- optional named anchor within a multiple-configuration file
- Throws:
- java.io.IOException
 
 - 
getDefaultResourceLocationpublic java.lang.String 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 interface- ProductDerivation
- Overrides:
- getDefaultResourceLocationin class- AbstractProductDerivation
 
 - 
getAnchorsInFilepublic java.util.List<java.lang.String> getAnchorsInFile(java.io.File file) throws java.io.IOExceptionDescription 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 interface- ProductDerivation
- Overrides:
- getAnchorsInFilein class- AbstractProductDerivation
- Throws:
- java.io.IOException
 
 - 
getAnchorsInResourcepublic java.util.List getAnchorsInResource(java.lang.String resource) throws java.lang.ExceptionDescription 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 interface- ProductDerivation
- Overrides:
- getAnchorsInResourcein class- AbstractProductDerivation
- Throws:
- java.lang.Exception
 
 - 
loadGlobalspublic ConfigurationProvider loadGlobals(java.lang.ClassLoader loader) throws java.io.IOException Description copied from interface:ProductDerivationLoad globals into the returned ConfigurationProvider, or return null if no globals are found.- Specified by:
- loadGlobalsin interface- ProductDerivation
- Overrides:
- loadGlobalsin class- AbstractProductDerivation
- Throws:
- java.io.IOException
 
 - 
loadDefaultspublic ConfigurationProvider loadDefaults(java.lang.ClassLoader loader) throws java.io.IOException Description copied from interface:ProductDerivationLoad defaults into the returned ConfigurationProvider, or return null if no defaults are found.- Specified by:
- loadDefaultsin interface- ProductDerivation
- Overrides:
- loadDefaultsin class- AbstractProductDerivation
- Throws:
- java.io.IOException
 
 - 
checkPuNameCollisionspublic boolean checkPuNameCollisions(Log logger, java.lang.String puName) 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.
 
- 
 
-