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 2001/12/28 19:08:39 UTC

cvs commit: jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test DirectTest.java PipeTest.java RmiClientTest.java RmiServerTest.java SocketClientTest.java SocketServerTest.java TestClient.java TestInterface.java TestInterfaceImpl.java

hammant     01/12/28 10:08:39

  Added:       armi     build.xml test.xml
               armi/src/java/org/apache/commons/armi/client
                        ArmiFactory.java ArmiHostContext.java
               armi/src/java/org/apache/commons/armi/client/impl
                        AbstractArmiHostContext.java BaseServedObject.java
                        DefaultArmiFactory.java
                        ObjectStreamInvocationHandler.java
               armi/src/java/org/apache/commons/armi/client/impl/direct
                        DirectArmiHostContext.java
                        DirectInvocationHandler.java
               armi/src/java/org/apache/commons/armi/client/impl/piped
                        PipedArmiHostContext.java
                        PipedInvocationHandler.java
               armi/src/java/org/apache/commons/armi/client/impl/rmi
                        RmiArmiHostContext.java RmiInvocationHandler.java
               armi/src/java/org/apache/commons/armi/client/impl/socket
                        PlainSocketArmiHostContext.java
                        PlainSocketInvocationHandler.java
               armi/src/java/org/apache/commons/armi/common
                        AbstractMethodHandler.java
                        ArmiConnectionException.java
                        ArmiInvocationException.java
                        ArmiInvocationHandler.java ArmiPipeConnector.java
                        ArmiReply.java ArmiRequest.java ExceptionReply.java
                        MethodReply.java MethodRequest.java
                        RmiArmiInvocationHandler.java
               armi/src/java/org/apache/commons/armi/generator
                        SourceGenerator.java
               armi/src/java/org/apache/commons/armi/generator/ant
                        ArmiTask.java
               armi/src/java/org/apache/commons/armi/server ArmiServer.java
                        ArmiServerException.java
               armi/src/java/org/apache/commons/armi/server/impl
                        AbstractServer.java DefaultInvocationHandler.java
                        ObjectStreamServerConnection.java
               armi/src/java/org/apache/commons/armi/server/impl/direct
                        DirectArmiInovcationAdapter.java DirectServer.java
               armi/src/java/org/apache/commons/armi/server/impl/piped
                        PipedServer.java
               armi/src/java/org/apache/commons/armi/server/impl/rmi
                        RmiArmiInovcationAdapter.java RmiServer.java
               armi/src/java/org/apache/commons/armi/server/impl/socket
                        PlainSocketServer.java
               armi/src/java/org/apache/commons/armi/test DirectTest.java
                        PipeTest.java RmiClientTest.java RmiServerTest.java
                        SocketClientTest.java SocketServerTest.java
                        TestClient.java TestInterface.java
                        TestInterfaceImpl.java
  Log:
  Initial cut of Armi
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/armi/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="Alt (to) RMI" default="compile" basedir=".">
  
  
  <!--
          "Alt (to) RMI" component of the Jakarta Commons Subproject
          $Id: build.xml,v 1.1 2001/12/28 18:08:37 hammant Exp $
  -->
  
  
  <!-- ========== Initialize Properties ===================================== -->
  
  
    <property file="build.properties"/>                <!-- Component local   -->
    <property file="../build.properties"/>             <!-- Commons local     -->
    <property file="${user.home}/build.properties"/>   <!-- User local        -->
  
  
  <!-- ========== External Dependencies ===================================== -->
  
  
    <!-- The home directory for the Commons collection classes distribution -->
    <property name="commons-collections.home" value="../collections/dist"/>
  
    <!-- The directory containing your binary distribution of JUnit,
         version 3.7 or later -->
    <property name="junit.home"              value="/usr/local/junit3.7"/>
   
  
  <!-- ========== Derived Values ============================================ -->
  
  
    <!-- The pathname of the collections classes JAR file -->
    <property name="commons-collections.jar" value="${commons-collections.home}/commons-collections.jar"/>
  
    <!-- The pathname of the "junit.jar" JAR file -->
    <property name="junit.jar"               value="${junit.home}/junit.jar"/>
  
  
  <!-- ========== Component Declarations ==================================== -->
  
  
    <!-- The name of this component -->
    <property name="component.name"          value="armi"/>
  
    <!-- The primary package name of this component -->
    <property name="component.package"       value="org.apache.commons.armi"/>
  
    <!-- The title of this component -->
    <property name="component.title"         value="Alternative to RMI"/>
  
    <!-- The current version number of this component -->
    <property name="component.version"       value="1.0-dev"/>
  
    <!-- The base directory for compilation targets -->
    <property name="build.home"              value="build"/>
  
  
    <!-- The base directory for distribution targets -->
    <property name="dist.home"               value="dist"/>
  
    <!-- The base directory for component sources -->
    <property name="source.home"             value="src/java"/>
  
    <!-- The base directory for unit test sources -->
    <property name="test.home"               value="src/test"/>
  
  
  <!-- ========== Compiler Defaults ========================================= -->
  
  
    <!-- Should Java compilations set the 'debug' compiler option? -->
    <property name="compile.debug"           value="true"/>
  
    <!-- Should Java compilations set the 'deprecation' compiler option? -->
    <property name="compile.deprecation"     value="true"/>
  
    <!-- Should Java compilations set the 'optimize' compiler option? -->
    <property name="compile.optimize"        value="true"/>
  
    <!-- Construct compile classpath -->
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${commons-collections.jar}"/>
    </path>
  
  <!-- ========== Test Execution Defaults =================================== -->
  
  
    <!-- Construct unit test classpath -->
    <path id="test.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${build.home}/tests"/>
      <pathelement location="${commons-collections.jar}"/>
      <pathelement location="${junit.jar}"/>
    </path>
  
    <!-- Should all tests fail if one does? -->
    <property name="test.failonerror"        value="true"/>
  
    <!-- The test runner to execute -->
    <property name="test.runner"             value="junit.textui.TestRunner"/>
  
  
  <!-- ========== Executable Targets ======================================== -->
  
  
    <target name="init"
     description="Initialize and evaluate conditionals">
      <echo message="-------- ${component.name} ${component.version} --------"/>
      <filter  token="name"                  value="${component.name}"/>
      <filter  token="package"               value="${component.package}"/>
      <filter  token="version"               value="${component.version}"/>
    </target>
  
  
    <target name="prepare" depends="init"
     description="Prepare build directory">
      <mkdir dir="${build.home}"/>
      <mkdir dir="${build.home}/classes"/>
      <mkdir dir="${build.home}/classes2"/>  
      <delete>
        <fileset dir="${build.home}/classes2" includes="*" defaultexcludes="no"/>
      </delete>     
      <mkdir dir="${build.home}/genjava"/>
      <delete>
        <fileset dir="${build.home}/genjava" includes="*" defaultexcludes="no"/>
      </delete>     
      <mkdir dir="${build.home}/conf"/>
      <mkdir dir="${build.home}/tests"/>
    </target>
  
  
    <target name="compile" depends="prepare" description="Compile shareable components">
  
      <javac  srcdir="${source.home}"
             destdir="${build.home}/classes"
               debug="${compile.debug}"
         deprecation="${compile.deprecation}"
            optimize="${compile.optimize}">
        <classpath refid="compile.classpath"/>
      </javac>
      
      <rmic base="${build.home}/classes"
            includes="org/apache/commons/armi/server/impl/rmi/RmiArmiInovcationAdapter.class">
          <classpath refid="compile.classpath" />    
      </rmic>    
      
    </target>
  
    <target name="clean"
     description="Clean build and distribution directories">
      <delete    dir="${build.home}"/>
      <delete    dir="${dist.home}"/>
    </target>
  
  
    <target name="all" depends="clean,compile"
     description="Clean and compile all components"/>
  
  
    <target name="javadoc" depends="compile"
     description="Create component Javadoc documentation">
      <mkdir      dir="${dist.home}"/>
      <mkdir      dir="${dist.home}/docs"/>
      <mkdir      dir="${dist.home}/docs/api"/>
      <javadoc sourcepath="${source.home}"
                  destdir="${dist.home}/docs/api"
             packagenames="org.apache.commons.*"
                   author="true"
                  private="true"
                  version="true"
                 doctitle="&lt;h1&gt;${component.title}&lt;/h1&gt;"
              windowtitle="${component.title} (Version ${component.version})"
                   bottom="Copyright (c) 2001 - Apache Software Foundation"/>
    </target>
  
  
    <target name="dist" depends="compile,javadoc"
     description="Create binary distribution">
      <mkdir      dir="${dist.home}"/>
      <copy      file="../LICENSE"
                todir="${dist.home}"/>
      <jar    jarfile="${dist.home}/commons-${component.name}.jar"
              basedir="${build.home}/classes"
             manifest="${build.home}/conf/MANIFEST.MF"/>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/armi/test.xml
  
  Index: test.xml
  ===================================================================
  <project name="Alt (to) RMI" default="generate" basedir=".">
  
  
  <!--
          "Alt (to) RMI" component of the Jakarta Commons Subproject
          $Id: test.xml,v 1.1 2001/12/28 18:08:37 hammant Exp $
  -->
  
  
  <!-- ========== Initialize Properties ===================================== -->
  
  
    <property file="build.properties"/>                <!-- Component local   -->
    <property file="../build.properties"/>             <!-- Commons local     -->
    <property file="${user.home}/build.properties"/>   <!-- User local        -->
   
  
  <!-- ========== Component Declarations ==================================== -->
  
  
    <!-- The base directory for compilation targets -->
    <property name="build.home"              value="build"/>
  
  
  <!-- ========== Compiler Defaults ========================================= -->
  
  
    <!-- Should Java compilations set the 'debug' compiler option? -->
    <property name="compile.debug"           value="true"/>
  
    <!-- Should Java compilations set the 'deprecation' compiler option? -->
    <property name="compile.deprecation"     value="true"/>
  
    <!-- Should Java compilations set the 'optimize' compiler option? -->
    <property name="compile.optimize"        value="true"/>
  
    <!-- Construct compile classpath -->
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
    </path>
    
    <!-- For running of tests -->
    <path id="test2.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${build.home}/classes2"/>
    </path>  
  
    <taskdef name="armi" classname="org.apache.commons.armi.generator.ant.ArmiTask">
      <classpath refid="compile.classpath" />
    </taskdef>   
  
  
  <!-- ========== Executable Targets ======================================== -->
  
    <target name="prepare"
     description="Prepare build directory">
      <mkdir dir="${build.home}"/>
      <mkdir dir="${build.home}/classes2"/>  
      <delete>
        <fileset dir="${build.home}/classes2" includes="*" defaultexcludes="no"/>
      </delete>     
      <mkdir dir="${build.home}/genjava"/>
      <delete>
        <fileset dir="${build.home}/genjava" includes="*" defaultexcludes="no"/>
      </delete>     
    </target>
  
    <target name="generate" depends="prepare">
       
      <armi genname="Hello" gendir="${build.home}/genjava" 
          interfaces="org.apache.commons.armi.test.TestInterface" />
  
      <javac  srcdir="${build.home}/genjava"
                 destdir="${build.home}/classes2"
                   debug="${compile.debug}"
             deprecation="${compile.deprecation}"
                optimize="${compile.optimize}">
            <classpath refid="compile.classpath"/>
      </javac>
    
    </target>
  
    <target name="test1-serve">
      <java classname="org.apache.commons.armi.test.SocketServerTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
    
    <target name="test1-client" depends="generate">
      <java classname="org.apache.commons.armi.test.SocketClientTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
  
    <target name="test2" depends="generate">
      <java classname="org.apache.commons.armi.test.PipeTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
  
    <target name="test3-serve">
      <java classname="org.apache.commons.armi.test.RmiServerTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
    
    <target name="test3-client" depends="generate">
      <java classname="org.apache.commons.armi.test.RmiClientTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
  
    <target name="test4" depends="generate">
      <java classname="org.apache.commons.armi.test.DirectTest" fork="true">
        <classpath refid="test2.classpath"/>
      </java>      
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/ArmiFactory.java
  
  Index: ArmiFactory.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/ArmiFactory.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client;
  
  
  
  import org.apache.commons.armi.client.impl.DefaultArmiFactory;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  
  /**
   * Class ArmiFactory
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public abstract class ArmiFactory {
  
      private static ArmiFactory mDefaultArmiFactory;
  
      /**
       * Method getDefaultArmiFactory
       *
       *
       * @return
       *
       */
      public static synchronized ArmiFactory getDefaultArmiFactory() {
  
          if (mDefaultArmiFactory == null) {
              mDefaultArmiFactory = new DefaultArmiFactory();
          }
  
          return mDefaultArmiFactory;
      }
  
      /**
       * Method lookup
       *
       *
       * @param hostContext
       * @param publishedServiceName
       *
       * @return
       *
       * @throws ArmiConnectionException
       *
       */
      public abstract Object lookup(ArmiHostContext hostContext, String publishedServiceName)
          throws ArmiConnectionException;
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/ArmiHostContext.java
  
  Index: ArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/ArmiHostContext.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  
  
  /**
   * Interface ArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface ArmiHostContext {
  
      /**
       * Method getInvocationHandler
       *
       *
       * @return
       *
       */
      ArmiInvocationHandler getInvocationHandler();
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/AbstractArmiHostContext.java
  
  Index: AbstractArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/AbstractArmiHostContext.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.client.ArmiHostContext;
  
  
  /**
   * Class AbstractArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractArmiHostContext implements ArmiHostContext {
  
      private final ArmiInvocationHandler mArmiInvocationHandler;
  
      /**
       * Constructor AbstractArmiHostContext
       *
       *
       * @param armiInvocationHandler
       *
       */
      public AbstractArmiHostContext(ArmiInvocationHandler armiInvocationHandler) {
          this.mArmiInvocationHandler = armiInvocationHandler;
      }
  
      /**
       * Method getInvocationHandler
       *
       *
       * @return
       *
       */
      public ArmiInvocationHandler getInvocationHandler() {
          return mArmiInvocationHandler;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/BaseServedObject.java
  
  Index: BaseServedObject.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/BaseServedObject.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.MethodReply;
  import org.apache.commons.armi.common.MethodRequest;
  import org.apache.commons.armi.common.ExceptionReply;
  import org.apache.commons.armi.common.ArmiInvocationException;
  
  
  /**
   * Class BaseServedObject
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public abstract class BaseServedObject {
  
      private ArmiInvocationHandler mInvocationHandler;
      private final Class[] mInterfacesSought;
      private String mPublishedObjectName;
      private Integer syncObject = new Integer(1);
  
      /**
       * Constructor BaseServedObject
       *
       *
       * @param interfacesSought
       *
       */
      public BaseServedObject(Class[] interfacesSought) {
          mInterfacesSought = interfacesSought;
      }
  
      /**
       * Method armiSetInvocationHandler
       *
       *
       * @param invocationHandler
       *
       */
      public void armiSetInvocationHandler(ArmiInvocationHandler invocationHandler) {
  
          if (mInvocationHandler == null) {
              mInvocationHandler = invocationHandler;
          }
      }
  
      /**
       * Method armiSetPublishedObjectName
       *
       *
       * @param publishedObjectName
       *
       */
      public void armiSetPublishedObjectName(String publishedObjectName) {
  
          if (mPublishedObjectName == null) {
              mPublishedObjectName = publishedObjectName;
          }
      }
  
      /**
       * Method armiProcessObjectRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @return
       *
       * @throws Throwable
       *
       */
      public Object armiProcessObjectRequest(String methodSignature, Object[] args)
              throws Throwable {
  
          MethodRequest request = new MethodRequest(mPublishedObjectName, methodSignature, args);
  
          synchronized (syncObject) {
              ArmiReply reply = mInvocationHandler.handleInvocation(request);
  
              if (reply instanceof MethodReply) {
                  MethodReply or = (MethodReply) reply;
  
                  return or.getReplyObject();
              } else if (reply instanceof ExceptionReply) {
                  ExceptionReply er = (ExceptionReply) reply;
  
                  throw er.getReplyException();
              }
          }
  
          return null;
      }
  
      /**
       * Method armiProcessVoidRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @throws Throwable
       *
       */
      public void armiProcessVoidRequest(String methodSignature, Object[] args) throws Throwable {
  
          MethodRequest request = new MethodRequest(mPublishedObjectName, methodSignature, args);
  
          synchronized (syncObject) {
              ArmiReply reply = mInvocationHandler.handleInvocation(request);
  
              if (reply instanceof MethodReply) {
                  MethodReply or = (MethodReply) reply;
  
                  return;
              } else if (reply instanceof ExceptionReply) {
                  ExceptionReply er = (ExceptionReply) reply;
  
                  throw er.getReplyException();
              } else {
                  throw new ArmiInvocationException("Internal Error : Unknown reply type :"
                                                    + reply.getClass().getName());
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/DefaultArmiFactory.java
  
  Index: DefaultArmiFactory.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/DefaultArmiFactory.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl;
  
  
  
  import org.apache.commons.armi.client.ArmiFactory;
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  import java.lang.reflect.Proxy;
  
  
  /**
   * Class DefaultArmiFactory
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultArmiFactory extends ArmiFactory {
  
      /**
       * Method lookup
       *
       *
       * @param hostContext
       * @param publishedServiceName
       *
       * @return
       *
       * @throws ArmiConnectionException
       *
       */
      public Object lookup(ArmiHostContext hostContext, String publishedServiceName)
              throws ArmiConnectionException {
  
          try {
              Class clazz = Class.forName("ArmiGenerated" + publishedServiceName);
              BaseServedObject bo = (BaseServedObject) clazz.newInstance();
  
              bo.armiSetInvocationHandler(hostContext.getInvocationHandler());
              bo.armiSetPublishedObjectName(publishedServiceName);
  
              return bo;
          } catch (ClassNotFoundException cnfe) {
              throw new ArmiConnectionException("Generated class not found during lookup : "
                                                + cnfe.getMessage());
          } catch (InstantiationException ie) {
              throw new ArmiConnectionException("Gerenated class not instantiable during lookup : "
                                                + ie.getMessage());
          } catch (IllegalAccessException iae) {
              throw new ArmiConnectionException("Illegal access to generated class during lookup : "
                                                + iae.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java
  
  Index: ObjectStreamInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.MethodRequest;
  import org.apache.commons.armi.common.ArmiInvocationException;
  
  import java.io.IOException;
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  
  
  /**
   * Class ObjectStreamInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ObjectStreamInvocationHandler implements ArmiInvocationHandler {
  
      ObjectInputStream mOIS;
      ObjectOutputStream mOOS;
  
      /**
       * Method setObjectInputStream
       *
       *
       * @param is
       *
       */
      public void setObjectInputStream(ObjectInputStream is) {
          mOIS = is;
      }
  
      /**
       * Method setObjectOutputStream
       *
       *
       * @param os
       *
       */
      public void setObjectOutputStream(ObjectOutputStream os) {
          mOOS = os;
      }
  
      protected void requestWritten() {}
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) {
  
          try {
              while (true) {
                  mOOS.writeObject(request);
                  mOOS.flush();
  
                  ArmiReply reply = (ArmiReply) mOIS.readObject();
  
                  return reply;
              }
          } catch (IOException e) {
              throw new ArmiInvocationException("IO Exception during invocation to server"
                                                + e.getMessage());
          } catch (ClassNotFoundException e) {
              throw new ArmiInvocationException("Class definition missing on Deserialization"
                                                + e.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectArmiHostContext.java
  
  Index: DirectArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectArmiHostContext.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.direct;
  
  
  
  import org.apache.commons.armi.client.impl.AbstractArmiHostContext;
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  
  /**
   * Class DirectArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DirectArmiHostContext extends AbstractArmiHostContext {
  
      /**
       * Constructor DirectArmiHostContext
       *
       *
       * @param armiInvocationHandler
       *
       * @throws ArmiConnectionException
       *
       */
      public DirectArmiHostContext(ArmiInvocationHandler armiInvocationHandler)
              throws ArmiConnectionException {
          super(new DirectInvocationHandler(armiInvocationHandler));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java
  
  Index: DirectInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.direct;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  
  
  /**
   * Class DirectInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class DirectInvocationHandler implements ArmiInvocationHandler {
  
      ArmiInvocationHandler mArmiInvocationHandler;
  
      /**
       * Constructor DirectInvocationHandler
       *
       *
       * @param armiInvocationHandler
       *
       * @throws ArmiConnectionException
       *
       */
      public DirectInvocationHandler(ArmiInvocationHandler armiInvocationHandler)
              throws ArmiConnectionException {
          mArmiInvocationHandler = armiInvocationHandler;
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) {
          return mArmiInvocationHandler.handleInvocation(request);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/piped/PipedArmiHostContext.java
  
  Index: PipedArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/piped/PipedArmiHostContext.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.piped;
  
  
  
  import org.apache.commons.armi.client.impl.AbstractArmiHostContext;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.server.impl.piped.PipedServer;
  
  
  /**
   * Class PipedArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PipedArmiHostContext extends AbstractArmiHostContext {
  
      /**
       * Constructor PipedArmiHostContext
       *
       *
       * @param pipedServer
       *
       * @throws ArmiConnectionException
       *
       */
      public PipedArmiHostContext(PipedServer pipedServer) throws ArmiConnectionException {
          super(new PipedInvocationHandler(pipedServer));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/piped/PipedInvocationHandler.java
  
  Index: PipedInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/piped/PipedInvocationHandler.java,v 1.1 2001/12/28 18:08:37 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.piped;
  
  
  
  import org.apache.commons.armi.client.impl.ObjectStreamInvocationHandler;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.common.ArmiPipeConnector;
  
  import java.io.PipedOutputStream;
  import java.io.PipedInputStream;
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  import java.io.IOException;
  
  
  /**
   * Class PipedInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class PipedInvocationHandler extends ObjectStreamInvocationHandler {
  
      /**
       * Constructor PipedInvocationHandler
       *
       *
       * @param apc
       *
       * @throws ArmiConnectionException
       *
       */
      public PipedInvocationHandler(ArmiPipeConnector apc) throws ArmiConnectionException {
  
          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 ArmiConnectionException("Cannot bind the pipes together :"
                                                + ioe.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiArmiHostContext.java
  
  Index: RmiArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiArmiHostContext.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.rmi;
  
  
  
  import org.apache.commons.armi.client.impl.AbstractArmiHostContext;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  
  /**
   * Class RmiArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiArmiHostContext extends AbstractArmiHostContext {
  
      /**
       * Constructor RmiArmiHostContext
       *
       *
       * @param host
       * @param port
       *
       * @throws ArmiConnectionException
       *
       */
      public RmiArmiHostContext(String host, int port) throws ArmiConnectionException {
          super(new RmiInvocationHandler(host, port));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java
  
  Index: RmiInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.rmi;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.RmiArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiInvocationException;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  import java.rmi.Naming;
  import java.rmi.RemoteException;
  import java.rmi.NotBoundException;
  
  import java.net.MalformedURLException;
  
  
  /**
   * Class RmiInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class RmiInvocationHandler implements ArmiInvocationHandler {
  
      RmiArmiInvocationHandler mServer;
  
      /**
       * Constructor RmiInvocationHandler
       *
       *
       * @param host
       * @param port
       *
       * @throws ArmiConnectionException
       *
       */
      public RmiInvocationHandler(String host, int port) throws ArmiConnectionException {
  
          String url = "rmi://" + host + ":" + port + "/"
                       + RmiArmiInvocationHandler.class.getName();
  
          try {
              mServer = (RmiArmiInvocationHandler) Naming.lookup(url);
          } catch (NotBoundException nbe) {
              throw new ArmiConnectionException(
                  "Cannot bind to the remote RMI service.  Either an IP or RMI issue.");
          } catch (MalformedURLException mfue) {
              throw new ArmiConnectionException("Malformed URL, host/port (" + host + "/" + port
                                                + ") must be wrong: " + mfue.getMessage());
          } catch (RemoteException re) {
              throw new ArmiConnectionException("Unknown Remote Exception : " + re.getMessage());
          }
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) {
  
          try {
              return mServer.handleInvocation(request);
          } catch (RemoteException re) {
              throw new ArmiInvocationException("Unknown RMI problem : " + re.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/socket/PlainSocketArmiHostContext.java
  
  Index: PlainSocketArmiHostContext.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/socket/PlainSocketArmiHostContext.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.socket;
  
  
  
  import org.apache.commons.armi.client.impl.AbstractArmiHostContext;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  import java.net.Socket;
  
  
  /**
   * Class PlainSocketArmiHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PlainSocketArmiHostContext extends AbstractArmiHostContext {
  
      /**
       * Constructor PlainSocketArmiHostContext
       *
       *
       * @param host
       * @param port
       *
       * @throws ArmiConnectionException
       *
       */
      public PlainSocketArmiHostContext(String host, int port) throws ArmiConnectionException {
          super(new PlainSocketInvocationHandler(host, port));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/socket/PlainSocketInvocationHandler.java
  
  Index: PlainSocketInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/socket/PlainSocketInvocationHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.client.impl.socket;
  
  
  
  import org.apache.commons.armi.client.impl.ObjectStreamInvocationHandler;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  import java.io.IOException;
  
  import java.net.Socket;
  import java.net.MalformedURLException;
  
  
  /**
   * Class PlainSocketInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public final class PlainSocketInvocationHandler extends ObjectStreamInvocationHandler {
  
      /**
       * Constructor PlainSocketInvocationHandler
       *
       *
       * @param host
       * @param port
       *
       * @throws ArmiConnectionException
       *
       */
      public PlainSocketInvocationHandler(String host, int port) throws ArmiConnectionException {
  
          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 ArmiConnectionException("Cannot open Stream(s) for socket");
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/AbstractMethodHandler.java
  
  Index: AbstractMethodHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/AbstractMethodHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.lang.reflect.Method;
  
  import java.util.HashMap;
  
  
  /**
   * Class AbstractMethodHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractMethodHandler {
  
      protected String getMethodSignature(Method method) {
  
          StringBuffer methodSignature = new StringBuffer();
  
          methodSignature.append(method.getName()).append("(");
  
          Class[] params = method.getParameterTypes();
  
          for (int i = 0; i < params.length; i++) {
              methodSignature.append(params[i].getName());
  
              if (i + 1 < params.length) {
                  methodSignature.append(", ");
              }
          }
  
          methodSignature.append(")");
  
          return methodSignature.toString().intern();
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiConnectionException.java
  
  Index: ArmiConnectionException.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiConnectionException.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  /**
   * Class ArmiConnectionException
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ArmiConnectionException extends Exception {
  
      /**
       * Constructor ArmiConnectionException
       *
       *
       * @param s
       *
       */
      public ArmiConnectionException(String s) {
          super(s);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiInvocationException.java
  
  Index: ArmiInvocationException.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiInvocationException.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.io.Serializable;
  
  
  /**
   * Class ArmiInvocationException
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ArmiInvocationException extends RuntimeException implements Serializable {
  
      /**
       * Constructor ArmiInvocationException
       *
       *
       * @param s
       *
       */
      public ArmiInvocationException(String s) {
          super(s);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiInvocationHandler.java
  
  Index: ArmiInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiInvocationHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.io.IOException;
  
  
  /**
   * Interface ArmiInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface ArmiInvocationHandler {
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      ArmiReply handleInvocation(ArmiRequest request);
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiPipeConnector.java
  
  Index: ArmiPipeConnector.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiPipeConnector.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import org.apache.commons.armi.server.ArmiServerException;
  
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  
  
  /**
   * Interface ArmiPipeConnector
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface ArmiPipeConnector {
  
      /**
       * Method connect
       *
       *
       * @param clientPOS
       *
       * @return
       *
       * @throws ArmiConnectionException
       *
       */
      PipedInputStream connect(PipedOutputStream clientPOS) throws ArmiConnectionException;
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiReply.java
  
  Index: ArmiReply.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiReply.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.io.Serializable;
  
  
  /**
   * Class ArmiReply
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public abstract class ArmiReply implements Serializable {
  
      /**
       * Constructor ArmiReply
       *
       *
       */
      ArmiReply() {}
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiRequest.java
  
  Index: ArmiRequest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ArmiRequest.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.io.Serializable;
  
  
  /**
   * Class ArmiRequest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public abstract class ArmiRequest implements Serializable {
  
      /**
       * Constructor ArmiRequest
       *
       *
       */
      ArmiRequest() {}
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ExceptionReply.java
  
  Index: ExceptionReply.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ExceptionReply.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  /**
   * Class ExceptionReply
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ExceptionReply extends ArmiReply {
  
      private final Throwable mReplyExcpt;
  
      /**
       * Constructor ExceptionReply
       *
       *
       * @param replyExcpt
       *
       */
      public ExceptionReply(Throwable replyExcpt) {
          this.mReplyExcpt = replyExcpt;
      }
  
      /**
       * Method getReplyException
       *
       *
       * @return
       *
       */
      public Throwable getReplyException() {
          return mReplyExcpt;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodReply.java
  
  Index: MethodReply.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodReply.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  /**
   * Class MethodReply
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class MethodReply extends ArmiReply {
  
      private final Object mReplyObj;
  
      /**
       * Constructor MethodReply
       *
       *
       * @param replyObj
       *
       */
      public MethodReply(Object replyObj) {
          this.mReplyObj = replyObj;
      }
  
      /**
       * Method getReplyObject
       *
       *
       * @return
       *
       */
      public Object getReplyObject() {
          return mReplyObj;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java
  
  Index: MethodRequest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  /**
   * Class MethodRequest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class MethodRequest extends ArmiRequest {
  
      private final String mMethodSignature;
      private final String mPublishedObjectName;
      private final Object[] mArgs;
  
      /**
       * Constructor MethodRequest
       *
       *
       * @param publishedObjectName
       * @param methodSignature
       * @param args
       *
       */
      public MethodRequest(String publishedObjectName, String methodSignature, Object[] args) {
  
          mPublishedObjectName = publishedObjectName;
          mMethodSignature = methodSignature;
          mArgs = args;
      }
  
      /**
       * Method getMethodSignature
       *
       *
       * @return
       *
       */
      public String getMethodSignature() {
          return mMethodSignature;
      }
  
      /**
       * Method getArgs
       *
       *
       * @return
       *
       */
      public Object[] getArgs() {
          return mArgs;
      }
  
      /**
       * Method getPublishedObjectName
       *
       *
       * @return
       *
       */
      public String getPublishedObjectName() {
          return mPublishedObjectName;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/RmiArmiInvocationHandler.java
  
  Index: RmiArmiInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/RmiArmiInvocationHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.common;
  
  
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
  
  /**
   * Interface RmiArmiInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface RmiArmiInvocationHandler extends Remote {
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       * @throws RemoteException
       *
       */
      ArmiReply handleInvocation(ArmiRequest request) throws RemoteException;
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/generator/SourceGenerator.java
  
  Index: SourceGenerator.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/generator/SourceGenerator.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.generator;
  
  
  
  import org.apache.commons.armi.common.AbstractMethodHandler;
  import org.apache.commons.armi.test.TestInterface;
  
  import java.lang.reflect.Method;
  
  import java.util.Vector;
  
  import java.io.PrintWriter;
  import java.io.FileOutputStream;
  import java.io.FileNotFoundException;
  
  
  /**
   * Class SourceGenerator
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class SourceGenerator extends AbstractMethodHandler {
  
      private String[] mInterfacesToExpose;
      private String mGenDir;
      private String mGenName;
      private PrintWriter mClassSource;
  
      /**
       * Method setInterfacesToExpose
       *
       *
       * @param interfacesToExpose
       *
       */
      public void setInterfacesToExpose(String[] interfacesToExpose) {
          mInterfacesToExpose = interfacesToExpose;
      }
  
      /**
       * Method setGenDir
       *
       *
       * @param genDir
       *
       */
      public void setGenDir(String genDir) {
          mGenDir = genDir;
      }
  
      /**
       * Method setGenName
       *
       *
       * @param genName
       *
       */
      public void setGenName(String genName) {
          this.mGenName = genName;
      }
  
      /**
       * Method generate
       *
       *
       */
      public void generate() {
  
          // methdos could be in more than one interface.
          Vector methodsDone = new Vector();
  
          try {
              mClassSource = new PrintWriter(new FileOutputStream(mGenDir + "\\ArmiGenerated"
                                                                  + mGenName + ".java"));
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  
          mClassSource
              .print("public final class ArmiGenerated" + mGenName
                     + " extends org.apache.commons.armi.client.impl.BaseServedObject implements ");
          generateInterfaceList();
          mClassSource.println(" { ");
          mClassSource.println("  public ArmiGenerated" + mGenName + "() {");
          mClassSource.print("    super(new Class[] {");
          generateInterfaceList2();
          mClassSource.println("});");
          mClassSource.println("  }");
  
          for (int x = 0; x < mInterfacesToExpose.length; x++) {
              Class clazz = null;
  
              try {
                  clazz = Class.forName(mInterfacesToExpose[x]);
              } catch (ClassNotFoundException e) {
                  e.printStackTrace();
              }
  
              Method[] methods = clazz.getMethods();
  
              for (int y = 0; y < methods.length; y++) {
                  Method method = methods[y];
                  String methodSignature = getMethodSignature(method);
  
                  if (!methodsDone.contains(methodSignature)) {
                      methodsDone.add(methodSignature);
  
                      String rClass = method.getReturnType().getName();
                      String mName = method.getName();
  
                      mClassSource.print("  public " + rClass + " " + mName + " (");
  
                      Class[] argTypes = method.getParameterTypes();
  
                      for (int i = 0; i < argTypes.length; i++) {
                          String cn = argTypes[i].getName();
  
                          generateParameter(cn, argTypes, i);
                      }
  
                      mClassSource.print(") ");
  
                      Class[] throwsTypes = method.getExceptionTypes();
  
                      for (int i = 0; i < throwsTypes.length; i++) {
                          generateThrows(i, throwsTypes);
                      }
  
                      mClassSource.println("{");
                      mClassSource.println("    Object[] args = new Object[" + argTypes.length
                                           + "];");
  
                      for (int i = 0; i < argTypes.length; i++) {
                          String cn = argTypes[i].getName();
  
                          generateAssignLine(cn, i);
                      }
  
                      mClassSource.println("    try {");
  
                      if (rClass.equals("void")) {
                          mClassSource.println("      armiProcessVoidRequest(\""
                                               + methodSignature.toString() + "\",args);");
                      } else {
                          mClassSource.println("      Object retVal = armiProcessObjectRequest(\""
                                               + methodSignature.toString() + "\",args);");
                          generateReturnLine(rClass);
                      }
  
                      mClassSource.println("    } catch (Throwable t) {");
  
                      throwsTypes = method.getExceptionTypes();
  
                      for (int i = 0; i < throwsTypes.length; i++) {
                          generateThrowHandler(i, throwsTypes);
                      }
  
                      mClassSource.println("      if (t instanceof RuntimeException) { ");
                      mClassSource.println("        throw (RuntimeException) t;");
                      mClassSource.println("      } else if (t instanceof Error) { ");
                      mClassSource.println("        throw (Error) t;");
                      mClassSource.println("      } else { ");
                      mClassSource.println(
                          "        throw new org.apache.commons.armi.common.ArmiInvocationException(\"Should never get here\" + t.getMessage()); ");
                      mClassSource.println("      }");
                      mClassSource.println("    }");
                      mClassSource.println("  }");
                  }
              }
          }
  
          mClassSource.print("}");
          mClassSource.close();
      }
  
      private void generateThrowHandler(int i, Class[] throwsTypes) {
  
          if (i == 0) {
              mClassSource.println("      if (t instanceof " + throwsTypes[i].getName() + ") { ");
          } else {
              mClassSource.println("      } else if (t instanceof " + throwsTypes[i].getName()
                                   + ") { ");
          }
  
          mClassSource.println("        throw (" + throwsTypes[i].getName() + ") t;");
  
          if (i + 1 == throwsTypes.length) {
              mClassSource.print("      } else");
          }
      }
  
      private void generateThrows(int i, Class[] throwsTypes) {
  
          if (i == 0) {
              mClassSource.print("throws ");
          }
  
          mClassSource.print(throwsTypes[i].getName());
  
          if (i + 1 < throwsTypes.length) {
              mClassSource.print(", ");
          }
      }
  
      private void generateInterfaceList2() {
  
          for (int x = 0; x < mInterfacesToExpose.length; x++) {
              mClassSource.print(mInterfacesToExpose[x] + ".class");
  
              if (x + 1 < mInterfacesToExpose.length) {
                  mClassSource.print(", ");
              }
          }
      }
  
      private void generateInterfaceList() {
  
          for (int x = 0; x < mInterfacesToExpose.length; x++) {
              mClassSource.print(mInterfacesToExpose[x]);
  
              if (x + 1 < mInterfacesToExpose.length) {
                  mClassSource.print(", ");
              }
          }
      }
  
      private void generateParameter(String cn, Class[] argTypes, int i) {
  
          if (cn.startsWith("L")) {
              mClassSource.print(argTypes[i].getName());
          } else if (cn.startsWith("[L")) {
              mClassSource.print(argTypes[i].getName() + "[]");
          } else if (cn.equals("[B")) {
              mClassSource.print("byte[]");
          } else if (cn.equals("[C")) {
              mClassSource.print("char[]");
          } else if (cn.equals("[D")) {
              mClassSource.print("double[]");
          } else if (cn.equals("[F")) {
              mClassSource.print("float[]");
          } else if (cn.equals("[I")) {
              mClassSource.print("int[]");
          } else if (cn.equals("[J")) {
              mClassSource.print("long[]");
          } else if (cn.equals("[S")) {
              mClassSource.print("short[]");
          } else if (cn.equals("[Z")) {
              mClassSource.print("boolean[]");
          } else {
              mClassSource.print(cn);
          }
  
          mClassSource.print(" v" + i);
  
          if (i + 1 < argTypes.length) {
              mClassSource.print(", ");
          }
      }
  
      private void generateAssignLine(String cn, int i) {
  
          if (cn.equals("int")) {
              mClassSource.println("    args[" + i + "] = new Integer(v" + i + ");");
          } else if (cn.equals("short")) {
              mClassSource.println("    args[" + i + "] = new Short(v" + i + ");");
          } else if (cn.equals("float")) {
              mClassSource.println("    args[" + i + "] = new Float(v" + i + ");");
          } else if (cn.equals("double")) {
              mClassSource.println("    args[" + i + "] = new Double(v" + i + ");");
          } else if (cn.equals("long")) {
              mClassSource.println("    args[" + i + "] = new Long(v" + i + ");");
          } else if (cn.equals("char")) {
              mClassSource.println("    args[" + i + "] = new Character(v" + i + ");");
          } else if (cn.equals("boolean")) {
              mClassSource.println("    args[" + i + "] = new Boolean(v" + i + ");");
          } else if (cn.equals("byte")) {
              mClassSource.println("    args[" + i + "] = new Byte(v" + i + ");");
          } else {
              mClassSource.println("    args[" + i + "] = v" + i + ";");
          }
      }
  
      private void generateReturnLine(String rClass) {
  
          if (rClass.equals("boolean")) {
              mClassSource.println("      return ((Boolean) retVal).booleanValue();");
          } else if (rClass.equals("integer")) {
              mClassSource.println("      return ((Integer) retVal).intValue();");
          } else if (rClass.equals("short")) {
              mClassSource.println("      return ((Short) retVal).shortValue();");
          } else if (rClass.equals("float")) {
              mClassSource.println("      return ((Float) retVal).floatValue();");
          } else if (rClass.equals("double")) {
              mClassSource.println("      return ((Double) retVal).doubleValue();");
          } else if (rClass.equals("long")) {
              mClassSource.println("      return ((Long) retVal).longValue();");
          } else if (rClass.equals("char")) {
              mClassSource.println("      return ((Character) retVal).charValue();");
          } else if (rClass.equals("byte")) {
              mClassSource.println("      return ((Byte) retVal).byteValue();");
          } else {
              mClassSource.println("      return (" + rClass + ") retVal;");
          }
      }
  
      /**
       * Method main
       *
       *
       * @param args
       *
       */
      public static void main(String[] args) {
  
          SourceGenerator gen = new SourceGenerator();
  
          gen.setGenName("Hello");
          gen.setGenDir("C:\\Apache-CVS\\jakarta-commons\\armi\\build\\genjava");
          gen.setInterfacesToExpose(new String[]{ TestInterface.class.getName() });
          gen.generate();
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/generator/ant/ArmiTask.java
  
  Index: ArmiTask.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/generator/ant/ArmiTask.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.generator.ant;
  
  import org.apache.tools.ant.Task;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.util.FileUtils;
  import org.apache.commons.armi.generator.SourceGenerator;
  
  import java.util.StringTokenizer;
  import java.util.Vector;
  
  public class ArmiTask extends Task {
  
      private String[] mInterfacesToExpose;
      private String mGenDir;
      private String mGenName;
  
      public ArmiTask() {
      }
  
      public void setInterfaces(String interfacesToExpose) {
          StringTokenizer st = new StringTokenizer(interfacesToExpose, ",");
          Vector strings = new Vector();
          while (st.hasMoreTokens()) {
              strings.add(st.nextToken().trim());
          }
          mInterfacesToExpose = new String[strings.size()];
          strings.copyInto(mInterfacesToExpose);
  
  
      }
  
      public void setGendir(String genDir) {
          mGenDir = genDir;
      }
  
      public void setGenname(String genName) {
          this.mGenName = genName;
      }
  
  
      public void execute() throws BuildException {
          if (mInterfacesToExpose == null) {
              throw new BuildException("Specify at least one interface to expose");
          }
          if (mGenDir == null) {
              throw new BuildException("Specify the directory to generate Java source in");
          }
          if (mGenName == null) {
              throw new BuildException("Specify the name to use for lookup");
          }
          SourceGenerator sg = new SourceGenerator();
          sg.setGenDir(mGenDir);
          sg.setGenName(mGenName);
          sg.setInterfacesToExpose(mInterfacesToExpose);
          sg.generate();
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/ArmiServer.java
  
  Index: ArmiServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/ArmiServer.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server;
  
  
  
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  
  
  /**
   * Interface ArmiServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface ArmiServer {
  
      /**
       * Method publish
       *
       *
       * @param impl
       * @param as
       * @param interfaceToExpose
       *
       */
      void publish(Object impl, String as, Class interfaceToExpose);
  
      /**
       * Method publish
       *
       *
       * @param impl
       * @param as
       * @param interfacesToExpose
       *
       */
      void publish(Object impl, String as, Class[] interfacesToExpose);
  
      /**
       * Method processRequest
       *
       *
       * @param request
       *
       * @return
       *
       */
      ArmiReply processRequest(ArmiRequest request);
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/ArmiServerException.java
  
  Index: ArmiServerException.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/ArmiServerException.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server;
  
  
  
  /**
   * Class ArmiServerException
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ArmiServerException extends Exception {
  
      /**
       * Constructor ArmiServerException
       *
       *
       * @param s
       *
       */
      public ArmiServerException(String s) {
          super(s);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java
  
  Index: AbstractServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl;
  
  
  
  import org.apache.commons.armi.server.ArmiServer;
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.AbstractMethodHandler;
  import org.apache.commons.armi.common.MethodRequest;
  import org.apache.commons.armi.common.ExceptionReply;
  
  import java.lang.reflect.Method;
  
  import java.util.HashMap;
  import java.util.Vector;
  
  
  /**
   * Class AbstractServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractServer extends AbstractMethodHandler implements ArmiServer {
  
      private HashMap publishedObjects = new HashMap();
  
      /**
       * Method publish
       *
       *
       * @param impl
       * @param as
       * @param interfaceToExpose
       *
       */
      public void publish(Object impl, String as, Class interfaceToExpose) {
          publish(impl, as, new Class[]{ interfaceToExpose });
      }
  
      /**
       * Method publish
       *
       *
       * @param impl
       * @param as
       * @param interfacesToExpose
       *
       */
      public void publish(Object impl, String as, Class[] interfacesToExpose) {
  
          String[] interfaceNames = new String[interfacesToExpose.length];
  
          for (int i = 0; i < interfacesToExpose.length; i++) {
              interfaceNames[i] = interfacesToExpose[i].getName();
          }
  
          HashMap methodMap = new HashMap();
          DefaultInvocationHandler dih = new DefaultInvocationHandler(impl, methodMap);
  
          publishedObjects.put(as, dih);
  
          for (int x = 0; x < interfacesToExpose.length; x++) {
              Method methods[] = interfacesToExpose[x].getMethods();
  
              for (int y = 0; y < methods.length; y++) {
                  Method method = methods[y];
                  String methodSignature = getMethodSignature(method);
  
                  if (!methodMap.containsKey(methodSignature.toString())) {
                      methodMap.put(methodSignature.toString(), methods[y]);
                  }
              }
          }
      }
  
      /**
       * Method processRequest
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply processRequest(ArmiRequest request) {
  
          if (request instanceof MethodRequest) {
              MethodRequest mr = (MethodRequest) request;
              String as = mr.getPublishedObjectName();
              ArmiInvocationHandler ih = (ArmiInvocationHandler) publishedObjects.get(as);
  
              return ih.handleInvocation(mr);
          }
  
          return null;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/DefaultInvocationHandler.java
  
  Index: DefaultInvocationHandler.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/DefaultInvocationHandler.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl;
  
  
  
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.MethodReply;
  import org.apache.commons.armi.common.ExceptionReply;
  import org.apache.commons.armi.common.MethodRequest;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiInvocationException;
  
  import java.util.HashMap;
  
  import java.lang.reflect.Method;
  import java.lang.reflect.InvocationTargetException;
  
  import java.io.Serializable;
  
  
  /**
   * Class DefaultInvocationHandler
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultInvocationHandler implements ArmiInvocationHandler {
  
      protected Object mBean;
      protected HashMap mMethodMap;
  
      /**
       * Constructor DefaultInvocationHandler
       *
       *
       * @param bean
       * @param methodMap
       *
       */
      public DefaultInvocationHandler(Object bean, HashMap methodMap) {
          mBean = bean;
          mMethodMap = methodMap;
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) {
  
          MethodRequest mr = (MethodRequest) request;
          String methodSignature = mr.getMethodSignature();
  
          if (!mMethodMap.containsKey(methodSignature)) {
              return new ExceptionReply(new ArmiInvocationException("Method not present in impl"));
          }
  
          Method method = (Method) mMethodMap.get(methodSignature);
          Object rv = null;
  
          try {
              return new MethodReply(method.invoke(mBean, mr.getArgs()));
          } catch (InvocationTargetException ite) {
              Throwable t = ite.getTargetException();
  
              if (t instanceof Serializable) {
                  return new ExceptionReply(t);
              } else {
                  return new ExceptionReply(
                      new ArmiInvocationException(
                          "Exception was not serializable :" + t.getClass().getName()));
              }
          } catch (Throwable t) {
              return new ExceptionReply(
                  new ArmiInvocationException(
                      "Some ServerSide exception problem :" + t.getMessage()));
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/ObjectStreamServerConnection.java
  
  Index: ObjectStreamServerConnection.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/ObjectStreamServerConnection.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl;
  
  
  
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiReply;
  
  import java.io.ObjectInputStream;
  import java.io.ObjectOutputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.io.InputStream;
  
  import java.net.Socket;
  import java.net.SocketException;
  
  
  /**
   * Class ObjectStreamServerConnection
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class ObjectStreamServerConnection implements Runnable {
  
      private InputStream mInputStream;
      private OutputStream mOutputStream;
      private AbstractServer mAbstractServer;
  
      /**
       * Constructor ObjectStreamServerConnection
       *
       *
       * @param abstractServer
       * @param inputStream
       * @param outputStream
       *
       */
      public ObjectStreamServerConnection(AbstractServer abstractServer, InputStream inputStream,
                                          OutputStream outputStream) {
  
          mAbstractServer = abstractServer;
          mInputStream = inputStream;
          mOutputStream = outputStream;
      }
  
      /**
       * Method run
       *
       *
       */
      public void run() {
  
          try {
              ObjectInputStream oIS = new ObjectInputStream(mInputStream);
              ObjectOutputStream oOS = new ObjectOutputStream(mOutputStream);
              boolean more = true;
  
              while (more) {
                  try {
                      ArmiRequest request = (ArmiRequest) oIS.readObject();
                      ArmiReply reply = mAbstractServer.processRequest(request);
  
                      oOS.writeObject(reply);
                      oOS.flush();
                  } catch (IOException ioe) {
  
                      // pipe closed?
                      more = false;
                  }
              }
          } catch (IOException e) {
              e.printStackTrace();
          } catch (ClassNotFoundException e) {
              e.printStackTrace();
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/direct/DirectArmiInovcationAdapter.java
  
  Index: DirectArmiInovcationAdapter.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/direct/DirectArmiInovcationAdapter.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.direct;
  
  
  
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.server.ArmiServer;
  
  
  /**
   * Class DirectArmiInovcationAdapter
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DirectArmiInovcationAdapter implements ArmiInvocationHandler {
  
      private ArmiServer mServer;
  
      /**
       * Constructor DirectArmiInovcationAdapter
       *
       *
       * @param server
       *
       */
      public DirectArmiInovcationAdapter(ArmiServer server) {
          mServer = server;
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) {
          return mServer.processRequest(request);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/direct/DirectServer.java
  
  Index: DirectServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/direct/DirectServer.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.direct;
  
  
  
  import org.apache.commons.armi.server.impl.AbstractServer;
  
  
  /**
   * Class DirectServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DirectServer extends AbstractServer {}
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/piped/PipedServer.java
  
  Index: PipedServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/piped/PipedServer.java,v 1.1 2001/12/28 18:08:38 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:38 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.piped;
  
  
  
  import org.apache.commons.armi.server.impl.AbstractServer;
  import org.apache.commons.armi.server.impl.ObjectStreamServerConnection;
  import org.apache.commons.armi.common.ArmiPipeConnector;
  import org.apache.commons.armi.common.ArmiConnectionException;
  
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  import java.io.IOException;
  
  
  /**
   * Class PipedServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PipedServer extends AbstractServer implements ArmiPipeConnector {
  
      /**
       * Method connect
       *
       *
       * @param clientPOS
       *
       * @return
       *
       * @throws ArmiConnectionException
       *
       */
      public PipedInputStream connect(PipedOutputStream clientPOS) throws ArmiConnectionException {
  
          try {
              PipedInputStream pIS = new PipedInputStream();
  
              pIS.connect(clientPOS);
  
              PipedOutputStream pOS = new PipedOutputStream();
              PipedInputStream clientPIS = new PipedInputStream();
  
              clientPIS.connect(pOS);
  
              ObjectStreamServerConnection dsc = new ObjectStreamServerConnection(this, pIS, pOS);
              Thread thread = new Thread(dsc);
  
              thread.start();
  
              return clientPIS;
          } catch (IOException pe) {
              throw new ArmiConnectionException("Some problem setting up server : "
                                                + pe.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/rmi/RmiArmiInovcationAdapter.java
  
  Index: RmiArmiInovcationAdapter.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/rmi/RmiArmiInovcationAdapter.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.rmi;
  
  
  
  import org.apache.commons.armi.common.ArmiReply;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.RmiArmiInvocationHandler;
  import org.apache.commons.armi.server.impl.AbstractServer;
  
  import java.rmi.RemoteException;
  
  
  /**
   * Class RmiArmiInovcationAdapter
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiArmiInovcationAdapter implements RmiArmiInvocationHandler {
  
      private AbstractServer mAbstractServer;
  
      /**
       * Constructor RmiArmiInovcationAdapter
       *
       *
       * @param abstractServer
       *
       */
      public RmiArmiInovcationAdapter(AbstractServer abstractServer) {
          mAbstractServer = abstractServer;
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       * @throws RemoteException
       *
       */
      public ArmiReply handleInvocation(ArmiRequest request) throws RemoteException {
          return mAbstractServer.processRequest(request);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/rmi/RmiServer.java
  
  Index: RmiServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/rmi/RmiServer.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.rmi;
  
  
  
  import org.apache.commons.armi.server.impl.AbstractServer;
  import org.apache.commons.armi.server.ArmiServerException;
  import org.apache.commons.armi.common.RmiArmiInvocationHandler;
  
  import java.rmi.server.UnicastRemoteObject;
  import java.rmi.registry.LocateRegistry;
  import java.rmi.registry.Registry;
  import java.rmi.RemoteException;
  
  
  /**
   * Class RmiServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiServer extends AbstractServer {
  
      private RmiArmiInovcationAdapter mRmiArmiInovcationAdapter;
  
      /**
       * Constructor RmiServer
       *
       *
       * @param host
       * @param port
       *
       * @throws ArmiServerException
       *
       */
      public RmiServer(String host, int port) throws ArmiServerException {
  
          try {
              mRmiArmiInovcationAdapter = new RmiArmiInovcationAdapter(this);
  
              UnicastRemoteObject.exportObject(mRmiArmiInovcationAdapter);
  
              Registry registry = LocateRegistry.createRegistry(port);
  
              registry.rebind(RmiArmiInvocationHandler.class.getName(), mRmiArmiInovcationAdapter);
          } catch (RemoteException re) {
              throw new ArmiServerException("Some problem setting up server : " + re.getMessage());
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/socket/PlainSocketServer.java
  
  Index: PlainSocketServer.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/socket/PlainSocketServer.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.server.impl.socket;
  
  
  
  import org.apache.commons.armi.server.ArmiServer;
  import org.apache.commons.armi.server.ArmiServerException;
  import org.apache.commons.armi.server.impl.AbstractServer;
  import org.apache.commons.armi.server.impl.ObjectStreamServerConnection;
  import org.apache.commons.armi.common.ArmiRequest;
  import org.apache.commons.armi.common.ArmiReply;
  
  import java.net.ServerSocket;
  import java.net.Socket;
  
  import java.io.IOException;
  
  
  /**
   * Class PlainSocketServer
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PlainSocketServer extends AbstractServer implements Runnable {
  
      private ServerSocket mServerSocket;
  
      /**
       * Constructor PlainSocketServer
       *
       *
       * @param port
       *
       * @throws ArmiServerException
       *
       */
      public PlainSocketServer(int port) throws ArmiServerException {
  
          try {
              mServerSocket = new ServerSocket(port);
          } catch (IOException ioe) {
              throw new ArmiServerException("Some problem setting up server : " + ioe.getMessage());
          }
      }
  
      /**
       * Method run
       *
       *
       */
      public void run() {
  
          try {
              while (true) {
                  Socket sock = mServerSocket.accept();
                  ObjectStreamServerConnection dsc = new ObjectStreamServerConnection(this,
                                                         sock.getInputStream(),
                                                         sock.getOutputStream());
                  Thread thread = new Thread(dsc);
  
                  thread.start();
              }
          } catch (IOException ioe) {
              System.err.println("Some problem connecting client via sockets.");
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/DirectTest.java
  
  Index: DirectTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/DirectTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.server.impl.direct.DirectServer;
  import org.apache.commons.armi.server.impl.direct.DirectArmiInovcationAdapter;
  import org.apache.commons.armi.common.ArmiInvocationHandler;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.client.ArmiFactory;
  import org.apache.commons.armi.client.impl.direct.DirectArmiHostContext;
  
  
  /**
   * Class DirectTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DirectTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          DirectServer ds = new DirectServer();
          TestInterfaceImpl ti = new TestInterfaceImpl();
  
          ds.publish(ti, "Hello", TestInterface.class);
  
          DirectTestClient dtc = new DirectTestClient(new DirectArmiInovcationAdapter(ds));
          Thread thread = new Thread(dtc);
  
          thread.start();
      }
  
      /**
       * Class DirectTestClient
       *
       *
       * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
       * @version $Revision: 1.1 $
       */
      static class DirectTestClient implements Runnable {
  
          private ArmiInvocationHandler mInvocationHandler;
  
          /**
           * Constructor DirectTestClient
           *
           *
           * @param ih
           *
           */
          public DirectTestClient(ArmiInvocationHandler ih) {
              mInvocationHandler = ih;
          }
  
          /**
           * Method run
           *
           *
           */
          public void run() {
  
              try {
                  ArmiHostContext arhc = new DirectArmiHostContext(mInvocationHandler);
                  TestInterface ti =
                      (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc, "Hello");
                  TestClient tc = new TestClient(ti);
              } catch (ArmiConnectionException ace) {
                  System.err.println("Some problem during connection to server : "
                                     + ace.getMessage());
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/PipeTest.java
  
  Index: PipeTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/PipeTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.server.impl.piped.PipedServer;
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.client.impl.socket.PlainSocketArmiHostContext;
  import org.apache.commons.armi.client.ArmiFactory;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.client.impl.piped.PipedArmiHostContext;
  
  import java.io.IOException;
  
  
  /**
   * Class PipeTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PipeTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          PipedServer ps = new PipedServer();
          TestInterfaceImpl ti = new TestInterfaceImpl();
  
          ps.publish(ti, "Hello", TestInterface.class);
  
          PipedTestClient ptc = new PipedTestClient(ps);
          Thread thread = new Thread(ptc);
  
          thread.start();
      }
  
      /**
       * Class PipedTestClient
       *
       *
       * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
       * @version $Revision: 1.1 $
       */
      static class PipedTestClient implements Runnable {
  
          private PipedServer mPipedServer;
  
          /**
           * Constructor PipedTestClient
           *
           *
           * @param pipedServer
           *
           */
          public PipedTestClient(PipedServer pipedServer) {
              mPipedServer = pipedServer;
          }
  
          /**
           * Method run
           *
           *
           */
          public void run() {
  
              try {
                  ArmiHostContext arhc = new PipedArmiHostContext(mPipedServer);
                  TestInterface ti =
                      (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc, "Hello");
                  TestClient tc = new TestClient(ti);
              } catch (ArmiConnectionException ace) {
                  System.err.println("Some problem during connection to server : "
                                     + ace.getMessage());
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/RmiClientTest.java
  
  Index: RmiClientTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/RmiClientTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.client.ArmiFactory;
  import org.apache.commons.armi.client.impl.rmi.RmiArmiHostContext;
  
  
  /**
   * Class RmiClientTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiClientTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          ArmiHostContext arhc = new RmiArmiHostContext("127.0.0.1", 4321);
          TestInterface ti = (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc,
                                 "Hello");
  
          new TestClient(ti);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/RmiServerTest.java
  
  Index: RmiServerTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/RmiServerTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.server.impl.rmi.RmiServer;
  
  import java.io.IOException;
  
  
  /**
   * Class RmiServerTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiServerTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          RmiServer rs = new RmiServer("127.0.0.1", 4321);
          TestInterfaceImpl ti = new TestInterfaceImpl();
  
          rs.publish(ti, "Hello", TestInterface.class);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/SocketClientTest.java
  
  Index: SocketClientTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/SocketClientTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.client.ArmiFactory;
  import org.apache.commons.armi.common.ArmiConnectionException;
  import org.apache.commons.armi.client.impl.socket.PlainSocketArmiHostContext;
  
  import java.io.IOException;
  
  
  /**
   * Class SocketClientTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class SocketClientTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          ArmiHostContext arhc = new PlainSocketArmiHostContext("127.0.0.1", 1234);
          TestInterface ti = (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc,
                                 "Hello");
  
          new TestClient(ti);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/SocketServerTest.java
  
  Index: SocketServerTest.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/SocketServerTest.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.server.impl.socket.PlainSocketServer;
  
  import java.io.IOException;
  
  
  /**
   * Class SocketServerTest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class SocketServerTest {
  
      /**
       * Method main
       *
       *
       * @param args
       *
       * @throws Exception
       *
       */
      public static void main(String[] args) throws Exception {
  
          PlainSocketServer ds = new PlainSocketServer(1234);
          TestInterfaceImpl ti = new TestInterfaceImpl();
  
          ds.publish(ti, "Hello", TestInterface.class);
          ds.run();
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import org.apache.commons.armi.client.ArmiHostContext;
  import org.apache.commons.armi.client.impl.socket.PlainSocketArmiHostContext;
  import org.apache.commons.armi.client.ArmiFactory;
  
  import java.io.IOException;
  
  import java.beans.PropertyVetoException;
  
  
  /**
   * Class TestClient
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class TestClient {
  
      /**
       * Constructor TestClient
       *
       *
       * @param ti
       *
       */
      public TestClient(TestInterface ti) {
  
          // it is your choice whether you catch ArmiInvocationException or not.
          // If you do, you could have several strategies:
          // 1) around each ti. invocation.
          // 2) around the whole contents of the constructor
          // 3) in the methods that instantiate TestClient
          ti.hello("howdie partner");
          ti.hello2(1234);
          ti.hello2(1235);
          ti.hello2(1236);
  
          try {
              ti.hello3((short) 222);
          } catch (PropertyVetoException e) {
              System.out.println("CLT: Client PropertyVetoException Caught " + e.getMessage());
          } catch (IOException e) {
              System.out.println("CLT: Client IOException Caught " + e.getMessage());
          }
  
          System.out.println("CLT: " + ti.hello4((float) 1.3, 2.1));
  
          long start = System.currentTimeMillis();
          for (int i = 0; i < 1000; i++) {
              ti.testSpeed();
          }
          long end = System.currentTimeMillis();
          System.out.println("Total time take for 1000 simple calls (millis) = " + (end - start));
  
          start = System.currentTimeMillis();
          for (int i = 0; i < 1000; i++) {
              String rv = ti.testSpeed2("qwerty");
          }
          end = System.currentTimeMillis();
          System.out.println("Total time take for 1000 retval/param calls (millis) = " + (end - start));
  
      }
  
      //public static void main(String[] args) throws Exception {
      //    ArmiHostContext arhc = new PlainSocketArmiHostContext("127.0.0.1",1234);
      //    TestInterface ti = (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc,"Hello",TestInterface.class);
      //    new TestClient(ti);
      //}
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestInterface.java
  
  Index: TestInterface.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestInterface.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import java.beans.PropertyVetoException;
  
  import java.io.IOException;
  
  
  /**
   * Interface TestInterface
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface TestInterface {
  
      /**
       * Method hello
       *
       *
       * @param greeting
       *
       */
      void hello(String greeting);
  
      /**
       * Method hello2
       *
       *
       * @param greeting
       *
       */
      void hello2(int greeting);
  
      /**
       * Method hello3
       *
       *
       * @param greeting
       *
       * @return
       *
       * @throws IOException
       * @throws PropertyVetoException
       *
       */
      boolean hello3(short greeting) throws PropertyVetoException, IOException;
  
      /**
       * Method hello4
       *
       *
       * @param greeting1
       * @param greeting2
       *
       * @return
       *
       */
      StringBuffer hello4(float greeting1, double greeting2);
  
      void testSpeed();
      String testSpeed2(String string);
  }
  
  
  
  1.1                  jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestInterfaceImpl.java
  
  Index: TestInterfaceImpl.java
  ===================================================================
  
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestInterfaceImpl.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/28 18:08:39 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.armi.test;
  
  
  
  import java.beans.PropertyVetoException;
  
  import java.io.IOException;
  
  
  /**
   * Class TestInterfaceImpl
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class TestInterfaceImpl implements TestInterface {
  
      /**
       * Method hello
       *
       *
       * @param greeting
       *
       */
      public void hello(String greeting) {
          System.out.println("SVR: Greeting (string) : " + greeting);
      }
  
      /**
       * Method hello2
       *
       *
       * @param greeting
       *
       */
      public void hello2(int greeting) {
          System.out.println("SVR: Greeting2 (int)   : " + greeting);
      }
  
      /**
       * Method hello3
       *
       *
       * @param greeting
       *
       * @return
       *
       * @throws IOException
       * @throws PropertyVetoException
       *
       */
      public boolean hello3(short greeting) throws PropertyVetoException, IOException {
  
          String str = new Double(Math.random()).toString();
  
          if (str.startsWith("0.1") | str.startsWith("0.2") | str.startsWith("0.3")
                  | str.startsWith("0.4")) {
              throw new IOException("Whoa - forced test of exception passing.");
          }
  
          System.out.println("SVR: Greeting3 (short)   : " + greeting);
  
          return true;
      }
  
      /**
       * Method hello4
       *
       *
       * @param greeting1
       * @param greeting2
       *
       * @return
       *
       */
      public StringBuffer hello4(float greeting1, double greeting2) {
  
          StringBuffer sb = new StringBuffer("Greeting4 (float, double)   : ");
  
          sb.append(greeting1).append(" ").append(greeting2);
          System.out.println("SVR: " + sb.toString());
  
          return sb;
      }
  
      public void testSpeed() {
      }
  
      public String testSpeed2(String string) {
          return "abc123";
      }
  }
  
  
  

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