View Javadoc

1   /*
2    *  Copyright 2004-2006 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 org.asteriskjava.manager.action;
18  
19  import java.io.Serializable;
20  
21  /***
22   * Interface that all Actions that can be sent to the Asterisk server must
23   * impement.<p>
24   * Instances of this class represent a command sent to Asterisk via Manager API,
25   * requesting a particular Action be performed. The number of actions available
26   * to the client are determined by the modules presently loaded in the Asterisk
27   * engine.<p>
28   * There is one conrete subclass of ManagerAction per each supported Asterisk
29   * Action.
30   * 
31   * @author srt
32   * @version $Id: ManagerAction.java 397 2006-05-26 12:13:32Z srt $
33   */
34  public interface ManagerAction extends Serializable
35  {
36      /***
37       * Returns the name of the action for example "Hangup".
38       */
39      String getAction();
40  
41      /***
42       * Returns the action id.
43       * 
44       * @return the user provied action id.
45       */
46      String getActionId();
47  
48      /***
49       * Sets the action id.<p>
50       * If the action id is set and sent to the asterisk server any response
51       * returned by the Asterisk server will include the same id. This way
52       * the action id can be used to track actions and their corresponding
53       * responses and response events.<p>
54       * Note that Asterisk-Java uses its own internal action id to match 
55       * actions with the corresponding responses and events. Though the internal
56       * action is never exposed to the application code. So if you want to 
57       * handle reponses or response events on your own your application must
58       * set a unique action id using this method otherwise the action id of
59       * the reponse and response event objects passed to your application
60       * will be null.
61       * 
62       * @param actionId the user provided action id to set.
63       * @see org.asteriskjava.manager.response.ManagerResponse#getActionId()
64       * @see org.asteriskjava.manager.event.ResponseEvent#getActionId()
65       */
66      void setActionId(String actionId);
67  
68  }