ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/ClientInterfaceMain.java
Revision: 1.17
Committed: Wed Feb 21 19:11:28 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.16: +7 -5 lines
Log Message:
Modification to the Queue system;
- interval of monitor is now configurable.
- attempt to identify each Queue better, although this is still hard.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.ac.ukc.iscream.clientinterface;
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 * This class starts the real time clients
11 * client interface.
12 * This is an iscream component that sends data
13 * direct to clients running on desktops to provide
14 * real time information.
15 *
16 * @author $Author: tdb1 $
17 * @version $Id: ClientInterfaceMain.java,v 1.16 2001/02/03 00:41:04 tdb1 Exp $
18 */
19 public class ClientInterfaceMain implements Component {
20
21 //---FINAL ATTRIBUTES---
22
23 /**
24 * The current CVS revision of this class
25 */
26 public static final String REVISION = "$Revision: 1.16 $";
27
28 //---STATIC METHODS---
29
30 //---CONSTRUCTORS---
31
32 //---PUBLIC METHODS---
33
34 /**
35 * This method starts the ClientInterface
36 */
37 public void start() throws ComponentStartException {
38
39 _logger.write(toString(), Logger.SYSINIT, "coming up");
40
41 // configuration variables we require
42 String ourName = null;
43 int listenPort = 0;
44 int queueMonitorInterval = 0;
45
46 Configuration config = _refman.getCM().getConfiguration("ClientInterface");
47 if (config == null) {
48 throw new ComponentStartException("Unable to obtain configuration for component");
49 }
50 else {
51 try {
52 // get the configuration properties we need
53 ourName = config.getProperty("RootFilter.realtimeInterfaceName");
54 listenPort = Integer.parseInt(config.getProperty("ClientInterface.listenPort"));
55 queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval"));
56 } catch (org.omg.CORBA.MARSHAL e) {
57 throw new ComponentStartException("Unable to obtain requried configuration property for component");
58 }
59 }
60
61 // now we have the name of the interface we set it
62 NAME = ourName;
63
64 _logger.write(toString(), Logger.SYSINIT, "configured");
65
66 // Setup a PacketSorter
67 PacketSorter ps = new PacketSorter(queueMonitorInterval);
68 ps.start();
69
70 // ClientInterfaceServant start (for inbound data)
71 _logger.write(toString(), Logger.DEBUG, "starting servant for inbound data");
72 ClientInterfaceServant ciServant = new ClientInterfaceServant(ps);
73 _refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME);
74
75 // Startup the TCPListener
76 TCPClientListener tcpClientListener = new TCPClientListener(listenPort, ps, queueMonitorInterval);
77 tcpClientListener.start();
78
79 // Startup the CORBA Listener
80 _logger.write(toString(), Logger.DEBUG, "starting servant for inbound clients");
81 CorbaClientListenerServant corbaServant = new CorbaClientListenerServant(ps, queueMonitorInterval);
82 // !!! verify this name is correct at some point !!!
83 _refman.bindToOrb(corbaServant, "iscream.ClientInterface.CorbaListener");
84
85 _logger.write(toString(), Logger.SYSINIT, "started");
86 }
87
88 /**
89 * Overrides the {@link java.lang.Object#toString() Object.toString()}
90 * method to provide clean logging (every class should have this).
91 *
92 * This uses the uk.ac.ukc.iscream.util.NameFormat class
93 * to format the toString()
94 *
95 * @return the name of this class and its CVS revision
96 */
97 public String toString() {
98 return FormatName.getName(
99 NAME,
100 getClass().getName(),
101 REVISION);
102 }
103
104 //---PRIVATE METHODS---
105
106 //---ACCESSOR/MUTATOR METHODS---
107
108 //---ATTRIBUTES---
109
110 /**
111 * This holds a reference to the
112 * system logger that is being used.
113 */
114 private Logger _logger = ReferenceManager.getInstance().getLogger();
115
116 /**
117 * A reference to the reference manager in use
118 */
119 private ReferenceManager _refman = ReferenceManager.getInstance();
120
121 //---STATIC ATTRIBUTES---
122
123 /**
124 * The friendly name for this component, used by
125 * all related classes.
126 * This is set from the configuration.
127 */
128 public static String NAME;
129
130 }