01: package com.mockrunner.mock.connector.spi;
02:
03: import java.io.PrintWriter;
04: import java.util.Vector;
05:
06: import javax.resource.ResourceException;
07: import javax.resource.spi.ConnectionEventListener;
08: import javax.resource.spi.ConnectionRequestInfo;
09: import javax.resource.spi.LocalTransaction;
10: import javax.resource.spi.ManagedConnection;
11: import javax.resource.spi.ManagedConnectionMetaData;
12: import javax.security.auth.Subject;
13: import javax.transaction.xa.XAResource;
14:
15: /**
16: * Mock implementation of <code>ManagedConnection</code>.
17: */
18: public class MockManagedConnection implements ManagedConnection {
19: private PrintWriter logWriter;
20: private ManagedConnectionMetaData metaData;
21: private Vector listeners;
22:
23: public MockManagedConnection() {
24: metaData = new MockManagedConnectionMetaData();
25: listeners = new Vector();
26: }
27:
28: public Object getConnection(Subject subject,
29: ConnectionRequestInfo connectionRequestInfo)
30: throws ResourceException {
31: return null;
32: }
33:
34: public void destroy() throws ResourceException {
35:
36: }
37:
38: public void cleanup() throws ResourceException {
39:
40: }
41:
42: public void associateConnection(Object connection)
43: throws ResourceException {
44:
45: }
46:
47: public void addConnectionEventListener(
48: ConnectionEventListener listener) {
49: listeners.add(listener);
50: }
51:
52: public void removeConnectionEventListener(
53: ConnectionEventListener listener) {
54: listeners.remove(listener);
55: }
56:
57: public XAResource getXAResource() throws ResourceException {
58: return null;
59: }
60:
61: public LocalTransaction getLocalTransaction()
62: throws ResourceException {
63: return null;
64: }
65:
66: public ManagedConnectionMetaData getMetaData()
67: throws ResourceException {
68: return metaData;
69: }
70:
71: public PrintWriter getLogWriter() throws ResourceException {
72: return logWriter;
73: }
74:
75: public void setLogWriter(PrintWriter logWriter)
76: throws ResourceException {
77: this .logWriter = logWriter;
78: }
79:
80: public void setMetaData(ManagedConnectionMetaData metaData) {
81: this.metaData = metaData;
82: }
83: }
|