1 23 24 26 27 package sample; 28 29 import javax.naming.*; 30 import javax.resource.cci.*; 31 import java.util.Iterator ; 32 import javax.resource.ResourceException ; 33 34 public class SampleScenario { 35 36 public void method() { 37 try { 38 Context nc = new InitialContext(); 39 40 ConnectionFactory cf = (ConnectionFactory)nc.lookup( 42 "java:comp/env/eis/ConnectionFactory"); 43 Connection cx = cf.getConnection(); 44 45 Interaction ix = cx.createInteraction(); 47 48 InteractionSpecImpl ixSpec = new InteractionSpecImpl(); 50 ixSpec.setFunctionName("<NAME OF FUNCTION>"); 51 ixSpec.setInteractionVerb(InteractionSpec.SYNC_SEND_RECEIVE); 52 53 RecordFactory rf = cf.getRecordFactory(); 54 55 MappedRecord input = rf.createMappedRecord("Name of Record"); 59 input.put("<key: element1>", new String ("<VALUE1>")); 60 input.put("<key: element2>", new String ("<VALUE2>")); 61 62 IndexedRecord output = rf.createIndexedRecord("Name of Record"); 64 65 ix.execute(ixSpec, input, output); 68 69 Iterator iterator = output.iterator(); 75 while (iterator.hasNext()) { 76 } 78 } 79 catch (NamingException ne) { 80 return; 81 } 82 catch (ResourceException e) { 83 return; 84 } 85 } 86 87 88 public static void main(String [] args) { 89 } 90 91 } 92 | Popular Tags |