1 8 9 package org.jboss.tutorial.packaging.client; 10 11 import javax.naming.InitialContext ; 12 import org.jboss.tutorial.packaging.bean.Session2; 13 import org.jboss.tutorial.packaging.bean.Session1; 14 import org.jboss.tutorial.packaging.bean.Entity1; 15 import org.jboss.tutorial.packaging.bean.Entity2; 16 17 23 24 public class Client 25 { 26 27 public static void main(String [] args) throws Exception 28 { 29 Session1 session1 = (Session1) getInitialContext().lookup(Session1.class.getName()); 30 Session2 session2 = (Session2) getInitialContext().lookup(Session2.class.getName()); 31 32 int oneF = session1.create1FromFactory(); 33 int oneM = session1.create1FromManager(); 34 int twoF = session1.create2FromFactory(); 35 int twoM = session1.create2FromManager(); 36 37 Entity1 one = session2.find1FromFactory(oneF); 38 System.out.println("factory: " + one.getString()); 39 40 one = session2.find1FromManager(oneM); 41 System.out.println("manager: " + one.getString()); 42 43 44 Entity2 two = session2.find2FromFactory(twoF); 45 System.out.println("factory: " + two.getString()); 46 47 two = session2.find2FromManager(twoM); 48 System.out.println("manager: " + two.getString()); 49 } 50 51 public static InitialContext getInitialContext() throws Exception 52 { 53 return new InitialContext (); 54 } 55 56 57 58 } 59 | Popular Tags |