35 |
|
* This method starts the ClientInterface |
36 |
|
*/ |
37 |
|
public void start() throws ComponentStartException { |
38 |
< |
|
38 |
> |
// get references to key objects |
39 |
> |
_logger = _refman.getLogger(); |
40 |
> |
|
41 |
|
_logger.write(toString(), Logger.SYSINIT, "coming up"); |
40 |
– |
|
41 |
– |
// configuration variables we require |
42 |
– |
String ourName = null; |
43 |
– |
int listenPort = 0; |
42 |
|
|
43 |
< |
Configuration config = _refman.getCM().getConfiguration("ClientInterface"); |
44 |
< |
if (config == null) { |
45 |
< |
System.err.println("CRITICAL:Unable to obtain configuration" + |
46 |
< |
"\n Advise you check the i-scream log for more information."); |
47 |
< |
_logger.write(toString(), Logger.FATAL, "ERROR - unable to obtain configuration"); |
48 |
< |
System.exit(1); |
49 |
< |
} else { |
50 |
< |
try { |
51 |
< |
ourName = config.getProperty("RootFilter.realtimeInterfaceName"); |
52 |
< |
listenPort = Integer.parseInt(config.getProperty("ClientInterface.listenPort")); |
55 |
< |
} catch (org.omg.CORBA.MARSHAL e) { |
56 |
< |
System.err.println ("CRITICAL:Unable to obtain required configuration property" + |
57 |
< |
"\n Advise you check the i-scream log for more information."); |
58 |
< |
_logger.write(toString(), Logger.FATAL, "ERROR - required configuration property not present"); |
59 |
< |
System.exit(1); |
60 |
< |
|
61 |
< |
} |
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 |
|
} |
63 |
– |
// now we have the name of the interface we set it |
64 |
– |
NAME = ourName; |
54 |
|
|
55 |
|
_logger.write(toString(), Logger.SYSINIT, "configured"); |
56 |
|
|
64 |
|
_refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME); |
65 |
|
|
66 |
|
// Startup the TCPListener |
67 |
< |
TCPClientListener tcpClientListener = new TCPClientListener(listenPort, ps); |
67 |
> |
TCPClientListener tcpClientListener = new TCPClientListener(ps); |
68 |
|
tcpClientListener.start(); |
69 |
|
|
70 |
+ |
// Startup the CORBA Listener |
71 |
+ |
_logger.write(toString(), Logger.DEBUG, "starting servant for inbound clients"); |
72 |
+ |
CorbaClientListenerServant corbaServant = new CorbaClientListenerServant(ps); |
73 |
+ |
// !!! verify this name is correct at some point !!! |
74 |
+ |
_refman.bindToOrb(corbaServant, "iscream.ClientInterface.CorbaListener"); |
75 |
+ |
|
76 |
|
_logger.write(toString(), Logger.SYSINIT, "started"); |
77 |
|
} |
78 |
< |
|
78 |
> |
|
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 |
+ |
System.err.println(toString() + ": Dependency Failure: "+e); |
93 |
+ |
return false; |
94 |
+ |
} |
95 |
+ |
// dependency check suceeded |
96 |
+ |
return true; |
97 |
+ |
} |
98 |
+ |
|
99 |
+ |
/** |
100 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
101 |
|
* method to provide clean logging (every class should have this). |
102 |
|
* |
122 |
|
* This holds a reference to the |
123 |
|
* system logger that is being used. |
124 |
|
*/ |
125 |
< |
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
125 |
> |
private Logger _logger; |
126 |
|
|
127 |
|
/** |
128 |
|
* A reference to the reference manager in use |