KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ersatz > resourceadapter > InteractionImpl


1 /*
2  * Created on December 10, 2003
3  *
4  * InteractionImpl.java is used to test the J2EE Connector
5  * as implemented by JOnAS. This class implements the Interaction
6  * (cci) classes.
7  *
8  */

9 package ersatz.resourceadapter;
10
11 import javax.resource.ResourceException;
12 import javax.resource.NotSupportedException;
13 import javax.resource.cci.Interaction;
14 import javax.resource.cci.InteractionSpec;
15 import javax.resource.cci.Connection;
16 import javax.resource.cci.Record;
17 import javax.resource.cci.ResourceWarning;
18 /**
19  * @author Bob Kruse
20  *
21  * Jtest Resource Adapter
22  *
23  * used to test the J2EE Connector as implemented by JOnAS.
24  *
25  */

26 public class InteractionImpl
27         implements Interaction
28 {
29
30     private Record output;
31     private boolean closed = false;
32     private ConnectionImpl con;
33     private ManagedConnectionImpl mcon;
34     String cName = "InteractionImpl";
35     
36     public InteractionImpl(ConnectionImpl c) {
37         Utility.log(cName+".constructor");
38         con=c;
39     }
40     public InteractionImpl(ConnectionImpl c, ManagedConnectionImpl mc) {
41         Utility.log(cName+".constructor");
42         con=c;
43         mcon=mc;
44     }
45     /*
46       If an Interaction implementation does not support a variant of the execute
47       method, the method must throw a javax.resource.NotSupportedException.
48     */

49     public boolean execute(InteractionSpec ispec,
50         Record input,
51         Record output) throws ResourceException
52     {
53         NotSupportedException nse = new NotSupportedException(
54                   "InteractionImpl.execute is not currently supported");
55         Utility.log(cName+".execute "+nse.toString());
56         throw nse;
57     }
58     public Record execute(InteractionSpec ispec,
59         Record input) throws ResourceException
60     {
61         NotSupportedException nse = new NotSupportedException(
62                   "InteractionImpl.execute is not currently supported");
63         Utility.log(cName+".execute "+nse.toString());
64         throw nse;
65     }
66     public void close()
67                throws ResourceException
68     {
69         Utility.log(cName+".close");
70         closed=true;
71     }
72     public Connection getConnection()
73     {
74         Utility.log(cName+".getConnection");
75         return con;
76     }
77     public ResourceWarning getWarnings()
78                                throws ResourceException
79     {
80         Utility.log(cName+".getWarnings");
81         NotSupportedException nse = new NotSupportedException(
82                   "InteractionImpl.getWarnings is not currently supported");
83         throw nse;
84     }
85     public void clearWarnings()
86                        throws ResourceException
87     {
88         Utility.log(cName+".clearWarnings");
89         NotSupportedException nse = new NotSupportedException(
90                        "InteractionImpl.clearWarnings is not currently supported");
91         throw nse;
92     }
93
94 }
95
Popular Tags