org.eclipse.persistence.jpa.osgi
Class PersistenceProvider

java.lang.Object
  extended by org.eclipse.persistence.jpa.PersistenceProvider
      extended by org.eclipse.persistence.jpa.osgi.PersistenceProvider
All Implemented Interfaces:
javax.persistence.spi.PersistenceProvider, javax.persistence.spi.ProviderUtil

public class PersistenceProvider
extends PersistenceProvider

EclipseLink JPA provider for use in OSGI Environments


Field Summary
static java.lang.String EQUINOX_INITIALIZER_NAME
           
 
Constructor Summary
PersistenceProvider()
           
PersistenceProvider(java.lang.String initializerClassName)
           
 
Method Summary
static void addBundle(org.osgi.framework.Bundle bundle, java.lang.String[] persistenceUnitNames)
          Add a bundle to the list of bundles managed by this persistence provider The bundle is indexed so it's classloader can be accessed
 javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo info, java.util.Map map)
          Called by the container when an EntityManagerFactory is to be created.
 java.lang.ClassLoader getClassLoader(java.lang.String persistenceUnitName, java.util.Map properties)
          Answer the ClassLoader to use to create an EntityManager.
 org.eclipse.persistence.internal.jpa.deployment.JPAInitializer getInitializer(java.lang.String emName, java.util.Map m)
          Get the initializer class Here we will attempt to build an EquinoxInitializer.
static boolean includesBundle(org.osgi.framework.Bundle bundle)
           
static void removeBundle(org.osgi.framework.Bundle bundle)
          Removed a bundle from the list of bundles managed by this persistence provider This typically happens on deactivation.
 
Methods inherited from class org.eclipse.persistence.jpa.PersistenceProvider
createEntityManagerFactory, getProviderUtil, isLoaded, isLoadedWithoutReference, isLoadedWithReference
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUINOX_INITIALIZER_NAME

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

PersistenceProvider

public PersistenceProvider()

PersistenceProvider

public PersistenceProvider(java.lang.String initializerClassName)
Method Detail

createContainerEntityManagerFactory

public javax.persistence.EntityManagerFactory createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo info,
                                                                                  java.util.Map map)
Description copied from class: PersistenceProvider
Called by the container when an EntityManagerFactory is to be created.

Specified by:
createContainerEntityManagerFactory in interface javax.persistence.spi.PersistenceProvider
Overrides:
createContainerEntityManagerFactory in class PersistenceProvider
Parameters:
info - Metadata for use by the persistence provider
Returns:
EntityManagerFactory for the persistence unit specified by the metadata

getInitializer

public org.eclipse.persistence.internal.jpa.deployment.JPAInitializer getInitializer(java.lang.String emName,
                                                                                     java.util.Map m)
Get the initializer class Here we will attempt to build an EquinoxInitializer. It will only be available if the org.eclipse.persistence.jpa.equinox fragment is available. Else, we will return a standard OSGi initializer.

Overrides:
getInitializer in class PersistenceProvider
Returns:

addBundle

public static void addBundle(org.osgi.framework.Bundle bundle,
                             java.lang.String[] persistenceUnitNames)
Add a bundle to the list of bundles managed by this persistence provider The bundle is indexed so it's classloader can be accessed

Parameters:
bundle -
persistenceUnitNames -

removeBundle

public static void removeBundle(org.osgi.framework.Bundle bundle)
Removed a bundle from the list of bundles managed by this persistence provider This typically happens on deactivation.

Parameters:
bundle -

getClassLoader

public java.lang.ClassLoader getClassLoader(java.lang.String persistenceUnitName,
                                            java.util.Map properties)
Answer the ClassLoader to use to create an EntityManager. The result is a CompositeClassLoader capable of loading classes from the optionally provided ClassLoader, the bundle that provides the persistence unit (i.e., contains the persistence.xml, and EclipseLink classes (since the persistence unit bundle may not have an explicit dependency on EclipseLink).

Overrides:
getClassLoader in class PersistenceProvider
Parameters:
persistenceUnitName -
properties -
Returns:
ClassLoader

includesBundle

public static boolean includesBundle(org.osgi.framework.Bundle bundle)


EclipseLink 2.2.1, "build v20110722-r9776" API Reference