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 MailboxStatusAction checks if a mailbox contains waiting messages.<br>
21   * The MailboxStatusAction returns a MailboxStatusResponse.
22   * 
23   * @see net.sf.asterisk.manager.response.MailboxStatusResponse
24   * @author srt
25   * @version $Id: MailboxStatusAction.java,v 1.5 2005/08/07 00:09:42 srt Exp $
26   */
27  public class MailboxStatusAction extends AbstractManagerAction
28  {
29      /***
30       * Serializable version identifier
31       */
32      static final long serialVersionUID = -3845028207155711950L;
33  
34      private String mailbox;
35  
36      /***
37       * Creates a new empty MailboxStatusAction.
38       */
39      public MailboxStatusAction()
40      {
41  
42      }
43  
44      /***
45       * Creates a new MailboxStatusAction that checks for waiting messages in the
46       * given mailbox.
47       * 
48       * @param mailbox the name of the mailbox to check.<br>
49       *            This can either be only the number of the mailbox or a string
50       *            of the form mailboxnumber@context.If no context is specified
51       *            "default" is assumed.
52       * @since 0.2
53       */
54      public MailboxStatusAction(String mailbox)
55      {
56          this.mailbox = mailbox;
57      }
58  
59      /***
60       * Returns the name of this action, i.e. "MailboxStatus".
61       */
62      public String getAction()
63      {
64          return "MailboxStatus";
65      }
66  
67      /***
68       * Returns the name of the mailbox to query.
69       */
70      public String getMailbox()
71      {
72          return mailbox;
73      }
74  
75      /***
76       * Sets the name of the mailbox to query.<br>
77       * This can either be only the name of the mailbox or a string of the form
78       * mailboxnumber@context. If no context is specified "default" is assumed.<br>
79       * Multiple mailboxes may be given, separated by ','. In this case the
80       * action checks whether at least one of the given mailboxes has waiting
81       * messages.<br>
82       * This property is mandatory.<br>
83       * Example: "1234,1235@mycontext"
84       */
85      public void setMailbox(String mailbox)
86      {
87          this.mailbox = mailbox;
88      }
89  }