PageRenderTime 85ms CodeModel.GetById 74ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/association/SrvChngReason.java

http://mobicents.googlecode.com/
Java | 321 lines | 123 code | 30 blank | 168 comment | 2 complexity | 32b58ee7f8d5642a9f22306134be6dce MD5 | raw file
  1package javax.megaco.association;
  2
  3import java.io.Serializable;
  4
  5/**
  6 * 
  7 Service change reason constants used in package javax.megaco.association.
  8 * This forms the class for the Service change reason parameters of the Jain
  9 * Megaco package.
 10 */
 11public class SrvChngReason implements Serializable {
 12
 13	/**
 14	 * Identifies the service change reason towards the peer shall be 900 -
 15	 * Service restored.
 16	 */
 17	public final static int M_R900 = 900;
 18	/**
 19	 * Identifies the service change reason towards the peer shall be 901 - Cold
 20	 * Boot.
 21	 */
 22	public final static int M_R901 = 901;
 23	/**
 24	 * Identifies the service change reason towards the peer shall be 902 - Warm
 25	 * Boot.
 26	 */
 27	public final static int M_R902 = 902;
 28	/**
 29	 * Identifies the service change reason towards the peer shall be 903 - MGC
 30	 * Directed Change.
 31	 */
 32	public final static int M_R903 = 903;
 33	/**
 34	 * Identifies the service change reason towards the peer shall be 904 -
 35	 * Termination Malfunctioning.
 36	 */
 37	public final static int M_R904 = 904;
 38	/**
 39	 * Identifies the service change reason towards the peer shall be 905 -
 40	 * Termination Taken Out Of Service.
 41	 */
 42	public final static int M_R905 = 905;
 43	/**
 44	 * Identifies the service change reason towards the peer shall be 906 - Loss
 45	 * Of Lower Layer Connectivity.
 46	 */
 47	public final static int M_R906 = 906;
 48	/**
 49	 * Identifies the service change reason towards the peer shall be 907 -
 50	 * Transmission Failure.
 51	 */
 52	public final static int M_R907 = 907;
 53	/**
 54	 * Identifies the service change reason towards the peer shall be 908 - MG
 55	 * Impending Failure.
 56	 */
 57	public final static int M_R908 = 908;
 58	/**
 59	 * Identifies the service change reason towards the peer shall be 909 - MGC
 60	 * Impending Failure.
 61	 */
 62	public final static int M_R909 = 909;
 63	/**
 64	 * Identifies the service change reason towards the peer shall be 910 -
 65	 * Media Capability Failure.
 66	 */
 67	public final static int M_R910 = 910;
 68	/**
 69	 * Identifies the service change reason towards the peer shall be 911 -
 70	 * Modem Capability Failure.
 71	 */
 72	public final static int M_R911 = 911;
 73	/**
 74	 * Identifies the service change reason towards the peer shall be 912 - Mux
 75	 * Capability Failure.
 76	 */
 77	public final static int M_R912 = 912;
 78	/**
 79	 * Identifies the service change reason towards the peer shall be 913 -
 80	 * Signal Capability Failure.
 81	 */
 82	public final static int M_R913 = 913;
 83	/**
 84	 * Identifies the service change reason towards the peer shall be 914 -
 85	 * Event Capability Failure.
 86	 */
 87	public final static int M_R914 = 914;
 88	/**
 89	 * Identifies the service change reason towards the peer shall be 915 -
 90	 * State Loss.
 91	 */
 92	public final static int M_R915 = 915;
 93
 94	/**
 95	 * Identifies a SrvChngReason object that constructs the class with the
 96	 * constant M_R900.
 97	 */
 98	public static final SrvChngReason R900 = new SrvChngReason(M_R900);
 99	/**
100	 * Identifies a SrvChngReason object that constructs the class with the
101	 * constant M_R901.
102	 */
103	public static final SrvChngReason R901 = new SrvChngReason(M_R901);
104	/**
105	 * Identifies a SrvChngReason object that constructs the class with the
106	 * constant M_R902.
107	 */
108	public static final SrvChngReason R902 = new SrvChngReason(M_R902);
109	/**
110	 * Identifies a SrvChngReason object that constructs the class with the
111	 * constant M_R903.
112	 */
113	public static final SrvChngReason R903 = new SrvChngReason(M_R903);
114	/**
115	 * Identifies a SrvChngReason object that constructs the class with the
116	 * constant M_R904.
117	 */
118	public static final SrvChngReason R904 = new SrvChngReason(M_R904);
119	/**
120	 * Identifies a SrvChngReason object that constructs the class with the
121	 * constant M_R905.
122	 */
123	public static final SrvChngReason R905 = new SrvChngReason(M_R905);
124	/**
125	 * Identifies a SrvChngReason object that constructs the class with the
126	 * constant M_R906.
127	 */
128	public static final SrvChngReason R906 = new SrvChngReason(M_R906);
129	/**
130	 * Identifies a SrvChngReason object that constructs the class with the
131	 * constant M_R907.
132	 */
133	public static final SrvChngReason R907 = new SrvChngReason(M_R907);
134	/**
135	 * Identifies a SrvChngReason object that constructs the class with the
136	 * constant M_R908.
137	 */
138	public static final SrvChngReason R908 = new SrvChngReason(M_R908);
139	/**
140	 * Identifies a SrvChngReason object that constructs the class with the
141	 * constant M_R909.
142	 */
143	public static final SrvChngReason R909 = new SrvChngReason(M_R909);
144	/**
145	 * Identifies a SrvChngReason object that constructs the class with the
146	 * constant M_R910.
147	 */
148	public static final SrvChngReason R910 = new SrvChngReason(M_R910);
149	/**
150	 * Identifies a SrvChngReason object that constructs the class with the
151	 * constant M_R911.
152	 */
153	public static final SrvChngReason R911 = new SrvChngReason(M_R911);
154	/**
155	 * Identifies a SrvChngReason object that constructs the class with the
156	 * constant M_R912.
157	 */
158	public static final SrvChngReason R912 = new SrvChngReason(M_R912);
159	/**
160	 * Identifies a SrvChngReason object that constructs the class with the
161	 * constant M_R913.
162	 */
163	public static final SrvChngReason R913 = new SrvChngReason(M_R913);
164	/**
165	 * Identifies a SrvChngReason object that constructs the class with the
166	 * constant M_R914.
167	 */
168	public static final SrvChngReason R914 = new SrvChngReason(M_R914);
169	/**
170	 * Identifies a SrvChngReason object that constructs the class with the
171	 * constant M_R915.
172	 */
173	public static final SrvChngReason R915 = new SrvChngReason(M_R915);
174
175	private int srvChngReasonId = -1;
176
177	/**
178	 * Constructs a class that initialised with value service_change_reason as
179	 * passed to it. The getSrvChngReasonId method of this class object would
180	 * always return value service_shange_reason.
181	 * 
182	 * @param reason
183	 */
184	private SrvChngReason(int service_change_reason) {
185		this.srvChngReasonId = service_change_reason;
186	}
187
188	/**
189	 * Returns reference of the SrvChngReason object that identifies the service
190	 * change reason as value passed to this method.
191	 * 
192	 * @param value
193	 *            - It is one of the possible values of the static constant that
194	 *            this class provides.
195	 * @return Returns reference of the SrvChngReason object.
196	 * @throws IllegalArgumentException
197	 *             - If the value passed to this method is invalid, then this
198	 *             exception is raised.
199	 */
200	public static final SrvChngReason getObject(int value) throws IllegalArgumentException {
201		switch (value) {
202		case M_R900:
203			return R900;
204
205		case M_R901:
206			return R901;
207
208		case M_R902:
209			return R902;
210
211		case M_R903:
212			return R903;
213		case M_R904:
214			return R904;
215		case M_R905:
216			return R905;
217		case M_R906:
218			return R906;
219		case M_R907:
220			return R907;
221		case M_R908:
222			return R908;
223		case M_R909:
224			return R909;
225		case M_R910:
226			return R910;
227		case M_R911:
228			return R911;
229		case M_R912:
230			return R912;
231		case M_R913:
232			return R913;
233		case M_R914:
234			return R914;
235		case M_R915:
236			return R915;
237		default:
238			throw new IllegalArgumentException("Wrogn value passed, there is no change reason with code: " + value);
239		}
240	}
241
242	/**
243	 * This method must be implemented to perform instance substitution during
244	 * serialization. This method is required for reference comparison. This
245	 * method if not implimented will simply fail each time we compare an
246	 * Enumeration value against a de-serialized Enumeration instance.
247	 * 
248	 * @return
249	 */
250	private Object readResolve() {
251		return this.getObject(this.srvChngReasonId);
252	}
253
254	/**
255	 * This method returns one of the static field constants defined in this
256	 * class.
257	 * 
258	 * @return Returns an integer value that identifies the service change
259	 *         reason.
260	 */
261	public int getSrvChngReasonId() {
262		return this.srvChngReasonId;
263	}
264
265	@Override
266	public String toString() {
267		switch (this.srvChngReasonId) {
268		case M_R900:
269			return "SrvChngReason[R900]";
270
271		case M_R901:
272			return "SrvChngReason[R901]";
273
274		case M_R902:
275			return "SrvChngReason[R902]";
276
277		case M_R903:
278			return "SrvChngReason[R903]";
279
280		case M_R904:
281			return "SrvChngReason[R904]";
282
283		case M_R905:
284			return "SrvChngReason[R905]";
285
286		case M_R906:
287			return "SrvChngReason[R906]";
288
289		case M_R907:
290			return "SrvChngReason[R907]";
291
292		case M_R908:
293			return "SrvChngReason[R908]";
294
295		case M_R909:
296			return "SrvChngReason[R909]";
297
298		case M_R910:
299			return "SrvChngReason[R910]";
300
301		case M_R911:
302			return "SrvChngReason[R911]";
303
304		case M_R912:
305			return "SrvChngReason[R912]";
306
307		case M_R913:
308			return "SrvChngReason[R913]";
309
310		case M_R914:
311			return "SrvChngReason[R914]";
312
313		case M_R915:
314			return "SrvChngReason[R915]";
315
316		default:
317			return "SrvChngReason[" + this.srvChngReasonId + "]";
318		}
319	}
320
321}