1 7 8 10 package org.jboss.net.axis.server; 11 12 import org.jboss.axis.Handler; 13 import org.jboss.axis.MessageContext; 14 import org.jboss.axis.providers.java.RPCProvider; 15 16 import javax.ejb.EJBHome ; 17 import javax.naming.InitialContext ; 18 19 38 39 public class EJBHomeProvider extends RPCProvider 40 { 41 42 private static final String beanNameOption = "beanJndiName"; 43 private static final String homeInterfaceNameOption = "homeInterfaceName"; 44 45 46 public EJBHomeProvider() 47 { 48 } 49 50 57 protected Object getNewServiceObject(MessageContext msgContext, String clsName) 58 throws Exception 59 { 60 Object result = new InitialContext ().lookup(clsName); 62 63 return result; 64 } 65 66 70 protected String getServiceClassNameOptionName() 71 { 72 return beanNameOption; 73 } 74 75 83 protected Class getServiceClass(MessageContext msgContext, 84 String beanJndiName) throws Exception 85 { 86 Handler serviceHandler = msgContext.getService(); 87 Class interfaceClass = null; 88 89 String homeName = 91 (String )serviceHandler.getOption(homeInterfaceNameOption); 92 if (homeName != null) 93 { 94 interfaceClass = msgContext.getClassLoader().loadClass(homeName); 95 } 96 else 97 { 98 EJBHome home = (EJBHome )getNewServiceObject(msgContext, beanJndiName); 100 interfaceClass = home.getEJBMetaData().getHomeInterfaceClass(); 101 } 102 103 return interfaceClass; 105 } 106 107 } | Popular Tags |