66 |
|
/** |
67 |
|
* Default port number |
68 |
|
*/ |
69 |
< |
public static final int DEFAULTPORT = 8080; |
69 |
> |
public static final int DEFAULTPORT = 8052; |
70 |
> |
|
71 |
> |
/** |
72 |
> |
* The default location of the properties file for the system |
73 |
> |
*/ |
74 |
> |
public static final String DEFAULTPROPERTIES = "./etc/default.properties"; |
75 |
|
|
76 |
|
//---STATIC METHODS--- |
77 |
|
|
81 |
|
*/ |
82 |
|
public static void main(String args[]) { |
83 |
|
|
79 |
– |
// Use JacORB |
80 |
– |
System.setProperty("org.omg.CORBA.ORBClass","org.jacorb.orb.ORB"); |
81 |
– |
System.setProperty("org.omg.CORBA.ORBSingletonClass","org.jacorb.orb.ORBSingleton"); |
82 |
– |
|
84 |
|
System.out.println("-----------------------------------------"); |
85 |
|
System.out.println("--- i-scream CORBA Services Manager ---"); |
86 |
< |
System.out.println("--- © 2001 The i-scream Project ---"); |
86 |
> |
System.out.println("--- (c) 2001 The i-scream Project ---"); |
87 |
|
System.out.println("--- (http://www.i-scream.org.uk) ---"); |
88 |
|
System.out.println("-----------------------------------------"); |
89 |
|
System.out.println("--- Starting System ---"); |
93 |
|
String servicesConf = DEFAULTSERVICESCONF; |
94 |
|
String webDir = DEFAULTWEBDIR; |
95 |
|
int port = DEFAULTPORT; |
96 |
+ |
String defaultProperties = DEFAULTPROPERTIES; |
97 |
|
for(int i=0; i < args.length; i++) { |
98 |
|
if(args[i].equals("-h")) { |
99 |
|
usage(); |
100 |
|
} |
101 |
|
else if(args[i].equals("-u")) { |
102 |
< |
i++; okUrls = args[i]; |
102 |
> |
if(++i < args.length) { |
103 |
> |
okUrls = args[i]; |
104 |
> |
} |
105 |
> |
else { |
106 |
> |
usage(); |
107 |
> |
} |
108 |
|
} |
109 |
|
else if(args[i].equals("-s")) { |
110 |
< |
i++; servicesConf = args[i]; |
110 |
> |
if(++i < args.length) { |
111 |
> |
servicesConf = args[i]; |
112 |
> |
} |
113 |
> |
else { |
114 |
> |
usage(); |
115 |
> |
} |
116 |
|
} |
117 |
|
else if(args[i].equals("-w")) { |
118 |
< |
i++; webDir = args[i]; |
118 |
> |
if(++i < args.length) { |
119 |
> |
webDir = args[i]; |
120 |
> |
} |
121 |
> |
else { |
122 |
> |
usage(); |
123 |
> |
} |
124 |
|
} |
125 |
|
else if(args[i].equals("-p")) { |
126 |
< |
i++; port = Integer.parseInt(args[i]); |
126 |
> |
if(++i < args.length) { |
127 |
> |
port = Integer.parseInt(args[i]); |
128 |
> |
} |
129 |
> |
else { |
130 |
> |
usage(); |
131 |
> |
} |
132 |
|
} |
133 |
+ |
else if(args[i].equals("-l")) { |
134 |
+ |
if(++i < args.length) { |
135 |
+ |
defaultProperties = args[i]; |
136 |
+ |
} |
137 |
+ |
else { |
138 |
+ |
usage(); |
139 |
+ |
} |
140 |
+ |
} |
141 |
|
else { |
142 |
|
usage(); |
143 |
|
} |
144 |
|
} |
145 |
|
|
146 |
+ |
// load the default properties file into the system properties |
147 |
+ |
System.out.println("initialising: reading " + defaultProperties); |
148 |
+ |
try { |
149 |
+ |
Properties initProperties = new Properties(System.getProperties()); |
150 |
+ |
initProperties.load(new FileInputStream(new File(defaultProperties)) |
151 |
+ |
); |
152 |
+ |
System.setProperties(initProperties); |
153 |
+ |
} catch (Exception e) { |
154 |
+ |
System.err.println("ERROR: " + e.getMessage()); |
155 |
+ |
usage(); |
156 |
+ |
} |
157 |
+ |
|
158 |
|
// Read in the services configuration |
159 |
|
System.out.println("--- Reading Configuration ---"); |
160 |
|
|
256 |
|
System.out.println(" -w <dir> - the location of the web directory"); |
257 |
|
System.out.println(" the default is ./web (no trailing /)"); |
258 |
|
System.out.println(" -p <port> - this port to bind the webserver to"); |
259 |
< |
System.out.println(" the default is 8080"); |
259 |
> |
System.out.println(" the default is 8052"); |
260 |
> |
System.out.println(" -l <filename> - the location of initial system properties"); |
261 |
> |
System.out.println(" the default is ./etc/default.properties"); |
262 |
|
System.out.println(" -h - this help screen"); |
263 |
|
System.exit(1); |
264 |
|
} |