View Javadoc

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.server.console;
17  
18  import java.io.IOException;
19  
20  import jline.console.ConsoleReader;
21  import it.jnrpe.JNRPE;
22  
23  public class ExitCommand extends ConsoleCommand {
24  
25      public final static String NAME="exit";
26      
27      public ExitCommand(ConsoleReader consoleReader, JNRPE jnrpe) {
28          super(consoleReader, jnrpe);
29      }
30  
31      public boolean execute(String[] args) throws Exception {
32          getJNRPE().shutdown();
33          return true;
34      }
35  
36      public String getName() {
37          return NAME;
38      }
39  
40      public String getCommandLine() {
41          return "";
42      }
43  
44      public void printHelp() throws IOException {
45          getConsole().println("Command Line : exit");
46          getConsole().println("  Exits from the JNRPE console");
47      }
48  
49  }