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