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.cms.server.client; |
23 |
|
24 |
//---IMPORTS--- |
25 |
import uk.org.iscream.cms.server.componentmanager.*; |
26 |
import uk.org.iscream.cms.server.core.*; |
27 |
import uk.org.iscream.cms.server.util.*; |
28 |
|
29 |
/** |
30 |
* A servant for the LocalClient. |
31 |
* This represents the Client interface for CORBA |
32 |
* clients connecting to the i-scream system on the ClientInterface. |
33 |
* |
34 |
* The i-scream ClientInterface pumps data over CORBA into the |
35 |
* queue, using the recieveXML method. The MonitorManager |
36 |
* then handles pulling the data out of this queue. |
37 |
* |
38 |
* @author $Author: tdb $ |
39 |
* @version $Id: ClientServant.java,v 1.11 2002/05/18 18:16:00 tdb Exp $ |
40 |
*/ |
41 |
class ClientServant extends ClientPOA { |
42 |
|
43 |
//---FINAL ATTRIBUTES--- |
44 |
|
45 |
/** |
46 |
* The current CVS revision of this class |
47 |
*/ |
48 |
public static final String REVISION = "$Revision: 1.11 $"; |
49 |
|
50 |
//---STATIC METHODS--- |
51 |
|
52 |
//---CONSTRUCTORS--- |
53 |
|
54 |
/** |
55 |
* Construct a new ClientServant, with a given Queue. |
56 |
* |
57 |
* @param queue The Queue that will link this class to the MonitorManager |
58 |
*/ |
59 |
public ClientServant(Queue queue) { |
60 |
_queue = queue; |
61 |
} |
62 |
|
63 |
//---PUBLIC METHODS--- |
64 |
|
65 |
/** |
66 |
* Adds the inbound data to our queue when the CORBA method is called. |
67 |
* |
68 |
* @param xml The String of XML data |
69 |
*/ |
70 |
public void receiveXML(String xml) { |
71 |
_queue.add(xml); |
72 |
} |
73 |
|
74 |
/** |
75 |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
76 |
* method to provide clean logging (every class should have this). |
77 |
* |
78 |
* This uses the uk.org.iscream.cms.server.util.FormatName class |
79 |
* to format the toString() |
80 |
* |
81 |
* @return the name of this class and its CVS revision |
82 |
*/ |
83 |
public String toString() { |
84 |
return FormatName.getName( |
85 |
_name, |
86 |
getClass().getName(), |
87 |
REVISION); |
88 |
} |
89 |
|
90 |
//---PRIVATE METHODS--- |
91 |
|
92 |
//---ACCESSOR/MUTATOR METHODS--- |
93 |
|
94 |
//---ATTRIBUTES--- |
95 |
|
96 |
/** |
97 |
* This is the friendly identifier of the |
98 |
* component this class is running in. |
99 |
* eg, a Filter may be called "filter1", |
100 |
* If this class does not have an owning |
101 |
* component, a name from the configuration |
102 |
* can be placed here. This name could also |
103 |
* be changed to null for utility classes. |
104 |
*/ |
105 |
private String _name = ClientMain.NAME; |
106 |
|
107 |
/** |
108 |
* This holds a reference to the |
109 |
* system logger that is being used. |
110 |
*/ |
111 |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
112 |
|
113 |
/** |
114 |
* A reference to our Queue to place the inbond data into. |
115 |
*/ |
116 |
private Queue _queue; |
117 |
|
118 |
//---STATIC ATTRIBUTES--- |
119 |
|
120 |
} |