1 /******************************************************************************* 2 * Copyright (c) 2007, 2014 Massimiliano Ziccardi 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 *******************************************************************************/ 16 package it.jnrpe.commands; 17 18 /** 19 * This class represent a command Option. 20 * 21 * @author Massimiliano Ziccardi 22 */ 23 public final class CommandOption { 24 /** 25 * The option name. 26 */ 27 private final String optionName; 28 /** 29 * The option value. 30 */ 31 private final String optionValue; 32 33 /** 34 * Initializes an option that has no value. 35 * 36 * @param optName 37 * The option name 38 */ 39 public CommandOption(final String optName) { 40 this.optionName = optName; 41 optionValue = null; 42 } 43 44 /** 45 * Initializes an option and its value. The value can be an $ARG?$ macro. If 46 * that's the case (and if the server is configured to accept macros), it's 47 * value is received by check_nrpe. 48 * 49 * @param optName 50 * The option name 51 * @param optValue 52 * The option value 53 */ 54 public CommandOption(final String optName, final String optValue) { 55 this.optionName = optName; 56 this.optionValue = optValue; 57 } 58 59 /** 60 * Returns the option name. 61 * 62 * @return The option name 63 */ 64 public String getName() { 65 return optionName; 66 } 67 68 /** 69 * Returns the option value. 70 * 71 * @return The argument value 72 */ 73 public String getValue() { 74 return optionValue; 75 } 76 }