org.apache.openjpa.persistence
Class EntityManagerFactoryImpl

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

public class EntityManagerFactoryImpl
extends 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
EntityManagerFactoryImpl()
          Default constructor provided for auto-instantiation.
EntityManagerFactoryImpl(BrokerFactory factory)
          Supply delegate on construction.
 
Method Summary
 void addLifecycleListener(Object listener, Class... classes)
          Register a listener for lifecycle-related events on the specified classes.
 void close()
           
 OpenJPAEntityManager createEntityManager()
           
 OpenJPAEntityManager createEntityManager(Map props)
          Return an entity manager with the provided additional configuration settings.
 boolean equals(Object other)
           
 BrokerFactory getBrokerFactory()
          Delegate.
 OpenJPAConfiguration getConfiguration()
          Return the configuration for this factory.
 Properties getProperties()
          Return properties describing this runtime.
 QueryResultCache getQueryResultCache()
          Access query result cache.
 StoreCache getStoreCache()
          Access the level 2 store cache.
 StoreCache getStoreCache(String cacheName)
          Access a named level 2 store cache.
 Object getUserObject(Object key)
          Get the value for the specified key from the map of user objects.
 int hashCode()
           
 boolean isOpen()
           
protected  EntityManagerImpl newEntityManagerImpl(Broker broker)
          Create a new entity manager around the given broker.
 Object putUserObject(Object key, Object val)
          Put the specified key-value pair into the map of user objects.
 void removeLifecycleListener(Object listener)
          Remove a listener for lifecycle-related events.
 void setBrokerFactory(BrokerFactory factory)
          Delegate must be provided before use.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityManagerFactoryImpl

public EntityManagerFactoryImpl()
Default constructor provided for auto-instantiation.


EntityManagerFactoryImpl

public EntityManagerFactoryImpl(BrokerFactory factory)
Supply delegate on construction.

Method Detail

getBrokerFactory

public BrokerFactory getBrokerFactory()
Delegate.


setBrokerFactory

public void setBrokerFactory(BrokerFactory factory)
Delegate must be provided before use.


getConfiguration

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

Specified by:
getConfiguration in interface OpenJPAEntityManagerFactory

getProperties

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

Specified by:
getProperties in interface OpenJPAEntityManagerFactory

putUserObject

public Object putUserObject(Object key,
                            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 Object getUserObject(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(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 EntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactory

createEntityManager

public OpenJPAEntityManager createEntityManager(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 EntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactory

newEntityManagerImpl

protected EntityManagerImpl newEntityManagerImpl(Broker broker)
Create a new entity manager around the given broker.


addLifecycleListener

public void addLifecycleListener(Object listener,
                                 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(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 EntityManagerFactory
Specified by:
close in interface Closeable

isOpen

public boolean isOpen()
Specified by:
isOpen in interface EntityManagerFactory

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.