Class TransactionAwareBeanProxyFactory


  • public class TransactionAwareBeanProxyFactory
    extends 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 a TransactionOperations.execute(TransactionCallback) call.
    • Constructor Detail

      • TransactionAwareBeanProxyFactory

        public TransactionAwareBeanProxyFactory​(org.springframework.transaction.support.TransactionOperations transactionOperations)
    • 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.