org.apache.openjpa.persistence
Class EntityManagerFactoryImpl

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

public class EntityManagerFactoryImpl
extends Object
implements OpenJPAEntityManagerFactory, OpenJPAEntityManagerFactorySPI, Closeable

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

Author:
Marc Prud'hommeaux
See Also:
Serialized Form

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 addTransactionListener(Object listener)
          Register a listener for transaction-related events on the specified classes.
 void close()
           
 OpenJPAEntityManagerSPI createEntityManager()
           
 OpenJPAEntityManagerSPI 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 removeTransactionListener(Object listener)
          Remove a listener for transaction-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: OpenJPAEntityManagerFactorySPI
Return the configuration for this factory.

Specified by:
getConfiguration in interface OpenJPAEntityManagerFactory
Specified by:
getConfiguration in interface OpenJPAEntityManagerFactorySPI

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 OpenJPAEntityManagerSPI createEntityManager()
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactorySPI

createEntityManager

public OpenJPAEntityManagerSPI 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 OpenJPAEntityManagerFactory
Specified by:
createEntityManager in interface OpenJPAEntityManagerFactorySPI

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: OpenJPAEntityManagerFactorySPI
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
Specified by:
addLifecycleListener in interface OpenJPAEntityManagerFactorySPI

removeLifecycleListener

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

Specified by:
removeLifecycleListener in interface OpenJPAEntityManagerFactory
Specified by:
removeLifecycleListener in interface OpenJPAEntityManagerFactorySPI

addTransactionListener

public void addTransactionListener(Object listener)
Description copied from interface: OpenJPAEntityManagerFactorySPI
Register a listener for transaction-related events on the specified classes. The listener will be passed on to all new entity managers. See the org.apache.openjpa.event package for listener types.

Specified by:
addTransactionListener in interface OpenJPAEntityManagerFactory
Specified by:
addTransactionListener in interface OpenJPAEntityManagerFactorySPI

removeTransactionListener

public void removeTransactionListener(Object listener)
Description copied from interface: OpenJPAEntityManagerFactorySPI
Remove a listener for transaction-related events.

Specified by:
removeTransactionListener in interface OpenJPAEntityManagerFactory
Specified by:
removeTransactionListener in interface OpenJPAEntityManagerFactorySPI

close

public void close()
Specified by:
close in interface Closeable

isOpen

public boolean isOpen()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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


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