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 QueuePauseAction makes a queue member temporarily unavailabe (or
21   * available again).<br>
22   * It is implemented in <code>apps/app_queue.c</code><br>
23   * Available since Asterisk 1.2.
24   * 
25   * @author srt
26   * @version $Id: QueuePauseAction.java,v 1.2 2005/08/27 10:03:40 srt Exp $
27   * @since 0.2
28   */
29  public class QueuePauseAction extends AbstractManagerAction
30  {
31      /***
32       * Serializable version identifier
33       */
34      private static final long serialVersionUID = -4296471882045706821L;
35  
36      private String iface;
37      private Boolean paused;
38      private String queue;
39  
40      /***
41       * Creates a new empty QueuePauseAction.
42       */
43      public QueuePauseAction()
44      {
45  
46      }
47  
48      /***
49       * Creates a new QueuePauseAction that makes the member on the given
50       * interface unavailable on all queues.
51       * 
52       * @param iface the interface of the member to make unavailable
53       */
54      public QueuePauseAction(String iface)
55      {
56          this.iface = iface;
57          this.paused = Boolean.TRUE;
58      }
59  
60      /***
61       * Creates a new QueuePauseAction that makes the member on the given
62       * interface unavailable on the given queue.
63       * 
64       * @param iface the interface of the member to make unavailable
65       * @param queue the queue the member is made unvailable on
66       */
67      public QueuePauseAction(String iface, String queue)
68      {
69          this.iface = iface;
70          this.queue = queue;
71          this.paused = Boolean.TRUE;
72      }
73  
74      /***
75       * Creates a new QueuePauseAction that makes the member on the given
76       * interface available or unavailable on all queues.
77       * 
78       * @param iface the interface of the member to make unavailable
79       * @param paused Boolean.TRUE to make the member unavailbale, Boolean.FALSE
80       *            to make the member available
81       */
82      public QueuePauseAction(String iface, Boolean paused)
83      {
84          this.iface = iface;
85          this.paused = paused;
86      }
87  
88      /***
89       * Creates a new QueuePauseAction that makes the member on the given
90       * interface unavailable on the given queue.
91       * 
92       * @param iface the interface of the member to make unavailable
93       * @param queue the queue the member is made unvailable on
94       * @param paused Boolean.TRUE to make the member unavailbale, Boolean.FALSE
95       *            to make the member available
96       */
97      public QueuePauseAction(String iface, String queue, Boolean paused)
98      {
99          this.iface = iface;
100         this.queue = queue;
101         this.paused = paused;
102     }
103 
104     /***
105      * Returns the name of this action, i.e. "QueuePause".
106      * 
107      * @return the name of this action.
108      */
109     public String getAction()
110     {
111         return "QueuePause";
112     }
113 
114     /***
115      * Returns the interface of the member to make available or unavailable.
116      * 
117      * @return the interface of the member to make available or unavailable.
118      */
119     public String getInterface()
120     {
121         return iface;
122     }
123 
124     /***
125      * Sets the interface of the member to make available or unavailable.<br>
126      * This property is mandatory.
127      * 
128      * @param iface the interface of the member to make available or
129      *            unavailable.
130      */
131     public void setInterface(String iface)
132     {
133         this.iface = iface;
134     }
135 
136     /***
137      * Returns the name of the queue the member is made available or unavailable
138      * on.
139      * 
140      * @return the name of the queue the member is made available or unavailable
141      *         on or <code>null</code> for all queues.
142      */
143     public String getQueue()
144     {
145         return queue;
146     }
147 
148     /***
149      * Sets the name of the queue the member is made available or unavailable
150      * on.
151      * 
152      * @param queue the name of the queue the member is made available or
153      *            unavailable on or <code>null</code> for all queues.
154      */
155     public void setQueue(String queue)
156     {
157         this.queue = queue;
158     }
159 
160     /***
161      * Returns if the member is made available or unavailable.
162      * 
163      * @return Boolean.TRUE to make the member unavailbale, Boolean.FALSE to
164      *         make the member available
165      */
166     public Boolean getPaused()
167     {
168         return paused;
169     }
170 
171     /***
172      * Sets if the member is made available or unavailable.<br>
173      * This property is mandatory.
174      * 
175      * @param paused Boolean.TRUE to make the member unavailbale, Boolean.FALSE
176      *            to make the member available
177      */
178     public void setPaused(Boolean paused)
179     {
180         this.paused = paused;
181     }
182 }