PageRenderTime 36ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/message/descriptor/EmbedFirstEventParam.java

http://mobicents.googlecode.com/
Java | 205 lines | 51 code | 21 blank | 133 comment | 8 complexity | f23d41a26d283e7554e1ed96d746246d MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. package javax.megaco.message.descriptor;
  2. import javax.megaco.pkg.PkgEventItem;
  3. import javax.megaco.pkg.PkgItemStr;
  4. /**
  5. * The class constructs the embedded event descriptor within an event
  6. * descriptor.
  7. */
  8. public class EmbedFirstEventParam {
  9. private int requestId = -1;
  10. private PkgEventItem eventItem = null;
  11. private PkgItemStr itemStr = null;
  12. private EventParam eventParam = null;
  13. private PkgEventItem pkgEventItem = null;
  14. /**
  15. *
  16. * Constructs a Embedded Event Descriptor with specific request identifier.
  17. *
  18. * @param requestId
  19. * - An integer value specifying the request identifier, which
  20. * uniquely identifies the event.
  21. * @throws IllegalArgumentException
  22. * - Thrown if request id is set to an invalid value.
  23. */
  24. public EmbedFirstEventParam(int requestId) throws IllegalArgumentException {
  25. // FIXME: what is invalid value?
  26. this.requestId = requestId;
  27. }
  28. /**
  29. *
  30. * Constructs a Embedded Event Descriptor with specific request identifier
  31. * and the PkgEventItem object. The PkgEventItem object contains the package
  32. * parameters for the event to be detected.
  33. *
  34. * @param requestId
  35. * - An integer value specifying the request identifier, which
  36. * uniquely identifies the event.
  37. * @param eventItem
  38. * - An PkgEventItem object which identifies the event to be
  39. * detected and corresponding package parameters.
  40. * @throws IllegalArgumentException
  41. * - Thrown if request id is set to an invalid value or the
  42. * reference of Package Event Item object is set to NULL.
  43. */
  44. public EmbedFirstEventParam(int requestId, PkgEventItem eventItem) throws IllegalArgumentException {
  45. this(requestId);
  46. if (eventItem == null) {
  47. throw new IllegalArgumentException("PkgEventItem must nto be null");
  48. }
  49. this.eventItem = eventItem;
  50. }
  51. /**
  52. * Constructs a Event Descriptor with specific request identifier and the
  53. * PkgItemStr object. The PkgItemStr object contains the package parameters
  54. * for the event to be detected in the string format. This constructor will
  55. * be used for the MEGACO packages which are not part of the
  56. * javax.megaco.pkg package.
  57. *
  58. * @param requestId
  59. * - An integer value specifying the request identifier, which
  60. * uniquely identifies the event.
  61. * @param eventItem
  62. * - An PkgItemStr object which identifies the event to be
  63. * detected and corresponding package parameters in the string
  64. * format.
  65. * @throws IllegalArgumentException
  66. * - Thrown if request id is set to an invalid value or the
  67. * reference of Package Item String object is set to NULL.
  68. */
  69. public EmbedFirstEventParam(int requestId, PkgItemStr eventItemStr) throws IllegalArgumentException {
  70. this(requestId);
  71. if (eventItemStr == null) {
  72. throw new IllegalArgumentException("PkgItemStr must nto be null");
  73. }
  74. this.itemStr = eventItemStr;
  75. }
  76. /**
  77. * This method returns an integer value corresponding to the unique
  78. * requested event.
  79. *
  80. * @return Returns an integer value that identifies request identifier which
  81. * uniquely identifies the event descriptor.
  82. */
  83. public int getRequestIdentifier() {
  84. return this.requestId;
  85. }
  86. /**
  87. * The method can be used the to retrieve the parameters corresponding to
  88. * whether the keep alive token is set, the digit map name or digit map
  89. * value is set or the embeded signal is set or stream id is set.
  90. *
  91. * @return EventParam - object identifier corresponding to the event
  92. * parameters corresponding to the non embedded event id. This
  93. * object interface may optionally be there. If the event parameter
  94. * is not set then this returns a null value.
  95. */
  96. public EventParam getEventParam() {
  97. return this.eventParam;
  98. }
  99. /**
  100. * The method can be used the to set the object reference to the event
  101. * parameter which has reference to whether keepactive token is present,
  102. * signal descriptor, digit map descriptor stream id. In case of an error,
  103. * an exception is raised.
  104. *
  105. * @param EventParam
  106. * The objectIdentifier corresponding to the event paramater of
  107. * first level event.
  108. * @throws IllegalArgumentException
  109. * Thrown if an illegal event is set in the embedded event
  110. * descriptor.
  111. */
  112. public void setEventParam(EventParam eventParam) throws IllegalArgumentException {
  113. // FIXME: add checks
  114. // if(eventItem == null)
  115. // throw new IllegalArgumentException("EventParam must not be null.");
  116. this.eventParam = eventParam;
  117. }
  118. /**
  119. * The method can be used to get the package name in the Embedded Event
  120. * descriptor. This method gives the package information, the attached event
  121. * information and the parameter name and value for the event id.
  122. *
  123. * @return The object reference for the Event Item. This has the object
  124. * reference of corresponding megaco package and has the reference
  125. * of the parameter info associated with it. If the parameter has
  126. * not been set, then this method shall return NULL.
  127. */
  128. public PkgEventItem getMegacoPkgEventItem() {
  129. return this.pkgEventItem;
  130. }
  131. /**
  132. * The method can be used to get the pkdgName as set in the Embedded Event
  133. * descriptor. This method gives the package information, the attached event
  134. * information and the parameter name and value. Compared to the
  135. * getMegacoPkgEventItem( ) method, this method returnes the package
  136. * parameters in the string format.
  137. *
  138. * @return The object reference for the megaco package item. This class
  139. * holds information about package name, item name and the
  140. * parameters in the string format. If the parameter has not been
  141. * set, then this method shall return NULL.
  142. */
  143. public PkgItemStr getMegacoPkgItemStr() {
  144. return this.itemStr;
  145. }
  146. /**
  147. * The method can be used to set the package name in the Embedded Event
  148. * descriptor. The Package Event Item object contains package information,
  149. * the attached event information and the parameter name and value for the
  150. * event id.
  151. *
  152. * @param eventItem
  153. * - The object reference for the Event Item. This has the object
  154. * reference of corresponding megaco package and has the
  155. * reference of the parameter info associated with it.
  156. * @throws IllegalArgumentException
  157. * : This exception is raised if the reference of Package Event
  158. * Item passed to this method is NULL.
  159. */
  160. public void setMegacoPkgEventItem(PkgEventItem eventItem) throws IllegalArgumentException {
  161. if (eventItem == null)
  162. throw new IllegalArgumentException("PkgEventItem must not be null.");
  163. }
  164. /**
  165. * The method can be used to set the pkdgName as set in the Embedded Event
  166. * descriptor. The Package Item String contains package information, the
  167. * attached event information and the parameter name and value. Compared to
  168. * the setMegacoPkgEventItem( ) method, this method takes the package
  169. * parameters in the string format.
  170. *
  171. * @param eventItemStr
  172. * - The object reference for the megaco package item. This class
  173. * holds information about package name, item name and the
  174. * parameters in the string format.
  175. * @throws IllegalArgumentException
  176. * : This exception is raised if the reference of package item
  177. * string passed to this method is NULL.
  178. */
  179. public void setMegacoPkgItemStr(PkgItemStr eventItemStr) throws IllegalArgumentException {
  180. if (eventItemStr == null)
  181. throw new IllegalArgumentException("PkgItemStr must not be null.");
  182. this.itemStr = eventItemStr;
  183. }
  184. }