org.apache.aries.jpa.container
Interface ManagedPersistenceUnitInfoFactory


public interface ManagedPersistenceUnitInfoFactory

A Factory for ManagedPersistenceUnitInfo objects. This interface marks a plug-point for implementations that wish to extend the Aries JPA Container by providing customized PersistenceUnitInfo objects. Customized implementations can be provided in two ways:

Note that properties provided through the properties file will override properties supplied through the blueprint container. The property key to use is "org.apache.aries.jpa.container.ManagedPersistenceUnitInfoFactory" and is accessible using the DEFAULT_PU_INFO_FACTORY_KEY field. The value associated with this key should be the class name of the ManagedPersistenceUnitInfoFactory implementation that should be used. The provided class name must be loadable by this bundle. Implementations of this interface must have a no-args constructor and be safe for use by multiple concurrent threads. No locks will be held by the JPA container or framework when calling methods on this interface.


Field Summary
static String ARIES_JPA_CONTAINER_PROPERTIES
          The name of the config properties file that can be used to configure the Aries JPA Container
static String DEFAULT_PU_INFO_FACTORY_KEY
          The config property key that should be used to provide a customized ManagedPersistenceUnitInfoFactory to the Aries JPA Container
 
Method Summary
 Collection<ManagedPersistenceUnitInfo> createManagedPersistenceUnitMetadata(BundleContext containerContext, Bundle persistenceBundle, ServiceReference providerReference, Collection<ParsedPersistenceUnit> persistenceMetadata)
          This method will be called by the Aries JPA container when persistence descriptors have been located in a persistence bundle.
 void destroyPersistenceBundle(BundleContext containerContext, Bundle persistenceBundle)
          This method will be called when the persistence bundle is no longer being managed.
 String getDefaultProviderClassName()
          If no persistence units in a persistence bundle specify a JPA PersistenceProvider implementation class, then the JPA container will call this method to obtain a default provider to use.
 

Field Detail

DEFAULT_PU_INFO_FACTORY_KEY

static final String DEFAULT_PU_INFO_FACTORY_KEY
The config property key that should be used to provide a customized ManagedPersistenceUnitInfoFactory to the Aries JPA Container

See Also:
Constant Field Values

ARIES_JPA_CONTAINER_PROPERTIES

static final String ARIES_JPA_CONTAINER_PROPERTIES
The name of the config properties file that can be used to configure the Aries JPA Container

See Also:
Constant Field Values
Method Detail

createManagedPersistenceUnitMetadata

Collection<ManagedPersistenceUnitInfo> createManagedPersistenceUnitMetadata(BundleContext containerContext,
                                                                            Bundle persistenceBundle,
                                                                            ServiceReference providerReference,
                                                                            Collection<ParsedPersistenceUnit> persistenceMetadata)
This method will be called by the Aries JPA container when persistence descriptors have been located in a persistence bundle.

Parameters:
containerContext - The BundleContext for the container bundle. This can be used to get services from the service registry when creating PersistenceUnitInfo objects.
persistenceBundle - The Bundle defining the persistence units. This bundle may be in any state, and so may not have a usable BundleContext or be able to load classes.
providerReference - A ServiceReference for the PersistenceProvider service that will be used to create EntityManagerFactory objects from these persistence units.
persistenceMetadata - A Collection of ParsedPersistenceUnit objects containing the metadata from the persistence descriptor.
Returns:
A Collection of ManagedPersistenceUnitInfo objects that can be used to create EntityManagerFactory instances

getDefaultProviderClassName

String getDefaultProviderClassName()
If no persistence units in a persistence bundle specify a JPA PersistenceProvider implementation class, then the JPA container will call this method to obtain a default provider to use.

Returns:
A PersistenceProvider implementation class name, or null if no default is specified.

destroyPersistenceBundle

void destroyPersistenceBundle(BundleContext containerContext,
                              Bundle persistenceBundle)
This method will be called when the persistence bundle is no longer being managed. This may be because the bundle is being updated, or because the PersistenceProvider being used is no longer available. When this method is called implementations should clear up any resources associated with persistence units defined by the persistence bundle.

Parameters:
containerContext - The BundleContext for the container bundle.
persistenceBundle - The persistence bundle that is no longer valid.


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.