ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/ClientServant.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/ClientServant.java (file contents):
Revision 1.2 by tdb, Mon Feb 5 02:58:54 2001 UTC vs.
Revision 1.6 by tdb, Wed Feb 21 22:48:20 2001 UTC

# Line 1 | Line 1
1 + //---PACKAGE DECLARATION---
2   package uk.ac.ukc.iscream.client;
3  
4 < import uk.ac.ukc.iscream.client.*;
5 < import uk.ac.ukc.iscream.clientinterface.*;
4 > //---IMPORTS---
5 > import uk.ac.ukc.iscream.componentmanager.*;
6 > import uk.ac.ukc.iscream.core.*;
7   import uk.ac.ukc.iscream.util.*;
6 import org.omg.CosNaming.*;
7 import org.omg.CORBA.*;
8 import org.omg.PortableServer.*;
9 import java.io.*;
8  
9 + /**
10 + * A servant for the LocalClient.
11 + *
12 + * @author  $Author$
13 + * @version $Id$
14 + */
15   class ClientServant extends ClientPOA {
16 +
17 + //---FINAL ATTRIBUTES---
18 +
19 +    /**
20 +     * The current CVS revision of this class
21 +     */
22 +    public static final String REVISION = "$Revision$";
23 +    
24 + //---STATIC METHODS---
25 +
26 + //---CONSTRUCTORS---
27 +
28 + //---PUBLIC METHODS---
29 +    
30 +    /**
31 +     * This should deal with the data... :)
32 +     *
33 +     * @param xml The String of XML data
34 +     */
35      public void receiveXML(String xml) {
36 <        System.out.println(" --- received XML --- ");
37 <        XMLPacketMaker xmlPacketMaker = new XMLPacketMaker(xml);
38 <        XMLPacket packet = xmlPacketMaker.createXMLPacket();
39 <        String machine_name = packet.getParam("packet.attributes.machine_name");
17 <        String cpuuser = packet.getParam("packet.cpu.user");
18 <        System.out.println("Hostname: " + machine_name + "  User CPU: " + cpuuser);
19 <        if(cpuuser != null) {
20 <            double c = new Double(cpuuser).doubleValue();
21 <            if (c > 80.0) {
22 <                String alert = "WARNING: Host "+machine_name+" has reached "+cpuuser+"% user CPU, which exceeds the threshold of 80%";
23 <                try {
24 <                    Smtp smtp = new Smtp("mercury.ukc.ac.uk");
25 <                    smtp.from("tdb1@ukc.ac.uk");
26 <                    smtp.to("dev@i-scream.org.uk");
27 <                    PrintWriter out = smtp.getOutputStream();
28 <                    out.println("Subject: i-scream Local Client proof-of-concept Test");
29 <                    out.println();
30 <                    out.println(alert);
31 <                    smtp.sendMessage();
32 <                    smtp.close();
33 <                } catch(IOException e) {}
34 <            }
35 <        }
36 >        // queue the xml?
37 >        //XMLPacketMaker xmlPacketMaker = new XMLPacketMaker(xml);
38 >        //XMLPacket packet = xmlPacketMaker.createXMLPacket();
39 >        // deal with the packet here, somehow, maybe...
40      }
37 }
41  
42 +    /**
43 +     * Overrides the {@link java.lang.Object#toString() Object.toString()}
44 +     * method to provide clean logging (every class should have this).
45 +     *
46 +     * This uses the uk.ac.ukc.iscream.util.FormatName class
47 +     * to format the toString()
48 +     *
49 +     * @return the name of this class and its CVS revision
50 +     */
51 +    public String toString() {
52 +        return FormatName.getName(
53 +            _name,
54 +            getClass().getName(),
55 +            REVISION);
56 +    }
57 +
58 + //---PRIVATE METHODS---
59 +
60 + //---ACCESSOR/MUTATOR METHODS---
61 +
62 + //---ATTRIBUTES---
63 +
64 +    /**
65 +     * This is the friendly identifier of the
66 +     * component this class is running in.
67 +     * eg, a Filter may be called "filter1",
68 +     * If this class does not have an owning
69 +     * component,  a name from the configuration
70 +     * can be placed here.  This name could also
71 +     * be changed to null for utility classes.
72 +     */
73 +    private String _name = ClientMain.NAME;
74 +
75 +    /**
76 +     * This holds a reference to the
77 +     * system logger that is being used.
78 +     */
79 +    private Logger _logger = ReferenceManager.getInstance().getLogger();
80 +
81 + //---STATIC ATTRIBUTES---
82 +
83 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines