summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionImpl.java
blob: 5cd6b7231a1a74f28c58288bf2e83262f60fdf75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package examples.integration.out_loan_ra;

import java.util.*;

import javax.resource.cci.*;
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionEvent;
import javax.resource.spi.IllegalStateException;
import javax.resource.spi.*;
import javax.resource.NotSupportedException;

public class ConnectionImpl implements javax.resource.cci.Connection {

     private ManagedConnectionImpl manConn;

     ConnectionImpl(ManagedConnectionImpl manConn) {

          System.out.println("ConnectionImpl(ManagedConnectionImpl) called");

          this.manConn = manConn;
     }
       
     public Interaction createInteraction() throws ResourceException {

          return new InteractionImpl(this);
     }
 
     public javax.resource.cci.LocalTransaction getLocalTransaction() throws ResourceException {

          throw new NotSupportedException("Local transactions are not supported.");
     }

     public ResultSetInfo getResultSetInfo() throws ResourceException {

          throw new NotSupportedException("ResultSet records are not supported.");
     }

     public void close() throws ResourceException {

          System.out.println("ConnectionImpl.close() called");      

          if (manConn == null) 
               return;

          manConn.sendEvent(ConnectionEvent.CONNECTION_CLOSED, null, this);

          manConn = null;
     }

     public ConnectionMetaData getMetaData() throws ResourceException {

          return new ConnectionMetaDataImpl(manConn);
     }
}