org.apache.openjpa.persistence
Class EntityManagerFactoryImpl

java.lang.Object
  extended by org.apache.openjpa.persistence.EntityManagerFactoryImpl
All Implemented Interfaces:
java.io.Serializable, javax.persistence.EntityManagerFactory, org.apache.openjpa.kernel.ConnectionRetainModes, org.apache.openjpa.lib.util.Closeable, OpenJPAEntityManagerFactory

public class EntityManagerFactoryImpl
extends java.lang.Object
implements OpenJPAEntityManagerFactory

Implementation of EntityManagerFactory that acts as a facade to a BrokerFactory.

Author:
Marc Prud'hommeaux
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.openjpa.kernel.ConnectionRetainModes
CONN_RETAIN_ALWAYS, CONN_RETAIN_DEMAND, CONN_RETAIN_TRANS
 
Constructor Summary
protected EntityManagerFactoryImpl(org.apache.openjpa.kernel.BrokerFactory factory)
          Constructor.
 
Method Summary
 void addLifecycleListener(java.lang.Object listener, java.lang.Class... classes)
          Register a listener for lifecycle-related events on the specified classes.
 void close()
           
 OpenJPAEntityManager createEntityManager()
           
 OpenJPAEntityManager createEntityManager(java.util.Map props)
          Return an entity manager with the provided additional configuration settings.
 boolean equals(java.lang.Object other)
           
 org.apache.openjpa.kernel.BrokerFactory getBrokerFactory()
          Delegate.
 org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration()
          Return the configuration for this factory.
 java.util.Properties getProperties()
          Return properties describing this runtime.
 QueryResultCache getQueryResultCache()
          Access query result cache.
 StoreCache getStoreCache()
          Access the level 2 store cache.
 StoreCache getStoreCache(java.lang.String cacheName)
          Access a named level 2 store cache.
 java.lang.Object getUserObject(java.lang.Object key)
          Get the value for the specified key from the map of user objects.
 int hashCode()
           
 boolean isOpen()
           
 java.lang.Object putUserObject(java.lang.Object key, java.lang.Object val)
          Put the specified key-value pair into the map of user objects.
 void removeLifecycleListener(java.lang.Object listener)
          Remove a listener for lifecycle-related events.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityManagerFactoryImpl

protected EntityManagerFactoryImpl(org.apache.openjpa.kernel.BrokerFactory factory)
Constructor. Delegate must be provided on construction.

Method Detail

getBrokerFactory

public org.apache.openjpa.kernel.BrokerFactory getBrokerFactory()
Delegate.


getConfiguration

public org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration()
Description copied from interface: OpenJPAEntityManagerFactory
Return the configuration for this factory.

Specified by:
getConfiguration in interface OpenJPAEntityManagerFactory

getProperties

public java.util.Properties getProperties()
Description copied from interface: OpenJPAEntityManagerFactory
Return properties describing this runtime.

Specified by:
getProperties in interface OpenJPAEntityManagerFactory

putUserObject

public java.lang.Object putUserObject(java.lang.Object key,
                                      java.lang.Object val)
Description copied from interface: OpenJPAEntityManagerFactory
Put the specified key-value pair into the map of user objects.

Specified by:
putUserObject in interface OpenJPAEntityManagerFactory

getUserObject

public java.lang.Object getUserObject(java.lang.Object key)
Description copied from interface: OpenJPAEntityManagerFactory
Get the value for the specified key from the map of user objects.

Specified by:
getUserObject in interface OpenJPAEntityManagerFactory

getStoreCache

public StoreCache getStoreCache()
Description copied from interface: OpenJPAEntityManagerFactory
Access the level 2 store cache. This cache acts as a proxy to all named caches.

Specified by:
getStoreCache in interface OpenJPAEntityManagerFactory

getStoreCache

public StoreCache getStoreCache(java.lang.String cacheName)
Description copied from interface: OpenJPAEntityManagerFactory
Access a named level 2 store cache.

Specified by:
getStoreCache in interface OpenJPAEntityManagerFactory

getQueryResultCache

public QueryResultCache getQueryResultCache()
Description copied from interface: OpenJPAEntityManagerFactory
Access query result cache.

Specified by:
getQueryResultCache in interface OpenJPAEntityManagerFactory

createEntityManager

public OpenJPAEntityManager createEntityManager()
Specified by:
createEntityManager in interface javax.persistence.EntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactory

createEntityManager

public OpenJPAEntityManager createEntityManager(java.util.Map props)
Description copied from interface: OpenJPAEntityManagerFactory
Return an entity manager with the provided additional configuration settings. OpenJPA recognizes the following configuration settings in this method:

Specified by:
createEntityManager in interface javax.persistence.EntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactory

addLifecycleListener

public void addLifecycleListener(java.lang.Object listener,
                                 java.lang.Class... classes)
Description copied from interface: OpenJPAEntityManagerFactory
Register a listener for lifecycle-related events on the specified classes. If the classes are null, all events will be propagated to the listener. The listener will be passed on to all new entity managers. See the org.apache.openjpa.event package for listener types.

Specified by:
addLifecycleListener in interface OpenJPAEntityManagerFactory

removeLifecycleListener

public void removeLifecycleListener(java.lang.Object listener)
Description copied from interface: OpenJPAEntityManagerFactory
Remove a listener for lifecycle-related events.

Specified by:
removeLifecycleListener in interface OpenJPAEntityManagerFactory

close

public void close()
Specified by:
close in interface javax.persistence.EntityManagerFactory
Specified by:
close in interface org.apache.openjpa.lib.util.Closeable

isOpen

public boolean isOpen()
Specified by:
isOpen in interface javax.persistence.EntityManagerFactory

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object


Copyright © 2006 Apache Software Foundation. All Rights Reserved.