2 |
|
package uk.ac.ukc.iscream.componentmanager; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
– |
import uk.ac.ukc.iscream.util.*; |
5 |
|
import java.util.*; |
6 |
|
import java.io.*; |
7 |
+ |
import uk.ac.ukc.iscream.util.*; |
8 |
|
|
9 |
|
/** |
10 |
|
* The component manager is the starting point for all |
47 |
|
* @param args the command line arguments |
48 |
|
*/ |
49 |
|
public static void main(String[] args) { |
50 |
< |
System.out.println("--- I-Scream System Component Manager ---"); |
50 |
> |
System.out.println("--- i-scream Server Component Manager ---"); |
51 |
|
System.out.println("--- Starting System ---"); |
52 |
|
|
53 |
|
// get the command line args |
54 |
– |
// this is a bit messy and should be looked at |
54 |
|
String defaultProperties = DEFAULTPROPERTIES; |
55 |
|
String filterName = null; |
56 |
< |
if (args.length > 0) { |
57 |
< |
if (args[0].equals("-l")) { |
59 |
< |
defaultProperties = args[1]; |
60 |
< |
} else if (args[0].equals("-f")) { |
61 |
< |
filterName = args[1]; |
62 |
< |
} else if (args[2].equals("-l")) { |
63 |
< |
filterName = args[3]; |
64 |
< |
} else if (args[2].equals("-f")) { |
65 |
< |
filterName = args[3]; |
66 |
< |
} else { |
56 |
> |
for(int i=0; i < args.length; i++) { |
57 |
> |
if(args[i].equals("-h") { |
58 |
|
usage(); |
59 |
< |
} |
59 |
> |
} |
60 |
> |
else if(args[i].equals("-f") { |
61 |
> |
i++; filterName = args[i]; |
62 |
> |
} |
63 |
> |
else if(args[i].equals("-l") { |
64 |
> |
i++; defaultProperties = args[i]; |
65 |
> |
} |
66 |
> |
else { |
67 |
> |
usage(); |
68 |
> |
} |
69 |
|
} |
70 |
|
|
71 |
|
// load the default properties file into the system properties |
109 |
|
component = new uk.ac.ukc.iscream.rootfilter.RootFilter(); |
110 |
|
} else if (componentName.equalsIgnoreCase("dbinterface")) { |
111 |
|
component = new uk.ac.ukc.iscream.dbinterface.DBInterface(); |
112 |
+ |
} else if (componentName.equalsIgnoreCase("clientinterface")) { |
113 |
+ |
component = new uk.ac.ukc.iscream.clientinterface.ClientInterfaceMain(); |
114 |
+ |
// note the passing of the Filter's name in its constructor |
115 |
+ |
} else if (componentName.equalsIgnoreCase("filter")) { |
116 |
+ |
component = new uk.ac.ukc.iscream.filter.FilterMain(filterName); |
117 |
|
} |
118 |
|
// ### Add new component constructors in the above section! ### |
119 |
|
|
143 |
|
*/ |
144 |
|
public static void usage() { |
145 |
|
System.out.println("USAGE: java uk.ac.ukc.iscream.componentmanager.ComponentManager <option>"); |
146 |
+ |
System.out.println(" or: java -jar iscream.jar <option>"); |
147 |
|
System.out.println("WHERE <option>:"); |
148 |
|
System.out.println(" -l <filename> - the location of initial system properties"); |
149 |
|
System.out.println(" the default is ./etc/default.properties"); |