Project

General

Profile

Download (2.85 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( "Defines the webapplication to run from, this either can be a compressed war or extracted file.\n" +
34
					"Defaults to the cdm-remote-webapp.war which is found in cdm-server/traget\n" +
35
					"If this option is used extraction of the war from the cdmserver jar file is omitted.\n \n" +
36
					"Using the following paths developers can run the cdmlib-remote-webapp instaces completely from the target folder or from source:\n" +
37
					" - '{cdmlib-project-root}/cdmlib-remote-webapp/target/cdmserver'\n " +
38
					" - '{cdmlib-project-root}/cdmlib-remote-webapp/src/main/webapp'\n" +
39
					"This will also affect the cdm-server project, if any of both paths is set cdm-server will be run using the cdm-server/src/main/webapp folder!" )
40
			.create("webapp");
41

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

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

    
72

    
73
}
(3-3/5)