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