1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.org.iscream.componentmanager; |
22 |
> |
package uk.org.iscream.cms.server.componentmanager; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
|
import java.util.*; |
26 |
|
import java.io.*; |
27 |
< |
import uk.org.iscream.util.*; |
27 |
> |
import uk.org.iscream.cms.server.util.*; |
28 |
|
|
29 |
|
/** |
30 |
|
* The component manager is the starting point for all |
32 |
|
* It loads its initial system configuration from the |
33 |
|
* default properties file, it then starts all the iscream |
34 |
|
* components as specified in the default.properties under |
35 |
< |
* uk.org.iscream.ComponentList |
35 |
> |
* uk.org.iscream.cms.server.ComponentList |
36 |
|
* |
37 |
|
* @author $Author$ |
38 |
|
* @version $Id$ |
73 |
|
* @param args the command line arguments |
74 |
|
*/ |
75 |
|
public static void main(String[] args) { |
76 |
+ |
System.out.println("-----------------------------------------"); |
77 |
|
System.out.println("--- i-scream Server Component Manager ---"); |
78 |
+ |
System.out.println("--- (c) 2001 The i-scream Project ---"); |
79 |
+ |
System.out.println("--- (http://www.i-scream.org.uk) ---"); |
80 |
+ |
System.out.println("-----------------------------------------"); |
81 |
|
System.out.println("--- Starting System ---"); |
82 |
|
|
83 |
|
// get the command line args |
84 |
|
String defaultProperties = DEFAULTPROPERTIES; |
85 |
|
String filterName = null; |
86 |
+ |
String filterManagerName = null; |
87 |
|
for(int i=0; i < args.length; i++) { |
88 |
|
if(args[i].equals("-h")) { |
89 |
|
usage(); |
90 |
|
} |
91 |
|
else if(args[i].equals("-f")) { |
92 |
< |
i++; filterName = args[i]; |
92 |
> |
if(++i < args.length) { |
93 |
> |
filterName = args[i]; |
94 |
> |
} |
95 |
> |
else { |
96 |
> |
usage(); |
97 |
> |
} |
98 |
|
} |
99 |
+ |
else if(args[i].equals("-fm")) { |
100 |
+ |
if(++i < args.length) { |
101 |
+ |
filterManagerName = args[i]; |
102 |
+ |
} |
103 |
+ |
else { |
104 |
+ |
usage(); |
105 |
+ |
} |
106 |
+ |
} |
107 |
|
else if(args[i].equals("-l")) { |
108 |
< |
i++; defaultProperties = args[i]; |
108 |
> |
if(++i < args.length) { |
109 |
> |
defaultProperties = args[i]; |
110 |
> |
} |
111 |
> |
else { |
112 |
> |
usage(); |
113 |
> |
} |
114 |
|
} |
115 |
|
else { |
116 |
|
usage(); |
139 |
|
refman.activatePOA(); |
140 |
|
|
141 |
|
// get the list of components |
142 |
< |
String componentList = System.getProperty("uk.org.iscream.ComponentList"); |
142 |
> |
String componentList = System.getProperty("uk.org.iscream.cms.server.ComponentList"); |
143 |
|
StringTokenizer st = new StringTokenizer(componentList, ";"); |
144 |
|
_componentsToStart = new LinkedList(); |
145 |
|
|
152 |
|
|
153 |
|
// ### This is where the list of supported components is checked! ### |
154 |
|
if (componentName.equalsIgnoreCase("core")) { |
155 |
< |
component = new uk.org.iscream.core.Core(); |
155 |
> |
component = new uk.org.iscream.cms.server.core.Core(); |
156 |
> |
// note the passing of the FilterManagers's name in its constructor |
157 |
|
} else if (componentName.equalsIgnoreCase("filtermanager")) { |
158 |
< |
component = new uk.org.iscream.filtermanager.FilterManager(); |
158 |
> |
component = new uk.org.iscream.cms.server.filtermanager.FilterManager(filterManagerName); |
159 |
|
} else if (componentName.equalsIgnoreCase("rootfilter")) { |
160 |
< |
component = new uk.org.iscream.rootfilter.RootFilter(); |
160 |
> |
component = new uk.org.iscream.cms.server.rootfilter.RootFilter(); |
161 |
|
} else if (componentName.equalsIgnoreCase("dbinterface")) { |
162 |
< |
component = new uk.org.iscream.dbinterface.DBInterface(); |
162 |
> |
component = new uk.org.iscream.cms.server.dbinterface.DBInterface(); |
163 |
|
} else if (componentName.equalsIgnoreCase("clientinterface")) { |
164 |
< |
component = new uk.org.iscream.clientinterface.ClientInterfaceMain(); |
164 |
> |
component = new uk.org.iscream.cms.server.clientinterface.ClientInterfaceMain(); |
165 |
|
// note the passing of the Filter's name in its constructor |
166 |
|
} else if (componentName.equalsIgnoreCase("filter")) { |
167 |
< |
component = new uk.org.iscream.filter.FilterMain(filterName); |
167 |
> |
component = new uk.org.iscream.cms.server.filter.FilterMain(filterName); |
168 |
|
} else if (componentName.equalsIgnoreCase("client")) { |
169 |
< |
component = new uk.org.iscream.client.ClientMain(); |
169 |
> |
component = new uk.org.iscream.cms.server.client.ClientMain(); |
170 |
|
} |
171 |
|
// ### Add new component constructors in the above section! ### |
172 |
|
|
184 |
|
|
185 |
|
String confTimeout = null; |
186 |
|
try { |
187 |
< |
confTimeout = System.getProperty("uk.org.iscream.ComponentTimeout"); |
187 |
> |
confTimeout = System.getProperty("uk.org.iscream.cms.server.ComponentTimeout"); |
188 |
|
confTimeout.trim(); |
189 |
|
_startTimeout = Integer.parseInt(confTimeout); |
190 |
|
} catch (NumberFormatException e) { |
191 |
|
_startTimeout = DEFAULT_COMPONENT_START_TIMEOUT; |
192 |
< |
System.err.println(toString + ": unable to read uk.org.iscream.ComponentTimeout value (" + confTimeout + "), using default!"); |
192 |
> |
System.err.println(toString + ": unable to read uk.org.iscream.cms.server.ComponentTimeout value (" + confTimeout + "), using default!"); |
193 |
|
} |
194 |
|
System.out.println(toString + ": using component start timeout of " + _startTimeout + " seconds"); |
195 |
|
|
215 |
|
* This method calls the start() methods on all the components. |
216 |
|
* If a component fails to start due to a CORBA communication |
217 |
|
* problem, then it catches this and tries to start it again |
218 |
< |
* according to uk.org.iscream.ComponentTimeout time. |
218 |
> |
* according to uk.org.iscream.cms.server.ComponentTimeout time. |
219 |
|
* |
220 |
|
* If the server dies and CORBA connections are lost, this method |
221 |
|
* is called again. |
234 |
|
while(i.hasNext()) { |
235 |
|
// get a refence to the component |
236 |
|
component = (Component) i.next(); |
237 |
< |
System.out.println(toString + ": starting component - " + component.toString()); |
237 |
> |
System.out.println(toString + ": dependency checking component - " + component.toString()); |
238 |
|
|
239 |
|
// check it's dependencies |
240 |
|
boolean depOK = component.depCheck(); |
241 |
|
if(depOK) { |
242 |
+ |
System.out.println(toString + ": starting component - " + component.toString()); |
243 |
|
// it should be ok to start the component |
244 |
|
try { |
245 |
|
// start the component |
294 |
|
* properly. |
295 |
|
*/ |
296 |
|
public static void usage() { |
297 |
< |
System.out.println("USAGE: java uk.org.iscream.componentmanager.ComponentManager <option>"); |
297 |
> |
System.out.println("USAGE: java uk.org.iscream.cms.server.componentmanager.ComponentManager <option>"); |
298 |
|
System.out.println(" or: java -jar iscream.jar <option>"); |
299 |
|
System.out.println("WHERE <option>:"); |
300 |
|
System.out.println(" -l <filename> - the location of initial system properties"); |
301 |
|
System.out.println(" the default is ./etc/default.properties"); |
302 |
|
System.out.println(" -f <name> - the name of the filter (if there is one configured"); |
303 |
+ |
System.out.println(" -fm <name> - the name of the filter manager (if there is one configured"); |
304 |
|
System.out.println(" -h - this help screen"); |
305 |
|
System.exit(1); |
306 |
|
} |