001    /****************************************************************
002     * Licensed to the Apache Software Foundation (ASF) under one   *
003     * or more contributor license agreements.  See the NOTICE file *
004     * distributed with this work for additional information        *
005     * regarding copyright ownership.  The ASF licenses this file   *
006     * to you under the Apache License, Version 2.0 (the            *
007     * "License"); you may not use this file except in compliance   *
008     * with the License.  You may obtain a copy of the License at   *
009     *                                                              *
010     *   http://www.apache.org/licenses/LICENSE-2.0                 *
011     *                                                              *
012     * Unless required by applicable law or agreed to in writing,   *
013     * software distributed under the License is distributed on an  *
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015     * KIND, either express or implied.  See the License for the    *
016     * specific language governing permissions and limitations      *
017     * under the License.                                           *
018     ****************************************************************/
019    
020    
021    
022    package org.apache.james.protocols.smtp.dsn;
023    
024    
025    /**
026     * Constants and getters for RFC 3463 Enhanced Mail System Status Codes
027     *
028     */
029    public class DSNStatus {
030        // status code classes
031        /**
032         * Success
033         */
034        public static final int SUCCESS = 2;
035    
036        /**
037         * Persistent Transient Failure
038         */
039        public static final int TRANSIENT = 4;
040    
041        /**
042         * Permanent Failure
043         */
044        public static final int PERMANENT = 5;
045    
046        // subjects and details
047    
048        /**
049         * Other or Undefined Status
050         */
051        public static final int UNDEFINED = 0;
052    
053        /**
054         * Other undefined status
055         */
056        public static final String UNDEFINED_STATUS = "0.0";
057    
058        /**
059         * Addressing Status
060         */
061        public static final int ADDRESS = 1;
062    
063        /**
064         * Other address status
065         */
066        public static final String ADDRESS_OTHER = "1.0";
067    
068        /**
069         * Bad destination mailbox address
070         */
071        public static final String ADDRESS_MAILBOX = "1.1";
072    
073        /**
074         * Bad destination system address
075         */
076        public static final String ADDRESS_SYSTEM = "1.2";
077    
078        /**
079         * Bad destination mailbox address syntax
080         */
081        public static final String ADDRESS_SYNTAX = "1.3";
082    
083        /**
084         * Destination mailbox address ambiguous
085         */
086        public static final String ADDRESS_AMBIGUOUS = "1.4";
087    
088        /**
089         * Destination Address valid
090         */
091        public static final String ADDRESS_VALID = "1.5";
092    
093        /**
094         * Destimation mailbox has moved, no forwarding address
095         */
096        public static final String ADDRESS_MOVED = "1.6";
097    
098        /**
099         * Bad sender's mailbox address syntax
100         */
101        public static final String ADDRESS_SYNTAX_SENDER = "1.7";
102    
103        /**
104         * Bad sender's system address
105         */
106        public static final String ADDRESS_SYSTEM_SENDER = "1.8";
107    
108    
109        /**
110         * Mailbox Status
111         */
112        public static final int MAILBOX = 2;
113    
114        /**
115         * Other or Undefined Mailbox Status
116         */
117        public static final String MAILBOX_OTHER = "2.0";
118    
119        /**
120         * Mailbox disabled, not accepting messages
121         */
122        public static final String MAILBOX_DISABLED = "2.1";
123    
124        /**
125         * Mailbox full
126         */
127        public static final String MAILBOX_FULL = "2.2";
128    
129        /**
130         * Message length exceeds administrative limit
131         */
132        public static final String MAILBOX_MSG_TOO_BIG = "2.3";
133    
134        /**
135         * Mailing list expansion problem
136         */
137        public static final String MAILBOX_LIST_EXPANSION = "2.4";
138    
139    
140        /**
141         * Mail System Status
142         */
143        public static final int SYSTEM = 3;
144    
145        /**
146         * Other or undefined mail system status
147         */
148        public static final String SYSTEM_OTHER = "3.0";
149    
150        /**
151         * Mail system full
152         */
153        public static final String SYSTEM_FULL = "3.1";
154    
155        /**
156         * System not accepting messages
157         */
158        public static final String SYSTEM_NOT_ACCEPTING = "3.2";
159    
160        /**
161         * System not capable of selected features
162         */
163        public static final String SYSTEM_NOT_CAPABLE = "3.3";
164    
165        /**
166         * Message too big for system
167         */
168        public static final String SYSTEM_MSG_TOO_BIG = "3.4";
169    
170        /**
171         * System incorrectly configured
172         */
173        public static final String SYSTEM_CFG_ERROR = "3.5";
174    
175    
176        /**
177         * Network and Routing Status
178         */
179        public static final int NETWORK = 4;
180    
181        /**
182         * Other or undefined network or routing status
183         */
184        public static final String NETWORK_OTHER = "4.0";
185    
186        /**
187         * No answer form host
188         */
189        public static final String NETWORK_NO_ANSWER = "4.1";
190    
191        /**
192         * Bad Connection
193         */
194        public static final String NETWORK_CONNECTION = "4.2";
195    
196        /**
197         * Directory server failure
198         */
199        public static final String NETWORK_DIR_SERVER = "4.3";
200    
201        /**
202         * Unable to route
203         */
204        public static final String NETWORK_ROUTE = "4.4";
205    
206        /**
207         * Mail system congestion
208         */
209        public static final String NETWORK_CONGESTION = "4.5";
210    
211        /**
212         * Routing loop detected
213         */
214        public static final String NETWORK_LOOP = "4.6";
215    
216        /**
217         * Delivery time expired
218         */
219        public static final String NETWORK_EXPIRED = "4.7";
220    
221    
222        /**
223         * Mail Delivery Protocol Status
224         */
225        public static final int DELIVERY = 5;
226    
227        /**
228         * Other or undefined (SMTP) protocol status
229         */
230        public static final String DELIVERY_OTHER = "5.0";
231    
232        /**
233         * Invalid command
234         */
235        public static final String DELIVERY_INVALID_CMD = "5.1";
236    
237        /**
238         * Syntax error
239         */
240        public static final String DELIVERY_SYNTAX = "5.2";
241    
242        /**
243         * Too many recipients
244         */
245        public static final String DELIVERY_TOO_MANY_REC = "5.3";
246    
247        /**
248         * Invalid command arguments
249         */
250        public static final String DELIVERY_INVALID_ARG = "5.4";
251    
252        /**
253         * Wrong protocol version
254         */
255        public static final String DELIVERY_VERSION = "5.5";
256    
257    
258        /**
259         * Message Content or Media Status
260         */
261        public static final int CONTENT = 6;
262    
263        /**
264         * Other or undefined media error
265         */
266        public static final String CONTENT_OTHER = "6.0";
267    
268        /**
269         * Media not supported
270         */
271        public static final String CONTENT_UNSUPPORTED = "6.1";
272    
273        /**
274         * Conversion required and prohibited
275         */
276        public static final String CONTENT_CONVERSION_NOT_ALLOWED = "6.2";
277    
278        /**
279         * Conversion required, but not supported
280         */
281        public static final String CONTENT_CONVERSION_NOT_SUPPORTED = "6.3";
282    
283        /**
284         * Conversion with loss performed
285         */
286        public static final String CONTENT_CONVERSION_LOSS = "6.4";
287    
288        /**
289         * Conversion failed
290         */
291        public static final String CONTENT_CONVERSION_FAILED = "6.5";
292    
293    
294        /**
295         * Security or Policy Status
296         */
297        public static final int SECURITY = 7;
298    
299        /**
300         * Other or undefined security status
301         */
302        public static final String SECURITY_OTHER = "7.0";
303    
304        /**
305         * Delivery not authorized, message refused
306         */
307        public static final String SECURITY_AUTH = "7.1";
308    
309        /**
310         * Mailing list expansion prohibited
311         */
312        public static final String SECURITY_LIST_EXP = "7.2";
313    
314        /**
315         * Security conversion required, but not possible
316         */
317        public static final String SECURITY_CONVERSION = "7.3";
318    
319        /**
320         * Security features not supported
321         */
322        public static final String SECURITY_UNSUPPORTED = "7.4";
323    
324        /**
325         * Cryptographic failure
326         */
327        public static final String SECURITY_CRYPT_FAIL = "7.5";
328    
329        /**
330         * Cryptographic algorithm not supported
331         */
332        public static final String SECURITY_CRYPT_ALGO = "7.6";
333    
334        /**
335         * Message integrity failure
336         */
337        public static final String SECURITY_INTEGRITY = "7.7";
338    
339    
340        // get methods
341    
342        public static String getStatus(int type, String detail) {
343            return type + "." + detail;
344        }
345    
346        public static String getStatus(int type, int subject, int detail) {
347            return type + "." + subject + "." + detail;
348        }
349    }