PageRenderTime 42ms CodeModel.GetById 13ms app.highlight 25ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/ErrorCode.java

http://mobicents.googlecode.com/
Java | 500 lines | 392 code | 101 blank | 7 comment | 2 complexity | a36110b5d3c0b048943e17e49e9bed52 MD5 | raw file
  1package javax.megaco;
  2
  3import java.io.Serializable;
  4
  5/**
  6 * This class defines the error codes which can be returned in the response
  7 * events from stack. These error codes would help the application in
  8 * identifying the granularity of the error occured.
  9 * 
 10 * 
 11 */
 12public class ErrorCode implements Serializable {
 13
 14	public static final int M_MISSING_ENC_FORMAT = 1;
 15	public static final int M_TPT_ADDR_ALREADY_INUSE = 2;
 16	public static final int M_PEER_ENTITY_UNVBLE = 3;
 17	public static final int M_INV_LOCAL_TPT_ADDRESS = 4;
 18	public static final int M_INV_REMOTE_TPT_ADDRESS = 5;
 19	public static final int M_INV_LCL_RMT_ADDR_PAIR = 6;
 20	public static final int M_INV_ASSOC_ID = 7;
 21	public static final int M_MISSING_SVC_CHNG_METHOD = 8;
 22	public static final int M_INV_SVC_CHNG_METH_REASON_PAIR = 9;
 23	public static final int M_UNSPTD_ENC_FORMAT = 10;
 24	public static final int M_UNSPTD_TPT_TYPE = 11;
 25	public static final int M_INV_SVC_CHNG_ADDR = 12;
 26	public static final int M_INV_HOFF_MGCID = 13;
 27	public static final int M_UNSPTD_SVC_CHNG_METH_EXTN = 14;
 28	public static final int M_INV_SVC_CHNG_REASON = 15;
 29	public static final int M_INV_SVC_CHNG_METHOD = 16;
 30	public static final int M_RES_UNVBLE = 17;
 31	public static final int M_MODIFY_ENC_FORMAT_FAILURE = 18;
 32	public static final int M_MODIFY_TPT_TYPE_FAILURE = 19;
 33	public static final int M_MODIFY_SVC_PROFILE_FAILURE = 20;
 34	public static final int M_MODIFY_PROTOCOL_VERSION_FAILURE = 21;
 35	public static final int M_INV_ACTION_HANDLE = 22;
 36	public static final int M_WLDCRD_CMD_NOT_SUPTD = 23;
 37	public static final int M_INV_CMD_REQID = 24;
 38	public static final int M_INV_CMD_RESPID = 25;
 39	public static final int M_TERM_TYPE_NOT_INSYNCH = 26;
 40	public static final int M_INV_TERM_NAME_FORMAT = 27;
 41	public static final int M_TOPOLOGY_DESC_NOT_SUPTD = 28;
 42	public static final int M_MEDIA_DESC_NOT_SUPTD = 29;
 43	public static final int M_MODEM_DESC_NOT_SUPTD = 30;
 44	public static final int M_MUX_DESC_NOT_SUPTD = 31;
 45	public static final int M_EVENT_DESC_NOT_SUPTD = 32;
 46	public static final int M_SIGNAL_DESC_NOT_SUPTD = 33;
 47	public static final int M_DIGITMAP_DESC_NOT_SUPTD = 34;
 48	public static final int M_EVENTBUFF_DESC_NOT_SUPTD = 35;
 49	public static final int M_AUDIT_DESC_NOT_SUPTD = 36;
 50	public static final int M_OBSRD_EVENT_DESC_NOT_SUPTD = 37;
 51	public static final int M_STATS_DESC_NOT_SUPTD = 38;
 52	public static final int M_PCKG_DESC_NOT_SUPTD = 39;
 53	public static final int M_SDPINFO_NOT_SUPTD = 40;
 54	public static final int M_INV_PKG_ITEM_TYPE = 41;
 55	public static final int M_INV_CTXID_TERMTYPE_PAIR = 42;
 56	public static final int M_MISSING_LCL_TPT_ADDR = 43;
 57	public static final int M_MISSING_REMOTE_TPT_ADDR = 44;
 58	public static final int M_MISSING_SVC_CHNG_REASON = 45;
 59
 60	public static final ErrorCode PEER_ENTITY_UNVBLE = new ErrorCode(M_PEER_ENTITY_UNVBLE);
 61	public static final ErrorCode INV_LOCAL_TPT_ADDRESS = new ErrorCode(M_INV_LOCAL_TPT_ADDRESS);
 62	public static final ErrorCode INV_REMOTE_TPT_ADDRESS = new ErrorCode(M_INV_REMOTE_TPT_ADDRESS);
 63	public static final ErrorCode INV_LCL_RMT_ADDR_PAIR = new ErrorCode(M_INV_LCL_RMT_ADDR_PAIR);
 64	public static final ErrorCode INV_ASSOC_ID = new ErrorCode(M_INV_ASSOC_ID);
 65	public static final ErrorCode INV_SVC_CHNG_METH_REASON_PAIR = new ErrorCode(M_INV_SVC_CHNG_METH_REASON_PAIR);
 66	public static final ErrorCode UNSPTD_ENC_FORMAT = new ErrorCode(M_UNSPTD_ENC_FORMAT);
 67	public static final ErrorCode UNSPTD_TPT_TYPE = new ErrorCode(M_UNSPTD_TPT_TYPE);
 68	public static final ErrorCode INV_SVC_CHNG_ADDR = new ErrorCode(M_INV_SVC_CHNG_ADDR);
 69	public static final ErrorCode INV_HOFF_MGCID = new ErrorCode(M_INV_HOFF_MGCID);
 70	public static final ErrorCode UNSPTD_SVC_CHNG_METH_EXTN = new ErrorCode(M_UNSPTD_SVC_CHNG_METH_EXTN);
 71	public static final ErrorCode INV_SVC_CHNG_REASON = new ErrorCode(M_INV_SVC_CHNG_REASON);
 72	public static final ErrorCode INV_SVC_CHNG_METHOD = new ErrorCode(M_INV_SVC_CHNG_METHOD);
 73	public static final ErrorCode RES_UNVBLE = new ErrorCode(M_RES_UNVBLE);
 74	public static final ErrorCode MODIFY_ENC_FORMAT_FAILURE = new ErrorCode(M_MODIFY_ENC_FORMAT_FAILURE);
 75	public static final ErrorCode MODIFY_TPT_TYPE_FAILURE = new ErrorCode(M_MODIFY_TPT_TYPE_FAILURE);
 76	public static final ErrorCode MODIFY_SVC_PROFILE_FAILURE = new ErrorCode(M_MODIFY_SVC_PROFILE_FAILURE);
 77	public static final ErrorCode MODIFY_PROTOCOL_VERSION_FAILURE = new ErrorCode(M_MODIFY_PROTOCOL_VERSION_FAILURE);
 78	public static final ErrorCode INV_ACTION_HANDLE = new ErrorCode(M_INV_ACTION_HANDLE);
 79	public static final ErrorCode WLDCRD_CMD_NOT_SUPTD = new ErrorCode(M_WLDCRD_CMD_NOT_SUPTD);
 80	public static final ErrorCode INV_CMD_REQID = new ErrorCode(M_INV_CMD_REQID);
 81	public static final ErrorCode INV_CMD_RESPID = new ErrorCode(M_INV_CMD_RESPID);
 82	public static final ErrorCode TERM_TYPE_NOT_INSYNCH = new ErrorCode(M_TERM_TYPE_NOT_INSYNCH);
 83	public static final ErrorCode INV_TERM_NAME_FORMAT = new ErrorCode(M_INV_TERM_NAME_FORMAT);
 84	public static final ErrorCode TOPOLOGY_DESC_NOT_SUPTD = new ErrorCode(M_TOPOLOGY_DESC_NOT_SUPTD);
 85	public static final ErrorCode MEDIA_DESC_NOT_SUPTD = new ErrorCode(M_MEDIA_DESC_NOT_SUPTD);
 86	public static final ErrorCode MODEM_DESC_NOT_SUPTD = new ErrorCode(M_MODEM_DESC_NOT_SUPTD);
 87	public static final ErrorCode MUX_DESC_NOT_SUPTD = new ErrorCode(M_MUX_DESC_NOT_SUPTD);
 88	public static final ErrorCode EVENT_DESC_NOT_SUPTD = new ErrorCode(M_EVENT_DESC_NOT_SUPTD);
 89	public static final ErrorCode SIGNAL_DESC_NOT_SUPTD = new ErrorCode(M_SIGNAL_DESC_NOT_SUPTD);
 90	public static final ErrorCode DIGITMAP_DESC_NOT_SUPTD = new ErrorCode(M_DIGITMAP_DESC_NOT_SUPTD);
 91	public static final ErrorCode EVENTBUFF_DESC_NOT_SUPTD = new ErrorCode(M_EVENTBUFF_DESC_NOT_SUPTD);
 92	public static final ErrorCode AUDIT_DESC_NOT_SUPTD = new ErrorCode(M_AUDIT_DESC_NOT_SUPTD);
 93	public static final ErrorCode OBSRD_EVENT_DESC_NOT_SUPTD = new ErrorCode(M_OBSRD_EVENT_DESC_NOT_SUPTD);
 94	public static final ErrorCode STATS_DESC_NOT_SUPTD = new ErrorCode(M_STATS_DESC_NOT_SUPTD);
 95	public static final ErrorCode PCKG_DESC_NOT_SUPTD = new ErrorCode(M_PCKG_DESC_NOT_SUPTD);
 96	public static final ErrorCode SDPINFO_NOT_SUPTD = new ErrorCode(M_SDPINFO_NOT_SUPTD);
 97	public static final ErrorCode INV_PKG_ITEM_TYPE = new ErrorCode(M_INV_PKG_ITEM_TYPE);
 98	public static final ErrorCode INV_CTXID_TERMTYPE_PAIR = new ErrorCode(M_INV_CTXID_TERMTYPE_PAIR);
 99	public static final ErrorCode MISSING_LCL_TPT_ADDR = new ErrorCode(M_MISSING_LCL_TPT_ADDR);
100	public static final ErrorCode MISSING_REMOTE_TPT_ADDR = new ErrorCode(M_MISSING_REMOTE_TPT_ADDR);
101	public static final ErrorCode MISSING_SVC_CHNG_REASON = new ErrorCode(M_MISSING_SVC_CHNG_REASON);
102	public static final ErrorCode MISSING_SVC_CHNG_METHOD = new ErrorCode(M_MISSING_SVC_CHNG_METHOD);
103	public static final ErrorCode MISSING_ENC_FORMAT = new ErrorCode(M_MISSING_ENC_FORMAT);
104	public static final ErrorCode TPT_ADDR_ALREADY_INUSE = new ErrorCode(M_TPT_ADDR_ALREADY_INUSE);
105
106	private int error_code;
107
108	private ErrorCode(int error_code) {
109		this.error_code = error_code;
110	}
111
112	public int getErrorCode() {
113		return this.error_code;
114	}
115
116	public static final ErrorCode getObject(int value) throws IllegalArgumentException {
117		ErrorCode e = null;
118		switch (value) {
119		case M_MISSING_ENC_FORMAT:
120			e = MISSING_ENC_FORMAT;
121			break;
122
123		case M_TPT_ADDR_ALREADY_INUSE:
124			e = TPT_ADDR_ALREADY_INUSE;
125			break;
126
127		case M_PEER_ENTITY_UNVBLE:
128			e = PEER_ENTITY_UNVBLE;
129			break;
130
131		case M_INV_LOCAL_TPT_ADDRESS:
132			e = INV_LOCAL_TPT_ADDRESS;
133			break;
134
135		case M_INV_REMOTE_TPT_ADDRESS:
136			e = INV_REMOTE_TPT_ADDRESS;
137			break;
138
139		case M_INV_LCL_RMT_ADDR_PAIR:
140			e = INV_LCL_RMT_ADDR_PAIR;
141			break;
142
143		case M_INV_ASSOC_ID:
144			e = INV_ASSOC_ID;
145			break;
146
147		case M_MISSING_SVC_CHNG_METHOD:
148			e = MISSING_SVC_CHNG_METHOD;
149			break;
150
151		case M_INV_SVC_CHNG_METH_REASON_PAIR:
152			e = INV_SVC_CHNG_METH_REASON_PAIR;
153			break;
154
155		case M_UNSPTD_ENC_FORMAT:
156			e = UNSPTD_ENC_FORMAT;
157			break;
158
159		case M_UNSPTD_TPT_TYPE:
160			e = UNSPTD_TPT_TYPE;
161			break;
162
163		case M_INV_SVC_CHNG_ADDR:
164			e = INV_SVC_CHNG_ADDR;
165			break;
166
167		case M_INV_HOFF_MGCID:
168			e = INV_HOFF_MGCID;
169			break;
170
171		case M_UNSPTD_SVC_CHNG_METH_EXTN:
172			e = UNSPTD_SVC_CHNG_METH_EXTN;
173			break;
174
175		case M_INV_SVC_CHNG_REASON:
176			e = INV_SVC_CHNG_REASON;
177			break;
178
179		case M_INV_SVC_CHNG_METHOD:
180			e = INV_SVC_CHNG_METHOD;
181			break;
182
183		case M_RES_UNVBLE:
184			e = RES_UNVBLE;
185			break;
186
187		case M_MODIFY_ENC_FORMAT_FAILURE:
188			e = MODIFY_ENC_FORMAT_FAILURE;
189			break;
190
191		case M_MODIFY_TPT_TYPE_FAILURE:
192			e = MODIFY_TPT_TYPE_FAILURE;
193			break;
194
195		case M_MODIFY_SVC_PROFILE_FAILURE:
196			e = MODIFY_SVC_PROFILE_FAILURE;
197			break;
198
199		case M_MODIFY_PROTOCOL_VERSION_FAILURE:
200			e = MODIFY_PROTOCOL_VERSION_FAILURE;
201			break;
202
203		case M_INV_ACTION_HANDLE:
204			e = INV_ACTION_HANDLE;
205			break;
206
207		case M_WLDCRD_CMD_NOT_SUPTD:
208			e = WLDCRD_CMD_NOT_SUPTD;
209			break;
210
211		case M_INV_CMD_REQID:
212			e = INV_CMD_REQID;
213			break;
214
215		case M_INV_CMD_RESPID:
216			e = INV_CMD_RESPID;
217			break;
218
219		case M_TERM_TYPE_NOT_INSYNCH:
220			e = TERM_TYPE_NOT_INSYNCH;
221			break;
222
223		case M_INV_TERM_NAME_FORMAT:
224			e = INV_TERM_NAME_FORMAT;
225			break;
226
227		case M_TOPOLOGY_DESC_NOT_SUPTD:
228			e = TOPOLOGY_DESC_NOT_SUPTD;
229			break;
230
231		case M_MEDIA_DESC_NOT_SUPTD:
232			e = MEDIA_DESC_NOT_SUPTD;
233			break;
234
235		case M_MODEM_DESC_NOT_SUPTD:
236			e = MODEM_DESC_NOT_SUPTD;
237			break;
238
239		case M_MUX_DESC_NOT_SUPTD:
240			e = MUX_DESC_NOT_SUPTD;
241			break;
242
243		case M_EVENT_DESC_NOT_SUPTD:
244			e = EVENT_DESC_NOT_SUPTD;
245			break;
246
247		case M_SIGNAL_DESC_NOT_SUPTD:
248			e = SIGNAL_DESC_NOT_SUPTD;
249			break;
250
251		case M_DIGITMAP_DESC_NOT_SUPTD:
252			e = DIGITMAP_DESC_NOT_SUPTD;
253			break;
254
255		case M_EVENTBUFF_DESC_NOT_SUPTD:
256			e = EVENTBUFF_DESC_NOT_SUPTD;
257			break;
258
259		case M_AUDIT_DESC_NOT_SUPTD:
260			e = AUDIT_DESC_NOT_SUPTD;
261			break;
262
263		case M_OBSRD_EVENT_DESC_NOT_SUPTD:
264			e = OBSRD_EVENT_DESC_NOT_SUPTD;
265			break;
266
267		case M_STATS_DESC_NOT_SUPTD:
268			e = STATS_DESC_NOT_SUPTD;
269			break;
270
271		case M_PCKG_DESC_NOT_SUPTD:
272			e = PCKG_DESC_NOT_SUPTD;
273			break;
274
275		case M_SDPINFO_NOT_SUPTD:
276			e = SDPINFO_NOT_SUPTD;
277			break;
278
279		case M_INV_PKG_ITEM_TYPE:
280			e = INV_PKG_ITEM_TYPE;
281			break;
282
283		case M_INV_CTXID_TERMTYPE_PAIR:
284			e = INV_CTXID_TERMTYPE_PAIR;
285			break;
286
287		case M_MISSING_LCL_TPT_ADDR:
288			e = MISSING_LCL_TPT_ADDR;
289			break;
290
291		case M_MISSING_REMOTE_TPT_ADDR:
292			e = MISSING_REMOTE_TPT_ADDR;
293			break;
294
295		case M_MISSING_SVC_CHNG_REASON:
296			e = MISSING_SVC_CHNG_REASON;
297			break;
298		default:
299			IllegalArgumentException illegalArgumentException = new IllegalArgumentException("No ErrorCode for passed value = " + value);
300			throw illegalArgumentException;
301		}
302		return e;
303	}
304
305	private Object readResolve() {
306
307		return this.getObject(this.error_code);
308
309	}
310
311	@Override
312	public String toString() {
313		String e = null;
314		switch (this.error_code) {
315		case M_MISSING_ENC_FORMAT:
316			e = "ErrorCode[MISSING_ENC_FORMAT]";
317			break;
318
319		case M_TPT_ADDR_ALREADY_INUSE:
320			e = "ErrorCode[TPT_ADDR_ALREADY_INUSE]";
321			break;
322
323		case M_PEER_ENTITY_UNVBLE:
324			e = "ErrorCode[PEER_ENTITY_UNVBLE]";
325			break;
326
327		case M_INV_LOCAL_TPT_ADDRESS:
328			e = "ErrorCode[INV_LOCAL_TPT_ADDRESS]";
329			break;
330
331		case M_INV_REMOTE_TPT_ADDRESS:
332			e = "ErrorCode[INV_REMOTE_TPT_ADDRESS]";
333			break;
334
335		case M_INV_LCL_RMT_ADDR_PAIR:
336			e = "ErrorCode[INV_LCL_RMT_ADDR_PAIR]";
337			break;
338
339		case M_INV_ASSOC_ID:
340			e = "ErrorCode[INV_ASSOC_ID]";
341			break;
342
343		case M_MISSING_SVC_CHNG_METHOD:
344			e = "ErrorCode[MISSING_SVC_CHNG_METHOD]";
345			break;
346
347		case M_INV_SVC_CHNG_METH_REASON_PAIR:
348			e = "ErrorCode[INV_SVC_CHNG_METH_REASON_PAIR]";
349			break;
350
351		case M_UNSPTD_ENC_FORMAT:
352			e = "ErrorCode[UNSPTD_ENC_FORMAT]";
353			break;
354
355		case M_UNSPTD_TPT_TYPE:
356			e = "ErrorCode[UNSPTD_TPT_TYPE]";
357			break;
358
359		case M_INV_SVC_CHNG_ADDR:
360			e = "ErrorCode[INV_SVC_CHNG_ADDR]";
361			break;
362
363		case M_INV_HOFF_MGCID:
364			e = "ErrorCode[INV_HOFF_MGCID]";
365			break;
366
367		case M_UNSPTD_SVC_CHNG_METH_EXTN:
368			e = "ErrorCode[UNSPTD_SVC_CHNG_METH_EXTN]";
369			break;
370
371		case M_INV_SVC_CHNG_REASON:
372			e = "ErrorCode[INV_SVC_CHNG_REASON]";
373			break;
374
375		case M_INV_SVC_CHNG_METHOD:
376			e = "ErrorCode[INV_SVC_CHNG_METHOD]";
377			break;
378
379		case M_RES_UNVBLE:
380			e = "ErrorCode[RES_UNVBLE]";
381			break;
382
383		case M_MODIFY_ENC_FORMAT_FAILURE:
384			e = "ErrorCode[MODIFY_ENC_FORMAT_FAILURE]";
385			break;
386
387		case M_MODIFY_TPT_TYPE_FAILURE:
388			e = "ErrorCode[MODIFY_TPT_TYPE_FAILURE]";
389			break;
390
391		case M_MODIFY_SVC_PROFILE_FAILURE:
392			e = "ErrorCode[MODIFY_SVC_PROFILE_FAILURE]";
393			break;
394
395		case M_MODIFY_PROTOCOL_VERSION_FAILURE:
396			e = "ErrorCode[MODIFY_PROTOCOL_VERSION_FAILURE]";
397			break;
398
399		case M_INV_ACTION_HANDLE:
400			e = "ErrorCode[INV_ACTION_HANDLE]";
401			break;
402
403		case M_WLDCRD_CMD_NOT_SUPTD:
404			e = "ErrorCode[WLDCRD_CMD_NOT_SUPTD]";
405			break;
406
407		case M_INV_CMD_REQID:
408			e = "ErrorCode[INV_CMD_REQID]";
409			break;
410
411		case M_INV_CMD_RESPID:
412			e = "ErrorCode[INV_CMD_RESPID]";
413			break;
414
415		case M_TERM_TYPE_NOT_INSYNCH:
416			e = "ErrorCode[TERM_TYPE_NOT_INSYNCH]";
417			break;
418
419		case M_INV_TERM_NAME_FORMAT:
420			e = "ErrorCode[INV_TERM_NAME_FORMAT]";
421			break;
422
423		case M_TOPOLOGY_DESC_NOT_SUPTD:
424			e = "ErrorCode[TOPOLOGY_DESC_NOT_SUPTD]";
425			break;
426
427		case M_MEDIA_DESC_NOT_SUPTD:
428			e = "ErrorCode[MEDIA_DESC_NOT_SUPTD]";
429			break;
430
431		case M_MODEM_DESC_NOT_SUPTD:
432			e = "ErrorCode[MODEM_DESC_NOT_SUPTD]";
433			break;
434
435		case M_MUX_DESC_NOT_SUPTD:
436			e = "ErrorCode[MUX_DESC_NOT_SUPTD]";
437			break;
438
439		case M_EVENT_DESC_NOT_SUPTD:
440			e = "ErrorCode[EVENT_DESC_NOT_SUPTD]";
441			break;
442
443		case M_SIGNAL_DESC_NOT_SUPTD:
444			e = "ErrorCode[SIGNAL_DESC_NOT_SUPTD]";
445			break;
446
447		case M_DIGITMAP_DESC_NOT_SUPTD:
448			e = "ErrorCode[DIGITMAP_DESC_NOT_SUPTD]";
449			break;
450
451		case M_EVENTBUFF_DESC_NOT_SUPTD:
452			e = "ErrorCode[EVENTBUFF_DESC_NOT_SUPTD]";
453			break;
454
455		case M_AUDIT_DESC_NOT_SUPTD:
456			e = "ErrorCode[AUDIT_DESC_NOT_SUPTD]";
457			break;
458
459		case M_OBSRD_EVENT_DESC_NOT_SUPTD:
460			e = "ErrorCode[OBSRD_EVENT_DESC_NOT_SUPTD]";
461			break;
462
463		case M_STATS_DESC_NOT_SUPTD:
464			e = "ErrorCode[STATS_DESC_NOT_SUPTD]";
465			break;
466
467		case M_PCKG_DESC_NOT_SUPTD:
468			e = "ErrorCode[PCKG_DESC_NOT_SUPTD]";
469			break;
470
471		case M_SDPINFO_NOT_SUPTD:
472			e = "ErrorCode[SDPINFO_NOT_SUPTD]";
473			break;
474
475		case M_INV_PKG_ITEM_TYPE:
476			e = "ErrorCode[INV_PKG_ITEM_TYPE]";
477			break;
478
479		case M_INV_CTXID_TERMTYPE_PAIR:
480			e = "ErrorCode[INV_CTXID_TERMTYPE_PAIR]";
481			break;
482
483		case M_MISSING_LCL_TPT_ADDR:
484			e = "ErrorCode[MISSING_LCL_TPT_ADDR]";
485			break;
486
487		case M_MISSING_REMOTE_TPT_ADDR:
488			e = "ErrorCode[MISSING_REMOTE_TPT_ADDR]";
489			break;
490
491		case M_MISSING_SVC_CHNG_REASON:
492			e = "ErrorCode[MISSING_SVC_CHNG_REASON]";
493			break;
494		default:
495			e = "ErrorCode[" + this.error_code + "]";
496		}
497		return e;
498	}
499
500}