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-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing PartialSocketStreamConnectionHandler.java SocketStreamPublisher.java SocketStreamPublisher.xinfo AbstractStreamPublisher.java SocketCustomStreamConnectionHandler.java SocketCustomStreamPublisher.java SocketObjectStreamConnectionHandler.java SocketObjectStreamPublisher.java SocketObjectStreamPublisher.xinfo
Date Sat, 13 Apr 2002 10:36:08 GMT
hammant     02/04/13 03:36:08

  Modified:    lib      excalibur-altrmi-client-impl.jar
                        excalibur-altrmi-client-interfaces.jar
                        excalibur-altrmi-common.jar
                        excalibur-altrmi-generator.jar
                        excalibur-altrmi-server-impl.jar
                        excalibur-altrmi-server-interfaces.jar
  Added:       src/java/org/apache/avalon/cornerstone/blocks/transport/publishing
                        PartialSocketStreamConnectionHandler.java
                        SocketStreamPublisher.java
                        SocketStreamPublisher.xinfo
  Removed:     src/java/org/apache/avalon/cornerstone/blocks/transport/publishing
                        AbstractStreamPublisher.java
                        SocketCustomStreamConnectionHandler.java
                        SocketCustomStreamPublisher.java
                        SocketObjectStreamConnectionHandler.java
                        SocketObjectStreamPublisher.java
                        SocketObjectStreamPublisher.xinfo
  Log:
  Refactor of Altrmi server allows refactor of transport package (patches from Peter Royal)
  
  Revision  Changes    Path
  1.2       +805 -611  jakarta-avalon-cornerstone/lib/excalibur-altrmi-client-impl.jar
  
  	<<Binary file>>
  
  
  1.2       +50 -45    jakarta-avalon-cornerstone/lib/excalibur-altrmi-client-interfaces.jar
  
  	<<Binary file>>
  
  
  1.2       +432 -429  jakarta-avalon-cornerstone/lib/excalibur-altrmi-common.jar
  
  	<<Binary file>>
  
  
  1.2       +55 -47    jakarta-avalon-cornerstone/lib/excalibur-altrmi-generator.jar
  
  	<<Binary file>>
  
  
  1.2       +511 -370  jakarta-avalon-cornerstone/lib/excalibur-altrmi-server-impl.jar
  
  	<<Binary file>>
  
  
  1.2       +44 -44    jakarta-avalon-cornerstone/lib/excalibur-altrmi-server-interfaces.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/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.avalon.cornerstone.blocks.transport.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.component.Component;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  
  /**
   * Class PartialSocketStreamConnectionHandler
   *
   *
   * @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 Component, ConnectionHandler
  {
  
      private AbstractPartialSocketStreamServer m_PartialSockeStreamServer;
  
      /**
       * Constructor PartialSocketStreamConnectionHandler
       *
       *
       * @param partialSocketStreamServer
       *
       */
      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-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/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.avalon.cornerstone.blocks.transport.publishing;
  
  
  
  import java.io.IOException;
  
  import java.net.InetAddress;
  import java.net.ServerSocket;
  import java.net.UnknownHostException;
  
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
  import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
  import org.apache.avalon.cornerstone.services.sockets.ServerSocketFactory;
  import org.apache.avalon.cornerstone.services.sockets.SocketManager;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.excalibur.altrmi.server.impl.socket.PartialSocketCustomStreamServer;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  
  
  /**
   * Class AbstractStreamPublisher
   *
   *
   * @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
  {
  
      protected SocketManager m_socketManager;
      protected ConnectionManager m_connectionManager;
      private int m_port;
      private InetAddress m_bindTo;
      private String m_socketStreamServerClass;
      boolean m_allAddresses = false;
  
      /**
       * 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 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();
      }
  
      /**
       * Method compose
       *
       *
       * @param manager
       *
       * @throws ComponentException
       *
       */
      public final void compose(ComponentManager manager) throws ComponentException
      {
  
          super.compose(manager);
  
          m_socketManager = (SocketManager) manager.lookup(SocketManager.ROLE);
          m_connectionManager = (ConnectionManager) manager.lookup(ConnectionManager.ROLE);
      }
  
      protected ServerSocket makeServerSocket() throws ComponentException, IOException
      {
  
          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);
          }
      }
  
      /**
       * Construct an appropriate ConnectionHandler.
       *
       * @return the new ConnectionHandler
       * @exception Exception if an error occurs
       */
      public ConnectionHandler createConnectionHandler() throws Exception
      {
  
          final PartialSocketStreamConnectionHandler handler =
              new PartialSocketStreamConnectionHandler(
                  (AbstractPartialSocketStreamServer) m_AbstractServer );
  
          setupLogger( handler );
  
          return handler;
      }
  
      /**
       * Release a previously created ConnectionHandler.
       * e.g. for spooling.
       */
      public void releaseConnectionHandler( ConnectionHandler connectionHandler )
      {
      }
  
      /**
       * 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_AbstractServer = (AbstractPartialSocketStreamServer) Class.forName(m_socketStreamServerClass).newInstance();
  
          setupLogger( m_AbstractServer );
          super.initialize();
          m_connectionManager.connect( "SocketStreamListener", makeServerSocket(), this );
      }
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/transport/publishing/SocketStreamPublisher.xinfo
  
  Index: SocketStreamPublisher.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE blockinfo PUBLIC "-//PHOENIX/Block Info DTD Version 1.0//EN"
                    "http://jakarta.apache.org/phoenix/blockinfo_1_0.dtd">
  
  <blockinfo>
  
    <!-- section to describe block -->
    <block>
      <version>1.0</version>
    </block>
  
    <!-- services that are offered by this block -->
    <services>
      <service name="org.apache.excalibur.altrmi.server.AltrmiPublisher" version="1.0"
/>
    </services>
  
    <dependencies>
      <dependency>
        <service name="org.apache.avalon.cornerstone.services.sockets.SocketManager" version="1.0"/>
      </dependency>
      <dependency>
        <service name="org.apache.avalon.cornerstone.services.connection.ConnectionManager"
                 version="1.0"/>
      </dependency>
      <dependency>
        <service name="org.apache.excalibur.altrmi.server.AltrmiAuthenticator" version="1.0"/>
      </dependency>
    </dependencies>
  
  </blockinfo>
  
  
  

--
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