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