All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.agent.server.ComandLineHelper Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.agent.server;

/**
 * 

ComandLineHelper class.

* * @author oaouattara * @version $Id: $Id */ public class ComandLineHelper { private static String SECURED = "-secured"; private static String PORT = "-port"; private static String KEYSTORE = "-keystore"; private static String CONFIG = "-config"; private String args[]; /** *

Constructor for ComandLineHelper.

* * @param args an array of {@link java.lang.String} objects. */ public ComandLineHelper(String args[]) { this.args = args; } /** *

getConfig.

* * @return a {@link java.lang.String} object. */ public String getConfig() { return getParameterValue(CONFIG); } /** *

isSecured.

* * @return a boolean. */ public boolean isSecured() { for (String arg : args) { if (SECURED.equalsIgnoreCase(arg)) { return true; } } return false; } /** *

getPort.

* * @param defaultPort a int. * @return a {@link java.lang.Integer} object. */ public Integer getPort(int defaultPort) { String port = getParameterValue(PORT); try { if (port != null) { return Integer.parseInt(port); } } catch (Exception ex) { } return defaultPort; } /** *

getKeyStore.

* * @return a {@link java.lang.String} object. */ public String getKeyStore() { return getParameterValue(KEYSTORE); } private String getParameterValue(String parameter) { if (args == null) { return null; } for (int i = 0; i < args.length; i++) { if (parameter.equalsIgnoreCase(args[i])) { if (i + 1 < args.length) { return args[i + 1]; } else { return null; } } } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy