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

# User Rev Content
1 ajm 1.3 //---PACKAGE DECLARATION---
2     package uk.ac.ukc.iscream.clientinterface;
3    
4     //---IMPORTS---
5 tdb 1.6 import uk.ac.ukc.iscream.componentmanager.*;
6 ajm 1.3 import uk.ac.ukc.iscream.core.*;
7 tdb 1.7 import uk.ac.ukc.iscream.util.*;
8 ajm 1.3
9     /**
10 ajm 1.4 * 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 ajm 1.3 *
16 tdb 1.7 * @author $Author: tdb1 $
17 tdb 1.17 * @version $Id: ClientInterfaceMain.java,v 1.16 2001/02/03 00:41:04 tdb1 Exp $
18 ajm 1.3 */
19 tdb 1.8 public class ClientInterfaceMain implements Component {
20 ajm 1.3
21     //---FINAL ATTRIBUTES---
22    
23     /**
24     * The current CVS revision of this class
25     */
26 tdb 1.17 public static final String REVISION = "$Revision: 1.16 $";
27 ajm 1.3
28     //---STATIC METHODS---
29    
30 ajm 1.4 //---CONSTRUCTORS---
31 ajm 1.3
32 ajm 1.4 //---PUBLIC METHODS---
33 ajm 1.3
34 ajm 1.4 /**
35     * This method starts the ClientInterface
36     */
37     public void start() throws ComponentStartException {
38    
39     _logger.write(toString(), Logger.SYSINIT, "coming up");
40 ajm 1.3
41     // configuration variables we require
42     String ourName = null;
43     int listenPort = 0;
44 tdb 1.17 int queueMonitorInterval = 0;
45 ajm 1.3
46 ajm 1.4 Configuration config = _refman.getCM().getConfiguration("ClientInterface");
47 ajm 1.3 if (config == null) {
48 tdb 1.15 throw new ComponentStartException("Unable to obtain configuration for component");
49 tdb 1.14 }
50     else {
51 ajm 1.3 try {
52 tdb 1.14 // get the configuration properties we need
53 ajm 1.3 ourName = config.getProperty("RootFilter.realtimeInterfaceName");
54     listenPort = Integer.parseInt(config.getProperty("ClientInterface.listenPort"));
55 tdb 1.17 queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval"));
56 ajm 1.3 } catch (org.omg.CORBA.MARSHAL e) {
57 tdb 1.15 throw new ComponentStartException("Unable to obtain requried configuration property for component");
58 ajm 1.3 }
59     }
60 tdb 1.14
61 ajm 1.3 // now we have the name of the interface we set it
62 ajm 1.4 NAME = ourName;
63    
64     _logger.write(toString(), Logger.SYSINIT, "configured");
65 tdb 1.10
66 tdb 1.11 // Setup a PacketSorter
67 tdb 1.17 PacketSorter ps = new PacketSorter(queueMonitorInterval);
68 tdb 1.12 ps.start();
69 tdb 1.10
70 ajm 1.3 // ClientInterfaceServant start (for inbound data)
71 ajm 1.4 _logger.write(toString(), Logger.DEBUG, "starting servant for inbound data");
72 tdb 1.11 ClientInterfaceServant ciServant = new ClientInterfaceServant(ps);
73 ajm 1.4 _refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME);
74 ajm 1.3
75 tdb 1.13 // Startup the TCPListener
76 tdb 1.17 TCPClientListener tcpClientListener = new TCPClientListener(listenPort, ps, queueMonitorInterval);
77 tdb 1.9 tcpClientListener.start();
78 tdb 1.16
79     // Startup the CORBA Listener
80     _logger.write(toString(), Logger.DEBUG, "starting servant for inbound clients");
81 tdb 1.17 CorbaClientListenerServant corbaServant = new CorbaClientListenerServant(ps, queueMonitorInterval);
82 tdb 1.16 // !!! verify this name is correct at some point !!!
83     _refman.bindToOrb(corbaServant, "iscream.ClientInterface.CorbaListener");
84 ajm 1.3
85 ajm 1.4 _logger.write(toString(), Logger.SYSINIT, "started");
86 ajm 1.3 }
87    
88 ajm 1.4 /**
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 ajm 1.5 NAME,
100 ajm 1.4 getClass().getName(),
101     REVISION);
102     }
103 ajm 1.3
104     //---PRIVATE METHODS---
105    
106     //---ACCESSOR/MUTATOR METHODS---
107    
108     //---ATTRIBUTES---
109 ajm 1.4
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 ajm 1.3 //---STATIC ATTRIBUTES---
122    
123 ajm 1.4 /**
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     }