commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common ClassLoaderObjectInputStream.java
Date Mon, 04 Mar 2002 12:10:49 GMT
hammant     02/03/04 04:10:49

  Modified:    altrmi/src/java/org/apache/commons/altrmi/client
                        AltrmiClientInvocationHandler.java
                        AltrmiHostContext.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl
                        AbstractAltrmiFactory.java
                        AbstractClientInvocationHandler.java
                        AbstractHostContext.java
                        ClientClassAltrmiFactory.java
                        ServerClassAltrmiFactory.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/beep
                        BEEPInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/direct
                        DirectHostContext.java
                        DirectMarshalledHostContext.java
                        DirectMarshalledInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/multiple
                        AbstractMultipleInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/piped
                        AbstractPipedStreamInvocationHandler.java
                        PipedCustomStreamInvocationHandler.java
                        PipedObjectStreamInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/socket
                        AbstractSocketStreamInvocationHandler.java
                        SocketCustomStreamHostContext.java
                        SocketCustomStreamInvocationHandler.java
                        SocketObjectStreamHostContext.java
                        SocketObjectStreamInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/stream
                        ClientCustomStreamReadWriter.java
                        StreamInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/common
                        ClassLoaderObjectInputStream.java
  Log:
  changes to allow for complex clientside classloading arrangements
  
  Revision  Changes    Path
  1.4       +3 -0      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiClientInvocationHandler.java
  
  Index: AltrmiClientInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiClientInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AltrmiClientInvocationHandler.java	21 Jan 2002 20:10:34 -0000	1.3
  +++ AltrmiClientInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.4
  @@ -38,6 +38,9 @@
   
       void ping();
   
  +    ClassLoader getInterfacesClassLoader();
  +
  +
   }
   
   
  
  
  
  1.3       +2 -1      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiHostContext.java
  
  Index: AltrmiHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AltrmiHostContext.java	19 Jan 2002 13:30:18 -0000	1.2
  +++ AltrmiHostContext.java	4 Mar 2002 12:10:48 -0000	1.3
  @@ -17,7 +17,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.2 $
  + * @version * $Revision: 1.3 $
    */
   public interface AltrmiHostContext {
   
  @@ -29,4 +29,5 @@
        *
        */
       AltrmiClientInvocationHandler getInvocationHandler();
  +
   }
  
  
  
  1.14      +3 -4      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java
  
  Index: AbstractAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractAltrmiFactory.java	2 Feb 2002 12:18:02 -0000	1.13
  +++ AbstractAltrmiFactory.java	4 Mar 2002 12:10:48 -0000	1.14
  @@ -31,7 +31,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public abstract class AbstractAltrmiFactory implements AltrmiFactory {
   
  @@ -41,7 +41,7 @@
       private final boolean mBeanOnly;
       private transient String mTextToSign;
       protected Long mSession;
  -    protected ClassLoader mClassLoader;
  +
   
       /**
        * Constructor AbstractAltrmiFactory
  @@ -51,9 +51,8 @@
        * @param classLoader
        *
        */
  -    public AbstractAltrmiFactory(boolean beanOnly, ClassLoader classLoader) {
  +    public AbstractAltrmiFactory(boolean beanOnly) {
           mBeanOnly = beanOnly;
  -        mClassLoader = classLoader;
       }
   
       /**
  
  
  
  1.4       +5 -1      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractClientInvocationHandler.java
  
  Index: AbstractClientInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractClientInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractClientInvocationHandler.java	30 Jan 2002 23:42:44 -0000	1.3
  +++ AbstractClientInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.4
  @@ -26,7 +26,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public abstract class AbstractClientInvocationHandler implements AltrmiInvocationHandler,
AltrmiClientInvocationHandler {
   
  @@ -79,5 +79,9 @@
        */
       public void setConnectionPinger(AltrmiConnectionPinger connectionPinger) {
           mConnectionPinger = connectionPinger;
  +    }
  +
  +    public ClassLoader getInterfacesClassLoader() {
  +        return AbstractClientInvocationHandler.class.getClassLoader();
       }
   }
  
  
  
  1.3       +3 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractHostContext.java
  
  Index: AbstractHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractHostContext.java	4 Feb 2002 21:07:07 -0000	1.2
  +++ AbstractHostContext.java	4 Mar 2002 12:10:48 -0000	1.3
  @@ -21,9 +21,9 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -public class AbstractHostContext implements AltrmiHostContext {
  +public abstract class AbstractHostContext implements AltrmiHostContext {
   
       protected final AltrmiClientInvocationHandler mAltrmiClientInvocationHandler;
   
  @@ -62,4 +62,5 @@
       public void setAltrmiConnectionListener(AltrmiConnectionListener altrmiConnectionListener)
{
           mAltrmiClientInvocationHandler.setAltrmiConnectionListener(altrmiConnectionListener);
       }
  +
   }
  
  
  
  1.10      +5 -5      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ClientClassAltrmiFactory.java
  
  Index: ClientClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ClientClassAltrmiFactory.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ClientClassAltrmiFactory.java	2 Feb 2002 12:18:02 -0000	1.9
  +++ ClientClassAltrmiFactory.java	4 Mar 2002 12:10:48 -0000	1.10
  @@ -29,7 +29,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class ClientClassAltrmiFactory extends AbstractAltrmiFactory {
   
  @@ -41,12 +41,12 @@
        *
        */
       public ClientClassAltrmiFactory(boolean beanOnly) {
  -        super(beanOnly, ClientClassAltrmiFactory.class.getClassLoader());
  +        super(beanOnly);
       }
   
  -    public ClientClassAltrmiFactory(boolean beanOnly, ClassLoader classLoader) {
  -        super(beanOnly, classLoader);
  -    }
  +//    public ClientClassAltrmiFactory(boolean beanOnly, ClassLoader classLoader) {
  +  //      super(beanOnly, classLoader);
  +    //}
   
       /**
        * Method lookup
  
  
  
  1.12      +4 -14     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ServerClassAltrmiFactory.java
  
  Index: ServerClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ServerClassAltrmiFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ServerClassAltrmiFactory.java	2 Feb 2002 12:18:02 -0000	1.11
  +++ ServerClassAltrmiFactory.java	4 Mar 2002 12:10:48 -0000	1.12
  @@ -36,12 +36,13 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class ServerClassAltrmiFactory extends AbstractAltrmiFactory {
   
       private HashMap mPublishedServiceClassLoaders = new HashMap();
   
  +
       /**
        * Constructor ServerClassAltrmiFactory
        *
  @@ -50,20 +51,9 @@
        *
        */
       public ServerClassAltrmiFactory(boolean beanOnly) {
  -        super(beanOnly, ServerClassAltrmiFactory.class.getClassLoader());
  +        super(beanOnly);
       }
   
  -    /**
  -     * Constructor ServerClassAltrmiFactory
  -     *
  -     *
  -     * @param beanOnly
  -     * @param classLoader
  -     *
  -     */
  -    public ServerClassAltrmiFactory(boolean beanOnly, ClassLoader classLoader) {
  -        super(beanOnly, classLoader);
  -    }
   
       /**
        * Method lookup
  @@ -150,7 +140,7 @@
                                                           + " not published on Server");
                   }
   
  -                tcl = new TransportedClassLoader(mClassLoader);
  +                tcl = new TransportedClassLoader(mHostContext.getInvocationHandler().getInterfacesClassLoader());
   
                   tcl.add(beanClassName, cr.getBeanClassBytes());
   
  
  
  
  1.2       +1 -0      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/beep/BEEPInvocationHandler.java
  
  Index: BEEPInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/beep/BEEPInvocationHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BEEPInvocationHandler.java	27 Feb 2002 14:47:36 -0000	1.1
  +++ BEEPInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.2
  @@ -43,7 +43,7 @@
    *
    *
    * @author Vinay Chandrasekharan<a href="mailto:vinay_chandran@users.surceforge.net">vinay_chandran@users.surceforge.net</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class BEEPInvocationHandler extends StreamInvocationHandler 
   {
  @@ -66,6 +66,7 @@
       public BEEPInvocationHandler(String host, int port)
               throws AltrmiConnectionException 
   	{
  +        super(BEEPInvocationHandler.class.getClassLoader());
           mHost = host;
           mPort = port;
           try 
  
  
  
  1.3       +1 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectHostContext.java
  
  Index: DirectHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DirectHostContext.java	26 Jan 2002 15:22:16 -0000	1.2
  +++ DirectHostContext.java	4 Mar 2002 12:10:48 -0000	1.3
  @@ -19,7 +19,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class DirectHostContext extends AbstractHostContext {
   
  @@ -39,5 +39,4 @@
   
       //public void setAltrmiConnectionListener(AltrmiConnectionListener altrmiConnectionListener)
{
       //}
  -
   }
  
  
  
  1.3       +1 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledHostContext.java
  
  Index: DirectMarshalledHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DirectMarshalledHostContext.java	2 Feb 2002 23:39:41 -0000	1.2
  +++ DirectMarshalledHostContext.java	4 Mar 2002 12:10:48 -0000	1.3
  @@ -19,7 +19,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class DirectMarshalledHostContext extends AbstractHostContext {
   
  @@ -41,6 +41,5 @@
               throws AltrmiConnectionException {
           super(new DirectMarshalledInvocationHandler(altrmiInvocationHandler, classLoader));
       }
  -
   
   }
  
  
  
  1.4       +8 -5      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java
  
  Index: DirectMarshalledInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DirectMarshalledInvocationHandler.java	2 Feb 2002 23:39:41 -0000	1.3
  +++ DirectMarshalledInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.4
  @@ -36,12 +36,12 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class DirectMarshalledInvocationHandler extends AbstractDirectInvocationHandler
{
   
       private AltrmiMarshalledInvocationHandler mAltrmiInvocationHandler;
  -    private ClassLoader mClassLoader;
  +    private ClassLoader mInterfacesClassLoader;
   
   
       /**
  @@ -56,13 +56,13 @@
       public DirectMarshalledInvocationHandler(AltrmiMarshalledInvocationHandler altrmiInvocationHandler)
               throws AltrmiConnectionException {
           mAltrmiInvocationHandler = altrmiInvocationHandler;
  -        mClassLoader = this.getClass().getClassLoader();
  +        mInterfacesClassLoader = this.getClass().getClassLoader();
       }
   
       public DirectMarshalledInvocationHandler(AltrmiMarshalledInvocationHandler altrmiInvocationHandler,
ClassLoader classLoader)
               throws AltrmiConnectionException {
           mAltrmiInvocationHandler = altrmiInvocationHandler;
  -        mClassLoader = classLoader;
  +        mInterfacesClassLoader = classLoader;
       }
   
       protected AltrmiReply performInvocation(AltrmiRequest request) throws IOException {
  @@ -70,7 +70,7 @@
           try {
               byte[] serRequest = SerializationHelper.getBytesFromInstance(request);
               byte[] serReply = mAltrmiInvocationHandler.handleInvocation(serRequest);
  -            return (AltrmiReply) SerializationHelper.getInstanceFromBytes(serReply, mClassLoader);
  +            return (AltrmiReply) SerializationHelper.getInstanceFromBytes(serReply, mInterfacesClassLoader);
           } catch (IOException e) {
               e.printStackTrace();
               return new RequestFailedReply("Some IO Exception on server side : " + e.getMessage());
  @@ -81,4 +81,7 @@
   
       }
   
  +    public ClassLoader getInterfacesClassLoader() {
  +        return mInterfacesClassLoader;
  +    }
   }
  
  
  
  1.2       +49 -9     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/multiple/AbstractMultipleInvocationHandler.java
  
  Index: AbstractMultipleInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/multiple/AbstractMultipleInvocationHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractMultipleInvocationHandler.java	21 Jan 2002 21:19:49 -0000	1.1
  +++ AbstractMultipleInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.2
  @@ -1,3 +1,4 @@
  +
   /*
    * Copyright (C) The Apache Software Foundation. All rights reserved.
    *
  @@ -7,6 +8,8 @@
    */
   package org.apache.commons.altrmi.client.impl.multiple;
   
  +
  +
   import org.apache.commons.altrmi.client.AltrmiClientInvocationHandler;
   import org.apache.commons.altrmi.client.AltrmiConnectionListener;
   import org.apache.commons.altrmi.client.AltrmiConnectionPinger;
  @@ -15,6 +18,14 @@
   
   import java.io.IOException;
   
  +
  +/**
  + * Class AbstractMultipleInvocationHandler
  + *
  + *
  + * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  + * @version $Revision: 1.2 $
  + */
   public abstract class AbstractMultipleInvocationHandler implements AltrmiClientInvocationHandler
{
   
       private AltrmiConnectionListener mAltrmiConnectionListener;
  @@ -35,8 +46,6 @@
           mMultipleHostContext = multipleHostContext;
       }
   
  -
  -
       /**
        * Method setConnectionPinger
        *
  @@ -44,19 +53,50 @@
        * @param connectionPinger
        *
        */
  -    public void setConnectionPinger(AltrmiConnectionPinger connectionPinger) {
  -    }
  +    public void setConnectionPinger(AltrmiConnectionPinger connectionPinger) {}
   
  -    public void initialize() throws IOException {
  -    }
  +    /**
  +     * Method initialize
  +     *
  +     *
  +     * @throws IOException
  +     *
  +     */
  +    public void initialize() throws IOException {}
   
  -    public void close() {
  -    }
  +    /**
  +     * Method close
  +     *
  +     *
  +     */
  +    public void close() {}
   
  +    /**
  +     * Method getLastRealRequest
  +     *
  +     *
  +     * @return
  +     *
  +     */
       public long getLastRealRequest() {
           return 0;
       }
   
  -    public void ping() {
  +    /**
  +     * Method ping
  +     *
  +     *
  +     */
  +    public void ping() {}
  +
  +    /**
  +     * Method getInterfacesClassLoader
  +     *
  +     *
  +     * @return
  +     *
  +     */
  +    public ClassLoader getInterfacesClassLoader() {
  +        return null;    //TODO
       }
   }
  
  
  
  1.5       +15 -4     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/AbstractPipedStreamInvocationHandler.java
  
  Index: AbstractPipedStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/AbstractPipedStreamInvocationHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractPipedStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.4
  +++ AbstractPipedStreamInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.5
  @@ -31,7 +31,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public abstract class AbstractPipedStreamInvocationHandler extends StreamInvocationHandler
{
   
  @@ -42,19 +42,30 @@
        * Constructor AbstractPipedStreamInvocationHandler
        *
        *
  -     *
        * @param is
        * @param os
  +     * @param interfacesClassLoader
        *
        * @throws AltrmiConnectionException
        *
        */
  -    public AbstractPipedStreamInvocationHandler(PipedInputStream is, PipedOutputStream
os)
  -            throws AltrmiConnectionException {
  +    public AbstractPipedStreamInvocationHandler(
  +            PipedInputStream is, PipedOutputStream os, ClassLoader interfacesClassLoader)
  +                throws AltrmiConnectionException {
  +
  +        super(interfacesClassLoader);
  +
           mIS = is;
           mOS = os;
       }
   
  +    /**
  +     * Method initialize
  +     *
  +     *
  +     * @throws IOException
  +     *
  +     */
       public void initialize() throws IOException {
           setObjectReadWriter(createClientStreamReadWriter(mIS, mOS));
           super.initialize();
  
  
  
  1.4       +28 -4     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedCustomStreamInvocationHandler.java
  
  Index: PipedCustomStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedCustomStreamInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PipedCustomStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.3
  +++ PipedCustomStreamInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.4
  @@ -26,7 +26,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class PipedCustomStreamInvocationHandler
           extends AbstractPipedStreamInvocationHandler {
  @@ -35,7 +35,6 @@
        * Constructor PipedCustomStreamInvocationHandler
        *
        *
  -     *
        * @param is
        * @param os
        *
  @@ -44,11 +43,36 @@
        */
       public PipedCustomStreamInvocationHandler(PipedInputStream is, PipedOutputStream os)
               throws AltrmiConnectionException {
  -        super(is, os);
  +        super(is, os, PipedCustomStreamInvocationHandler.class.getClassLoader());
  +    }
  +
  +    /**
  +     * Constructor PipedCustomStreamInvocationHandler
  +     *
  +     *
  +     * @param is
  +     * @param os
  +     * @param interfacesClassLoader
  +     *
  +     * @throws AltrmiConnectionException
  +     *
  +     */
  +    public PipedCustomStreamInvocationHandler(
  +            PipedInputStream is, PipedOutputStream os, ClassLoader interfacesClassLoader)
  +                throws AltrmiConnectionException {
  +        super(is, os, interfacesClassLoader);
       }
   
       protected ClientStreamReadWriter createClientStreamReadWriter(
               InputStream in, OutputStream out) throws IOException {
  -        return new ClientCustomStreamReadWriter(in, out);
  +
  +        return new ClientCustomStreamReadWriter(in, out,
  +                                                PipedCustomStreamInvocationHandler.class
  +                                                    .getClassLoader());
  +    }
  +
  +    protected ClientStreamReadWriter createClientStreamReadWriter(
  +            InputStream in, OutputStream out, ClassLoader classLoader) throws IOException
{
  +        return new ClientCustomStreamReadWriter(in, out, classLoader);
       }
   }
  
  
  
  1.6       +19 -3     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedObjectStreamInvocationHandler.java
  
  Index: PipedObjectStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedObjectStreamInvocationHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PipedObjectStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.5
  +++ PipedObjectStreamInvocationHandler.java	4 Mar 2002 12:10:48 -0000	1.6
  @@ -26,7 +26,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public final class PipedObjectStreamInvocationHandler
           extends AbstractPipedStreamInvocationHandler {
  @@ -35,7 +35,6 @@
        * Constructor PipedObjectStreamInvocationHandler
        *
        *
  -     *
        * @param is
        * @param os
        *
  @@ -44,7 +43,24 @@
        */
       public PipedObjectStreamInvocationHandler(PipedInputStream is, PipedOutputStream os)
               throws AltrmiConnectionException {
  -        super(is, os);
  +        super(is, os, PipedObjectStreamInvocationHandler.class.getClassLoader());
  +    }
  +
  +    /**
  +     * Constructor PipedObjectStreamInvocationHandler
  +     *
  +     *
  +     * @param is
  +     * @param os
  +     * @param interfacesClassLoader
  +     *
  +     * @throws AltrmiConnectionException
  +     *
  +     */
  +    public PipedObjectStreamInvocationHandler(
  +            PipedInputStream is, PipedOutputStream os, ClassLoader interfacesClassLoader)
  +                throws AltrmiConnectionException {
  +        super(is, os, interfacesClassLoader);
       }
   
       protected ClientStreamReadWriter createClientStreamReadWriter(
  
  
  
  1.7       +6 -4      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/AbstractSocketStreamInvocationHandler.java
  
  Index: AbstractSocketStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/AbstractSocketStreamInvocationHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractSocketStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.6
  +++ AbstractSocketStreamInvocationHandler.java	4 Mar 2002 12:10:49 -0000	1.7
  @@ -30,12 +30,13 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public abstract class AbstractSocketStreamInvocationHandler extends StreamInvocationHandler
{
   
  -    private String mHost;
  -    private int mPort;
  +    private final String mHost;
  +    private final int mPort;
  +
   
       /**
        * Constructor SocketCustomStreamInvocationHandler
  @@ -47,9 +48,10 @@
        * @throws AltrmiConnectionException
        *
        */
  -    public AbstractSocketStreamInvocationHandler(String host, int port)
  +    public AbstractSocketStreamInvocationHandler(String host, int port, ClassLoader classLoader)
               throws AltrmiConnectionException {
   
  +        super(classLoader);
           mHost = host;
           mPort = port;
   
  
  
  
  1.3       +7 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamHostContext.java
  
  Index: SocketCustomStreamHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SocketCustomStreamHostContext.java	21 Jan 2002 15:38:21 -0000	1.2
  +++ SocketCustomStreamHostContext.java	4 Mar 2002 12:10:49 -0000	1.3
  @@ -21,7 +21,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class SocketCustomStreamHostContext extends AbstractHostContext {
   
  @@ -36,6 +36,11 @@
        *
        */
       public SocketCustomStreamHostContext(String host, int port) throws AltrmiConnectionException
{
  -        super(new SocketCustomStreamInvocationHandler(host, port));
  +        super(new SocketCustomStreamInvocationHandler(host, port, SocketCustomStreamHostContext.class.getClassLoader()));
       }
  +
  +    public SocketCustomStreamHostContext(String host, int port, ClassLoader classLoader)
throws AltrmiConnectionException {
  +        super(new SocketCustomStreamInvocationHandler(host, port, classLoader));
  +    }
  +
   }
  
  
  
  1.4       +6 -6      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamInvocationHandler.java
  
  Index: SocketCustomStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SocketCustomStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.3
  +++ SocketCustomStreamInvocationHandler.java	4 Mar 2002 12:10:49 -0000	1.4
  @@ -24,13 +24,13 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class SocketCustomStreamInvocationHandler
           extends AbstractSocketStreamInvocationHandler {
   
  -    private String mHost;
  -    private int mPort;
  +
  +
   
       /**
        * Constructor SocketCustomStreamInvocationHandler
  @@ -42,13 +42,13 @@
        * @throws AltrmiConnectionException
        *
        */
  -    public SocketCustomStreamInvocationHandler(String host, int port)
  +    public SocketCustomStreamInvocationHandler(String host, int port, ClassLoader classLoader)
               throws AltrmiConnectionException {
  -        super(host, port);
  +        super(host, port, classLoader);
       }
   
       protected ClientStreamReadWriter createClientStreamReadWriter(
               InputStream in, OutputStream out) throws IOException {
  -        return new ClientCustomStreamReadWriter(in, out);
  +        return new ClientCustomStreamReadWriter(in, out, mInterfacesClassLoader);
       }
   }
  
  
  
  1.6       +30 -3     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamHostContext.java
  
  Index: SocketObjectStreamHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamHostContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SocketObjectStreamHostContext.java	21 Jan 2002 15:38:21 -0000	1.5
  +++ SocketObjectStreamHostContext.java	4 Mar 2002 12:10:49 -0000	1.6
  @@ -21,7 +21,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class SocketObjectStreamHostContext extends AbstractHostContext {
   
  @@ -39,7 +39,11 @@
        *
        */
       public SocketObjectStreamHostContext(String host, int port) throws AltrmiConnectionException
{
  -        super(new SocketObjectStreamInvocationHandler(host, port, null, null));
  +        super(new SocketObjectStreamInvocationHandler(host, port, null, null, SocketObjectStreamHostContext.class.getClassLoader()
));
  +    }
  +
  +    public SocketObjectStreamHostContext(String host, int port, ClassLoader classLoader)
throws AltrmiConnectionException {
  +        super(new SocketObjectStreamInvocationHandler(host, port, null, null, classLoader));
       }
   
       /**
  @@ -57,7 +61,30 @@
       public SocketObjectStreamHostContext(
               String host, int port, String objectInputStreamClassName, String objectOutputStreamClassName)
                   throws AltrmiConnectionException {
  +
  +        super(new SocketObjectStreamInvocationHandler(host, port, objectInputStreamClassName,
  +                                                      objectOutputStreamClassName,
  +                                                      SocketObjectStreamHostContext.class
  +                                                          .getClassLoader()));
  +    }
  +
  +    /**
  +     * Constructor SocketObjectStreamHostContext
  +     *
  +     *
  +     * @param host
  +     * @param port
  +     * @param objectInputStreamClassName
  +     * @param objectOutputStreamClassName
  +     * @param classLoader
  +     *
  +     * @throws AltrmiConnectionException
  +     *
  +     */
  +    public SocketObjectStreamHostContext(
  +            String host, int port, String objectInputStreamClassName, String objectOutputStreamClassName,
ClassLoader classLoader)
  +                throws AltrmiConnectionException {
           super(new SocketObjectStreamInvocationHandler(host, port, objectInputStreamClassName,
  -                                                      objectOutputStreamClassName));
  +                                                      objectOutputStreamClassName, classLoader));
       }
   }
  
  
  
  1.8       +6 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamInvocationHandler.java
  
  Index: SocketObjectStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamInvocationHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SocketObjectStreamInvocationHandler.java	20 Jan 2002 00:13:40 -0000	1.7
  +++ SocketObjectStreamInvocationHandler.java	4 Mar 2002 12:10:49 -0000	1.8
  @@ -24,7 +24,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public final class SocketObjectStreamInvocationHandler
           extends AbstractSocketStreamInvocationHandler {
  @@ -45,10 +45,13 @@
        *
        */
       public SocketObjectStreamInvocationHandler(
  -            String host, int port, String objectInputStreamClassName, String objectOutputStreamClassName)
  +            String host, int port, String objectInputStreamClassName, String objectOutputStreamClassName,
ClassLoader classLoader)
                   throws AltrmiConnectionException {
   
  -        super(host, port);
  +        super(host, port, classLoader);
  +
  +        //TODO - is this a pending problem?  The superclass invokes createClientStreamReadWriter
  +        // perhaps an init() is needed.
   
           mObjectInputStreamClassName = objectInputStreamClassName;
           mObjectOutputStreamClassName = objectOutputStreamClassName;
  
  
  
  1.3       +5 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java
  
  Index: ClientCustomStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClientCustomStreamReadWriter.java	26 Jan 2002 15:22:16 -0000	1.2
  +++ ClientCustomStreamReadWriter.java	4 Mar 2002 12:10:49 -0000	1.3
  @@ -25,12 +25,13 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class ClientCustomStreamReadWriter extends ClientStreamReadWriter {
   
       private DataInputStream mDataInputStream;
       private DataOutputStream mDataOutputStream;
  +    private ClassLoader mClassLoader;
   
       /**
        * Constructor ClientCustomStreamReadWriter
  @@ -42,10 +43,11 @@
        * @throws IOException
        *
        */
  -    public ClientCustomStreamReadWriter(InputStream inputStream, OutputStream outputStream)
  +    public ClientCustomStreamReadWriter(InputStream inputStream, OutputStream outputStream,
ClassLoader classLoader)
               throws IOException {
           mDataOutputStream = new DataOutputStream(new BufferedOutputStream(outputStream));
           mDataInputStream = new DataInputStream(inputStream);
  +        mClassLoader = classLoader;
       }
   
       protected synchronized AltrmiReply postRequest(AltrmiRequest altrmiRequest)
  @@ -72,6 +74,6 @@
   
           mDataInputStream.read(byteArray);
   
  -        return (AltrmiReply) SerializationHelper.getInstanceFromBytes(byteArray);
  +        return (AltrmiReply) SerializationHelper.getInstanceFromBytes(byteArray, mClassLoader);
       }
   }
  
  
  
  1.6       +14 -2     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java
  
  Index: StreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StreamInvocationHandler.java	4 Feb 2002 21:07:07 -0000	1.5
  +++ StreamInvocationHandler.java	4 Mar 2002 12:10:49 -0000	1.6
  @@ -37,13 +37,22 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class StreamInvocationHandler extends AbstractClientInvocationHandler {
   
       private ClientStreamReadWriter mObjectReadWriter;
       private boolean mMethodLogging = false;
       private long mLastRealRequest = System.currentTimeMillis();
  +    protected final ClassLoader mInterfacesClassLoader;
  +
  +    public StreamInvocationHandler(ClassLoader interfacesClassLoader) {
  +        mInterfacesClassLoader = interfacesClassLoader;
  +    }
  +
  +    public ClassLoader getInterfacesClassLoader() {
  +        return mInterfacesClassLoader;
  +    }
   
       /**
        * Method setAltrmiConnectionListener
  @@ -153,7 +162,10 @@
                   return reply;
               }
           } catch (ClassNotFoundException e) {
  -            throw new AltrmiInvocationException("Class definition missing on Deserialization"
  +            System.out.println("--");
  +            e.printStackTrace();
  +            System.out.println("--");
  +            throw new AltrmiInvocationException("Class definition missing on Deserialization:
"
                                                   + e.getMessage());
           }
       }
  
  
  
  1.3       +11 -0     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/ClassLoaderObjectInputStream.java
  
  Index: ClassLoaderObjectInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/ClassLoaderObjectInputStream.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassLoaderObjectInputStream.java	18 Feb 2002 21:25:24 -0000	1.2
  +++ ClassLoaderObjectInputStream.java	4 Mar 2002 12:10:49 -0000	1.3
  @@ -46,7 +46,18 @@
               return clazz; // the classloader knows of the class
           } else {
               // classloader knows not of class, let the super classloader do it
  +            //printCLs();
               return super.resolveClass(objectStreamClass);
  +        }
  +    }
  +
  +    // for debugging
  +    private void printCLs() {
  +        ClassLoader cl = mClassLoader;
  +        System.out.println("Cl1>" + cl);
  +        while(cl != null) {
  +            System.out.println("Cl?>" + cl);
  +            cl = cl.getParent();
           }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message