View Javadoc

1   /************************************************************************
2    * Copyright (c) 2000-2006 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.util.mail.dsn;
19  
20  
21  /***
22   * Constants and getters for RFC 3463 Enhanced Mail System Status Codes
23   *
24   */
25  public class DSNStatus {
26      // status code classes
27      /***
28       * Success
29       */
30      public static final int SUCCESS = 2;
31  
32      /***
33       * Persistent Transient Failure
34       */
35      public static final int TRANSIENT = 4;
36  
37      /***
38       * Permanent Failure
39       */
40      public static final int PERMANENT = 5;
41  
42      // subjects and details
43  
44      /***
45       * Other or Undefined Status
46       */
47      public static final int UNDEFINED = 0;
48  
49      /***
50       * Other undefined status
51       */
52      public static final String UNDEFINED_STATUS = "0.0";
53  
54      /***
55       * Addressing Status
56       */
57      public static final int ADDRESS = 1;
58  
59      /***
60       * Other address status
61       */
62      public static final String ADDRESS_OTHER = "1.0";
63  
64      /***
65       * Bad destination mailbox address
66       */
67      public static final String ADDRESS_MAILBOX = "1.1";
68  
69      /***
70       * Bad destination system address
71       */
72      public static final String ADDRESS_SYSTEM = "1.2";
73  
74      /***
75       * Bad destination mailbox address syntax
76       */
77      public static final String ADDRESS_SYNTAX = "1.3";
78  
79      /***
80       * Destination mailbox address ambiguous
81       */
82      public static final String ADDRESS_AMBIGUOUS = "1.4";
83  
84      /***
85       * Destination Address valid
86       */
87      public static final String ADDRESS_VALID = "1.5";
88  
89      /***
90       * Destimation mailbox has moved, no forwarding address
91       */
92      public static final String ADDRESS_MOVED = "1.6";
93  
94      /***
95       * Bad sender's mailbox address syntax
96       */
97      public static final String ADDRESS_SYNTAX_SENDER = "1.7";
98  
99      /***
100      * Bad sender's system address
101      */
102     public static final String ADDRESS_SYSTEM_SENDER = "1.8";
103 
104 
105     /***
106      * Mailbox Status
107      */
108     public static final int MAILBOX = 2;
109 
110     /***
111      * Other or Undefined Mailbox Status
112      */
113     public static final String MAILBOX_OTHER = "2.0";
114 
115     /***
116      * Mailbox disabled, not accepting messages
117      */
118     public static final String MAILBOX_DISABLED = "2.1";
119 
120     /***
121      * Mailbox full
122      */
123     public static final String MAILBOX_FULL = "2.2";
124 
125     /***
126      * Message length exceeds administrative limit
127      */
128     public static final String MAILBOX_MSG_TOO_BIG = "2.3";
129 
130     /***
131      * Mailing list expansion problem
132      */
133     public static final String MAILBOX_LIST_EXPANSION = "2.4";
134 
135 
136     /***
137      * Mail System Status
138      */
139     public static final int SYSTEM = 3;
140 
141     /***
142      * Other or undefined mail system status
143      */
144     public static final String SYSTEM_OTHER = "3.0";
145 
146     /***
147      * Mail system full
148      */
149     public static final String SYSTEM_FULL = "3.1";
150 
151     /***
152      * System not accepting messages
153      */
154     public static final String SYSTEM_NOT_ACCEPTING = "3.2";
155 
156     /***
157      * System not capable of selected features
158      */
159     public static final String SYSTEM_NOT_CAPABLE = "3.3";
160 
161     /***
162      * Message too big for system
163      */
164     public static final String SYSTEM_MSG_TOO_BIG = "3.4";
165 
166     /***
167      * System incorrectly configured
168      */
169     public static final String SYSTEM_CFG_ERROR = "3.5";
170 
171 
172     /***
173      * Network and Routing Status
174      */
175     public static final int NETWORK = 4;
176 
177     /***
178      * Other or undefined network or routing status
179      */
180     public static final String NETWORK_OTHER = "4.0";
181 
182     /***
183      * No answer form host
184      */
185     public static final String NETWORK_NO_ANSWER = "4.1";
186 
187     /***
188      * Bad Connection
189      */
190     public static final String NETWORK_CONNECTION = "4.2";
191 
192     /***
193      * Directory server failure
194      */
195     public static final String NETWORK_DIR_SERVER = "4.3";
196 
197     /***
198      * Unable to route
199      */
200     public static final String NETWORK_ROUTE = "4.4";
201 
202     /***
203      * Mail system congestion
204      */
205     public static final String NETWORK_CONGESTION = "4.5";
206 
207     /***
208      * Routing loop detected
209      */
210     public static final String NETWORK_LOOP = "4.6";
211 
212     /***
213      * Delivery time expired
214      */
215     public static final String NETWORK_EXPIRED = "4.7";
216 
217 
218     /***
219      * Mail Delivery Protocol Status
220      */
221     public static final int DELIVERY = 5;
222 
223     /***
224      * Other or undefined (SMTP) protocol status
225      */
226     public static final String DELIVERY_OTHER = "5.0";
227 
228     /***
229      * Invalid command
230      */
231     public static final String DELIVERY_INVALID_CMD = "5.1";
232 
233     /***
234      * Syntax error
235      */
236     public static final String DELIVERY_SYNTAX = "5.2";
237 
238     /***
239      * Too many recipients
240      */
241     public static final String DELIVERY_TOO_MANY_REC = "5.3";
242 
243     /***
244      * Invalid command arguments
245      */
246     public static final String DELIVERY_INVALID_ARG = "5.4";
247 
248     /***
249      * Wrong protocol version
250      */
251     public static final String DELIVERY_VERSION = "5.5";
252 
253 
254     /***
255      * Message Content or Media Status
256      */
257     public static final int CONTENT = 6;
258 
259     /***
260      * Other or undefined media error
261      */
262     public static final String CONTENT_OTHER = "6.0";
263 
264     /***
265      * Media not supported
266      */
267     public static final String CONTENT_UNSUPPORTED = "6.1";
268 
269     /***
270      * Conversion required and prohibited
271      */
272     public static final String CONTENT_CONVERSION_NOT_ALLOWED = "6.2";
273 
274     /***
275      * Conversion required, but not supported
276      */
277     public static final String CONTENT_CONVERSION_NOT_SUPPORTED = "6.3";
278 
279     /***
280      * Conversion with loss performed
281      */
282     public static final String CONTENT_CONVERSION_LOSS = "6.4";
283 
284     /***
285      * Conversion failed
286      */
287     public static final String CONTENT_CONVERSION_FAILED = "6.5";
288 
289 
290     /***
291      * Security or Policy Status
292      */
293     public static final int SECURITY = 7;
294 
295     /***
296      * Other or undefined security status
297      */
298     public static final String SECURITY_OTHER = "7.0";
299 
300     /***
301      * Delivery not authorized, message refused
302      */
303     public static final String SECURITY_AUTH = "7.1";
304 
305     /***
306      * Mailing list expansion prohibited
307      */
308     public static final String SECURITY_LIST_EXP = "7.2";
309 
310     /***
311      * Security conversion required, but not possible
312      */
313     public static final String SECURITY_CONVERSION = "7.3";
314 
315     /***
316      * Security features not supported
317      */
318     public static final String SECURITY_UNSUPPORTED = "7.4";
319 
320     /***
321      * Cryptographic failure
322      */
323     public static final String SECURITY_CRYPT_FAIL = "7.5";
324 
325     /***
326      * Cryptographic algorithm not supported
327      */
328     public static final String SECURITY_CRYPT_ALGO = "7.6";
329 
330     /***
331      * Message integrity failure
332      */
333     public static final String SECURITY_INTEGRITY = "7.7";
334 
335 
336     // get methods
337 
338     public static String getStatus(int type, String detail) {
339         return type + "." + detail;
340     }
341 
342     public static String getStatus(int type, int subject, int detail) {
343         return type + "." + subject + "." + detail;
344     }
345 }