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;
17
18 import java.util.List;
19
20 /**
21 * This interface represents the command line received by plugin instances.
22 *
23 * @author Massimiliano Ziccardi
24 */
25 public interface ICommandLine {
26
27 /**
28 * Returns the value of the specified option.
29 *
30 * @param optionName
31 * The option name
32 * @return The value of the option
33 */
34 String getOptionValue(String optionName);
35
36 /**
37 * Returns the values associated with the specified option.
38 *
39 * @param optionName The option name
40 * @return An ordered list of values
41 */
42 List<String> getOptionValues(String optionName);
43
44 /**
45 * Returns the value of the specified option. If the option is not present,
46 * returns the default value.
47 *
48 * @param optionName
49 * The option name
50 * @param defaultValue
51 * The default value
52 * @return The option value or, if not specified, the default value
53 */
54 String getOptionValue(String optionName, String defaultValue);
55
56 /**
57 * Returns the value of the specified option.
58 *
59 * @param shortOptionName
60 * The option short name
61 * @return The option value
62 */
63 String getOptionValue(char shortOptionName);
64
65 /**
66 * Returns the values associated with the specified option.
67 *
68 * @param shortOptionName The option short name
69 * @return An ordered list of values
70 */
71 List<String> getOptionValues(char shortOptionName);
72
73 /**
74 * Returns the value of the specified option If the option is not present,
75 * returns the default value.
76 *
77 * @param shortOptionName
78 * The option short name
79 * @param defaultValue
80 * The default value
81 * @return The option value or, if not specified, the default value
82 */
83 String getOptionValue(char shortOptionName, String defaultValue);
84
85 /**
86 * Returns <code>true</code> if the option is present.
87 *
88 * @param optionName
89 * The option name
90 * @return <code>true</code> if the option is present
91 */
92 boolean hasOption(String optionName);
93
94 /**
95 * Returns <code>true</code> if the option is present.
96 *
97 * @param shortOptionName
98 * The option short name
99 * @return <code>true</code> if the specified option is present
100 */
101 boolean hasOption(char shortOptionName);
102 }