You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ha...@apache.org on 2002/01/10 01:08:59 UTC

cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test PipeTest.java SocketClientTest.java SocketServerTest.java TestClient.java

hammant     02/01/09 16:08:59

  Modified:    altrmi/src/java/org/apache/commons/altrmi/test PipeTest.java
                        SocketClientTest.java SocketServerTest.java
                        TestClient.java
  Added:       altrmi/src/java/org/apache/commons/altrmi/client/impl/piped
                        PipedObjectStreamHostContext.java
                        PipedObjectStreamInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/socket
                        SocketObjectStreamHostContext.java
                        SocketObjectStreamInvocationHandler.java
  Removed:     altrmi/src/java/org/apache/commons/altrmi/client/impl/piped
                        PipedAltrmiHostContext.java
                        PipedInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/socket
                        PlainSocketAltrmiHostContext.java
                        PlainSocketInvocationHandler.java
  Log:
  sensible renames
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedObjectStreamHostContext.java
  
  Index: PipedObjectStreamHostContext.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.commons.altrmi.client.impl.piped;
  
  
  
  import org.apache.commons.altrmi.client.impl.AbstractAltrmiHostContext;
  import org.apache.commons.altrmi.common.AltrmiConnectionException;
  import org.apache.commons.altrmi.server.impl.piped.PipedServer;
  
  
  /**
   * Class PipedObjectStreamHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PipedObjectStreamHostContext extends AbstractAltrmiHostContext {
  
      /**
       * Constructor PipedObjectStreamHostContext
       *
       *
       * @param pipedServer
       *
       * @throws AltrmiConnectionException
       *
       */
      public PipedObjectStreamHostContext(PipedServer pipedServer) throws AltrmiConnectionException {
          super(new PipedObjectStreamInvocationHandler(pipedServer));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/piped/PipedObjectStreamInvocationHandler.java
  
  Index: PipedObjectStreamInvocationHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.commons.altrmi.client.impl.piped;
  
  
  
  import org.apache.commons.altrmi.client.impl.ObjectStreamInvocationHandler;
  import org.apache.commons.altrmi.common.AltrmiConnectionException;
  import org.apache.commons.altrmi.common.AltrmiPipeConnector;
  import org.apache.commons.altrmi.common.AltrmiInvocationException;
  
  import java.io.PipedOutputStream;
  import java.io.PipedInputStream;
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  import java.io.IOException;
  
  
  /**
   * Class PipedObjectStreamInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class PipedObjectStreamInvocationHandler extends ObjectStreamInvocationHandler {
  
      /**
       * Constructor PipedObjectStreamInvocationHandler
       *
       *
       * @param apc
       *
       * @throws AltrmiConnectionException
       *
       */
      public PipedObjectStreamInvocationHandler(AltrmiPipeConnector apc) throws AltrmiConnectionException {
  
          try {
              PipedOutputStream pOS = new PipedOutputStream();
              PipedInputStream pIS = apc.connect(pOS);
              ObjectOutputStream oOS = new ObjectOutputStream(pOS);
              ObjectInputStream oIS = new ObjectInputStream(pIS);
  
              setObjectInputStream(oIS);
              setObjectOutputStream(oOS);
          } catch (IOException ioe) {
              throw new AltrmiConnectionException("Cannot bind the pipes together :"
                                                + ioe.getMessage());
          }
      }
  
      protected boolean tryReconnect() {
          // blimey how do we reconnect this?
          throw new AltrmiInvocationException("Piped connection broken, unable to reconnect.");
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamHostContext.java
  
  Index: SocketObjectStreamHostContext.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.commons.altrmi.client.impl.socket;
  
  
  
  import org.apache.commons.altrmi.client.impl.AbstractAltrmiHostContext;
  import org.apache.commons.altrmi.common.AltrmiConnectionException;
  
  import java.net.Socket;
  
  
  /**
   * Class SocketObjectStreamHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class SocketObjectStreamHostContext extends AbstractAltrmiHostContext {
  
      /**
       * Constructor SocketObjectStreamHostContext
       *
       *
       * @param host
       * @param port
       *
       * @throws AltrmiConnectionException
       *
       */
      public SocketObjectStreamHostContext(String host, int port) throws AltrmiConnectionException {
          super(new SocketObjectStreamInvocationHandler(host, port));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamInvocationHandler.java
  
  Index: SocketObjectStreamInvocationHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */package org.apache.commons.altrmi.client.impl.socket;
  
  import org.apache.commons.altrmi.client.impl.ObjectStreamInvocationHandler;
  import org.apache.commons.altrmi.common.AltrmiConnectionException;
  
  import java.net.Socket;
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  import java.io.IOException;
  
  
  /**
   * Class SocketObjectStreamInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class SocketObjectStreamInvocationHandler extends ObjectStreamInvocationHandler {
  
      private String mHost;
      private int mPort;
  
      /**
       * Constructor SocketObjectStreamInvocationHandler
       *
       *
       * @param host
       * @param port
       *
       * @throws AltrmiConnectionException
       *
       */
      public SocketObjectStreamInvocationHandler(String host, int port) throws AltrmiConnectionException {
          mHost = host;
          mPort = port;
          try {
              Socket socket = new Socket(host, port);
              ObjectOutputStream oOS = new ObjectOutputStream(socket.getOutputStream());
              ObjectInputStream oIS = new ObjectInputStream(socket.getInputStream());
              setObjectInputStream(oIS);
              setObjectOutputStream(oOS);
          } catch (IOException ioe) {
              throw new AltrmiConnectionException("Cannot open Stream(s) for socket");
          }
  
  
      }
  
      /**
       * Method tryReconnect
       *
       *
       * @return connected or not.
       */
      protected boolean tryReconnect() {
          try {
              Socket socket = new Socket(mHost, mPort);
              ObjectOutputStream oOS = new ObjectOutputStream(socket.getOutputStream());
              ObjectInputStream oIS = new ObjectInputStream(socket.getInputStream());
  
              setObjectInputStream(oIS);
              setObjectOutputStream(oOS);
              return true;
          } catch (IOException ioe) {
              return false;
          }
      }
  }
  
  
  
  1.2       +5 -5      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/PipeTest.java
  
  Index: PipeTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/PipeTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PipeTest.java	9 Jan 2002 19:25:56 -0000	1.1
  +++ PipeTest.java	10 Jan 2002 00:08:59 -0000	1.2
  @@ -11,10 +11,10 @@
   
   import org.apache.commons.altrmi.server.impl.piped.PipedServer;
   import org.apache.commons.altrmi.client.AltrmiHostContext;
  -import org.apache.commons.altrmi.client.impl.socket.PlainSocketAltrmiHostContext;
  +import org.apache.commons.altrmi.client.impl.socket.SocketObjectStreamHostContext;
   import org.apache.commons.altrmi.client.AltrmiFactory;
   import org.apache.commons.altrmi.common.AltrmiConnectionException;
  -import org.apache.commons.altrmi.client.impl.piped.PipedAltrmiHostContext;
  +import org.apache.commons.altrmi.client.impl.piped.PipedObjectStreamHostContext;
   import org.apache.commons.altrmi.client.impl.ServerClassAltrmiFactory;
   import org.apache.commons.altrmi.client.impl.ClientClassAltrmiFactory;
   
  @@ -26,7 +26,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class PipeTest {
   
  @@ -64,7 +64,7 @@
        *
        *
        * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  -     * @version $Revision: 1.1 $
  +     * @version $Revision: 1.2 $
        */
       static class PipedTestClient implements Runnable {
   
  @@ -89,7 +89,7 @@
           public void run() {
   
               try {
  -                AltrmiHostContext arhc = new PipedAltrmiHostContext(mPipedServer);
  +                AltrmiHostContext arhc = new PipedObjectStreamHostContext(mPipedServer);
                   AltrmiFactory af = null;
   
                   if (mServerOrClientFactory.equals("S")) {
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/SocketClientTest.java
  
  Index: SocketClientTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/SocketClientTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SocketClientTest.java	9 Jan 2002 19:25:56 -0000	1.1
  +++ SocketClientTest.java	10 Jan 2002 00:08:59 -0000	1.2
  @@ -12,7 +12,7 @@
   import org.apache.commons.altrmi.client.AltrmiHostContext;
   import org.apache.commons.altrmi.client.AltrmiFactory;
   import org.apache.commons.altrmi.common.AltrmiConnectionException;
  -import org.apache.commons.altrmi.client.impl.socket.PlainSocketAltrmiHostContext;
  +import org.apache.commons.altrmi.client.impl.socket.SocketObjectStreamHostContext;
   import org.apache.commons.altrmi.client.impl.ServerClassAltrmiFactory;
   import org.apache.commons.altrmi.client.impl.ClientClassAltrmiFactory;
   
  @@ -24,7 +24,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class SocketClientTest {
   
  @@ -41,7 +41,7 @@
   
           System.out.println("Stream over Socket Client");
   
  -        AltrmiHostContext arhc = new PlainSocketAltrmiHostContext("127.0.0.1", 1234);
  +        AltrmiHostContext arhc = new SocketObjectStreamHostContext("127.0.0.1", 1234);
           AltrmiFactory af = null;
   
           if (args[0].equals("S")) {
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/SocketServerTest.java
  
  Index: SocketServerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/SocketServerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SocketServerTest.java	9 Jan 2002 19:25:56 -0000	1.1
  +++ SocketServerTest.java	10 Jan 2002 00:08:59 -0000	1.2
  @@ -9,7 +9,7 @@
   
   
   
  -import org.apache.commons.altrmi.server.impl.socket.PlainSocketServer;
  +import org.apache.commons.altrmi.server.impl.socket.CompleteSocketObjectStreamServer;
   
   import java.io.IOException;
   
  @@ -19,7 +19,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class SocketServerTest {
   
  @@ -36,7 +36,7 @@
   
           System.out.println("Stream over Socket Server");
   
  -        PlainSocketServer pss = new PlainSocketServer(1234);
  +        CompleteSocketObjectStreamServer pss = new CompleteSocketObjectStreamServer(1234);
           TestInterfaceImpl ti = new TestInterfaceImpl();
   
           pss.publish(ti, "Hello", TestInterface.class, TestInterface2.class);
  
  
  
  1.2       +2 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/test/TestClient.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestClient.java	9 Jan 2002 19:25:56 -0000	1.1
  +++ TestClient.java	10 Jan 2002 00:08:59 -0000	1.2
  @@ -10,7 +10,7 @@
   
   
   import org.apache.commons.altrmi.client.AltrmiHostContext;
  -import org.apache.commons.altrmi.client.impl.socket.PlainSocketAltrmiHostContext;
  +import org.apache.commons.altrmi.client.impl.socket.SocketObjectStreamHostContext;
   import org.apache.commons.altrmi.client.AltrmiFactory;
   
   import java.io.IOException;
  @@ -23,7 +23,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class TestClient {
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>