Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 in `openjpa.properties` system property for the location of a file to parse. If no system property is defined, the default resource location of `META-INF/openjpa.xml` is used. For defaults, looks for `META-INF/persistence.xml`. Within `persistence.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 Summary
`static class` | `PersistenceProductDerivation.ConfigurationParser` SAX handler capable of parsing an JPA persistence.xml file.
`static class` | `PersistenceProductDerivation.ConfigurationProviderImpl` Custom configuration provider.

Field Summary
`protected String` | `_providerImplName`
`static Specification` | `ALIAS_EJB`
`static String` | `PREFIX`
`static String` | `RSRC_DEFAULT`
`static String` | `RSRC_GLOBAL`
`static Specification` | `SPEC_JPA`
`static BigDecimal` | `VERSION_1_0`

Fields inherited from interface org.apache.openjpa.conf.OpenJPAProductDerivation
`TYPE_PRODUCT_STORE, TYPE_SPEC, TYPE_SPEC_STORE, TYPE_STORE`

Fields inherited from interface org.apache.openjpa.lib.conf.ProductDerivation
`TYPE_FEATURE, TYPE_PRODUCT`

Constructor Summary
`PersistenceProductDerivation()`

Method Summary
`boolean` | `afterSpecificationSet(Configuration c)` Called after the specification has been set.
`boolean` | `beforeConfigurationLoad(Configuration c)` Provides the instance with the opportunity to mutate `conf` before the user configuration is applied.
`boolean` | `checkPuNameCollisions(Log logger, String puName)` This method checks to see if the provided `puName` was detected in multiple resources.
`List<String>` | `getAnchorsInFile(File file)` Return a List of all the anchors defined in `file`.
`List` | `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.
`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(PersistenceUnitInfo pinfo, Map m)` Load configuration from the given persistence unit with the specified user properties.
`ConfigurationProvider` | `load(String rsrc, 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` | `load(String rsrc, String name, Map m)` Load configuration from the given resource and unit names, which may be null.
`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` | `putBrokerFactoryAliases(Map<String,String> m)` Load default alias options into the given map.
`void` | `validate()` Ensure that this derivation is valid.

Methods inherited from class org.apache.openjpa.lib.conf.AbstractProductDerivation
`beforeConfigurationClose, beforeConfigurationConstruct`

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
`beforeConfigurationClose, beforeConfigurationConstruct`

Field Detail

### SPEC_JPA

    public static final Specification SPEC_JPA

### ALIAS_EJB

    public static final Specification ALIAS_EJB

### RSRC_GLOBAL

    public static final String RSRC_GLOBAL

See Also:
  Constant Field Values

### RSRC_DEFAULT

    public static final String RSRC_DEFAULT

See Also:
  Constant Field Values

### VERSION_1_0

    public static final BigDecimal VERSION_1_0

### PREFIX

    public static final String PREFIX

See Also:
  Constant Field Values

### _providerImplName

    protected String _providerImplName

Constructor Detail

### PersistenceProductDerivation

    public PersistenceProductDerivation()

Method Detail

### putBrokerFactoryAliases

    public void putBrokerFactoryAliases(Map<String,String> m)

  Description copied from interface: `OpenJPAProductDerivation`
  Load 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:
    `putBrokerFactoryAliases` in interface `OpenJPAProductDerivation`

### getType

    public int getType()

  Description copied from interface: `ProductDerivation`
  Return the type of derivation.

  Specified by:
    `getType` in interface `ProductDerivation`

### getConfigurationPrefix

    public String getConfigurationPrefix()

  Description copied from interface: `ProductDerivation`
  Return the configuration prefix for properties of this product.

  Specified by:
    `getConfigurationPrefix` in interface `ProductDerivation`
  Overrides:
    `getConfigurationPrefix` in class `AbstractProductDerivation`

### 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`
  Overrides:
    `getSupportedQueryHints` in class `AbstractProductDerivation`

### 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`
  Overrides:
    `validate` in class `AbstractProductDerivation`
  Throws:
    `Exception`

### beforeConfigurationLoad

    public boolean beforeConfigurationLoad(Configuration c)

  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`
  Overrides:
    `beforeConfigurationLoad` in class `AbstractProductDerivation`
  Returns:
    true if given Configuration has been mutated.

### afterSpecificationSet

    public boolean afterSpecificationSet(Configuration c)

  Description copied from interface: `ProductDerivation`
  Called after the specification has been set.

  Specified by:
    `afterSpecificationSet` in interface `ProductDerivation`
  Overrides:
    `afterSpecificationSet` in class `AbstractProductDerivation`
  Returns:
    true if given Configuration has been mutated.

### load

    public ConfigurationProvider load(PersistenceUnitInfo pinfo,
                                      Map m)
                               throws IOException

  Load configuration from the given persistence unit with the specified user properties.

  Throws:
    `IOException`

### load

    public ConfigurationProvider load(String rsrc,
                                      String name,
                                      Map m)
                               throws IOException

  Load configuration from the given resource and unit names, which may be null.

  Throws:
    `IOException`

### load

    public ConfigurationProvider load(String rsrc,
                                      String anchor,
                                      ClassLoader loader)
                               throws IOException

  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`
  Overrides:
    `load` in class `AbstractProductDerivation`
    `anchor` - optional named anchor within a multiple-configuration resource
  Throws:
    `IOException`

### load

    public ConfigurationProvider load(File file,
                                      String anchor)
                               throws IOException

  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`
  Overrides:
    `load` in class `AbstractProductDerivation`
    `anchor` - optional named anchor within a multiple-configuration file
  Throws:
    `IOException`

### 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`
  Overrides:
    `getDefaultResourceLocation` in class `AbstractProductDerivation`

### getAnchorsInFile

    public List<String> getAnchorsInFile(File file)
                                  throws IOException

  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`
  Overrides:
    `getAnchorsInFile` in class `AbstractProductDerivation`
  Throws:
    `IOException`

### getAnchorsInResource

    public List 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`
  Overrides:
    `getAnchorsInResource` in class `AbstractProductDerivation`
  Throws:
    `Exception`

### loadGlobals

    public ConfigurationProvider loadGlobals(ClassLoader loader)
                                      throws IOException

  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`
  Overrides:
    `loadGlobals` in class `AbstractProductDerivation`
  Throws:
    `IOException`

### loadDefaults

    public ConfigurationProvider loadDefaults(ClassLoader loader)
                                       throws IOException

  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`
  Overrides:
    `loadDefaults` in class `AbstractProductDerivation`
  Throws:
    `IOException`

### checkPuNameCollisions

    public boolean checkPuNameCollisions(Log logger,
                                         String puName)

  This method checks to see if the provided `puName` was detected in multiple resources. If a collision is detected, a warning will be logged and this method will return `true`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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