KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > store > MailboxException


1 /***********************************************************************
2  * Copyright (c) 2000-2004 The Apache Software Foundation. *
3  * All rights reserved. *
4  * ------------------------------------------------------------------- *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you *
6  * may not use this file except in compliance with the License. You *
7  * may obtain a copy of the License at: *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14  * implied. See the License for the specific language governing *
15  * permissions and limitations under the License. *
16  ***********************************************************************/

17
18 package org.apache.james.imapserver.store;
19
20 /**
21  * Thrown on an inappropriate attempt to reference a mailbox.
22  * Includes attempting to create a mailbox that already exists and attempting
23  * to open a mailbox that does not exist.
24  * If status is ALREADY_EXISTS_REMOTELY or IF_CREATED_REMOTE then field
25  * remoteServer should be set to the url of the remote server, formatted for
26  * Mailbox Referral.
27  *
28  * @version 0.1 on 14 Dec 2000
29  */

30 public class MailboxException extends Exception JavaDoc
31 {
32
33     public final static String JavaDoc ALREADY_EXISTS_LOCALLY
34             = "Already exists locally";
35     public final static String JavaDoc ALREADY_EXISTS_REMOTELY
36             = "Already exists remotely";
37     public final static String JavaDoc IF_CREATED_LOCAL
38             = "If created, mailbox would be local";
39     public final static String JavaDoc IF_CREATED_REMOTE
40             = "If created, mailbox would be remote";
41     public final static String JavaDoc NOT_LOCAL
42             = "Does not exist locally, no further information available";
43     public final static String JavaDoc LOCAL_BUT_DELETED
44             = "Was local but has been deleted.";
45
46     protected String JavaDoc status = null;
47     protected String JavaDoc remoteServer = null;
48
49     private String JavaDoc responseCode = null;
50
51     /**
52      * Construct a new <code>MailboxException</code> instance.
53      *
54      * @param message The detail message for this exception (mandatory).
55      */

56     public MailboxException( String JavaDoc message )
57     {
58         super( message );
59     }
60
61     /**
62      * Construct a new <code>MailBoxException</code> instance.
63      *
64      * @param message The detail message for this exception (mandatory).
65      * @param aStatus String constant indicating condition
66      */

67     public MailboxException( String JavaDoc message, String JavaDoc aStatus )
68     {
69         super( message );
70         this.status = aStatus;
71     }
72
73     /**
74      * Construct a new <code>MailBoxException</code> instance.
75      *
76      * @param message The detail message for this exception (mandatory).
77      * @param aStatus String constant indicating condition
78      * @param aServer String indicating another server where Mailbox should be.
79      */

80     public MailboxException( String JavaDoc message, String JavaDoc aStatus, String JavaDoc aServer )
81     {
82         super( message );
83         this.status = aStatus;
84         this.remoteServer = aServer;
85     }
86
87     public String JavaDoc getStatus()
88     {
89         return status;
90     }
91
92     public String JavaDoc getRemoteServer()
93     {
94         return remoteServer;
95     }
96
97     public boolean isRemote()
98     {
99         return ( status.equals( ALREADY_EXISTS_REMOTELY )
100                 || status.equals( IF_CREATED_REMOTE ) );
101     }
102
103     public String JavaDoc getResponseCode()
104     {
105         return responseCode;
106     }
107
108     public void setResponseCode( String JavaDoc responseCode )
109     {
110         this.responseCode = responseCode;
111     }
112 }
113
Popular Tags