avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/server PDKDemoServerImpl.java
Date Fri, 09 Nov 2001 22:30:40 GMT
donaldp     01/11/09 14:30:40

  Modified:    src/pdk/src/java/phoenixdemo/api PDKDemoServer.java
               src/pdk/src/java/phoenixdemo/block DefaultPDKDemoServer.java
               src/pdk/src/java/phoenixdemo/client Client.java
               src/pdk/src/java/phoenixdemo/server PDKDemoServerImpl.java
  Log:
  Update pdk src to make compliant with code style.
  
  Also remove all the noop comments.
  
  Revision  Changes    Path
  1.2       +4 -5      jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/api/PDKDemoServer.java
  
  Index: PDKDemoServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/api/PDKDemoServer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDKDemoServer.java	2001/10/22 11:24:47	1.1
  +++ PDKDemoServer.java	2001/11/09 22:30:40	1.2
  @@ -8,13 +8,12 @@
    */
   package phoenixdemo.api;
   
  -
  -
   /**
    * Interface PDKDemoServer
    *
  - *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.1 $
  + * @version * $Revision: 1.2 $
    */
  -public interface PDKDemoServer {}
  +public interface PDKDemoServer
  +{
  +}
  
  
  
  1.2       +32 -62    jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/block/DefaultPDKDemoServer.java
  
  Index: DefaultPDKDemoServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/block/DefaultPDKDemoServer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultPDKDemoServer.java	2001/10/22 11:24:47	1.1
  +++ DefaultPDKDemoServer.java	2001/11/09 22:30:40	1.2
  @@ -8,86 +8,56 @@
    */
   package phoenixdemo.block;
   
  -
  -
  -import org.apache.avalon.framework.logger.AbstractLoggable;
  +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.activity.Startable;
  -import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.phoenix.Block;
  -
   import phoenixdemo.api.PDKDemoServer;
  -
   import phoenixdemo.server.PDKDemoServerImpl;
   
  -
   /**
    * @author  Paul Hammant <Paul_Hammant@yahoo.com>
    * @version 1.0
    */
  -public class DefaultPDKDemoServer extends AbstractLoggable
  -        implements Block, PDKDemoServer, Configurable, Startable, Initializable {
  -
  -    protected int mPort;
  -    protected PDKDemoServerImpl mPDKServer;
  -    protected SocketThread mSocketThread;
  -
  -    /**
  -     * Method configure
  -     *
  -     *
  -     * @param configuration
  -     *
  -     * @throws ConfigurationException
  -     *
  -     */
  -    public void configure(final Configuration configuration) throws ConfigurationException
{
  -        mPort = configuration.getChild("port").getValueAsInteger(7777);
  +public class DefaultPDKDemoServer 
  +    extends AbstractLogEnabled
  +    implements Block, PDKDemoServer, Configurable, Startable, Initializable
  +{
  +    private int m_port;
  +    private PDKDemoServerImpl m_pdkServer;
  +    private SocketThread m_socketThread;
  +
  +    public void configure( final Configuration configuration )
  +        throws ConfigurationException
  +    {
  +        m_port = configuration.getChild("port").getValueAsInteger(7777);
       }
   
  -    /**
  -     * Method initialize
  -     *
  -     *
  -     * @throws Exception
  -     *
  -     */
  -    public void initialize() throws Exception {
  -        mPDKServer = new PDKDemoServerImpl();
  +    public void initialize() 
  +        throws Exception
  +    {
  +        m_pdkServer = new PDKDemoServerImpl();
       }
  -
  -    /**
  -     * Method start
  -     *
  -     *
  -     * @throws Exception
  -     *
  -     */
  -    public void start() throws Exception {
   
  -        mSocketThread = new SocketThread(mPDKServer, mPort);
  +    public void start() 
  +        throws Exception
  +    {
  +        m_socketThread = new SocketThread( m_pdkServer, m_port );
  +        m_socketThread.start();
   
  -        mSocketThread.start();
  -        System.out.println("Server started on port " + mPort);
  +        System.out.println( "Server started on port " + m_port );
       }
  -
  -    /**
  -     * Method stop
  -     *
  -     *
  -     * @throws Exception
  -     *
  -     */
  -    public void stop() throws Exception {
  -
  -        mSocketThread = new SocketThread(mPDKServer, mPort);
  -
  -        mSocketThread.interrupt();
   
  -        mSocketThread = null;
  +    public void stop() 
  +        throws Exception
  +    {
  +        m_socketThread = new SocketThread( m_pdkServer, m_port );
  +        m_socketThread.interrupt();
  +        m_socketThread = null;
   
  -        System.out.println("Server stopped on port " + mPort);
  +        System.out.println( "Server stopped on port " + m_port );
       }
   }
  
  
  
  1.2       +14 -28    jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/client/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/client/Client.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Client.java	2001/10/22 11:24:47	1.1
  +++ Client.java	2001/11/09 22:30:40	1.2
  @@ -8,46 +8,32 @@
    */
   package phoenixdemo.client;
   
  -
  -
   import java.net.Socket;
  -
   import java.io.ObjectOutputStream;
   import java.io.IOException;
   
  -
   /**
  - * Class Client
  - *
  - *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
  -public class Client {
  -
  -    /**
  -     * Method main
  -     *
  -     *
  -     * @param args
  -     *
  -     * @throws IOException
  -     *
  -     */
  -    public static void main(String[] args) throws IOException {
  -
  -        if (args.length < 3) {
  +public class Client
  +{
  +    public static void main( final String[] args ) 
  +        throws IOException
  +    {
  +        if( args.length < 3 )
  +        {
               System.out.println("Usage java -jar pdkdemo-client.jar <hostname> <port>
<message>");
               System.exit(10);
           }
   
  -        String host = args[0];
  -        int port = Integer.parseInt(args[1]);
  -        String message = args[2];
  -        Socket socket = new Socket(host, port);
  -        ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
  +        final String host = args[ 0 ];
  +        final int port = Integer.parseInt( args[ 1 ] );
  +        final String message = args[ 2 ];
  +        final Socket socket = new Socket( host, port );
  +        final ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream()
);
   
  -        oos.writeObject(message);
  +        oos.writeObject( message );
           oos.close();
           socket.close();
       }
  
  
  
  1.2       +34 -59    jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/server/PDKDemoServerImpl.java
  
  Index: PDKDemoServerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/pdk/src/java/phoenixdemo/server/PDKDemoServerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDKDemoServerImpl.java	2001/10/22 11:24:47	1.1
  +++ PDKDemoServerImpl.java	2001/11/09 22:30:40	1.2
  @@ -1,4 +1,3 @@
  -
   /*
    * Copyright (C) The Apache Software Foundation. All rights reserved.
    *
  @@ -7,78 +6,54 @@
    * the LICENSE file.
    */
   package phoenixdemo.server;
  -
  -
  -
  -import phoenixdemo.api.PDKDemoServer;
   
  +import java.io.IOException;
  +import java.io.ObjectInputStream;
   import java.net.ServerSocket;
   import java.net.Socket;
  -
  -import java.io.ObjectInputStream;
  -import java.io.IOException;
  -
  +import phoenixdemo.api.PDKDemoServer;
   
   /**
  - * Class PDKDemoServerImpl
  - *
  - *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
  -public class PDKDemoServerImpl implements PDKDemoServer {
  +public class PDKDemoServerImpl 
  +    implements PDKDemoServer
  +{
  +    public void processSocket( final Socket socket )
  +    {
  +        try
  +        {
  +            final ObjectInputStream ois = 
  +                new ObjectInputStream( socket.getInputStream() );
   
  -    /**
  -     * Constructor PDKDemoServerImpl
  -     *
  -     *
  -     */
  -    public PDKDemoServerImpl() {}
  -
  -    /**
  -     * Method processSocket
  -     *
  -     *
  -     * @param socket
  -     *
  -     */
  -    public void processSocket(Socket socket) {
  -
  -        try {
  -            ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
  -            String st = null;
  -
  -            try {
  -                st = (String) ois.readObject();
  -            } catch (ClassNotFoundException cnfe) {}
  +            String string = null;
   
  -            System.out.println("String passed = " + st);
  +            try { string = (String)ois.readObject(); }
  +            catch( final ClassNotFoundException cnfe) {}
  +
  +            System.out.println( "String passed = " + string );
               ois.close();
               socket.close();
  -        } catch (IOException ioe) {
  -            System.out.println("Unexpected IO Exception");
  +        } 
  +        catch( final IOException ioe )
  +        {
  +            System.out.println( "Unexpected IO Exception" );
           }
       }
  -
  -    /**
  -     * Method main
  -     *
  -     *
  -     * @param args
  -     *
  -     * @throws IOException
  -     *
  -     */
  -    public static void main(String[] args) throws IOException {
  -
  -        PDKDemoServerImpl svr = new PDKDemoServerImpl();
  -        ServerSocket serverSocket = new ServerSocket(7654);
  -
  -        System.out.println("PDK Demo listening on port " + 7654);
  -        System.out.println("Ctrl-C to exit");
   
  -        while (true) {
  -            svr.processSocket(serverSocket.accept());
  +    public static void main( final String[] args ) 
  +        throws IOException
  +    {
  +        final PDKDemoServerImpl svr = new PDKDemoServerImpl();
  +        final ServerSocket serverSocket = new ServerSocket(7654);
  +
  +        System.out.println( "PDK Demo listening on port " + 7654 );
  +        System.out.println( "Ctrl-C to exit" );
  +
  +        while( true )
  +        {
  +            svr.processSocket( serverSocket.accept() );
           }
       }
   }
  
  
  

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


Mime
View raw message