Package org.apache.openjpa.lib.conf
Interface ProductDerivation
-
- All Known Subinterfaces:
OpenJPAProductDerivation
- All Known Implementing Classes:
AbstractProductDerivation,JDBCPersistenceProductDerivation,JDBCProductDerivation,PersistenceProductDerivation,ProductDerivation
public interface ProductDerivationHooks for deriving products with additional functionality. Parses configuration information from global, default or explictly-specified resources. All implementations of this interface will have a chance to mutate aConfigurationboth before and after the user-specified configuration data is loaded. The order in which the product derivations are evaluated is determined by the specificity of the derivation type.- Since:
- 0.4.1
- Author:
- Abe White, Pinaki Poddar
-
-
Field Summary
Fields Modifier and Type Field Description static intTYPE_FEATUREstatic intTYPE_PRODUCT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanafterSpecificationSet(Configuration conf)Called after the specification has been set.voidbeforeConfigurationClose(Configuration conf)Called before the given Configuration is closed.booleanbeforeConfigurationConstruct(ConfigurationProvider cp)Provides the instance with a callback to mutate the initial properties of theConfigurationProvider.booleanbeforeConfigurationLoad(Configuration conf)Provides the instance with the opportunity to mutateconfbefore 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.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(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 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.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.voidvalidate()Ensure that this derivation is valid.
-
-
-
Field Detail
-
TYPE_PRODUCT
static final int TYPE_PRODUCT
- See Also:
- Constant Field Values
-
TYPE_FEATURE
static final int TYPE_FEATURE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
int getType()
Return the type of derivation.
-
getConfigurationPrefix
java.lang.String getConfigurationPrefix()
Return the configuration prefix for properties of this product.
-
validate
void validate() throws java.lang.ExceptionEnsure 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.- Throws:
java.lang.Exception
-
loadGlobals
ConfigurationProvider loadGlobals(java.lang.ClassLoader loader) throws java.lang.Exception
Load globals into the returned ConfigurationProvider, or return null if no globals are found.- Throws:
java.lang.Exception
-
loadDefaults
ConfigurationProvider loadDefaults(java.lang.ClassLoader loader) throws java.lang.Exception
Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.- Throws:
java.lang.Exception
-
load
ConfigurationProvider load(java.lang.String resource, java.lang.String anchor, java.lang.ClassLoader loader) throws java.lang.Exception
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.- Parameters:
anchor- optional named anchor within a multiple-configuration resource- Throws:
java.lang.Exception
-
load
ConfigurationProvider load(java.io.File file, java.lang.String anchor) throws java.lang.Exception
Load given file, or return null if it is not a file this receiver understands.- Parameters:
anchor- optional named anchor within a multiple-configuration file- Throws:
java.lang.Exception
-
getDefaultResourceLocation
java.lang.String getDefaultResourceLocation()
Return a string identifying the default resource location for this product derivation, if one exists. If there is no default location, returnsnull.- Since:
- 1.1.0
-
getAnchorsInFile
java.util.List<java.lang.String> getAnchorsInFile(java.io.File file) throws java.io.IOException, java.lang.ExceptionReturn a Listof all the anchors defined in file. The returned names are not fully-qualified, so must be used in conjunction withfilein calls toload(java.io.File, String). Returnsnullor an empty list if no anchors could be found.- Throws:
java.io.IOExceptionjava.lang.Exception- Since:
- 1.1.0
-
getAnchorsInResource
java.util.List<java.lang.String> getAnchorsInResource(java.lang.String resource) throws java.lang.ExceptionReturn a Listof all the anchors defined in resource. The returned names are not fully-qualified, so must be used in conjunction withresourcein calls toload(java.io.File, String). Returnsnullor an empty list if no anchors could be found.- Throws:
java.lang.Exception- Since:
- 1.1.0
-
beforeConfigurationConstruct
boolean beforeConfigurationConstruct(ConfigurationProvider cp)
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.- Returns:
- true if given ConfigurationProvider has been mutated.
-
beforeConfigurationLoad
boolean beforeConfigurationLoad(Configuration conf)
Provides the instance with the opportunity to mutateconfbefore the user configuration is applied.- Returns:
- true if given Configuration has been mutated.
-
afterSpecificationSet
boolean afterSpecificationSet(Configuration conf)
Called after the specification has been set.- Returns:
- true if given Configuration has been mutated.
-
beforeConfigurationClose
void beforeConfigurationClose(Configuration conf)
Called before the given Configuration is closed.- Since:
- 0.9.7
-
getSupportedQueryHints
java.util.Set<java.lang.String> getSupportedQueryHints()
Return set of Query hint keys recognized by this receiver.- Since:
- 2.0.0
-
-