org.apache.openjpa.lib.conf
Class AbstractProductDerivation

java.lang.Object
  extended by org.apache.openjpa.lib.conf.AbstractProductDerivation
All Implemented Interfaces:
ProductDerivation
Direct Known Subclasses:
JDBCPersistenceProductDerivation, JDBCProductDerivation, PersistenceProductDerivation, ProductDerivation

public abstract class AbstractProductDerivation
extends 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
AbstractProductDerivation()
           
 
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.
 List<String> getAnchorsInFile(File file)
          Return a List of all the anchors defined in file.
 List<String> getAnchorsInResource(String resource)
          Return a List of all the anchors defined in resource.
 String getConfigurationPrefix()
          Return the configuration prefix for properties of this product.
 String getDefaultResourceLocation()
          Return a string identifying the default resource location for this product derivation, if one exists.
 Set<String> getSupportedQueryHints()
          Return set of Query hint keys recognized by this receiver.
 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.
 
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
 

Constructor Detail

AbstractProductDerivation

public AbstractProductDerivation()
Method Detail

getConfigurationPrefix

public String getConfigurationPrefix()
Description copied from interface: ProductDerivation
Return the configuration prefix for properties of this product.

Specified by:
getConfigurationPrefix in interface ProductDerivation

validate

public void validate()
              throws 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 interface ProductDerivation
Throws:
Exception

loadGlobals

public ConfigurationProvider loadGlobals(ClassLoader loader)
                                  throws Exception
Description copied from interface: ProductDerivation
Load globals into the returned ConfigurationProvider, or return null if no globals are found.

Specified by:
loadGlobals in interface ProductDerivation
Throws:
Exception

loadDefaults

public ConfigurationProvider loadDefaults(ClassLoader loader)
                                   throws Exception
Description copied from interface: ProductDerivation
Load defaults into the returned ConfigurationProvider, or return null if no defaults are found.

Specified by:
loadDefaults in interface ProductDerivation
Throws:
Exception

load

public ConfigurationProvider load(String resource,
                                  String anchor,
                                  ClassLoader loader)
                           throws 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 interface ProductDerivation
anchor - optional named anchor within a multiple-configuration resource
Throws:
Exception

load

public ConfigurationProvider load(File file,
                                  String anchor)
                           throws 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 interface ProductDerivation
anchor - optional named anchor within a multiple-configuration file
Throws:
Exception

getDefaultResourceLocation

public 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, returns null.

Specified by:
getDefaultResourceLocation in interface ProductDerivation

getAnchorsInFile

public List<String> getAnchorsInFile(File file)
                              throws Exception
Description copied from interface: ProductDerivation
Return a List of all the anchors defined in file. The returned names are not fully-qualified, so must be used in conjunction with file in calls to ProductDerivation.load(java.io.File, String). Returns null or an empty list if no anchors could be found.

Specified by:
getAnchorsInFile in interface ProductDerivation
Throws:
Exception

getAnchorsInResource

public List<String> getAnchorsInResource(String resource)
                                  throws Exception
Description copied from interface: ProductDerivation
Return a List of all the anchors defined in resource. The returned names are not fully-qualified, so must be used in conjunction with resource in calls to ProductDerivation.load(java.io.File, String). Returns null or an empty list if no anchors could be found.

Specified by:
getAnchorsInResource in interface ProductDerivation
Throws:
Exception

beforeConfigurationConstruct

public boolean beforeConfigurationConstruct(ConfigurationProvider cp)
Description copied from interface: ProductDerivation
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.

Specified by:
beforeConfigurationConstruct in interface ProductDerivation
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 mutate conf before the user configuration is applied.

Specified by:
beforeConfigurationLoad in interface ProductDerivation
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 interface ProductDerivation
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 interface ProductDerivation

getSupportedQueryHints

public Set<String> getSupportedQueryHints()
Description copied from interface: ProductDerivation
Return set of Query hint keys recognized by this receiver.

Specified by:
getSupportedQueryHints in interface ProductDerivation


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