com.caucho.env.jpa
Class PersistenceManager

java.lang.Object
  extended by com.caucho.env.jpa.PersistenceManager
All Implemented Interfaces:
ScanListener, EnvironmentEnhancerListener, EnvironmentListener

@Module
public class PersistenceManager
extends java.lang.Object
implements ScanListener, EnvironmentEnhancerListener

Manages the JPA persistence contexts.


Method Summary
 void addPersistenceUnitDefault(ConfigProgram program)
          Adds a persistence-unit default
 void addPersistenceUnitProxy(java.lang.String name, java.util.ArrayList<ConfigProgram> program)
          Adds a persistence-unit default
 void classMatchEvent(EnvironmentClassLoader loader, Path root, java.lang.String className)
          Callback to note the class matches
 void close()
           
 void configurePersistenceRoots()
           
static PersistenceManager create()
          Returns the local container.
static PersistenceManager create(java.lang.ClassLoader loader)
          Returns the local container.
 void environmentBind(EnvironmentClassLoader loader)
          Handles the environment config phase
 void environmentConfigure(EnvironmentClassLoader loader)
          Handles the environment config phase
 void environmentConfigureEnhancer(EnvironmentClassLoader loader)
          Handles the environment config phase
 void environmentStart(EnvironmentClassLoader loader)
          Handles the case where the environment is starting (after init).
 void environmentStop(EnvironmentClassLoader loader)
          Handles the case where the environment is stopping
 EnvironmentClassLoader getClassLoader()
          Returns the environment's class loader
static PersistenceManager getCurrent()
          Returns the local container.
static PersistenceManager getCurrent(java.lang.ClassLoader loader)
          Returns the current environment container.
 java.util.ArrayList<ConfigProgram> getPersistenceUnitDefaults()
          Returns the persistence-unit default list.
 java.util.ArrayList<ConfigProgram> getProxyProgram(java.lang.String name)
           
 int getScanPriority()
          Since JPA enhances, it is priority 0
 java.lang.ClassLoader getTempClassLoader()
          Returns the JClassLoader.
 void init()
           
 boolean isRootScannable(Path root, java.lang.String packageRoot)
          Returns true if the root is a valid scannable root.
 boolean isScanMatchAnnotation(CharBuffer annotationName)
          Returns true if the string matches an annotation class.
 java.lang.Class<?> loadTempClass(java.lang.String name)
           
 ScanClass scanClass(Path root, java.lang.String packageRoot, java.lang.String className, int modifiers)
          Returns the state when scanning the class
 void start()
           
 void startPersistenceUnits()
          Adds the URLs for the classpath.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static PersistenceManager create()
Returns the local container.


create

public static PersistenceManager create(java.lang.ClassLoader loader)
Returns the local container.


getCurrent

public static PersistenceManager getCurrent()
Returns the local container.


getCurrent

public static PersistenceManager getCurrent(java.lang.ClassLoader loader)
Returns the current environment container.


getClassLoader

public EnvironmentClassLoader getClassLoader()
Returns the environment's class loader


getTempClassLoader

public java.lang.ClassLoader getTempClassLoader()
Returns the JClassLoader.


addPersistenceUnitDefault

public void addPersistenceUnitDefault(ConfigProgram program)
Adds a persistence-unit default


getPersistenceUnitDefaults

public java.util.ArrayList<ConfigProgram> getPersistenceUnitDefaults()
Returns the persistence-unit default list.


addPersistenceUnitProxy

public void addPersistenceUnitProxy(java.lang.String name,
                                    java.util.ArrayList<ConfigProgram> program)
Adds a persistence-unit default


getProxyProgram

public java.util.ArrayList<ConfigProgram> getProxyProgram(java.lang.String name)

loadTempClass

public java.lang.Class<?> loadTempClass(java.lang.String name)
                                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

init

public void init()

start

public void start()

configurePersistenceRoots

public void configurePersistenceRoots()

startPersistenceUnits

public void startPersistenceUnits()
Adds the URLs for the classpath.


close

public void close()

getScanPriority

public int getScanPriority()
Since JPA enhances, it is priority 0

Specified by:
getScanPriority in interface ScanListener

isRootScannable

public boolean isRootScannable(Path root,
                               java.lang.String packageRoot)
Returns true if the root is a valid scannable root.

Specified by:
isRootScannable in interface ScanListener

scanClass

public ScanClass scanClass(Path root,
                           java.lang.String packageRoot,
                           java.lang.String className,
                           int modifiers)
Description copied from interface: ScanListener
Returns the state when scanning the class

Specified by:
scanClass in interface ScanListener
Parameters:
root - the module/jar's root path
packageRoot - the virtual package root (usually for Testing)
className - the class name
modifiers - the class modifiers
Returns:
the ScanClass object

isScanMatchAnnotation

public boolean isScanMatchAnnotation(CharBuffer annotationName)
Description copied from interface: ScanListener
Returns true if the string matches an annotation class.

Specified by:
isScanMatchAnnotation in interface ScanListener

classMatchEvent

public void classMatchEvent(EnvironmentClassLoader loader,
                            Path root,
                            java.lang.String className)
Callback to note the class matches

Specified by:
classMatchEvent in interface ScanListener

environmentConfigureEnhancer

public void environmentConfigureEnhancer(EnvironmentClassLoader loader)
Handles the environment config phase

Specified by:
environmentConfigureEnhancer in interface EnvironmentEnhancerListener

environmentConfigure

public void environmentConfigure(EnvironmentClassLoader loader)
Handles the environment config phase

Specified by:
environmentConfigure in interface EnvironmentListener

environmentBind

public void environmentBind(EnvironmentClassLoader loader)
Handles the environment config phase

Specified by:
environmentBind in interface EnvironmentListener

environmentStart

public void environmentStart(EnvironmentClassLoader loader)
Handles the case where the environment is starting (after init).

Specified by:
environmentStart in interface EnvironmentListener

environmentStop

public void environmentStop(EnvironmentClassLoader loader)
Handles the case where the environment is stopping

Specified by:
environmentStop in interface EnvironmentListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object