ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java
Revision: 1.2
Committed: Mon Nov 27 10:23:32 2000 UTC (23 years, 5 months ago) by tdb
Branch: MAIN
Changes since 1.1: +3 -101 lines
Log Message:
Took out the old code. Just need to add the new bits.

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4     import uk.ac.ukc.iscream.core.*;
5     import uk.ac.ukc.iscream.filter.*;
6     import java.net.Socket;
7     import java.io.InputStream;
8     import java.io.OutputStream;
9     import java.io.IOException;
10     import java.io.*;
11     import org.omg.CORBA.*;
12     import org.omg.CosNaming.*;
13    
14     /**
15     * <ONE LINE DESCRIPTION>
16     * <DETAILED DESCRIPTION>
17     *
18 tdb 1.2 * @author $Author: tdb1 $
19     * @version $Id: TCPReaderInit.java,v 1.1 2000/11/27 00:43:26 tdb1 Exp $
20 tdb 1.1 */
21     class TCPReaderInit extends Thread {
22    
23     //---FINAL ATTRIBUTES---
24    
25     /**
26     * The current CVS revision of this class
27     */
28     public final String REVISION = "$Revision: 1.1 $";
29    
30     //---STATIC METHODS---
31    
32     //---CONSTRUCTORS---
33    
34     public TCPReaderInit(Socket socket, ConfigurationManager configManager, Logger logRef, Filter parent) throws IOException {
35     _configManager = configManager;
36     _logRef = logRef;
37     _socket = socket;
38     _parent = parent;
39     _socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream()));
40     _socketOut = new PrintWriter(_socket.getOutputStream());
41     _logRef.write(toString(), Logger.SYSINIT, "created");
42     }
43    
44     //---PUBLIC METHODS---
45    
46     //NEED TO MAJORILY CHANGE THIS BIT !
47     public void run() {
48     try {
49 tdb 1.2
50 tdb 1.1
51     } catch (Exception e) {
52     _logRef.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage());
53     }
54    
55     _socketOut.flush();
56     // Disconnect streams & socket
57     try {
58     _socketIn.close();
59     _socketOut.close();
60     _socket.close();
61     } catch (IOException e) {
62     _logRef.write(toString(), Logger.ERROR, "exception on socket close");
63     }
64     _logRef.write(toString(), Logger.SYSMSG, "finished");
65     }
66    
67     /**
68     * Overrides the {@link java.lang.Object#toString() Object.toString()}
69     * method to provide clean logging (every class should have this).
70     *
71     * @return the name of this class and its CVS revision
72     */
73     public String toString() {
74     return this.getClass().getName() + "{" + _socket.getInetAddress().getHostName()
75     + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")";
76    
77     }
78    
79     //---PRIVATE METHODS---
80    
81     //---ACCESSOR/MUTATOR METHODS---
82    
83     //---ATTRIBUTES---
84    
85     ConfigurationManager _configManager;
86     Logger _logRef;
87     Socket _socket;
88     BufferedReader _socketIn;
89     PrintWriter _socketOut;
90     Filter _parent;
91     //---STATIC ATTRIBUTES---
92    
93     }