org.apache.aries.jpa.container.impl
Class EntityManagerFactoryManager

java.lang.Object
  extended by org.apache.aries.jpa.container.impl.EntityManagerFactoryManager
All Implemented Interfaces:
org.osgi.util.tracker.ServiceTrackerCustomizer

public class EntityManagerFactoryManager
extends Object
implements org.osgi.util.tracker.ServiceTrackerCustomizer

This class manages the lifecycle of Persistence Units and their associated EntityManagerFactory objects.


Constructor Summary
EntityManagerFactoryManager(org.osgi.framework.BundleContext containerCtx, org.osgi.framework.Bundle b, Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> parsedUnits, org.osgi.framework.ServiceReference ref, Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
          Create an EntityManagerFactoryManager for the supplied persistence bundle.
 
Method Summary
 StringBuffer addingService(org.osgi.framework.ServiceReference reference)
           
 void bundleStateChange()
          Notify the EntityManagerFactoryManager that the bundle it is managing has changed state This method should only be called when not holding any locks
 void destroy()
          Stop managing any EntityManagerFactorys This method should only be called when not holding any locks
 org.osgi.framework.Bundle getBundle()
           
 Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> getParsedPersistenceUnits()
           
 void manage(Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> parsedUnits, org.osgi.framework.ServiceReference ref, Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
          Manage the EntityManagerFactories for the following provider, updated persistence xmls and PersistenceUnitInfos This method should only be called when not holding any locks
 void manage(org.osgi.framework.ServiceReference ref, Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
          Manage the EntityManagerFactories for the following provider and PersistenceUnitInfos This method should only be called when not holding any locks
 void modifiedService(org.osgi.framework.ServiceReference reference, Object service)
           
 boolean providerRemoved(org.osgi.framework.ServiceReference ref)
          Notify the EntityManagerFactoryManager that a provider is being removed from the service registry.
 void quiesce(DestroyCallback countdown)
          Quiesce this Manager
 void removedService(org.osgi.framework.ServiceReference reference, Object service)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityManagerFactoryManager

public EntityManagerFactoryManager(org.osgi.framework.BundleContext containerCtx,
                                   org.osgi.framework.Bundle b,
                                   Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> parsedUnits,
                                   org.osgi.framework.ServiceReference ref,
                                   Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
Create an EntityManagerFactoryManager for the supplied persistence bundle. This constructor should only be used by a PersistenceBundleManager that is synchronized on itself, and the resulting manager should be immediately stored in the bundleToManager Map

Parameters:
b -
infos -
ref -
parsedUnits -
Method Detail

providerRemoved

public boolean providerRemoved(org.osgi.framework.ServiceReference ref)
Notify the EntityManagerFactoryManager that a provider is being removed from the service registry. If the provider is used by this EntityManagerFactoryManager then the manager should destroy the dependent persistence units. This method should only be called when not holding any locks

Parameters:
ref - The provider service reference
Returns:
true if the the provider is being used by this manager

bundleStateChange

public void bundleStateChange()
                       throws InvalidPersistenceUnitException
Notify the EntityManagerFactoryManager that the bundle it is managing has changed state This method should only be called when not holding any locks

Throws:
InvalidPersistenceUnitException - if the manager is no longer valid and should be destroyed

manage

public void manage(org.osgi.framework.ServiceReference ref,
                   Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
            throws IllegalStateException
Manage the EntityManagerFactories for the following provider and PersistenceUnitInfos This method should only be called when not holding any locks

Parameters:
ref - The PersistenceProvider ServiceReference
infos - The PersistenceUnitInfos defined by our bundle
Throws:
IllegalStateException

manage

public void manage(Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> parsedUnits,
                   org.osgi.framework.ServiceReference ref,
                   Collection<? extends org.apache.aries.jpa.container.ManagedPersistenceUnitInfo> infos)
            throws IllegalStateException
Manage the EntityManagerFactories for the following provider, updated persistence xmls and PersistenceUnitInfos This method should only be called when not holding any locks

Parameters:
parsedUnits - The updated ParsedPersistenceUnits for this bundle
ref - The PersistenceProvider ServiceReference
infos - The PersistenceUnitInfos defined by our bundle
Throws:
IllegalStateException

destroy

public void destroy()
Stop managing any EntityManagerFactorys This method should only be called when not holding any locks


getBundle

public org.osgi.framework.Bundle getBundle()

getParsedPersistenceUnits

public Collection<org.apache.aries.jpa.container.parsing.ParsedPersistenceUnit> getParsedPersistenceUnits()

quiesce

public void quiesce(DestroyCallback countdown)
Quiesce this Manager


addingService

public StringBuffer addingService(org.osgi.framework.ServiceReference reference)
Specified by:
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer

modifiedService

public void modifiedService(org.osgi.framework.ServiceReference reference,
                            Object service)
Specified by:
modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer

removedService

public void removedService(org.osgi.framework.ServiceReference reference,
                           Object service)
Specified by:
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer


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