avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/subscription AbstractSubscriber.java RmiSubscriber.java SocketObjectStreamSubscriber.java
Date Fri, 27 Dec 2002 00:07:28 GMT
hammant     2002/12/26 16:07:28

  Modified:    altrmi   build.xml default.properties
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http
                        ClientHttpReadWriter.java
               altrmi/src/java/org/apache/excalibur/altrmi/server
                        PublicationDescriptionItem.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http
                        CustomHttpServlet.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/http
                        CustomHttpServletTestCase.java KludgeServlet.java
               altrmi/src/xdocs index.xml
  Added:       altrmi/lib cornerstone-api.jar phoenix-client.jar
                        phoenix-metagenerate.jar
               altrmi/src/conf MANIFEST-blocks.MF
               altrmi/src/java/org/apache/excalibur/altrmi/blocks/authentication
                        DefaultAuthenticator.java
               altrmi/src/java/org/apache/excalibur/altrmi/blocks/autopublishing
                        AutoPublisher-schema.xml AutoPublisher.java
                        PublicationInfo.java
               altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing
                        AbstractPublisher.java
                        PartialSocketStreamConnectionHandler.java
                        RmiPublisher.java SocketStreamPublisher-schema.xml
                        SocketStreamPublisher.java
               altrmi/src/java/org/apache/excalibur/altrmi/blocks/subscription
                        AbstractSubscriber.java RmiSubscriber.java
                        SocketObjectStreamSubscriber.java
  Log:
  Transport from cornerstone arrives, if only temporarily. Version bumped to 0.8a
  
  Revision  Changes    Path
  1.55      +31 -6     jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- build.xml	21 Dec 2002 23:18:13 -0000	1.54
  +++ build.xml	27 Dec 2002 00:07:27 -0000	1.55
  @@ -26,6 +26,9 @@
           <pathelement location="${jakarta-bcel.jar}"/>
           <pathelement path="${java.class.path}"/>
   <!--        <pathelement path="lib/servlet.jar"/>-->
  +        <pathelement path="${cornerstone-api.jar}"/>
  +        <pathelement path="${phoenix-client.jar}"/>
  +        <pathelement path="${phoenix-metagenerate.jar}"/>
           <pathelement path="jetty-download/Jetty-${jetty.rel}/Jetty-${jetty.rel}/lib/javax.servlet.jar"/>
           <pathelement path="jetty-download/Jetty-${jetty.rel}/Jetty-${jetty.rel}/lib/org.mortbay.jetty.jar"/>
       </path>
  @@ -162,9 +165,23 @@
           </copy>
   
       </target>
  +    
  +  <target name="metagenerate" description="Generates the XML descriptors">
  +
  +    <taskdef name="generatemeta" classname="org.apache.avalon.phoenix.tools.metagenerate.MetaGenerateTask">
  +      <classpath refid="project.class.path" />
  +    </taskdef>
  +
  +    <generatemeta dest="${build.classes}">
  +      <fileset dir="${java.dir}">
  +        <include name="**/*.java"/>
  +      </fileset>
  +    </generatemeta>
  +
  +  </target>    
   
       <!-- Creates all the .jar file -->
  -    <target name="jar" depends="compile" description="Generates the jar files">
  +    <target name="jar" depends="compile, metagenerate" description="Generates the jar files">
   
           <mkdir dir="${build.lib}"/>
   
  @@ -187,6 +204,7 @@
               compress="${build.compress}"
               manifest="src/conf/MANIFEST-client-impl.MF">
             <include name="org/apache/excalibur/altrmi/client/impl/**"/>
  +          <exclude name="**/http/**"/>
           </jar>
   
           <jar jarfile="${build.lib}/${server-interfaces.jar.name}"
  @@ -201,9 +219,9 @@
               compress="${build.compress}"
               manifest="src/conf/MANIFEST-server-impl.MF">
             <include name="org/apache/excalibur/altrmi/server/impl/**"/>
  +          <exclude name="**/http/**"/>
           </jar>
   
  -
           <jar jarfile="${build.lib}/${generator.jar.name}"
               basedir="${build.classes}"
               manifest="src/conf/MANIFEST-generator.MF">
  @@ -217,6 +235,12 @@
             <include name="org/apache/excalibur/altrmi/registry/**"/>
           </jar>
   
  +        <jar jarfile="${build.lib}/${blocks.jar.name}"
  +            basedir="${build.classes}"
  +            manifest="src/conf/MANIFEST-blocks.MF">
  +          <include name="org/apache/excalibur/altrmi/blocks/**"/>
  +        </jar>
  +
   
       </target>
   
  @@ -265,15 +289,16 @@
               <batchtest todir="${build.tests}">
                   <fileset dir="${build.testclasses}">
   
  +                    <include name="**/test/**/CustomHttpServletTestCase.class"/>
  +<!--
   
   
  -
  -<!--
  +                    <include name="**/test/**/*TestCase.class"/>
                       <include name="**/test/**/JettyServletTestCase.class"/>
  -                    <include name="**/test/**/CustomHttpServletTestCase.class"/>
   -->
  -                    <include name="**/test/**/*TestCase.class"/>
  +
                       <exclude name="**/Abstract*"/>
  +                    <exclude name="**/CustomHttpServletTestCase*"/>
                       <exclude name="**/JSXObjectStreamTestCase.class"/>
                   </fileset>
               </batchtest>
  
  
  
  1.15      +6 -2      jakarta-avalon-excalibur/altrmi/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/default.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- default.properties	21 Dec 2002 19:34:43 -0000	1.14
  +++ default.properties	27 Dec 2002 00:07:27 -0000	1.15
  @@ -8,8 +8,8 @@
   name=excalibur-altrmi
   Name=Excalibur AltRMI
   dir-name=altrmi
  -version=0.7
  -year=2002
  +version=0.8a
  +year=2002-2003
   
   common.jar.name=${name}-common-${version}.jar
   client-interfaces.jar.name=${name}-client-interfaces-${version}.jar
  @@ -18,6 +18,7 @@
   server-impl.jar.name=${name}-server-impl-${version}.jar
   generator.jar.name=${name}-generator-${version}.jar
   registry.jar.name=${name}-registry-${version}.jar
  +blocks.jar.name=${name}-blocks-${version}.jar
   
   # --------------------------------------------------
   #                REQUIRED LIBRARIES
  @@ -29,6 +30,9 @@
   avalon-framework.jar=${avalon-framework.lib}/avalon-framework.jar
   jakarta-bcel.jar=lib/bcel.jar
   qdox.jar=lib/qdox-1.0.jar
  +cornerstone-api.jar=lib/cornerstone-api.jar
  +phoenix-client.jar=lib/phoenix-client.jar
  +phoenix-metagenerate.jar=lib/phoenix-metagenerate.jar
   jakarta-commons-attributes.jar=./lib/commons-attributes-0.1.jar
   jakarta-commons-httpclient.jar=./lib/commons-httpclient.jar
   jakarta-commons-logging.jar=./lib/commons-logging.jar
  
  
  
  1.5       +23 -40    jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http/ClientHttpReadWriter.java
  
  Index: ClientHttpReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http/ClientHttpReadWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClientHttpReadWriter.java	21 Dec 2002 21:43:54 -0000	1.4
  +++ ClientHttpReadWriter.java	27 Dec 2002 00:07:27 -0000	1.5
  @@ -7,23 +7,16 @@
    */
   package org.apache.excalibur.altrmi.client.impl.http;
   
  +import org.apache.commons.httpclient.Header;
  +import org.apache.commons.httpclient.HttpClient;
  +import org.apache.commons.httpclient.methods.PostMethod;
   import org.apache.excalibur.altrmi.client.impl.ClientStreamReadWriter;
  -import org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter;
   import org.apache.excalibur.altrmi.common.AltrmiReply;
   import org.apache.excalibur.altrmi.common.AltrmiRequest;
  -import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  -import org.apache.commons.httpclient.HttpConnection;
  -import org.apache.commons.httpclient.HttpConnectionManager;
  -import org.apache.commons.httpclient.HttpClient;
  -import org.apache.commons.httpclient.methods.GetMethod;
  -import org.apache.commons.httpclient.methods.PostMethod;
  +import org.apache.excalibur.altrmi.common.SerializationHelper;
   
  +import java.io.ByteArrayInputStream;
   import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.OutputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.net.URL;
  -import java.net.URLConnection;
   
   public class ClientHttpReadWriter implements ClientStreamReadWriter
   {
  @@ -41,41 +34,31 @@
       public AltrmiReply postRequest(AltrmiRequest altrmiRequest)
               throws IOException, ClassNotFoundException
       {
  -        //URL url = new URL("http",m_host, m_port,"/mystuff/Dump/");
  -//        HttpConnection connection = new HttpConnection(m_host, m_port);
   
           HttpClient client = new HttpClient();
           client.getHostConfiguration().setHost(m_host, m_port, "http");
           // we shouldn't have to wait if a connection is available
  -        client.setHttpConnectionFactoryTimeout( 1 );
  +        client.setHttpConnectionFactoryTimeout( 10 * 1000 );
   
  -        PostMethod postMethod = new PostMethod("/mystuff/Dump/");
  +        PostMethod postMethod = new PostMethod("/mystuff/Dump");
  +
  +        byte[] requestBytes = SerializationHelper.getBytesFromInstance( altrmiRequest );
  +
  +        ByteArrayInputStream inputStream = new ByteArrayInputStream(requestBytes);
  +
  +        postMethod.setRequestBody(inputStream);
           client.executeMethod(postMethod);
   
  +        byte[] response = postMethod.getResponseBody();
  +        //Header[] headers = postMethod.getRequestHeaders();
  +        //for (int i = 0; i < headers.length; i++)
  +        //{
  +        //    Header header = headers[i];
  +        //    System.out.println("--> " + i + " " + header);
  +        //}
  +        //System.out.println("--> resp " + response.length);
  +
  +        return (AltrmiReply) SerializationHelper.getInstanceFromBytes( response, m_interfacesClassLoader );
   
  -        ClientCustomStreamReadWriter clientCustomStreamReadWriter;
  -        try
  -        {
  -            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  -            outputStream.write(postMethod.getResponseBody());
  -            InputStream inputStream = postMethod.getRequestBody();
  -            clientCustomStreamReadWriter = new ClientCustomStreamReadWriter(
  -                    inputStream, outputStream, m_interfacesClassLoader);
  -            return clientCustomStreamReadWriter.postRequest(altrmiRequest);
  -        }
  -        catch (AltrmiConnectionException e)
  -        {
  -            throw new IOException("Connection exception during read/writing:" + e.getMessage());
  -        }
  -        catch (IOException e)
  -        {
  -            System.err.println("IOException during posting of request " + e.getMessage());
  -            //e.printStackTrace();  //To change body of catch statement use Options | File Templates.
  -            throw e;
  -        }
  -
  -//        OutputStream out = connection
  -//        ObjectOutputStream out
  -        //return null;
       }
   }
  
  
  
  1.8       +3 -3      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/PublicationDescriptionItem.java
  
  Index: PublicationDescriptionItem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/PublicationDescriptionItem.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PublicationDescriptionItem.java	21 Dec 2002 20:32:37 -0000	1.7
  +++ PublicationDescriptionItem.java	27 Dec 2002 00:07:27 -0000	1.8
  @@ -53,8 +53,8 @@
           }
           catch (NoClassDefFoundError ncdfe)
           {
  -            System.out.println("--> ncdfe " + ncdfe.getMessage());
  -            ncdfe.printStackTrace();
  +            //System.out.println("--> ncdfe " + ncdfe.getMessage());
  +            //ncdfe.printStackTrace();
               // attribute jars are missing.
               // This allowed for when there is no Async functionality.
           }
  
  
  
  1.3       +4 -1      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServlet.java
  
  Index: CustomHttpServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CustomHttpServlet.java	16 Dec 2002 01:00:01 -0000	1.2
  +++ CustomHttpServlet.java	27 Dec 2002 00:07:27 -0000	1.3
  @@ -82,4 +82,7 @@
   
       }
   
  +
  +
  +
   }
  
  
  
  1.5       +1 -2      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/CustomHttpServletTestCase.java
  
  Index: CustomHttpServletTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/CustomHttpServletTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CustomHttpServletTestCase.java	21 Dec 2002 23:18:14 -0000	1.4
  +++ CustomHttpServletTestCase.java	27 Dec 2002 00:07:27 -0000	1.5
  @@ -11,12 +11,11 @@
   import org.apache.excalibur.altrmi.client.impl.http.CustomHttpHostContext;
   import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.server.impl.http.CustomHttpServlet;
  -import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
  +import org.apache.excalibur.altrmi.test.AbstractAltrmiTestCase;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.TestInterface2;
   import org.apache.excalibur.altrmi.test.TestInterface3;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  -import org.apache.excalibur.altrmi.test.AbstractAltrmiTestCase;
   import org.mortbay.http.HttpContext;
   import org.mortbay.http.HttpServer;
   import org.mortbay.http.SocketListener;
  
  
  
  1.4       +8 -0      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/KludgeServlet.java
  
  Index: KludgeServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/KludgeServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- KludgeServlet.java	21 Dec 2002 20:32:37 -0000	1.3
  +++ KludgeServlet.java	27 Dec 2002 00:07:27 -0000	1.4
  @@ -10,10 +10,15 @@
   import org.apache.excalibur.altrmi.server.impl.http.CustomHttpServlet;
   
   import javax.servlet.ServletException;
  +import javax.servlet.ServletRequest;
  +import javax.servlet.ServletResponse;
  +import javax.servlet.ServletConfig;
  +import javax.servlet.ServletContext;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpServlet;
   import java.io.IOException;
  +import java.util.Enumeration;
   
   public class KludgeServlet extends HttpServlet
   {
  @@ -36,5 +41,8 @@
           realServlet.doPost(httpServletRequest, httpServletResponse);
       }
   
  +    public KludgeServlet()
  +    {
  +    }
   
   }
  
  
  
  1.8       +7 -1      jakarta-avalon-excalibur/altrmi/src/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/xdocs/index.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- index.xml	16 Aug 2002 12:04:51 -0000	1.7
  +++ index.xml	27 Dec 2002 00:07:27 -0000	1.8
  @@ -16,6 +16,12 @@
           is also inspired by the remoting facility in .NET.  This does not mean that it has SOAP 
           capabilty (yet), as it is more like the proprietary RPC transport for the .NET framework.
         </p>
  +      <p>
  +        The name AltRMI is inspired by the 'alt' usenet ewgroup hierarchy.  We have thought about 
  +        renaming it especially as alt means old in German.  DRMI (Distributed RMI), PMI (Proxied 
  +        Method Invocation), ARC (Apache Remote Control) were all considered as replacements, but 
  +        for now we stick with AltRMI.
  +      </p>
         <warn>
           This package is under development, and the API is not
           guaranteed to be the same when it is ready for release.
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/lib/cornerstone-api.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/lib/phoenix-client.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/lib/phoenix-metagenerate.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/conf/MANIFEST-blocks.MF
  
  Index: MANIFEST-blocks.MF
  ===================================================================
  Extension-Name: excalibur-altrmi-blocks
  Specification-Vendor: Apache Software Foundation
  Specification-Version: 0.9
  Implementation-Vendor: Apache Software Foundation
  Implementation-Version: 0.9
  
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/authentication/DefaultAuthenticator.java
  
  Index: DefaultAuthenticator.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.authentication;
  
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
  import org.apache.excalibur.altrmi.common.AltrmiAuthenticationException;
  import org.apache.excalibur.altrmi.server.AltrmiAuthenticator;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultAuthenticator
      implements AltrmiAuthenticator, Initializable
  {
      private AltrmiAuthenticator m_altrmiAuthenticator;
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize()
          throws Exception
      {
          m_altrmiAuthenticator =
              new org.apache.excalibur.altrmi.server.impl.DefaultAuthenticator();
      }
  
      public void checkAuthority( AltrmiAuthentication authentication, String publishedName )
          throws AltrmiAuthenticationException
      {
          m_altrmiAuthenticator.checkAuthority( authentication, publishedName );
      }
  
      public String getTextToSign()
      {
          return m_altrmiAuthenticator.getTextToSign();
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/autopublishing/AutoPublisher-schema.xml
  
  Index: AutoPublisher-schema.xml
  ===================================================================
  <?xml version="1.0"?>
  <element
      name="root"
      xmlns="http://relaxng.org/ns/structure/1.0"
      datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
      xmlns:a="http://jakarta.apache.org/phoenix/schema-annotations/1.0"
  >
      <element name="publisher"><text/></element>
      <oneOrMore>
          <element name="publish">
              <attribute name="block"/>
              <attribute name="publishAsName"/>
              <attribute name="interfaceToPublish"/>
          </element>
      </oneOrMore>
  </element>
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/autopublishing/AutoPublisher.java
  
  Index: AutoPublisher.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.altrmi.blocks.autopublishing;
  
  import java.util.HashMap;
  import java.util.Map;
  import java.util.Vector;
  import org.apache.avalon.framework.CascadingRuntimeException;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.phoenix.ApplicationEvent;
  import org.apache.avalon.phoenix.ApplicationListener;
  import org.apache.avalon.phoenix.BlockEvent;
  import org.apache.excalibur.altrmi.server.AltrmiPublisher;
  import org.apache.excalibur.altrmi.server.PublicationException;
  
  /**
   * Publishes so configured services automatically after block start().
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AutoPublisher extends AbstractLogEnabled
      implements Configurable, ApplicationListener
  {
      private String m_publisherName;
      private AltrmiPublisher m_altrmiPublisher;
      private Map m_publications;
      private Vector m_events = new Vector();
  
      /**
       * @phoenix:configuration-schema type="relax-ng"
       */
      public void configure( final Configuration configuration ) throws ConfigurationException
      {
  
          m_publisherName = configuration.getChild( "publisher" ).getValue( "altrmification" );
          m_publications = new HashMap();
  
          final Configuration[] confs = configuration.getChildren( "publish" );
  
          for( int i = 0; i < confs.length; i++ )
          {
              final Configuration conf = confs[ i ];
              final String blockName = conf.getAttribute( "block" );
              final String publishAsName = conf.getAttribute( "publishAsName" );
              final String interfaceToPublish = conf.getAttribute( "interfaceToPublish" );
  
              m_publications.put( blockName, new PublicationInfo( publishAsName, interfaceToPublish ) );
          }
      }
  
      public void blockAdded( final BlockEvent event )
      {
          if( m_publisherName.equals( event.getName() ) )
          {
              m_altrmiPublisher = (AltrmiPublisher)event.getBlock();
          }
  
          if( m_publications.containsKey( event.getName() ) )
          {
              m_events.add( event );
  
              if( getLogger().isDebugEnabled() )
                  getLogger().debug( "Will publish block: " + event.getName() );
          }
      }
  
      public void blockRemoved( final BlockEvent event )
      {
      }
  
      public void applicationStarting( ApplicationEvent event ) throws Exception
      {
      }
  
      public void applicationStarted()
      {
  
          for( int i = 0; i < m_events.size(); i++ )
          {
              final BlockEvent event = (BlockEvent)m_events.elementAt( i );
              final Object block = event.getBlock();
              PublicationInfo pi = (PublicationInfo)m_publications.get( event.getName() );
  
              try
              {
                  m_altrmiPublisher.publish( block, pi.getPublishAsName(),
                      this.getClass().getClassLoader().loadClass( pi.getInterfaceToPublish() ) );
              }
              catch( PublicationException e )
              {
                  getLogger().error( "Some problem auto-publishing", e );
  
                  throw new CascadingRuntimeException( "Some problem auto-publishing", e );
              }
              catch( ClassNotFoundException e )
              {
                  throw new CascadingRuntimeException(
                      "Interface specified in config.xml ('interfaceToPublish' attribte) not found",
                      e );
              }
          }
      }
  
      public void applicationStopping()
      {
          for( int i = 0; i < m_events.size(); i++ )
          {
              BlockEvent event = (BlockEvent)m_events.elementAt( i );
  
              if( m_publications.containsKey( event.getName() ) )
              {
                  final Object block = event.getBlock();
                  PublicationInfo pi = (PublicationInfo)m_publications.get( event.getName() );
  
                  try
                  {
                      m_altrmiPublisher.unPublish( block, pi.getPublishAsName() );
                  }
                  catch( PublicationException e )
                  {
                      throw new CascadingRuntimeException( "Some problem un-auto-publishing", e );
                  }
              }
          }
      }
  
      public void applicationStopped()
      {
          m_events.clear();
  
          if( getLogger().isDebugEnabled() ) getLogger().debug( "Cleared event list" );
      }
  
      public void applicationFailure( Exception e )
      {
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/autopublishing/PublicationInfo.java
  
  Index: PublicationInfo.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.altrmi.blocks.autopublishing;
  
  /**
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class PublicationInfo
  {
      private final String m_publishAsName;
      private final String m_interfaceToPublish;
  
      public PublicationInfo( String publishAsName, String interfaceToPublish )
      {
          m_publishAsName = publishAsName;
          m_interfaceToPublish = interfaceToPublish;
      }
  
      /**
       * Method getPublishAsName
       *
       *
       * @return
       *
       */
      public String getPublishAsName()
      {
          return m_publishAsName;
      }
  
      public String getInterfaceToPublish()
      {
          return m_interfaceToPublish;
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing/AbstractPublisher.java
  
  Index: AbstractPublisher.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.publishing;
  
  import java.io.File;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.StringTokenizer;
  import java.util.Vector;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.excalibur.altrmi.common.MethodRequest;
  import org.apache.excalibur.altrmi.server.AltrmiAuthenticator;
  import org.apache.excalibur.altrmi.server.AltrmiPublisher;
  import org.apache.excalibur.altrmi.server.ClassRetriever;
  import org.apache.excalibur.altrmi.server.MethodInvocationHandler;
  import org.apache.excalibur.altrmi.server.PublicationDescription;
  import org.apache.excalibur.altrmi.server.PublicationException;
  import org.apache.excalibur.altrmi.server.impl.AbstractServer;
  import org.apache.excalibur.altrmi.server.impl.classretrievers.AbstractDynamicGeneratorClassRetriever;
  import org.apache.excalibur.altrmi.server.impl.classretrievers.BcelDynamicGeneratorClassRetriever;
  import org.apache.excalibur.altrmi.server.impl.classretrievers.JarFileClassRetriever;
  import org.apache.excalibur.altrmi.server.impl.classretrievers.NoClassRetriever;
  import org.apache.avalon.framework.context.ContextException;
  
  /**
   * Abstract Publisher.
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @author Thomas Kiesgen
   * @version $Revision: 1.1 $
   */
  public abstract class AbstractPublisher
      extends AbstractLogEnabled
      implements AltrmiPublisher, Startable, Serviceable, Contextualizable, Configurable,
      Initializable
  {
      private AbstractServer m_abstractServer;
      private ClassRetriever m_classRetriever;
      private AltrmiAuthenticator m_altrmiAuthenticator;
      protected File m_baseDirectory;
      private boolean m_isDynamicPublisher = false;
  
      /**
       *
       * @param configuration
       * @throws ConfigurationException
       */
      public void configure( Configuration configuration )
          throws ConfigurationException
      {
          String classRetrieverType = configuration.getChild( "classRetrieverType" ).getValue();
  
          if( classRetrieverType.equals( "jarFile" ) )
          {
              StringTokenizer st =
                  new StringTokenizer( configuration.getChild( "gerneratedClassJarURLs" ).getValue(),
                                       "," );
              Vector vector = new Vector();
  
              while( st.hasMoreTokens() )
              {
                  try
                  {
                      String url = st.nextToken();
  
                      if( url.startsWith( "./" ) )
                      {
                          File file = new File( m_baseDirectory, url.substring( 2, url.length() ) );
  
                          vector.add( file.toURL() );
                      }
                      else
                      {
                          vector.add( new URL( url ) );
                      }
                  }
                  catch( MalformedURLException e )
                  {
                      getLogger()
                          .debug( "Can't create URL from config element 'gerneratedClassJarURLs'",
                                  e );
                  }
              }
  
              URL[] urls = new URL[ vector.size() ];
  
              vector.copyInto( urls );
  
              m_classRetriever = new JarFileClassRetriever( urls );
          }
          else if( classRetrieverType.equals( "none" ) )
          {
              m_classRetriever = new NoClassRetriever();
          }
          else if( classRetrieverType.equals( "bcel" ) )
          {
              AbstractDynamicGeneratorClassRetriever generator = new BcelDynamicGeneratorClassRetriever();
              File classGenDir = new File( m_baseDirectory, configuration.getChild( "classGenDir" ).getValue( "" ) );
              generator.setClassGenDir( classGenDir.getAbsolutePath() );
              m_classRetriever = generator;
  
              m_isDynamicPublisher = true;
              getLogger().debug( "setting classgen dir for generator to " + classGenDir.getAbsolutePath() );
              getLogger().debug( "setting class retriever to bcel dynamic generator" );
          }
  
  
          else
          {
              throw new ConfigurationException(
                  "classRetrieverType must be 'bcel', 'jarFile' or 'none'" );
          }
      }
  
      /**
       * contextualize as per Contextualizable interface
       * @param context
       */
      public void contextualize( final Context context ) throws ContextException
      {
          m_baseDirectory = ( File ) context.get("app.home");
      }
  
      /**
       * Service as per Serviceable interface
       * @param manager a service manager
       * @throws ServiceException if a problem during servicing
       * @phoenix:dependency name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator"
       */
      public void service( ServiceManager manager )
          throws ServiceException
      {
          m_altrmiAuthenticator =
              (AltrmiAuthenticator)manager.lookup( AltrmiAuthenticator.class.getName() );
      }
  
      /**
       * initialize as per Initializable interface
       * @throws Exception
       */
      public void initialize() throws Exception
      {
          m_abstractServer.setClassRetriever( m_classRetriever );
          m_abstractServer.setAuthenticator( m_altrmiAuthenticator );
      }
  
      /**
       *
       * @param implementation
       * @param asName
       * @param interfaceToExpose
       * @throws PublicationException
       */
      public void publish( Object implementation, String asName, Class interfaceToExpose )
          throws PublicationException
      {
          if( getLogger().isDebugEnabled() )
              getLogger().debug( "Publishing object [as: " + asName + ", impl: " + implementation
                                + ", interf: "+ interfaceToExpose + "]" );
  
          if( m_isDynamicPublisher )
          {
              ( ( AbstractDynamicGeneratorClassRetriever ) m_classRetriever ).generate( asName, interfaceToExpose, this.getClass().getClassLoader() );
                  if( getLogger().isDebugEnabled() )
                  {
                      getLogger().debug( "generated dynamic proxy for published interface " + asName );
                  }
          }
  
          m_abstractServer.publish( implementation, asName, interfaceToExpose );
      }
  
      /**
       * Publish an service
       * @param implementation
       * @param asName
       * @param publicationDescription
       * @throws PublicationException
       */
      public void publish(
          Object implementation, String asName, PublicationDescription publicationDescription )
          throws PublicationException
      {
          if( getLogger().isDebugEnabled() )
              getLogger().debug( "Publishing object [as: " + asName + ", impl: " + implementation + "]" );
  
          if( m_isDynamicPublisher )
          {
              ( ( AbstractDynamicGeneratorClassRetriever ) m_classRetriever ).generate( asName, publicationDescription, this.getClass().getClassLoader() );
                  if( getLogger().isDebugEnabled() )
                  {
                      getLogger().debug( "generated dynamic proxy for published interface " + asName );
                  }
          }
  
  
  
          m_abstractServer.publish( implementation, asName, publicationDescription );
      }
  
      /**
       *
       * @param object
       * @param asName
       * @throws PublicationException
       */
      public void unPublish( Object object, String asName ) throws PublicationException
      {
          if( getLogger().isDebugEnabled() )
              getLogger().debug( "Unpublishing object [nane: " + asName + ", impl: " + object + "]" );
  
          m_abstractServer.unPublish( object, asName );
      }
  
      /**
       *
       * @param object
       * @param asName
       * @param o1
       * @throws PublicationException
       */
      public void replacePublished( Object object, String asName, Object o1 ) throws PublicationException
      {
          if( getLogger().isDebugEnabled() )
              getLogger().debug( "Replacing published object [nane: " + asName + ", existing: " + object + ", new: " + o1 + "]" );
  
          m_abstractServer.replacePublished( object, asName, o1 );
      }
  
      /**
       *
       * @throws Exception
       */
      public void start() throws Exception
      {
          m_abstractServer.start();
      }
  
      /**
       *
       * @throws Exception
       */
      public void stop() throws Exception
      {
          m_abstractServer.stop();
      }
  
      /**
       *
       * @param request
       * @param publishedName
       * @return
       */
      public MethodInvocationHandler getMethodInvocationHandler( MethodRequest request, String publishedName )
      {
          return m_abstractServer.getMethodInvocationHandler( request, publishedName );
      }
  
      /**
       *
       * @param publishedName
       * @return
       */
      public MethodInvocationHandler getMethodInvocationHandler(String publishedName)
      {
          return m_abstractServer.getMethodInvocationHandler( publishedName );
      }
  
      /**
       *
       * @return
       */
      protected AbstractServer getAbstractServer()
      {
          return m_abstractServer;
      }
  
      /**
       *
       * @param abstractServer
       */
      protected void setAbstractServer( AbstractServer abstractServer )
      {
          m_abstractServer = abstractServer;
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing/PartialSocketStreamConnectionHandler.java
  
  Index: PartialSocketStreamConnectionHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.publishing;
  
  import java.io.IOException;
  import java.net.ProtocolException;
  import java.net.Socket;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  
  /**
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @author Peter Royal.
   * @version $Revision: 1.1 $
   */
  public class PartialSocketStreamConnectionHandler
      extends AbstractLogEnabled
      implements ConnectionHandler
  {
      private AbstractPartialSocketStreamServer m_PartialSockeStreamServer;
  
      public PartialSocketStreamConnectionHandler(
          AbstractPartialSocketStreamServer partialSocketStreamServer )
      {
          m_PartialSockeStreamServer = partialSocketStreamServer;
      }
  
      /**
       * Handle a connection.
       * This handler is responsible for processing connections as they occur.
       *
       * @param connection the connection
       * @exception IOException if an error reading from socket occurs
       * @exception ProtocolException if an error handling connection occurs
       */
      public void handleConnection( Socket connection )
          throws IOException, ProtocolException
      {
          m_PartialSockeStreamServer.handleConnection( connection );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing/RmiPublisher.java
  
  Index: RmiPublisher.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.publishing;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.excalibur.altrmi.server.impl.rmi.RmiServer;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.excalibur.altrmi.server.AltrmiPublisher"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiPublisher
      extends AbstractPublisher
  {
      private String m_host;
      private int m_port;
  
      /**
       * Pass the <code>Configuration</code> to the <code>Configurable</code>
       * class. This method must always be called after the constructor
       * and before any other method.
       *
       * @param configuration the class configurations.
       */
      public void configure( Configuration configuration ) throws ConfigurationException
      {
  
          super.configure( configuration );
  
          m_port = configuration.getChild( "port" ).getValueAsInteger();
          m_host = configuration.getChild( "host" ).getValue();
      }
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize() throws Exception
      {
  
          setAbstractServer( new RmiServer( m_host, m_port ) );
  
          setupLogger( getAbstractServer() );
          super.initialize();
      }
  
      /**
       * Service as per Serviceable interface
       * @param manager a service manager
       * @throws ServiceException if a problem during servicing
       */
      public void service( ServiceManager manager )
          throws ServiceException
      {
          super.service( manager );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing/SocketStreamPublisher-schema.xml
  
  Index: SocketStreamPublisher-schema.xml
  ===================================================================
  <?xml version="1.0"?>
  <element
      name="root"
      xmlns="http://relaxng.org/ns/structure/1.0"
      datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
      xmlns:a="http://jakarta.apache.org/phoenix/schema-annotations/1.0"
  >
      <interleave>
          <element name="bind"><text/></element>
          <element name="port"><data type="integer"/></element>
          <element name="socketStreamServerClass"><text/></element>
          <element name="classRetrieverType">
              <choice>
                  <value>baseMobileClass</value>
                  <value>jarFile</value>
                  <value>none</value>
              </choice>
          </element>
      </interleave>
  </element>
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/publishing/SocketStreamPublisher.java
  
  Index: SocketStreamPublisher.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.publishing;
  
  import java.io.IOException;
  import java.net.InetAddress;
  import java.net.ServerSocket;
  import java.net.UnknownHostException;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
  import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
  import org.apache.avalon.cornerstone.services.sockets.ServerSocketFactory;
  import org.apache.avalon.cornerstone.services.sockets.SocketManager;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.excalibur.altrmi.server.AltrmiPublisher"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @author Mike Miller.
   * @author Peter Royal.
   * @version $Revision: 1.1 $
   */
  public class SocketStreamPublisher
      extends AbstractPublisher
      implements ConnectionHandlerFactory
  {
      private SocketManager m_socketManager;
      private ConnectionManager m_connectionManager;
      private int m_port;
      private InetAddress m_bindTo;
      private String m_socketStreamServerClass;
      private boolean m_allAddresses = false;
  
      /**
       * @phoenix:configuration-schema type="relax-ng"
       */
      public final void configure( Configuration configuration ) throws ConfigurationException
      {
  
          super.configure( configuration );
  
          m_port = configuration.getChild( "port" ).getValueAsInteger();
  
          try
          {
              final String bindAddress = configuration.getChild( "bind" ).getValue();
  
              if( "*".equals( bindAddress ) )
              {
                  m_allAddresses = true;
                  m_bindTo = null;
              }
              else
              {
                  m_allAddresses = false;
                  m_bindTo = InetAddress.getByName( bindAddress );
              }
          }
          catch( final UnknownHostException unhe )
          {
              throw new ConfigurationException( "Malformed bind parameter", unhe );
          }
  
          m_socketStreamServerClass = configuration.getChild( "socketStreamServerClass" ).getValue();
      }
  
      /**
       * Service as per Serviceable interface
       * @param manager a service manager
       * @throws ServiceException if a problem during servicing
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.sockets.SocketManager"
       * @phoenix:dependency name="org.apache.avalon.cornerstone.services.connection.ConnectionManager"
       */
      public final void service( final ServiceManager manager )
          throws ServiceException
      {
          super.service( manager );
  
          m_socketManager = (SocketManager)manager.lookup( SocketManager.ROLE );
          m_connectionManager = (ConnectionManager)manager.lookup( ConnectionManager.ROLE );
      }
  
      protected ServerSocket makeServerSocket()
          throws IOException, Exception
      {
  
          final ServerSocketFactory factory = m_socketManager.getServerSocketFactory( "plain" );
  
          if( m_allAddresses )
          {
              return factory.createServerSocket( m_port, 5 );
          }
          else
          {
              return factory.createServerSocket( m_port, 5, m_bindTo );
          }
      }
  
      public ConnectionHandler createConnectionHandler() throws Exception
      {
          final PartialSocketStreamConnectionHandler handler =
              new PartialSocketStreamConnectionHandler(
                  (AbstractPartialSocketStreamServer)getAbstractServer() );
  
          setupLogger( handler );
  
          return handler;
      }
  
      /**
       * Release a previously created ConnectionHandler.
       * e.g. for spooling.
       */
      public void releaseConnectionHandler( ConnectionHandler connectionHandler )
      {
      }
  
      public void initialize() throws Exception
      {
          setAbstractServer( (AbstractPartialSocketStreamServer)Class.forName( m_socketStreamServerClass ).newInstance() );
  
          setupLogger( getAbstractServer() );
          super.initialize();
          m_connectionManager.connect( "SocketStreamListener", makeServerSocket(), this );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/subscription/AbstractSubscriber.java
  
  Index: AbstractSubscriber.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.subscription;
  
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.excalibur.altrmi.client.AltrmiFactory;
  import org.apache.excalibur.altrmi.client.AltrmiHostContext;
  import org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup;
  import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
  import org.apache.excalibur.altrmi.client.impl.ServerClassAltrmiFactory;
  import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  
  /**
   * @phoenix:service name="org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public abstract class AbstractSubscriber
      extends AbstractLogEnabled
      implements AltrmiInterfaceLookup, Configurable, Initializable
  {
      protected AltrmiFactory m_altrmiFactory;
      protected AltrmiHostContext m_hostContext;
  
      /**
       * Pass the <code>Configuration</code> to the <code>Configurable</code>
       * class. This method must always be called after the constructor
       * and before any other method.
       *
       * @param configuration the class configurations.
       */
      public void configure( Configuration configuration ) throws ConfigurationException
      {
  
          String proxyClassLocation = configuration.getChild( "proxyClassLocation" ).getValue();
  
          if( proxyClassLocation.equals( "client" ) )
          {
              m_altrmiFactory = new ClientClassAltrmiFactory( false );
          }
          else if( proxyClassLocation.equals( "server" ) )
          {
              m_altrmiFactory = new ServerClassAltrmiFactory( false );
          }
          else
          {
              throw new ConfigurationException( "proxyClassLocation must be 'client' or 'server'" );
          }
      }
  
      public Object lookup( String publishedName ) throws AltrmiConnectionException
      {
          return m_altrmiFactory.lookup( publishedName );
      }
  
      public Object lookup( String publishedName, AltrmiAuthentication authentication )
          throws AltrmiConnectionException
      {
          return m_altrmiFactory.lookup( publishedName, authentication );
      }
  
      public String getTextToSignForAuthentication()
      {
          return m_altrmiFactory.getTextToSignForAuthentication();
      }
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize() throws Exception
      {
          m_altrmiFactory.setHostContext( m_hostContext );
      }
  
      public void close()
      {
          m_altrmiFactory.close();
      }
  
      public String[] list()
      {
          return m_altrmiFactory.list();
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/subscription/RmiSubscriber.java
  
  Index: RmiSubscriber.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.subscription;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.excalibur.altrmi.client.impl.rmi.RmiHostContext;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class RmiSubscriber
      extends AbstractSubscriber
  {
      private String m_host;
      private int m_port;
  
      /**
       * Pass the <code>Configuration</code> to the <code>Configurable</code>
       * class. This method must always be called after the constructor
       * and before any other method.
       *
       * @param configuration the class configurations.
       */
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
  
          super.configure( configuration );
  
          m_port = configuration.getChild( "port" ).getValueAsInteger();
          m_host = configuration.getChild( "host" ).getValue();
      }
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize()
          throws Exception
      {
          m_hostContext = new RmiHostContext( m_host, m_port );
          super.initialize();
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/blocks/subscription/SocketObjectStreamSubscriber.java
  
  Index: SocketObjectStreamSubscriber.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.blocks.subscription;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.excalibur.altrmi.client.impl.socket.SocketObjectStreamHostContext;
  
  /**
   * @phoenix:block
   * @phoenix:service name="org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup"
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class SocketObjectStreamSubscriber
      extends AbstractSubscriber
  {
      private String m_host;
      private int m_port;
  
      /**
       * Pass the <code>Configuration</code> to the <code>Configurable</code>
       * class. This method must always be called after the constructor
       * and before any other method.
       *
       * @param configuration the class configurations.
       */
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          super.configure( configuration );
  
          m_port = configuration.getChild( "port" ).getValueAsInteger();
          m_host = configuration.getChild( "host" ).getValue();
      }
  
      /**
       * Initialialize the component. Initialization includes
       * allocating any resources required throughout the
       * components lifecycle.
       *
       * @exception Exception if an error occurs
       */
      public void initialize()
          throws Exception
      {
          m_hostContext = new SocketObjectStreamHostContext( m_host, m_port );
          super.initialize();
      }
  }
  
  
  

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


Mime
View raw message