1 |
tdb |
1.1 |
//---PACKAGE DECLARATION--- |
2 |
|
|
package uk.ac.ukc.iscream.client; |
3 |
|
|
|
4 |
|
|
//---IMPORTS--- |
5 |
|
|
import uk.ac.ukc.iscream.componentmanager.*; |
6 |
|
|
import uk.ac.ukc.iscream.core.*; |
7 |
|
|
import uk.ac.ukc.iscream.util.*; |
8 |
|
|
|
9 |
|
|
/** |
10 |
|
|
* Provides a feed to the webpage system. |
11 |
|
|
* |
12 |
|
|
* @author $Author$ |
13 |
|
|
* @version $Id$ |
14 |
|
|
*/ |
15 |
|
|
public class WebFeeder { |
16 |
|
|
|
17 |
|
|
//---FINAL ATTRIBUTES--- |
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* The current CVS revision of this class |
21 |
|
|
*/ |
22 |
|
|
public static final String REVISION = "$Revision: 1.1 $"; |
23 |
|
|
|
24 |
|
|
//---STATIC METHODS--- |
25 |
|
|
|
26 |
|
|
/** |
27 |
|
|
* Return a reference to the single class. |
28 |
|
|
* Construct it if it does not already exist, otherwise just return the reference. |
29 |
|
|
*/ |
30 |
|
|
public static WebFeeder getInstance() { |
31 |
|
|
if (_instance == null){ |
32 |
|
|
_instance = new WebFeeder(); |
33 |
|
|
} |
34 |
|
|
return _instance; |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
//---CONSTRUCTORS--- |
38 |
|
|
|
39 |
|
|
private WebFeeder() { |
40 |
|
|
// do something, or nothing.. but must be private |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
//---PUBLIC METHODS--- |
44 |
|
|
|
45 |
|
|
// TO BE COMPLETED |
46 |
|
|
// The following two methods should process and save |
47 |
|
|
// XMLPackets and Alerts, in a directory structure that |
48 |
|
|
// has been defined by the web page designer. |
49 |
|
|
|
50 |
|
|
// There may also be need to have a Thread to grab any |
51 |
|
|
// required config (groups, "nice names, etc) and dump |
52 |
|
|
// that to a file. |
53 |
|
|
|
54 |
|
|
public void receiveXMLPacket(XMLPacket packet) { |
55 |
|
|
// process and save |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
public void receiveAlert(Alert alert) { |
59 |
|
|
// process and save |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
/** |
63 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
64 |
|
|
* method to provide clean logging (every class should have this). |
65 |
|
|
* |
66 |
|
|
* This uses the uk.ac.ukc.iscream.util.FormatName class |
67 |
|
|
* to format the toString() |
68 |
|
|
* |
69 |
|
|
* @return the name of this class and its CVS revision |
70 |
|
|
*/ |
71 |
|
|
public String toString() { |
72 |
|
|
return FormatName.getName( |
73 |
|
|
_name, |
74 |
|
|
getClass().getName(), |
75 |
|
|
REVISION); |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
//---PRIVATE METHODS--- |
79 |
|
|
|
80 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
81 |
|
|
|
82 |
|
|
//---ATTRIBUTES--- |
83 |
|
|
|
84 |
|
|
/** |
85 |
|
|
* This is the friendly identifier of the |
86 |
|
|
* component this class is running in. |
87 |
|
|
* eg, a Filter may be called "filter1", |
88 |
|
|
* If this class does not have an owning |
89 |
|
|
* component, a name from the configuration |
90 |
|
|
* can be placed here. This name could also |
91 |
|
|
* be changed to null for utility classes. |
92 |
|
|
*/ |
93 |
|
|
private String _name = ClientMain.NAME; |
94 |
|
|
|
95 |
|
|
/** |
96 |
|
|
* This holds a reference to the |
97 |
|
|
* system logger that is being used. |
98 |
|
|
*/ |
99 |
|
|
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
100 |
|
|
|
101 |
|
|
//---STATIC ATTRIBUTES--- |
102 |
|
|
|
103 |
|
|
/** |
104 |
|
|
* A reference to the single instance of this class |
105 |
|
|
*/ |
106 |
|
|
private static WebFeeder _instance; |
107 |
|
|
|
108 |
|
|
} |