Revision d8a13c97
Added by Andreas Müller over 2 years ago
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.server; |
11 | 10 |
|
12 | 11 |
import static eu.etaxonomy.cdm.server.AssumedMemoryRequirements.KB; |
... | ... | |
75 | 74 |
import eu.etaxonomy.cdm.server.logging.LoggingConfigurator; |
76 | 75 |
import eu.etaxonomy.cdm.server.win32service.Win32Service; |
77 | 76 |
|
78 |
|
|
79 | 77 |
/** |
80 | 78 |
* A bootstrap class for starting Jetty Runner using an embedded war. |
81 | 79 |
* |
... | ... | |
158 | 156 |
|
159 | 157 |
/* end of singleton implementation */ |
160 | 158 |
|
161 |
|
|
162 |
/** |
|
163 |
* @param input |
|
164 |
* @param output |
|
165 |
* @param bufferSize |
|
166 |
* @return |
|
167 |
* @throws IOException |
|
168 |
*/ |
|
169 | 159 |
public int writeStreamTo(final InputStream input, final OutputStream output, int bufferSize) throws IOException { |
170 | 160 |
int available = Math.min(input.available(), 256 * KB); |
171 | 161 |
byte[] buffer = new byte[Math.max(bufferSize, available)]; |
... | ... | |
179 | 169 |
return answer; |
180 | 170 |
} |
181 | 171 |
|
182 |
|
|
183 |
|
|
184 | 172 |
public void parseCommandOptions(String[] args) throws ParseException { |
185 | 173 |
CommandLineParser parser = new GnuParser(); |
186 | 174 |
|
... | ... | |
195 | 183 |
} |
196 | 184 |
} |
197 | 185 |
|
198 |
|
|
199 | 186 |
/** |
200 | 187 |
* Finds the named war file either in the resources known to the class loader |
201 | 188 |
* or in a target folder if the bootloader is started from within a maven project. |
... | ... | |
311 | 298 |
public String getCdmlibServicesLastModified() { |
312 | 299 |
return cdmlibServicesLastModified; |
313 | 300 |
} |
314 |
/** |
|
315 |
* @param extractWar |
|
316 |
* @return |
|
317 |
* @throws IOException |
|
318 |
*/ |
|
301 |
|
|
319 | 302 |
private File unzip(File extractWar) throws IOException { |
320 | 303 |
UnzipUtility unzip = new UnzipUtility(); |
321 | 304 |
|
... | ... | |
325 | 308 |
return destDirectory; |
326 | 309 |
} |
327 | 310 |
|
328 |
|
|
329 |
|
|
330 | 311 |
/** |
331 | 312 |
* MAIN METHOD |
332 | 313 |
* |
... | ... | |
336 | 317 |
public static void main(String[] args) throws Exception { |
337 | 318 |
|
338 | 319 |
Bootloader bootloader = Bootloader.getBootloader(); |
339 |
|
|
340 | 320 |
bootloader.parseCommandOptions(args); |
341 |
|
|
342 | 321 |
bootloader.startServer(); |
343 | 322 |
} |
344 | 323 |
|
345 |
|
|
346 |
|
|
347 | 324 |
public void startServer() throws IOException, |
348 | 325 |
FileNotFoundException, Exception, InterruptedException { |
349 | 326 |
|
Also available in: Unified diff
cleanup