1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.fastagi.command;
18
19 /***
20 * Retrieves an entry in the Asterisk database for a given family and key.<br>
21 * Returns 0 if is not set. Returns 1 if the variable is set and returns the
22 * value in parenthesis.<br>
23 * Example return code: 200 result=1 (testvariable)
24 *
25 * @author srt
26 * @version $Id: DatabaseGetCommand.java,v 1.2 2005/03/08 16:48:34 srt Exp $
27 */
28 public class DatabaseGetCommand extends AGICommand
29 {
30 /***
31 * Serial version identifier.
32 */
33 private static final long serialVersionUID = 3256719598056387384L;
34
35 /***
36 * The family of the key to retrieve.
37 */
38 private String family;
39
40 /***
41 * The key to retrieve.
42 */
43 private String key;
44
45 /***
46 * Creates a new DatabaseGetCommand.
47 *
48 * @param family the family of the key to retrieve.
49 * @param key the key to retrieve.
50 */
51 public DatabaseGetCommand(String family, String key)
52 {
53 this.family = family;
54 this.key = key;
55 }
56
57 /***
58 * Returns the family of the key to retrieve.
59 *
60 * @return the family of the key to retrieve.
61 */
62 public String getFamily()
63 {
64 return family;
65 }
66
67 /***
68 * Sets the family of the key to retrieve.
69 *
70 * @param family the family of the key to retrieve.
71 */
72 public void setFamily(String family)
73 {
74 this.family = family;
75 }
76
77 /***
78 * Returns the the key to retrieve.
79 *
80 * @return the key to retrieve.
81 */
82 public String getKey()
83 {
84 return key;
85 }
86
87 /***
88 * Sets the key to retrieve.
89 *
90 * @param key the key to retrieve.
91 */
92 public void setKey(String key)
93 {
94 this.key = key;
95 }
96
97 public String buildCommand()
98 {
99 return "DATABASE GET " + escapeAndQuote(family) + " "
100 + escapeAndQuote(key);
101 }
102 }