1 22 package org.jboss.test.proxyfactory.support; 23 24 import javax.resource.spi.ConnectionManager ; 25 import javax.resource.spi.ManagedConnectionFactory ; 26 27 import org.jboss.aop.joinpoint.Invocation; 28 29 35 public class ConnectionFactoryInterceptor extends AbstractInterceptor 36 { 37 public static final String CONNECTION_FACTORY = "CONNECTION_FACTORY"; 38 public static final String CONNECTION_MANAGER = "CONNECTION_MANAGER"; 39 public static final String MANAGED_CONNECTION_FACTORY = "MANAGED_CONNECTION_FACTORY"; 40 41 public Object invoke(Invocation invocation) throws Throwable 42 { 43 ConnectionManager cm = (ConnectionManager ) invocation.getMetaData(CONNECTION_FACTORY, CONNECTION_MANAGER); 44 ManagedConnectionFactory mcf = (ManagedConnectionFactory ) invocation.getMetaData(CONNECTION_MANAGER, MANAGED_CONNECTION_FACTORY); 45 46 return cm.allocateConnection(mcf, null); 47 } 48 } 49 | Popular Tags |