public class TransactionAwareBeanProxyFactory
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 a TransactionOperations.execute(TransactionCallback) call.
public TransactionAwareBeanProxyFactory(org.springframework.transaction.support.TransactionOperations transactionOperations)
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.
T - The type of the proxy object.
createProxyFor - The object to create the proxy for. Must not be null.
The proxy of the object to proxy where each (interface) method call is enforced to run within a transaction scope.