1 22 package org.jboss.tutorial.consumer_deployment_descriptor.client; 23 24 import java.util.HashMap ; 25 import java.util.Map ; 26 import javax.naming.InitialContext ; 27 import org.jboss.ejb3.mdb.ProducerManager; 28 import org.jboss.ejb3.mdb.ProducerObject; 29 import org.jboss.ejb3.mdb.ProducerConfig; 30 import org.jboss.tutorial.consumer_deployment_descriptor.bean.ExampleProducerRemote; 31 import org.jboss.tutorial.consumer_deployment_descriptor.bean.Tester; 32 33 public class Client 34 { 35 public static void main(String [] args) throws Exception 36 { 37 InitialContext ctx = new InitialContext (); 38 ExampleProducerRemote remote = (ExampleProducerRemote) ctx.lookup(ExampleProducerRemote.class.getName()); 39 40 ProducerManager manager = ((ProducerObject) remote).getProducerManager(); 43 44 45 manager.connect(); 47 48 try 49 { 50 remote.method1("Remote method1 called", 1); 52 53 Map <String , String > map = new HashMap <String , String >(); 55 map.put("hello", "world"); 56 map.put("great", "ejb3"); 57 58 remote.method2("Remote method2 called", map); 59 } 60 finally 61 { 62 ProducerConfig.close(remote); 64 } 65 66 67 Tester tester = (Tester) ctx.lookup("TesterBean/remote"); 69 tester.testLocal(); 70 tester.testXA(); 71 } 72 } 73 | Popular Tags |