View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
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   */
17  package net.sf.asterisk.manager.action;
18  
19  /***
20   * The CommandAction sends a command line interface (CLI) command to the
21   * asterisk server.<br>
22   * For a list of supported commands type <code>help</code> on asterisk's
23   * command line.
24   * 
25   * @author srt
26   * @version $Id: CommandAction.java,v 1.5 2005/08/07 00:09:42 srt Exp $
27   */
28  public class CommandAction extends AbstractManagerAction
29  {
30      /***
31       * Serializable version identifier
32       */
33      static final long serialVersionUID = 4753117770471622025L;
34  
35      protected String command;
36  
37      /***
38       * Creates a new CommandAction.
39       */
40      public CommandAction()
41      {
42  
43      }
44  
45      /***
46       * Creates a new CommandAction with the given command.
47       * 
48       * @param command the CLI command to execute.
49       * @since 0.2
50       */
51      public CommandAction(String command)
52      {
53          this.command = command;
54      }
55  
56      /***
57       * Returns the name of this action, i.e. "Command".
58       */
59      public String getAction()
60      {
61          return "Command";
62      }
63  
64      /***
65       * Returns the command.
66       */
67      public String getCommand()
68      {
69          return command;
70      }
71  
72      /***
73       * Sets the CLI command to send to the asterisk server.
74       */
75      public void setCommand(String command)
76      {
77          this.command = command;
78      }
79  }