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
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/ClientInterfaceMain.java (file contents):
Revision 1.18 by ajm, Fri Feb 23 17:07:07 2001 UTC vs.
Revision 1.22 by tdb, Wed Mar 14 01:54:26 2001 UTC

# Line 36 | Line 36 | public class ClientInterfaceMain implements Component
36       */
37      public void start() throws ComponentStartException {
38          // get references to key objects
39 <        _refman = ReferenceManager.getInstance();
40 <        _logger = ReferenceManager.getInstance().getLogger();
39 >        _logger = _refman.getLogger();
40          
41          _logger.write(toString(), Logger.SYSINIT, "coming up");
43            
44        // configuration variables we require
45        String ourName = null;
46        int listenPort = 0;
47        int queueMonitorInterval = 0;
42          
49        Configuration config = _refman.getCM().getConfiguration("ClientInterface");
50        if (config == null) {
51            throw new ComponentStartException("Unable to obtain configuration for component");
52        }
53        else {
54            try {
55                // get the configuration properties we need
56                ourName = config.getProperty("RootFilter.realtimeInterfaceName");
57                listenPort = Integer.parseInt(config.getProperty("ClientInterface.listenPort"));
58                queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval"));
59            } catch (org.omg.CORBA.MARSHAL e) {
60                throw new ComponentStartException("Unable to obtain requried configuration property for component");
61            }
62        }
43          
44 <        // now we have the name of the interface we set it
45 <        NAME = ourName;
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 +        }
54 +        
55          _logger.write(toString(), Logger.SYSINIT, "configured");
56          
57          // Setup a PacketSorter
58 <        PacketSorter ps = new PacketSorter(queueMonitorInterval);
58 >        PacketSorter ps = new PacketSorter();
59          ps.start();
60          
61          // ClientInterfaceServant start (for inbound data)
# Line 76 | Line 64 | public class ClientInterfaceMain implements Component
64          _refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME);
65          
66          // Startup the TCPListener
67 <        TCPClientListener tcpClientListener = new TCPClientListener(listenPort, ps, queueMonitorInterval);
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, queueMonitorInterval);
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       *
# Line 119 | Line 127 | public class ClientInterfaceMain implements Component
127      /**
128       * A reference to the reference manager in use
129       */
130 <    private ReferenceManager _refman;
130 >    private ReferenceManager _refman = ReferenceManager.getInstance();
131  
132   //---STATIC ATTRIBUTES---
133  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines