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.21
Committed: Wed Mar 14 01:43:50 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.20: +4 -5 lines
Log Message:
We weren't grabbing a ReferenceManager reference until startup, although there
is no reason (unlike the Logger) why we can't grab it on construction.

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.20 * @author $Author: tdb1 $
17 tdb 1.21 * @version $Id: ClientInterfaceMain.java,v 1.20 2001/03/14 01:34:22 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.21 public static final String REVISION = "$Revision: 1.20 $";
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 ajm 1.18 // get references to key objects
39 tdb 1.21 _logger = _refman.getLogger();
40 ajm 1.18
41 ajm 1.4 _logger.write(toString(), Logger.SYSINIT, "coming up");
42 tdb 1.19
43    
44     ConfigurationProxy cp = ConfigurationProxy.getInstance();
45     String configName = "ClientInterface";
46    
47     // set our name
48     try {
49     NAME = cp.getProperty(configName, "RootFilter.realtimeInterfaceName");
50     } catch (PropertyNotFoundException e) {
51     NAME = null;
52     _logger.write(toString(), Logger.WARNING, "ClientInterface name not set: "+e);
53 tdb 1.14 }
54 ajm 1.4
55     _logger.write(toString(), Logger.SYSINIT, "configured");
56 tdb 1.10
57 tdb 1.11 // Setup a PacketSorter
58 tdb 1.19 PacketSorter ps = new PacketSorter();
59 tdb 1.12 ps.start();
60 tdb 1.10
61 ajm 1.3 // ClientInterfaceServant start (for inbound data)
62 ajm 1.4 _logger.write(toString(), Logger.DEBUG, "starting servant for inbound data");
63 tdb 1.11 ClientInterfaceServant ciServant = new ClientInterfaceServant(ps);
64 ajm 1.4 _refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME);
65 ajm 1.3
66 tdb 1.13 // Startup the TCPListener
67 tdb 1.19 TCPClientListener tcpClientListener = new TCPClientListener(ps);
68 tdb 1.9 tcpClientListener.start();
69 tdb 1.16
70     // Startup the CORBA Listener
71     _logger.write(toString(), Logger.DEBUG, "starting servant for inbound clients");
72 tdb 1.19 CorbaClientListenerServant corbaServant = new CorbaClientListenerServant(ps);
73 tdb 1.16 // !!! verify this name is correct at some point !!!
74     _refman.bindToOrb(corbaServant, "iscream.ClientInterface.CorbaListener");
75 ajm 1.3
76 ajm 1.4 _logger.write(toString(), Logger.SYSINIT, "started");
77 ajm 1.3 }
78 tdb 1.20
79     /**
80     * Does a dependency check. Used mainly at startup to
81     * see if the required dependencies (components) are up
82     * and running.
83     *
84     * @return a boolean value, true if the depdencies are satisfied
85     */
86     public boolean depCheck() {
87     try {
88     org.omg.CORBA.Object obj;
89     obj = _refman.getCORBARef("iscream.Logger");
90     obj = _refman.getCORBARef("iscream.ConfigurationManager");
91     } catch(ComponentCORBAException e) {
92     _logger.write(toString(), Logger.WARNING, "Dependency Failure: "+e);
93     return false;
94     }
95     // dependency check suceeded
96     return true;
97     }
98    
99 ajm 1.4 /**
100     * Overrides the {@link java.lang.Object#toString() Object.toString()}
101     * method to provide clean logging (every class should have this).
102     *
103     * This uses the uk.ac.ukc.iscream.util.NameFormat class
104     * to format the toString()
105     *
106     * @return the name of this class and its CVS revision
107     */
108     public String toString() {
109     return FormatName.getName(
110 ajm 1.5 NAME,
111 ajm 1.4 getClass().getName(),
112     REVISION);
113     }
114 ajm 1.3
115     //---PRIVATE METHODS---
116    
117     //---ACCESSOR/MUTATOR METHODS---
118    
119     //---ATTRIBUTES---
120 ajm 1.4
121     /**
122     * This holds a reference to the
123     * system logger that is being used.
124     */
125 ajm 1.18 private Logger _logger;
126 ajm 1.4
127     /**
128     * A reference to the reference manager in use
129     */
130 tdb 1.21 private ReferenceManager _refman = ReferenceManager.getInstance();
131 ajm 1.4
132 ajm 1.3 //---STATIC ATTRIBUTES---
133    
134 ajm 1.4 /**
135     * The friendly name for this component, used by
136     * all related classes.
137     * This is set from the configuration.
138     */
139     public static String NAME;
140    
141     }