Project

General

Profile

Download (3.54 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 LOG_DIR = OptionBuilder
51
            .withArgName("file")
52
            .hasArg()
53
            .withDescription( "Alternative location to write logs to. " +
54
                    "By default the cdm server will use ${user.home}/.cdmLibrary/logs/" )
55
            .create("logdir");
56

    
57
    @SuppressWarnings("static-access")
58
    public static final Option DATASOURCES_FILE = OptionBuilder
59
    .withArgName("datasourcesfile")
60
    .hasArg()
61
    .withDescription( "use the specified datasources file. Default is {user.home}/.cdmLibrary/datasources.xml")
62
    .create("datasources");
63

    
64

    
65

    
66

    
67
    public static Options getOptions(){
68
        if(options == null){
69
            options = new Options();
70
            options.addOption(HELP);
71
            options.addOption(WEBAPP);
72
            options.addOption(HTTP_PORT);
73
            options.addOption(LOG_DIR);
74
            options.addOption(DATASOURCES_FILE);
75
            options.addOption(JMX);
76
            options.addOption(WIN32SERVICE);
77
        }
78
        return options;
79
    }
80

    
81

    
82
}
(3-3/6)