View Javadoc

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