1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.org.iscream.componentmanager; |
2 |
> |
package uk.org.iscream.cms.server.componentmanager; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
|
import java.util.*; |
6 |
|
import java.io.*; |
7 |
< |
import uk.org.iscream.util.*; |
7 |
> |
import uk.org.iscream.cms.server.util.*; |
8 |
|
|
9 |
|
/** |
10 |
|
* The component manager is the starting point for all |
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.org.iscream.ComponentList |
15 |
> |
* uk.org.iscream.cms.server.ComponentList |
16 |
|
* |
17 |
|
* @author $Author$ |
18 |
|
* @version $Id$ |
53 |
|
* @param args the command line arguments |
54 |
|
*/ |
55 |
|
public static void main(String[] args) { |
56 |
+ |
System.out.println("-----------------------------------------"); |
57 |
|
System.out.println("--- i-scream Server Component Manager ---"); |
58 |
+ |
System.out.println("--- (c) 2001 The i-scream Project ---"); |
59 |
+ |
System.out.println("--- (http://www.i-scream.org.uk) ---"); |
60 |
+ |
System.out.println("-----------------------------------------"); |
61 |
|
System.out.println("--- Starting System ---"); |
62 |
|
|
63 |
|
// get the command line args |
64 |
|
String defaultProperties = DEFAULTPROPERTIES; |
65 |
|
String filterName = null; |
66 |
+ |
String filterManagerName = null; |
67 |
|
for(int i=0; i < args.length; i++) { |
68 |
|
if(args[i].equals("-h")) { |
69 |
|
usage(); |
70 |
|
} |
71 |
|
else if(args[i].equals("-f")) { |
72 |
< |
i++; filterName = args[i]; |
72 |
> |
if(++i < args.length) { |
73 |
> |
filterName = args[i]; |
74 |
> |
} |
75 |
> |
else { |
76 |
> |
usage(); |
77 |
> |
} |
78 |
|
} |
79 |
+ |
else if(args[i].equals("-fm")) { |
80 |
+ |
if(++i < args.length) { |
81 |
+ |
filterManagerName = args[i]; |
82 |
+ |
} |
83 |
+ |
else { |
84 |
+ |
usage(); |
85 |
+ |
} |
86 |
+ |
} |
87 |
|
else if(args[i].equals("-l")) { |
88 |
< |
i++; defaultProperties = args[i]; |
88 |
> |
if(++i < args.length) { |
89 |
> |
defaultProperties = args[i]; |
90 |
> |
} |
91 |
> |
else { |
92 |
> |
usage(); |
93 |
> |
} |
94 |
|
} |
95 |
|
else { |
96 |
|
usage(); |
119 |
|
refman.activatePOA(); |
120 |
|
|
121 |
|
// get the list of components |
122 |
< |
String componentList = System.getProperty("uk.org.iscream.ComponentList"); |
122 |
> |
String componentList = System.getProperty("uk.org.iscream.cms.server.ComponentList"); |
123 |
|
StringTokenizer st = new StringTokenizer(componentList, ";"); |
124 |
|
_componentsToStart = new LinkedList(); |
125 |
|
|
132 |
|
|
133 |
|
// ### This is where the list of supported components is checked! ### |
134 |
|
if (componentName.equalsIgnoreCase("core")) { |
135 |
< |
component = new uk.org.iscream.core.Core(); |
135 |
> |
component = new uk.org.iscream.cms.server.core.Core(); |
136 |
> |
// note the passing of the FilterManagers's name in its constructor |
137 |
|
} else if (componentName.equalsIgnoreCase("filtermanager")) { |
138 |
< |
component = new uk.org.iscream.filtermanager.FilterManager(); |
138 |
> |
component = new uk.org.iscream.cms.server.filtermanager.FilterManager(filterManagerName); |
139 |
|
} else if (componentName.equalsIgnoreCase("rootfilter")) { |
140 |
< |
component = new uk.org.iscream.rootfilter.RootFilter(); |
140 |
> |
component = new uk.org.iscream.cms.server.rootfilter.RootFilter(); |
141 |
|
} else if (componentName.equalsIgnoreCase("dbinterface")) { |
142 |
< |
component = new uk.org.iscream.dbinterface.DBInterface(); |
142 |
> |
component = new uk.org.iscream.cms.server.dbinterface.DBInterface(); |
143 |
|
} else if (componentName.equalsIgnoreCase("clientinterface")) { |
144 |
< |
component = new uk.org.iscream.clientinterface.ClientInterfaceMain(); |
144 |
> |
component = new uk.org.iscream.cms.server.clientinterface.ClientInterfaceMain(); |
145 |
|
// note the passing of the Filter's name in its constructor |
146 |
|
} else if (componentName.equalsIgnoreCase("filter")) { |
147 |
< |
component = new uk.org.iscream.filter.FilterMain(filterName); |
147 |
> |
component = new uk.org.iscream.cms.server.filter.FilterMain(filterName); |
148 |
|
} else if (componentName.equalsIgnoreCase("client")) { |
149 |
< |
component = new uk.org.iscream.client.ClientMain(); |
149 |
> |
component = new uk.org.iscream.cms.server.client.ClientMain(); |
150 |
|
} |
151 |
|
// ### Add new component constructors in the above section! ### |
152 |
|
|
164 |
|
|
165 |
|
String confTimeout = null; |
166 |
|
try { |
167 |
< |
confTimeout = System.getProperty("uk.org.iscream.ComponentTimeout"); |
167 |
> |
confTimeout = System.getProperty("uk.org.iscream.cms.server.ComponentTimeout"); |
168 |
|
confTimeout.trim(); |
169 |
|
_startTimeout = Integer.parseInt(confTimeout); |
170 |
|
} catch (NumberFormatException e) { |
171 |
|
_startTimeout = DEFAULT_COMPONENT_START_TIMEOUT; |
172 |
< |
System.err.println(toString + ": unable to read uk.org.iscream.ComponentTimeout value (" + confTimeout + "), using default!"); |
172 |
> |
System.err.println(toString + ": unable to read uk.org.iscream.cms.server.ComponentTimeout value (" + confTimeout + "), using default!"); |
173 |
|
} |
174 |
|
System.out.println(toString + ": using component start timeout of " + _startTimeout + " seconds"); |
175 |
|
|
195 |
|
* This method calls the start() methods on all the components. |
196 |
|
* If a component fails to start due to a CORBA communication |
197 |
|
* problem, then it catches this and tries to start it again |
198 |
< |
* according to uk.org.iscream.ComponentTimeout time. |
198 |
> |
* according to uk.org.iscream.cms.server.ComponentTimeout time. |
199 |
|
* |
200 |
|
* If the server dies and CORBA connections are lost, this method |
201 |
|
* is called again. |
214 |
|
while(i.hasNext()) { |
215 |
|
// get a refence to the component |
216 |
|
component = (Component) i.next(); |
217 |
< |
System.out.println(toString + ": starting component - " + component.toString()); |
217 |
> |
System.out.println(toString + ": dependency checking component - " + component.toString()); |
218 |
|
|
219 |
|
// check it's dependencies |
220 |
|
boolean depOK = component.depCheck(); |
221 |
|
if(depOK) { |
222 |
+ |
System.out.println(toString + ": starting component - " + component.toString()); |
223 |
|
// it should be ok to start the component |
224 |
|
try { |
225 |
|
// start the component |
274 |
|
* properly. |
275 |
|
*/ |
276 |
|
public static void usage() { |
277 |
< |
System.out.println("USAGE: java uk.org.iscream.componentmanager.ComponentManager <option>"); |
277 |
> |
System.out.println("USAGE: java uk.org.iscream.cms.server.componentmanager.ComponentManager <option>"); |
278 |
|
System.out.println(" or: java -jar iscream.jar <option>"); |
279 |
|
System.out.println("WHERE <option>:"); |
280 |
|
System.out.println(" -l <filename> - the location of initial system properties"); |
281 |
|
System.out.println(" the default is ./etc/default.properties"); |
282 |
|
System.out.println(" -f <name> - the name of the filter (if there is one configured"); |
283 |
+ |
System.out.println(" -fm <name> - the name of the filter manager (if there is one configured"); |
284 |
|
System.out.println(" -h - this help screen"); |
285 |
|
System.exit(1); |
286 |
|
} |