ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/componentmanager/ComponentManager.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/componentmanager/ComponentManager.java (file contents):
Revision 1.1 by ajm, Mon Dec 11 16:41:33 2000 UTC vs.
Revision 1.2 by ajm, Tue Dec 12 18:25:18 2000 UTC

# Line 2 | Line 2
2   package uk.ac.ukc.iscream.componentmanager;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.util.Component;
6 < import uk.ac.ukc.iscream.util.ReferenceManager;
5 > import uk.ac.ukc.iscream.util.*;
6   import java.util.*;
7   import java.io.*;
8  
9   /**
10 + * The component manager is the starting point for all
11 + * server side components of the iscream system.
12 + * It loads its initial system configuration from the
13 + * default properties file, it then starts all the iscream
14 + * components as specified in the default.properties under
15 + * uk.ac.ukc.iscream.ComponentList
16   *
12 *
17   * @author  $Author$
18   * @version $Id$
19   */
# Line 25 | Line 29 | public class ComponentManager {
29      /**
30       * The toString() of this class
31       * As it won't be instatiated, this is needed.
32 +     * Not also that we pass a null as the class name (as we are static)
33       */
34 <    public static final String toString = "ComponentManager(" + REVISION.substring(11, REVISION.length() - 2) + ")";
34 >    public static final String toString = FormatName.getName("ComponentManager", null, REVISION);
35      
36      /**
37       * The default location of the properties file for the system
38       */
39 <    public static final String DEFAULTPROPERTIES = "default.properties";
39 >    public static final String DEFAULTPROPERTIES = "./etc/default.properties";
40      
41   //---STATIC METHODS---
42  
43      /**
44 <     * The main method which starts the CORE
45 <     * Currently the args are passed direct to the ORB,
41 <     * so any ORB paramaters could go there.
44 >     * The main method which starts the components as
45 >     * listed in the default.properties file.
46       *
47       * @param args the command line arguments
48       */
49      public static void main(String[] args) {
50          System.out.println("--- I-Scream System Component Manager ---");
51 <                
51 >        System.out.println("---          Starting System          ---");        
52 >        
53          // get the command line args
54          // this is a bit messy and should be looked at
55          String defaultProperties = DEFAULTPROPERTIES;
# Line 78 | Line 83 | public class ComponentManager {
83          System.out.println(toString + ": coming up");
84          
85          // start the ORB by initialising the ReferenceManager
86 <        ReferenceManager refman = ReferenceManager.init(null, null);
86 >        ReferenceManager refman = ReferenceManager.getInstance();
87          
88 <        // now we are running, we just need to serve
89 <        // so we ask the orb to block for us until it has finished
88 >        // now the ORB is running, we need to activate our RootPOA
89 >        // so that we can start serving requests once servants start up
90          refman.activatePOA();
91          
92 +        // get the list of components
93          String componentList = System.getProperty("uk.ac.ukc.iscream.ComponentList");
94          StringTokenizer st = new StringTokenizer(componentList, ";");
95          
# Line 93 | Line 99 | public class ComponentManager {
99              String componentName = st.nextToken();
100              Component component = null;
101              System.out.println(toString + ": starting component - " + componentName);
102 <            if (componentName.equalsIgnoreCase("CoRe")) {
102 >            
103 >            // ### This is where the list of supported components is checked! ###
104 >            if (componentName.equalsIgnoreCase("core")) {
105                  component = new uk.ac.ukc.iscream.core.Core();
106              }
107 +            // ###  Add new component constructors in the above section! ###
108              if (component != null) {
109 <                boolean result = component.start();
110 <                if (result == false) {
109 >                try {
110 >                    component.start();
111 >                } catch (ComponentStartException e) {
112                      System.err.println(toString + ": ERROR starting component - " + componentName);
113 +                    System.err.println(toString + ": component reports - " + e.getMessage());
114                      System.exit(1);
115                  }
116              } else {
117                  System.err.println(toString + ": WARNING unsupported component not started");
118              }
119          }
120 <        System.out.println(toString + ": finished - blocking on ORB");
121 <        //refman.activatePOA();
120 >            System.out.println(toString + ": finished");
121 >            
122 >            // block on the ORB...in time, management functionality can be placed here.
123          refman.getORB().run();
124      }
125      
126 +  
127      /**
128       * A simple method to print the usage of this class.
129       * It never returns, but instead exits to the system
# Line 121 | Line 134 | public class ComponentManager {
134          System.out.println("USAGE: java uk.ac.ukc.iscream.componentmanager.ComponentManager <option>");
135          System.out.println("WHERE <option>:");
136          System.out.println("      -l <filename> - the location of initial system properties");
137 +        System.out.println("                      the default is ./etc/default.properties");
138          System.out.println("      -f <name>     - the name of the filter (if there is one configured");
139          System.out.println("      -h            - this help screen");
140          System.exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines