org.apache.openjpa.persistence
Class PersistenceProductDerivation

java.lang.Object
  extended by org.apache.openjpa.lib.conf.AbstractProductDerivation
      extended by org.apache.openjpa.persistence.PersistenceProductDerivation
All Implemented Interfaces:
org.apache.openjpa.conf.OpenJPAProductDerivation, org.apache.openjpa.lib.conf.ProductDerivation

public class PersistenceProductDerivation
extends org.apache.openjpa.lib.conf.AbstractProductDerivation
implements org.apache.openjpa.conf.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
static java.lang.String ALIAS_EJB
           
static java.lang.String RSRC_DEFAULT
           
static java.lang.String RSRC_GLOBAL
           
static java.lang.String SPEC_JPA
           
 
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(org.apache.openjpa.lib.conf.Configuration c)
           
 boolean beforeConfigurationLoad(org.apache.openjpa.lib.conf.Configuration c)
           
 int getType()
           
 org.apache.openjpa.lib.conf.ConfigurationProvider load(java.io.File file, java.lang.String anchor)
           
 org.apache.openjpa.lib.conf.ConfigurationProvider load(javax.persistence.spi.PersistenceUnitInfo pinfo, java.util.Map m)
          Load configuration from the given persistence unit with the specified user properties.
 org.apache.openjpa.lib.conf.ConfigurationProvider load(java.lang.String rsrc, java.lang.String anchor, java.lang.ClassLoader loader)
           
 org.apache.openjpa.lib.conf.ConfigurationProvider load(java.lang.String rsrc, java.lang.String name, java.util.Map m)
          Load configuration from the given resource and unit names, which may be null.
 org.apache.openjpa.lib.conf.ConfigurationProvider loadDefaults(java.lang.ClassLoader loader)
           
 org.apache.openjpa.lib.conf.ConfigurationProvider loadGlobals(java.lang.ClassLoader loader)
           
 void putBrokerFactoryAliases(java.util.Map m)
           
 void validate()
           
 
Methods inherited from class org.apache.openjpa.lib.conf.AbstractProductDerivation
beforeConfigurationClose, beforeConfigurationConstruct, getConfigurationPrefix
 
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, getConfigurationPrefix
 

Field Detail

SPEC_JPA

public static final java.lang.String SPEC_JPA
See Also:
Constant Field Values

ALIAS_EJB

public static final java.lang.String ALIAS_EJB
See Also:
Constant Field Values

RSRC_GLOBAL

public static final java.lang.String RSRC_GLOBAL
See Also:
Constant Field Values

RSRC_DEFAULT

public static final java.lang.String RSRC_DEFAULT
See Also:
Constant Field Values
Constructor Detail

PersistenceProductDerivation

public PersistenceProductDerivation()
Method Detail

putBrokerFactoryAliases

public void putBrokerFactoryAliases(java.util.Map m)
Specified by:
putBrokerFactoryAliases in interface org.apache.openjpa.conf.OpenJPAProductDerivation

getType

public int getType()
Specified by:
getType in interface org.apache.openjpa.lib.conf.ProductDerivation

validate

public void validate()
              throws java.lang.Exception
Specified by:
validate in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
validate in class org.apache.openjpa.lib.conf.AbstractProductDerivation
Throws:
java.lang.Exception

beforeConfigurationLoad

public boolean beforeConfigurationLoad(org.apache.openjpa.lib.conf.Configuration c)
Specified by:
beforeConfigurationLoad in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
beforeConfigurationLoad in class org.apache.openjpa.lib.conf.AbstractProductDerivation

afterSpecificationSet

public boolean afterSpecificationSet(org.apache.openjpa.lib.conf.Configuration c)
Specified by:
afterSpecificationSet in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
afterSpecificationSet in class org.apache.openjpa.lib.conf.AbstractProductDerivation

load

public org.apache.openjpa.lib.conf.ConfigurationProvider load(javax.persistence.spi.PersistenceUnitInfo pinfo,
                                                              java.util.Map m)
                                                       throws java.io.IOException
Load configuration from the given persistence unit with the specified user properties.

Throws:
java.io.IOException

load

public org.apache.openjpa.lib.conf.ConfigurationProvider load(java.lang.String rsrc,
                                                              java.lang.String name,
                                                              java.util.Map m)
                                                       throws java.io.IOException
Load configuration from the given resource and unit names, which may be null.

Throws:
java.io.IOException

load

public org.apache.openjpa.lib.conf.ConfigurationProvider load(java.lang.String rsrc,
                                                              java.lang.String anchor,
                                                              java.lang.ClassLoader loader)
                                                       throws java.io.IOException
Specified by:
load in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
load in class org.apache.openjpa.lib.conf.AbstractProductDerivation
Throws:
java.io.IOException

load

public org.apache.openjpa.lib.conf.ConfigurationProvider load(java.io.File file,
                                                              java.lang.String anchor)
                                                       throws java.io.IOException
Specified by:
load in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
load in class org.apache.openjpa.lib.conf.AbstractProductDerivation
Throws:
java.io.IOException

loadGlobals

public org.apache.openjpa.lib.conf.ConfigurationProvider loadGlobals(java.lang.ClassLoader loader)
                                                              throws java.io.IOException
Specified by:
loadGlobals in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
loadGlobals in class org.apache.openjpa.lib.conf.AbstractProductDerivation
Throws:
java.io.IOException

loadDefaults

public org.apache.openjpa.lib.conf.ConfigurationProvider loadDefaults(java.lang.ClassLoader loader)
                                                               throws java.io.IOException
Specified by:
loadDefaults in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
loadDefaults in class org.apache.openjpa.lib.conf.AbstractProductDerivation
Throws:
java.io.IOException