|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.ipojo.Handler
org.apache.felix.ipojo.PrimitiveHandler
org.krakenapps.jpa.handler.TransactionalHandler
public class TransactionalHandler
Provide declarative transaction support using iPOJO component handler. TransactionHandler starts transaction at method entry, and commit/rollback transaction at method exit.
| Field Summary |
|---|
| Fields inherited from class org.apache.felix.ipojo.PrimitiveHandler |
|---|
HANDLER_TYPE |
| Fields inherited from class org.apache.felix.ipojo.Handler |
|---|
HANDLER_LEVEL_PROPERTY, HANDLER_NAME_PROPERTY, HANDLER_NAMESPACE_PROPERTY, HANDLER_TYPE_PROPERTY, m_instance, m_isValid |
| Constructor Summary | |
|---|---|
TransactionalHandler()
|
|
| Method Summary | |
|---|---|
void |
configure(org.apache.felix.ipojo.metadata.Element metadata,
java.util.Dictionary configuration)
Find and hook all transactional methods. |
void |
factoryAdded(java.lang.String factoryName,
javax.persistence.EntityManagerFactory factory)
Move to valid state if associated entity manager factory is added. |
void |
factoryRemoved(java.lang.String factoryName,
javax.persistence.EntityManagerFactory factory)
Move to invalid state if associated entity manager factory is removed. |
void |
onEntry(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Object[] args)
Find the entity manager in the current thread context and begin transaction at entry of transactional method. |
void |
onError(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Throwable throwable)
Rollback transaction in the current thread context if an exception raised. |
void |
onExit(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Object returnedObj)
Commit transaction in the current thread context at exit of transactional method. onError method will be called if commit failed. |
void |
onFinally(java.lang.Object pojo,
java.lang.reflect.Method method)
Close the entity manager in the current thread context. |
void |
setJpaService(JpaService jpaService)
Set new JPA service and register event listener to JPA service. |
void |
setThreadLocalEntityManager(ThreadLocalEntityManagerService threadLocalEntityManager)
Set new thread local entity manager service |
void |
start()
Check if entity manager factory is available and register factory life cycle event listener |
void |
stop()
Unregister factory life cycle event listener. |
| Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler |
|---|
attach, getFactory, getHandler, getInstanceManager, getLogger, getPojoMetadata, onCreation, onGet, onSet, setFactory |
| Methods inherited from class org.apache.felix.ipojo.Handler |
|---|
debug, error, error, getDescription, getHandlerManager, getValidity, info, initializeComponentFactory, isValid, reconfigure, setValidity, stateChanged, warn, warn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TransactionalHandler()
| Method Detail |
|---|
public void configure(org.apache.felix.ipojo.metadata.Element metadata,
java.util.Dictionary configuration)
throws org.apache.felix.ipojo.ConfigurationException
configure in class org.apache.felix.ipojo.Handlerorg.apache.felix.ipojo.ConfigurationExceptionpublic void start()
start in class org.apache.felix.ipojo.Handlerpublic void stop()
stop in class org.apache.felix.ipojo.Handler
public void onEntry(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Object[] args)
onEntry in interface org.apache.felix.ipojo.MethodInterceptoronEntry in class org.apache.felix.ipojo.PrimitiveHandler
public void onExit(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Object returnedObj)
onExit in interface org.apache.felix.ipojo.MethodInterceptoronExit in class org.apache.felix.ipojo.PrimitiveHandler
public void onError(java.lang.Object pojo,
java.lang.reflect.Method method,
java.lang.Throwable throwable)
onError in interface org.apache.felix.ipojo.MethodInterceptoronError in class org.apache.felix.ipojo.PrimitiveHandler
public void onFinally(java.lang.Object pojo,
java.lang.reflect.Method method)
onFinally in interface org.apache.felix.ipojo.MethodInterceptoronFinally in class org.apache.felix.ipojo.PrimitiveHandlerpublic void setJpaService(JpaService jpaService)
jpaService - new JPA servicepublic void setThreadLocalEntityManager(ThreadLocalEntityManagerService threadLocalEntityManager)
threadLocalEntityManager - the thread local entity manager service
public void factoryAdded(java.lang.String factoryName,
javax.persistence.EntityManagerFactory factory)
factoryAdded in interface EntityManagerFactoryListenerfactoryName - the name of entity manager factoryfactory - the newly added entity manager factory
public void factoryRemoved(java.lang.String factoryName,
javax.persistence.EntityManagerFactory factory)
factoryRemoved in interface EntityManagerFactoryListenerfactoryName - the name of entity manager factoryfactory - the removed entity manager factory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||