/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

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