owenb       2002/12/16 03:27:59

  Modified:    java/src/org/apache/wsif/providers/ejb WSIFPort_EJB.java
  Log:
  Fix - if className is used in the ejb:address, make use of the 
PortableRemoteObject.narrow method on the EJBHome returned by the JNDI lookup
  
  Revision  Changes    Path
  1.10      +23 -1     
xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFPort_EJB.java
  
  Index: WSIFPort_EJB.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFPort_EJB.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WSIFPort_EJB.java 7 Dec 2002 12:34:02 -0000       1.9
  +++ WSIFPort_EJB.java 16 Dec 2002 11:27:59 -0000      1.10
  @@ -66,6 +66,7 @@
   import javax.ejb.EJBHome;
   import javax.ejb.EJBObject;
   import javax.naming.InitialContext;
  +import javax.rmi.PortableRemoteObject;
   import javax.wsdl.BindingOperation;
   import javax.wsdl.Definition;
   import javax.wsdl.Port;
  @@ -177,7 +178,28 @@
   
                   InitialContext initContext;
                   initContext = new InitialContext(hash);
  -                fieldEjbHome = (EJBHome) initContext.lookup(address.getJndiName());
  +                
  +                Class homeClass = null;
  +                try {
  +                    if (address.getClassName() != null) {
  +                        homeClass =
  +                            Class.forName(
  +                                address.getClassName(),
  +                                true,
  +                                Thread.currentThread().getContextClassLoader());
  +                        if (!(EJBHome.class.isAssignableFrom(homeClass))) {
  +                            homeClass = null;
  +                        }
  +                    }
  +                } catch (ClassNotFoundException cnf) {
  +                     Trc.ignoredException(cnf);
  +                }
  +                
  +                if (homeClass != null) {
  +                     fieldEjbHome = (EJBHome) 
PortableRemoteObject.narrow(initContext.lookup(address.getJndiName()),homeClass);
  +                } else {
  +                     fieldEjbHome = (EJBHome) 
initContext.lookup(address.getJndiName());
  +                }
   
               } catch (Exception ex) {
                Trc.exception(ex);
  
  
  


Reply via email to