00001 /* Package Web Test Tools 00002 * Copyright (C) 2001 "Artur Hefczyc" <kobit@users.sourceforge.net> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Lesser General Public License as published 00006 * by the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * $Id: ConnectionHandlerImpl.java,v 1.1 2002/11/29 15:18:28 kobit Exp $ 00019 * $Author: kobit $ 00020 * $Date: 2002/11/29 15:18:28 $ 00021 */ 00022 00023 package wttools.remotecons; 00024 00025 import wttools.remotecons.ifc.ConnectionHandlerIfc; 00026 import wttools.remotecons.ifc.CommandHandlerIfc; 00027 import java.net.Socket; 00028 import java.util.List; 00029 import java.util.LinkedList; 00030 import java.io.IOException; 00031 00050 public class ConnectionHandlerImpl implements ConnectionHandlerIfc { 00051 00070 public void handleNewConnection(Socket connection_socket, List command_handlers) { 00071 LinkedList ll = null; 00072 if (command_handlers != null) { 00073 ll = new LinkedList(); 00074 for (int i = 0; i < command_handlers.size(); i++) { 00075 CommandHandlerIfc chi = 00076 ((CommandHandlerIfc)command_handlers.get(i)).getInstance(); 00077 ll.add(chi); 00078 } // end of for (int i = 0; i < command_handlers.size(); i++) 00079 } // end of if (command_handlers != null) 00080 try { 00081 new ConnectionServer(connection_socket, ll); 00082 } catch (IOException e) { 00083 handleException(e); 00084 } // end of try-catch 00085 00086 } 00087 00095 public void handleException(Exception e) { 00096 // e.printStackTrace(); 00097 } 00098 00099 }// ConnectionHandlerImpl 00100 /* 00101 * Changes in file: 00102 * 00103 * $Log: ConnectionHandlerImpl.java,v $ 00104 * Revision 1.1 2002/11/29 15:18:28 kobit 00105 * Refactoring packages, thanks to RefactorIT 00106 * 00107 * Revision 1.1 2002/03/21 09:57:27 kobit 00108 * 1. Small but important redesign: 00109 * - package 'remotecons.wttools' was removed and all classes 00110 * were moved to 'remotecons' package 00111 * 2. Added 'asyncMessage' to provide sending messages to remote clients 00112 * in asynchronous mode 00113 * 00114 * Revision 1.7 2002/01/21 16:30:19 kobit 00115 * Commenting out code in progress 00116 * 00117 * Revision 1.6 2002/01/15 19:20:01 kobit 00118 * Corrected bug in external command runner 00119 * 00120 * Revision 1.5 2002/01/14 17:02:02 kobit 00121 * Changed interface to CommandHandlersIfc 00122 * 00123 * Revision 1.4 2002/01/13 18:09:29 kobit 00124 * Added methods for closing remote console 00125 * 00126 * Revision 1.3 2002/01/13 17:27:13 kobit 00127 * Corrected interface for external command handlers 00128 * 00129 * Revision 1.2 2002/01/12 12:31:26 kobit 00130 * Updated CVS keyword in all files 00131 * 00132 * 00133 */