1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* Copyright (C) 2000-2002 i-scream |
4 |
+ |
* |
5 |
+ |
* This program is free software; you can redistribute it and/or |
6 |
+ |
* modify it under the terms of the GNU General Public License |
7 |
+ |
* as published by the Free Software Foundation; either version 2 |
8 |
+ |
* of the License, or (at your option) any later version. |
9 |
+ |
* |
10 |
+ |
* This program is distributed in the hope that it will be useful, |
11 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
+ |
* GNU General Public License for more details. |
14 |
+ |
* |
15 |
+ |
* You should have received a copy of the GNU General Public License |
16 |
+ |
* along with this program; if not, write to the Free Software |
17 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
+ |
*/ |
19 |
+ |
|
20 |
|
//---PACKAGE DECLARATION--- |
21 |
< |
package uk.ac.ukc.iscream.clientinterface; |
21 |
> |
package uk.org.iscream.cms.server.clientinterface; |
22 |
|
|
23 |
|
//---IMPORTS--- |
24 |
< |
import uk.ac.ukc.iscream.util.*; |
25 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
26 |
< |
import uk.ac.ukc.iscream.core.*; |
27 |
< |
import uk.ac.ukc.iscream.client.*; |
24 |
> |
import uk.org.iscream.cms.server.util.*; |
25 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
26 |
> |
import uk.org.iscream.cms.server.core.*; |
27 |
> |
import uk.org.iscream.cms.server.client.*; |
28 |
|
|
29 |
|
|
30 |
|
/** |
31 |
|
* Acts as a Control Handler to a CORBA based client. |
32 |
|
* |
14 |
– |
* !!! FUNDAMENTAL DESIGN PROBLEM !!! |
15 |
– |
* !!! Need a way to "shutdown" this class !!! |
16 |
– |
* |
33 |
|
* @author $Author$ |
34 |
|
* @version $Id$ |
35 |
|
*/ |
73 |
|
public boolean startData() { |
74 |
|
if(_dataHandler == null) { |
75 |
|
// create a new DataHandler |
76 |
< |
CorbaDataHandler dh = new CorbaDataHandler(_client); |
76 |
> |
CorbaDataHandler dh = new CorbaDataHandler(_client, this); |
77 |
|
// register the Queue |
78 |
|
_packetSorter.register(dh.getQueue(), _hostList); |
79 |
|
try { |
134 |
|
} |
135 |
|
|
136 |
|
/** |
137 |
+ |
* Disconnect, this will shutdown the data and unhook from |
138 |
+ |
* the CORBA ORB. |
139 |
+ |
*/ |
140 |
+ |
public void disconnect() { |
141 |
+ |
// close the data handler |
142 |
+ |
stopData(); |
143 |
+ |
// disconnect from the ORB |
144 |
+ |
try { |
145 |
+ |
byte[] oid = _refman.getRootPOA().servant_to_id(this); |
146 |
+ |
_refman.getRootPOA().deactivate_object(oid); |
147 |
+ |
} catch(Exception e) { |
148 |
+ |
_logger.write(this.toString(), Logger.ERROR, "disconnect failed: "+e); |
149 |
+ |
} |
150 |
+ |
} |
151 |
+ |
|
152 |
+ |
/** |
153 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
154 |
|
* method to provide clean logging (every class should have this). |
155 |
|
* |
156 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
156 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
157 |
|
* to format the toString() |
158 |
|
* |
159 |
|
* @return the name of this class and its CVS revision |
167 |
|
|
168 |
|
//---PRIVATE METHODS--- |
169 |
|
|
170 |
+ |
/** |
171 |
+ |
* Overridden for debugging purposes |
172 |
+ |
* to see when an instance of this class |
173 |
+ |
* is destroyed |
174 |
+ |
*/ |
175 |
+ |
protected void finalize() throws Throwable { |
176 |
+ |
_logger.write(this.toString(), Logger.DEBUG, "finalized by GC"); |
177 |
+ |
} |
178 |
+ |
|
179 |
|
//---ACCESSOR/MUTATOR METHODS--- |
180 |
|
|
181 |
|
//---ATTRIBUTES--- |
196 |
|
* system logger that is being used. |
197 |
|
*/ |
198 |
|
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
199 |
+ |
|
200 |
+ |
/** |
201 |
+ |
* A reference to the reference manager in use |
202 |
+ |
*/ |
203 |
+ |
private ReferenceManager _refman = ReferenceManager.getInstance(); |
204 |
|
|
205 |
|
/** |
206 |
|
* A reference to the PacketSorter. |