Project

General

Profile

Download (2.57 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2009 EDIT
4
 * European Distributed Institute of Taxonomy 
5
 * http://www.e-taxonomy.eu
6
 * 
7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8
 * See LICENSE.TXT at the top of this package for the full license terms.
9
 */
10

    
11
package eu.etaxonomy.cdm.server;
12

    
13
import org.apache.commons.cli.Option;
14
import org.apache.commons.cli.OptionBuilder;
15
import org.apache.commons.cli.Options;
16

    
17
public class CommandOptions{
18
	
19
	private static Options options = null;
20
	
21
	public static final Option HELP = new Option( "help", "print this message" );
22
	public static final Option JMX = new Option( "jmx", "Start the server with the Jetty MBeans in JMX Management mode. \n" +
23
			"For testing you can use the following jvm options:\n" +
24
			"   -Dcom.sun.management.jmxremote.ssl=false\n" +
25
			"   -Dcom.sun.management.jmxremote.authenticate=false\n" +
26
			"   -Dcom.sun.management.jmxremote.port=9999" );
27
	public static final Option WIN32SERVICE= new Option("win32service", "ONLY USED INTERNALLY - prepare for running as win32 service, the server will not be started automatically!");
28
	
29
	@SuppressWarnings("static-access")
30
	public static final Option WEBAPP = OptionBuilder
31
			.withArgName("file")
32
			.hasArg()
33
			.withDescription( "use the specified webapplication this either can be a compressed war or extracted file. " +
34
					"If this option is used extraction of the war from the cdmserver jar file is omitted." +
35
					"Using the following paths developers can run the server completely from the target folder or completely from source:\n" +
36
					"'{cdmlib-project-root}/cdmlib-remote/target/cdmserver'\n " +
37
					"'{cdmlib-project-root}/cdmlib-remote/src/main/webapp'" )
38
			.create("webapp");
39

    
40
	@SuppressWarnings("static-access")
41
	public static final Option HTTP_PORT = OptionBuilder
42
			.withArgName("httpPortNumber")
43
			.hasArg()
44
			.withDescription( "set the http listening port. Default is 8080")
45
			.create("httpPort") ;
46
	
47
	@SuppressWarnings("static-access")
48
	public static final Option DATASOURCES_FILE = OptionBuilder
49
	.withArgName("datasourcesfile")
50
	.hasArg()
51
	.withDescription( "use the specified datasources file. Default is {user.home}/.cdmLibrary/datasources.xml")
52
	.create("datasources");
53
	
54
		
55

    
56
	
57
	public static Options getOptions(){
58
		if(options == null){
59
			options = new Options();
60
			options.addOption(HELP);
61
			options.addOption(WEBAPP);		
62
			options.addOption(HTTP_PORT);
63
			options.addOption(DATASOURCES_FILE);
64
			options.addOption(JMX);
65
			options.addOption(WIN32SERVICE);
66
		}
67
		return options;
68
	}
69

    
70

    
71
}
(3-3/5)