1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.org.iscream.conient; |
22 |
> |
package uk.org.iscream.cms.conient; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
|
import java.io.*; |
26 |
< |
import uk.org.iscream.util.*; |
26 |
> |
import uk.org.iscream.cms.server.util.*; |
27 |
|
|
28 |
|
/** |
29 |
|
* The class reads in data from a BufferedReader, |
52 |
|
* |
53 |
|
* @param inBound the BufferedReader this class should use |
54 |
|
* @param dataQueue the queue new data should be placed on |
55 |
+ |
* @param ch the connection handler in use |
56 |
|
*/ |
57 |
< |
public DataReader(BufferedReader inBound, Queue dataQueue) { |
57 |
> |
public DataReader(BufferedReader inBound, Queue dataQueue, ConnectionHandler ch) { |
58 |
> |
_ch = ch; |
59 |
|
_inBound = inBound; |
60 |
|
_dataQueue = dataQueue; |
61 |
|
} |
67 |
|
* It does this until either there is a problem |
68 |
|
* or it is told to stop. |
69 |
|
* |
70 |
+ |
* If there is a problem it calls shutdownLinks in the |
71 |
+ |
* ConnectionHandler. |
72 |
+ |
* |
73 |
|
* Any data it reads it converts to XML and then |
74 |
|
* adds to its queue. |
75 |
|
*/ |
92 |
|
} catch (IOException e) { |
93 |
|
Conient.addMessage("WARNING{data reader}: inbound data stopped - "+e); |
94 |
|
_running = false; |
95 |
+ |
// tell the ConnectionHandler to shut down the links |
96 |
+ |
_ch.shutdownDataLink(); |
97 |
|
} |
98 |
|
} |
99 |
|
|
114 |
|
/** |
115 |
|
* The reader we are reading from. |
116 |
|
*/ |
117 |
< |
BufferedReader _inBound; |
117 |
> |
private BufferedReader _inBound; |
118 |
|
|
119 |
|
/** |
120 |
|
* The Queue we place data on. |
121 |
|
*/ |
122 |
< |
Queue _dataQueue; |
122 |
> |
private Queue _dataQueue; |
123 |
|
|
124 |
|
/** |
125 |
|
* The state of this thread. |
126 |
|
*/ |
127 |
< |
boolean _running = true; |
127 |
> |
private boolean _running = true; |
128 |
> |
|
129 |
> |
/** |
130 |
> |
* A reference to the ConnectionHandler in use |
131 |
> |
*/ |
132 |
> |
private ConnectionHandler _ch; |
133 |
|
|
134 |
|
//---STATIC ATTRIBUTES--- |
135 |
|
|