1 17 18 package org.apache.geronimo.connector.mock; 19 20 import javax.naming.NamingException ; 21 import javax.naming.Reference ; 22 import javax.resource.ResourceException ; 23 import javax.resource.cci.Connection ; 24 import javax.resource.cci.ConnectionFactory ; 25 import javax.resource.cci.ConnectionSpec ; 26 import javax.resource.cci.RecordFactory ; 27 import javax.resource.cci.ResourceAdapterMetaData ; 28 import javax.resource.spi.ConnectionManager ; 29 30 36 public class MockConnectionFactory implements ConnectionFactoryExtension { 37 38 private ConnectionManager connectionManager; 39 private MockManagedConnectionFactory managedConnectionFactory; 40 private Reference reference; 41 42 public MockConnectionFactory(MockManagedConnectionFactory managedConnectionFactory, ConnectionManager connectionManager) { 43 this.managedConnectionFactory = managedConnectionFactory; 44 this.connectionManager = connectionManager; 45 } 46 47 public Connection getConnection() throws ResourceException { 48 return getConnection(null); 49 } 50 51 public Connection getConnection(ConnectionSpec properties) throws ResourceException { 52 return (MockConnection) connectionManager.allocateConnection(managedConnectionFactory, (MockConnectionRequestInfo) properties); 53 } 54 55 public RecordFactory getRecordFactory() throws ResourceException { 56 return null; 57 } 58 59 public ResourceAdapterMetaData getMetaData() throws ResourceException { 60 return null; 61 } 62 63 public void setReference(Reference reference) { 64 this.reference = reference; 65 } 66 67 public Reference getReference() throws NamingException { 68 return reference; 69 } 70 71 public String doSomethingElse() { 72 return "SomethingElse"; 73 } 74 } 75 | Popular Tags |