org.apache.onami.persist
Class PersistenceModule

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by org.apache.onami.persist.PersistenceModule
All Implemented Interfaces:
com.google.inject.Module

public abstract class PersistenceModule
extends com.google.inject.AbstractModule

Main module of the onami persist guice extension.


Constructor Summary
PersistenceModule()
           
 
Method Summary
protected  UnannotatedPersistenceUnitBuilder bindApplicationManagedPersistenceUnit(String puName)
          Binds an application managed persistence unit.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnit(javax.persistence.EntityManagerFactory emf)
          Binds a container managed persistence unit for a given entity manager factory.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(Class<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderClass)
          Binds a container managed persistence unit.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(com.google.inject.Key<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderKey)
          Binds a container managed persistence unit.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(javax.inject.Provider<javax.persistence.EntityManagerFactory> emfProvider)
          Binds a container managed persistence unit.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(com.google.inject.TypeLiteral<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderType)
          Binds a container managed persistence unit.
protected  UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitWithJndiName(String jndiName)
          Binds a container managed persistence unit.
protected  void configure()
          
protected abstract  void configurePersistence()
          Configures the persistence units over the exposed methods.
 
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceModule

public PersistenceModule()
Method Detail

configure

protected final void configure()

Specified by:
configure in class com.google.inject.AbstractModule

configurePersistence

protected abstract void configurePersistence()
Configures the persistence units over the exposed methods.


bindApplicationManagedPersistenceUnit

protected UnannotatedPersistenceUnitBuilder bindApplicationManagedPersistenceUnit(String puName)
Binds an application managed persistence unit.

Parameters:
puName - the name of the persistence unit as defined in the persistence.xml.
Returns:
the next builder step.

bindContainerManagedPersistenceUnit

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnit(javax.persistence.EntityManagerFactory emf)
Binds a container managed persistence unit for a given entity manager factory.

Parameters:
emf - the entity manager factory to use when creating new entity managers.
Returns:
the next builder step.

bindContainerManagedPersistenceUnitWithJndiName

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitWithJndiName(String jndiName)
Binds a container managed persistence unit. The entity manager factory will be retrieved from the JNDI context.

Parameters:
jndiName - the JNDI name of the entity manager factory.
Returns:
the next builder step.

bindContainerManagedPersistenceUnitProvidedBy

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(javax.inject.Provider<javax.persistence.EntityManagerFactory> emfProvider)
Binds a container managed persistence unit. The entity manager factory will be retrieved from the given provider.

Parameters:
emfProvider - the provider for the entity manager factory.
Returns:
the next builder step.

bindContainerManagedPersistenceUnitProvidedBy

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(Class<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderClass)
Binds a container managed persistence unit. The entity manager factory will be retrieved from the given provider.

Parameters:
emfProviderClass - the provider for the entity manager factory.
Returns:
the next builder step.

bindContainerManagedPersistenceUnitProvidedBy

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(com.google.inject.TypeLiteral<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderType)
Binds a container managed persistence unit. The entity manager factory will be retrieved from the given provider.

Parameters:
emfProviderType - the provider for the entity manager factory.
Returns:
the next builder step.

bindContainerManagedPersistenceUnitProvidedBy

protected UnannotatedPersistenceUnitBuilder bindContainerManagedPersistenceUnitProvidedBy(com.google.inject.Key<? extends javax.inject.Provider<javax.persistence.EntityManagerFactory>> emfProviderKey)
Binds a container managed persistence unit. The entity manager factory will be retrieved from the given provider.

Parameters:
emfProviderKey - the provider for the entity manager factory.
Returns:
the next builder step.


Copyright © 2013–2014 The Apache Software Foundation. All rights reserved.