1 7 package org.jboss.test.cts.service; 8 9 import javax.naming.InitialContext ; 10 11 import org.jboss.system.ServiceMBeanSupport; 12 import org.jboss.test.cts.interfaces.CtsCmp2Local; 13 import org.jboss.test.cts.interfaces.CtsCmp2LocalHome; 14 import org.jboss.test.util.Debug; 15 16 22 public class CtsCmpService extends ServiceMBeanSupport 23 implements CtsCmpServiceMBean 24 { 25 private CtsCmp2LocalHome home; 26 private String homeJndiName = "v2/local/CtsCmp2Bean"; 27 28 public CtsCmpService() 29 { 30 log.info("CtsCmpService V2 ctor"); 31 } 32 33 public void setHomeJndiName(String jndiName) 34 { 35 this.homeJndiName = jndiName; 36 } 37 38 protected void startService() throws Exception 39 { 40 InitialContext ctx = new InitialContext (); 41 Object obj = new InitialContext ().lookup(homeJndiName); 42 Class homeClass = obj.getClass(); 43 StringBuffer results = new StringBuffer (); 44 results.append("CtsCmpService V2 class info:\n"); 45 Debug.displayClassInfo(getClass(), results); 46 results.append("CtsCmp2LocalHome Proxy class info:\n"); 47 Debug.displayClassInfo(homeClass, results); 48 results.append("\nLocal CtsCmp2LocalHome.class info:\n"); 49 Debug.displayClassInfo(CtsCmp2LocalHome.class, results); 50 log.info(results.toString()); 51 home = (CtsCmp2LocalHome) obj; 52 53 CtsCmp2Local bean = home.create("V2key", "V2data"); 54 log.info("CtsCmp2Local.key = "+bean.getKey()); 55 log.info("CtsCmp2Local.data = "+bean.getData()); 56 log.info("CtsCmp2Local.moreData = "+bean.getMoreData()); 57 } 58 } 59 | Popular Tags |