1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.manager;
18
19 import net.sf.asterisk.AsteriskVersion;
20 import net.sf.asterisk.manager.action.ManagerAction;
21
22 /***
23 * Transforms ManagerActions to Strings suitable to be sent to Asterisk.<br>
24 * The attributes are determined using reflection.
25 *
26 * @author srt
27 * @version $Id: ActionBuilder.java,v 1.7 2005/11/08 15:25:18 srt Exp $
28 */
29 public interface ActionBuilder
30 {
31 /***
32 * Sets the version of the Asterisk server to built the action for.
33 *
34 * @param asteriskVersion the version of the target Asterisk server.
35 * @since 0.2
36 */
37 public void setTargetVersion(AsteriskVersion targetVersion);
38
39 /***
40 * Builds a String suitable to be sent to Asterisk based on the given action object.<br>
41 * Asterisk actions consist of an unordered set of key value pairs corresponding to the
42 * attributes of the ManagerActions. Key and value are separated by a colon (":"), key value
43 * pairs by a CR/NL ("\r\n"). An action is terminated by an empty line ("\r\n\r\n").
44 *
45 * @param action the action to transform
46 * @return a String representing the given action in an asterisk compatible format
47 */
48 String buildAction(final ManagerAction action);
49
50 /***
51 * Builds a String suitable to be sent to Asterisk based on the given action object.<br>
52 * Asterisk actions consist of an unordered set of key value pairs corresponding to the
53 * attributes of the ManagerActions. Key and value are separated by a colon (":"), key value
54 * pairs by a CR/NL ("\r\n"). An action is terminated by an empty line ("\r\n\r\n").
55 *
56 * @param action the action to transform
57 * @param internalActionId the internal action id to add
58 * @return a String representing the given action in an asterisk compatible format
59 */
60 String buildAction(final ManagerAction action, final String internalActionId);
61 }