org.apache.openjpa.lib.conf
Interface ProductDerivation

All Known Subinterfaces:
OpenJPAProductDerivation
All Known Implementing Classes:
AbstractProductDerivation, JDBCPersistenceProductDerivation, JDBCProductDerivation, PersistenceProductDerivation

public interface ProductDerivation

Hooks 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 a Configuration both 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
static int TYPE_FEATURE
           
static int TYPE_PRODUCT
           
 
Method Summary
 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 the ConfigurationProvider.
 boolean beforeConfigurationLoad(Configuration conf)
          Provides the instance with the opportunity to mutate conf before the user configuration is applied.
 String getConfigurationPrefix()
          Return the configuration prefix for properties of this product.
 int getType()
          Return the type of derivation.
 ConfigurationProvider load(File file, String anchor)
          Load given file, or return null if it is not a file this receiver understands.
 ConfigurationProvider load(String resource, 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.
 ConfigurationProvider loadDefaults(ClassLoader loader)
          Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.
 ConfigurationProvider loadGlobals(ClassLoader loader)
          Load globals into the returned ConfigurationProvider, or return null if no globals are found.
 void validate()
          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

String getConfigurationPrefix()
Return the configuration prefix for properties of this product.


validate

void validate()
              throws Exception
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.

Throws:
Exception

loadGlobals

ConfigurationProvider loadGlobals(ClassLoader loader)
                                  throws Exception
Load globals into the returned ConfigurationProvider, or return null if no globals are found.

Throws:
Exception

loadDefaults

ConfigurationProvider loadDefaults(ClassLoader loader)
                                   throws Exception
Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.

Throws:
Exception

load

ConfigurationProvider load(String resource,
                           String anchor,
                           ClassLoader loader)
                           throws 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:
Exception

load

ConfigurationProvider load(File file,
                           String anchor)
                           throws 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:
Exception

beforeConfigurationConstruct

boolean beforeConfigurationConstruct(ConfigurationProvider cp)
Provides the instance with a callback to mutate the initial properties of the ConfigurationProvider. 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 mutate conf before 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


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.