diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java')
| -rw-r--r-- | Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java new file mode 100644 index 0000000..2f532f9 --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java @@ -0,0 +1,96 @@ +package examples.integration.out_loan_ra;
+
+import examples.jni.JavaLoanApp;
+
+import java.util.*;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.IllegalStateException;
+import javax.resource.cci.*;
+import java.lang.reflect.*;
+import java.lang.*;
+
+public class InteractionImpl implements Interaction {
+
+ Connection conn = null;
+
+ public InteractionImpl(Connection conn) {
+
+ System.out.println("InteractionImpl(Connection conn) called");
+
+ this.conn = conn;
+ }
+
+ public javax.resource.cci.Connection getConnection() {
+
+ return conn;
+ }
+
+ public void close() throws ResourceException {
+
+ conn = null;
+ }
+
+ public boolean execute (InteractionSpec iSpec, Record in, Record out) throws ResourceException {
+
+ System.out.println ("InteractionImpl.execute(InteractionSpec iSpec, Record in, Record out) called");
+
+ out = exec((MappedRecord)in,(MappedRecord)out);
+
+ if (out != null) {
+
+ return true;
+ } else {
+
+ return false;
+ }
+ }
+
+ public Record execute (InteractionSpec iSpec, Record in) throws ResourceException {
+
+ System.out.println ("InteractionImpl.execute(InteractionSpec iSpec, Record in) called");
+
+ MappedRecord out = new MappedRecordImpl();
+
+ return exec((MappedRecord)in, out);
+ }
+
+ Record exec(MappedRecord in, MappedRecord out) throws ResourceException {
+
+ try {
+
+ System.out.println("InteractionImpl.exec(MappedRecord in, MappedRecord out) called");
+
+ Set keys = in.keySet();
+ Iterator iterator = keys.iterator();
+
+ while (iterator.hasNext()) {
+
+ String key = (String)iterator.next();
+
+ if (key.equalsIgnoreCase("HomeEquityRate")) {
+
+ JavaLoanApp jlaObj = new JavaLoanApp("C:\\LoanApp.dll");
+ float equityRate = jlaObj.getHomeEquityLoanRate();
+ System.out.println ("JNI Call Returned: " + equityRate);
+ out.put(key, new Float(equityRate));
+ }
+ }
+
+ return out;
+ }
+ catch(Exception e) {
+
+ throw new ResourceException(e.getMessage());
+ }
+ }
+
+ public ResourceWarning getWarnings() throws ResourceException {
+
+ return null;
+ }
+
+ public void clearWarnings() throws ResourceException {
+
+ }
+}
\ No newline at end of file |
