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.16 by tdb, Sat Feb 3 00:41:04 2001 UTC vs.
Revision 1.24 by tdb, Fri Mar 23 05:06:02 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.clientinterface;
2 > package uk.org.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.*;
5 > import uk.org.iscream.componentmanager.*;
6 > import uk.org.iscream.core.*;
7 > import uk.org.iscream.util.*;
8  
9   /**
10   * This class starts the real time clients
# Line 35 | Line 35 | public class ClientInterfaceMain implements Component
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          
45        Configuration config = _refman.getCM().getConfiguration("ClientInterface");
46        if (config == null) {
47            throw new ComponentStartException("Unable to obtain configuration for component");
48        }
49        else {
50            try {
51                // get the configuration properties we need
52                ourName = config.getProperty("RootFilter.realtimeInterfaceName");
53                listenPort = Integer.parseInt(config.getProperty("ClientInterface.listenPort"));
54            } catch (org.omg.CORBA.MARSHAL e) {
55                throw new ComponentStartException("Unable to obtain requried configuration property for component");
56            }
57        }
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, "ClientInterface.name");
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
# Line 71 | 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);
67 >        TCPClientListener tcpClientListener = new TCPClientListener(ps);
68          tcpClientListener.start();
69          
70          // Startup the CORBA Listener
# Line 82 | Line 75 | public class ClientInterfaceMain implements Component
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       *
103 <     * This uses the uk.ac.ukc.iscream.util.NameFormat class
103 >     * This uses the uk.org.iscream.util.NameFormat class
104       * to format the toString()
105       *
106       * @return the name of this class and its CVS revision
# Line 109 | Line 122 | public class ClientInterfaceMain implements Component
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines