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.7 by tdb, Thu Jan 18 23:07:00 2001 UTC vs.
Revision 1.22 by tdb, Wed Mar 14 01:54:26 2001 UTC

# Line 16 | Line 16 | import uk.ac.ukc.iscream.util.*;
16   * @author  $Author$
17   * @version $Id$
18   */
19 < public class ClientInterfaceMain implements uk.ac.ukc.iscream.util.Component {
19 > public class ClientInterfaceMain implements Component {
20  
21   //---FINAL ATTRIBUTES---
22  
# Line 35 | Line 35 | public class ClientInterfaceMain implements uk.ac.ukc.
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 <                
56 >        
57 >        // Setup a PacketSorter
58 >        PacketSorter ps = new PacketSorter();
59 >        ps.start();
60 >        
61          // ClientInterfaceServant start (for inbound data)
62          _logger.write(toString(), Logger.DEBUG, "starting servant for inbound data");
63 <        ClientInterfaceServant ciServant = new ClientInterfaceServant();
63 >        ClientInterfaceServant ciServant = new ClientInterfaceServant(ps);
64          _refman.bindToOrb(ciServant, "iscream.ClientInterface." + ClientInterfaceMain.NAME);
65          
66 <        ClientListener clientListener = new ClientListener(listenPort, ciServant);
67 <        clientListener.start();
66 >        // Startup the TCPListener
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       *
# Line 102 | Line 122 | public class ClientInterfaceMain implements uk.ac.ukc.
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