1 7 package org.jboss.tutorial.consumer.client; 8 9 import org.jboss.tutorial.consumer.bean.ExampleProducerRemote; 10 import org.jboss.tutorial.consumer.bean.Tester; 11 import org.jboss.ejb3.mdb.ProducerManager; 12 import org.jboss.ejb3.mdb.ProducerObject; 13 14 import javax.naming.InitialContext ; 15 import java.util.HashMap ; 16 import java.util.Map ; 17 18 public class Client 19 { 20 public static void main(String [] args) throws Exception 21 { 22 InitialContext ctx = new InitialContext (); 23 ExampleProducerRemote remote = (ExampleProducerRemote) ctx.lookup(ExampleProducerRemote.class.getName()); 24 ProducerManager manager = ((ProducerObject) remote).getProducerManager(); 25 26 27 manager.connect(); 29 30 try 31 { 32 remote.method1("Remote method1 called", 1); 34 35 Map <String , String > map = new HashMap <String , String >(); 37 map.put("hello", "world"); 38 map.put("great", "ejb3"); 39 40 remote.method2("Remote method2 called", map); 41 } 42 finally 43 { 44 manager.close(); 45 } 46 47 48 Tester tester = (Tester) ctx.lookup(Tester.class.getName()); 50 tester.testLocal(); 51 tester.testXA(); 52 } 53 } 54 | Popular Tags |