maguro      2005/03/07 23:08:28

  Modified:    modules/core/src/java/org/openejb/corba/util
                        ClasspathTieLoader.java TieLoader.java Util.java
                        UtilDelegateImpl.java
  Log:

  Intermediate CORBA checkin.
  
  Revision  Changes    Path
  1.3       +5 -10     
openejb/modules/core/src/java/org/openejb/corba/util/ClasspathTieLoader.java
  
  Index: ClasspathTieLoader.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/ClasspathTieLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClasspathTieLoader.java   5 Mar 2005 05:41:57 -0000       1.2
  +++ ClasspathTieLoader.java   8 Mar 2005 04:08:28 -0000       1.3
  @@ -49,10 +49,7 @@
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoBuilder;
   
  -import org.openejb.EJBContainer;
   import org.openejb.corba.CORBAException;
  -import org.openejb.corba.TSSBean;
  -import org.openejb.proxy.ProxyInfo;
   
   
   /**
  @@ -63,9 +60,7 @@
    */
   public class ClasspathTieLoader implements TieLoader {
   
  -    public Servant loadTieClass(Class itf, ProxyInfo pi) throws 
CORBAException {
  -        EJBContainer container = TSSBean.getContainer(pi.getContainerID());
  -
  +    public Servant loadTieClass(Class itf, ClassLoader cl) throws 
CORBAException {
           String name = itf.getName();
           try {
               int namepos = name.lastIndexOf('.');
  @@ -80,7 +75,7 @@
               }
               String stubName = packagename + "_" + classname + "_Tie";
   
  -            return (Servant) 
container.getClassLoader().loadClass(stubName).newInstance();
  +            return (Servant) cl.loadClass(stubName).newInstance();
           } catch (InstantiationException e) {
               throw new CORBAException(e);
           } catch (IllegalAccessException e) {
  @@ -95,7 +90,7 @@
       static {
           GBeanInfoBuilder infoFactory = new 
GBeanInfoBuilder(ClasspathTieLoader.class);
   
  -        infoFactory.addOperation("loadTieClass", new Class[]{Class.class, 
ProxyInfo.class});
  +        infoFactory.addOperation("loadTieClass", new Class[]{Class.class, 
ClassLoader.class});
   
           GBEAN_INFO = infoFactory.getBeanInfo();
       }
  
  
  
  1.2       +3 -3      
openejb/modules/core/src/java/org/openejb/corba/util/TieLoader.java
  
  Index: TieLoader.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/TieLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TieLoader.java    13 Jan 2005 17:00:24 -0000      1.1
  +++ TieLoader.java    8 Mar 2005 04:08:28 -0000       1.2
  @@ -58,6 +58,6 @@
    */
   public interface TieLoader {
   
  -    public Servant loadTieClass(Class itf, ProxyInfo pi) throws 
CORBAException;
  +    public Servant loadTieClass(Class itf, ClassLoader cl) throws 
CORBAException;
   
   }
  
  
  
  1.2       +14 -2     
openejb/modules/core/src/java/org/openejb/corba/util/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/Util.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Util.java 2 Mar 2005 23:48:14 -0000       1.1
  +++ Util.java 8 Mar 2005 04:08:28 -0000       1.2
  @@ -50,6 +50,9 @@
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import javax.ejb.spi.HandleDelegate;
  +import javax.naming.InitialContext;
  +import javax.naming.NamingException;
   
   import org.bouncycastle.asn1.DERInputStream;
   import org.bouncycastle.asn1.DERObjectIdentifier;
  @@ -71,8 +74,9 @@
   
   /**
    * Various utility functions.
  - *
  + * <p/>
    * Note: #getORB() and #getCodec() rely on UtilInitializer to initialze the 
ORB and codec.
  + *
    * @version $Rev: $ $Date$
    * @see UtilInitializer
    */
  @@ -84,6 +88,7 @@
       private static final byte ASN_TAG_GSS = 0x60;
       private static ORB orb;
       private static Codec codec;
  +    private static HandleDelegate handleDelegate;
   
       public static ORB getORB() {
           assert orb != null;
  @@ -101,6 +106,13 @@
           return codec;
       }
   
  +    public static HandleDelegate getHandleDelegate() throws NamingException {
  +        if (handleDelegate == null) {
  +            InitialContext ic = new InitialContext();
  +            handleDelegate = (HandleDelegate) 
ic.lookup("java:comp/HandleDelegate");
  +        }
  +        return handleDelegate;
  +    }
   
       public static byte[] encodeOID(String oid) throws IOException {
           oid = (oid.startsWith("oid:") ? oid.substring(4) : oid);
  
  
  
  1.2       +13 -8     
openejb/modules/core/src/java/org/openejb/corba/util/UtilDelegateImpl.java
  
  Index: UtilDelegateImpl.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/util/UtilDelegateImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UtilDelegateImpl.java     13 Jan 2005 17:00:24 -0000      1.1
  +++ UtilDelegateImpl.java     8 Mar 2005 04:08:28 -0000       1.2
  @@ -76,20 +76,18 @@
   
       private final Log log = LogFactory.getLog(UtilDelegateImpl.class);
       private final UtilDelegate delegate;
  -    private static TieLoader tieLoader;
   
       private final static String DELEGATE_NAME = 
"org.openejb.corba.UtilDelegateClass";
   
       public UtilDelegateImpl() throws ClassNotFoundException, 
IllegalAccessException, InstantiationException {
           String value = System.getProperty(DELEGATE_NAME);
           if (value == null) {
  +            log.error("No delegate specfied via " + DELEGATE_NAME);
               throw new IllegalStateException("The property " + DELEGATE_NAME 
+ " must be defined!");
           }
  -        delegate = (UtilDelegate) Class.forName(value).newInstance();
  -    }
   
  -    public static void setTieLoader(TieLoader tieLoader) {
  -        UtilDelegateImpl.tieLoader = tieLoader;
  +        if (log.isDebugEnabled()) log.debug("Set delegate " + value);
  +        delegate = (UtilDelegate) Class.forName(value).newInstance();
       }
   
       public void unexportObject(Remote target) throws NoSuchObjectException {
  @@ -161,7 +159,14 @@
       }
   
       public Class loadClass(String className, String remoteCodebase, 
ClassLoader loader) throws ClassNotFoundException {
  -        return delegate.loadClass(className, remoteCodebase, loader);
  +        if (log.isDebugEnabled()) log.debug("loadClass: " + className + ", " 
+ remoteCodebase + ", " + loader);
  +
  +        Class result = delegate.loadClass(className, remoteCodebase, loader);
  +        if (result == null) {
  +            
  +        }
  +
  +        return result;
       }
   
       /**
  
  
  

Reply via email to