Package org.opennms.netmgt.vaadin.core
Class TransactionAwareBeanProxyFactory
- java.lang.Object
-
- org.opennms.netmgt.vaadin.core.TransactionAwareBeanProxyFactory
-
public class TransactionAwareBeanProxyFactory extends java.lang.Object
This factory class is needed, because when we use DAOs or other classes requiring a transaction scope when not running in the Jetty container, but in the Apache Karaf Container. We either have to ensure that the method call is run within a transaction scope, or we create an new scope. We already have setup this with Spring and do not want to set it up again in the blueprint container. The factory creates a proxy of an already existing object and ensures that each method of a bean is invoked within a transaction scope. This is achieved by wrapping each method call around aTransactionOperations.execute(TransactionCallback)
call.
-
-
Constructor Summary
Constructors Constructor Description TransactionAwareBeanProxyFactory(org.springframework.transaction.support.TransactionOperations transactionOperations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
createProxy(T createProxyFor)
Creates a proxy for the given object.
-
-
-
Method Detail
-
createProxy
public <T> T createProxy(T createProxyFor)
Creates a proxy for the given object. The object must already been instantiated and must implement at least one interface.. The proxy created wraps only methods of all defined interfaces of the provided class. All wrapped methods are executed within a transaction scope.- Type Parameters:
T
- The type of the proxy object.- Parameters:
createProxyFor
- The object to create the proxy for. Must not be null.- Returns:
- The proxy of the object to proxy where each (interface) method call is enforced to run within a transaction scope.
-
-