Package org.apache.openjpa.lib.conf
Class AbstractProductDerivation
- java.lang.Object
-
- org.apache.openjpa.lib.conf.AbstractProductDerivation
-
- All Implemented Interfaces:
ProductDerivation
- Direct Known Subclasses:
JDBCPersistenceProductDerivation
,JDBCProductDerivation
,PersistenceProductDerivation
,ProductDerivation
public abstract class AbstractProductDerivation extends java.lang.Object implements ProductDerivation
Abstract no-op product derivation for easy extension.- Since:
- 0.4.1
- Author:
- Pinaki Poddar
-
-
Field Summary
-
Fields inherited from interface org.apache.openjpa.lib.conf.ProductDerivation
TYPE_FEATURE, TYPE_PRODUCT
-
-
Constructor Summary
Constructors Constructor Description AbstractProductDerivation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
afterSpecificationSet(Configuration conf)
Called after the specification has been set.void
beforeConfigurationClose(Configuration conf)
Called before the given Configuration is closed.boolean
beforeConfigurationConstruct(ConfigurationProvider cp)
Provides the instance with a callback to mutate the initial properties of theConfigurationProvider
.boolean
beforeConfigurationLoad(Configuration conf)
Provides the instance with the opportunity to mutateconf
before the user configuration is applied.java.util.List<java.lang.String>
getAnchorsInFile(java.io.File file)
Return a Listof all the anchors defined in file
.java.util.List<java.lang.String>
getAnchorsInResource(java.lang.String resource)
Return a Listof all the anchors defined in resource
.java.lang.String
getConfigurationPrefix()
Return the configuration prefix for properties of this product.java.lang.String
getDefaultResourceLocation()
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.ConfigurationProvider
load(java.io.File file, java.lang.String anchor)
Load given file, or return null if it is not a file this receiver understands.ConfigurationProvider
load(java.lang.String resource, 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.ConfigurationProvider
loadDefaults(java.lang.ClassLoader loader)
Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.ConfigurationProvider
loadGlobals(java.lang.ClassLoader loader)
Load globals into the returned ConfigurationProvider, or return null if no globals are found.void
validate()
Ensure that this derivation is valid.-
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.lib.conf.ProductDerivation
getType
-
-
-
-
Method Detail
-
getConfigurationPrefix
public java.lang.String getConfigurationPrefix()
Description copied from interface:ProductDerivation
Return the configuration prefix for properties of this product.- Specified by:
getConfigurationPrefix
in interfaceProductDerivation
-
validate
public void validate() throws java.lang.Exception
Description copied from interface:ProductDerivation
Ensure 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:
validate
in interfaceProductDerivation
- Throws:
java.lang.Exception
-
loadGlobals
public ConfigurationProvider loadGlobals(java.lang.ClassLoader loader) throws java.lang.Exception
Description copied from interface:ProductDerivation
Load globals into the returned ConfigurationProvider, or return null if no globals are found.- Specified by:
loadGlobals
in interfaceProductDerivation
- Throws:
java.lang.Exception
-
loadDefaults
public ConfigurationProvider loadDefaults(java.lang.ClassLoader loader) throws java.lang.Exception
Description copied from interface:ProductDerivation
Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.- Specified by:
loadDefaults
in interfaceProductDerivation
- Throws:
java.lang.Exception
-
load
public ConfigurationProvider load(java.lang.String resource, java.lang.String anchor, java.lang.ClassLoader loader) throws java.lang.Exception
Description copied from interface:ProductDerivation
Load 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:
load
in interfaceProductDerivation
anchor
- optional named anchor within a multiple-configuration resource- Throws:
java.lang.Exception
-
load
public ConfigurationProvider load(java.io.File file, java.lang.String anchor) throws java.lang.Exception
Description copied from interface:ProductDerivation
Load given file, or return null if it is not a file this receiver understands.- Specified by:
load
in interfaceProductDerivation
anchor
- optional named anchor within a multiple-configuration file- Throws:
java.lang.Exception
-
getDefaultResourceLocation
public java.lang.String getDefaultResourceLocation()
Description copied from interface:ProductDerivation
Return a string identifying the default resource location for this product derivation, if one exists. If there is no default location, returnsnull
.- Specified by:
getDefaultResourceLocation
in interfaceProductDerivation
-
getAnchorsInFile
public java.util.List<java.lang.String> getAnchorsInFile(java.io.File file) throws java.lang.Exception
Description copied from interface:ProductDerivation
Return a Listof all the anchors defined in file
. The returned names are not fully-qualified, so must be used in conjunction withfile
in calls toProductDerivation.load(java.io.File, String)
. Returnsnull
or an empty list if no anchors could be found.- Specified by:
getAnchorsInFile
in interfaceProductDerivation
- Throws:
java.lang.Exception
-
getAnchorsInResource
public java.util.List<java.lang.String> getAnchorsInResource(java.lang.String resource) throws java.lang.Exception
Description copied from interface:ProductDerivation
Return a Listof all the anchors defined in resource
. The returned names are not fully-qualified, so must be used in conjunction withresource
in calls toProductDerivation.load(java.io.File, String)
. Returnsnull
or an empty list if no anchors could be found.- Specified by:
getAnchorsInResource
in interfaceProductDerivation
- Throws:
java.lang.Exception
-
beforeConfigurationConstruct
public boolean beforeConfigurationConstruct(ConfigurationProvider cp)
Description copied from interface:ProductDerivation
Provides the instance with a callback to mutate the initial properties of theConfigurationProvider
. This is primarily to alter or add properties that determine what type of configuration is constructed, and therefore is typically used at runtime only.- Specified by:
beforeConfigurationConstruct
in interfaceProductDerivation
- Returns:
- true if given ConfigurationProvider has been mutated.
-
beforeConfigurationLoad
public boolean beforeConfigurationLoad(Configuration conf)
Description copied from interface:ProductDerivation
Provides the instance with the opportunity to mutateconf
before the user configuration is applied.- Specified by:
beforeConfigurationLoad
in interfaceProductDerivation
- Returns:
- true if given Configuration has been mutated.
-
afterSpecificationSet
public boolean afterSpecificationSet(Configuration conf)
Description copied from interface:ProductDerivation
Called after the specification has been set.- Specified by:
afterSpecificationSet
in interfaceProductDerivation
- Returns:
- true if given Configuration has been mutated.
-
beforeConfigurationClose
public void beforeConfigurationClose(Configuration conf)
Description copied from interface:ProductDerivation
Called before the given Configuration is closed.- Specified by:
beforeConfigurationClose
in interfaceProductDerivation
-
getSupportedQueryHints
public java.util.Set<java.lang.String> getSupportedQueryHints()
Description copied from interface:ProductDerivation
Return set of Query hint keys recognized by this receiver.- Specified by:
getSupportedQueryHints
in interfaceProductDerivation
-
-