You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ow...@apache.org on 2002/12/16 12:25:50 UTC

cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/ejb WSIFPort_EJB.java

owenb       2002/12/16 03:25:50

  Modified:    java/src/org/apache/wsif/providers/ejb Tag: pre1_2_0-patches
                        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
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +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.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- WSIFPort_EJB.java	24 Oct 2002 16:09:07 -0000	1.8
  +++ WSIFPort_EJB.java	16 Dec 2002 11:25:49 -0000	1.8.2.1
  @@ -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);