PageRenderTime 88ms CodeModel.GetById 52ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 98 lines | 32 code | 15 blank | 51 comment | 3 complexity | e316838e9fc7506795ab267afafb76b1 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.ParameterNotSetException;
  3. import javax.megaco.message.Descriptor;
  4. import javax.megaco.message.DescriptorType;
  5. /**
  6. * The class extends JAIN MEGACO Descriptor. This class describes the Event
  7. * descriptor of the MEGACO protocol.
  8. *
  9. *
  10. */
  11. public class EventDescriptor extends Descriptor {
  12. private int requestId;
  13. private RequestedEventParam[] requestedEventParam = null;
  14. /**
  15. * Constructs a Event Descriptor with specific request identifier.
  16. *
  17. * @param requestId
  18. * requestId - An integer value specifying the request
  19. * identifier, which uniquely identifies the event.
  20. * @throws IllegalArgumentException
  21. * : This exception is raised if the value of request identifier
  22. * passed to this method is less than 0.
  23. */
  24. public EventDescriptor(int requestId) throws IllegalArgumentException {
  25. if (requestId < 0) {
  26. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("requestId cannot be less than 0 for EventDescriptor");
  27. // TODO set ExceptionInfoCode ?
  28. throw invalidArgumentException;
  29. }
  30. this.requestId = requestId;
  31. super.descriptorId = DescriptorType.M_EVENT_DESC;
  32. }
  33. /**
  34. * This method cannot be overridden by the derived class. This method
  35. * returns that the descriptor identifier is of type descriptor Event. This
  36. * method overrides the corresponding method of the base class Descriptor.
  37. */
  38. @Override
  39. public final int getDescriptorId() {
  40. return super.descriptorId;
  41. }
  42. /**
  43. * This method cannot be overridden by the derived class. This method
  44. * returns an integer value identifying the RequestID field of the event
  45. * descriptor.
  46. *
  47. * @return Returns an integer value that identifies request identifier which
  48. * uniquely identifies the event descriptor.
  49. */
  50. public final int getRequestId() {
  51. return this.requestId;
  52. }
  53. /**
  54. * This method sets the Requested Event Params field of the event
  55. * descriptor.
  56. *
  57. * @param requestedParam
  58. * - Sets the requested params. There can be multiple requested
  59. * parameters set, but atleaset one should be present.
  60. * @throws IllegalArgumentException
  61. * : This exception is raised if the reference of request event
  62. * params as passed to this method is NULL.
  63. */
  64. public final void setRequestedEventParam(RequestedEventParam[] requestedParam) throws IllegalArgumentException {
  65. // FIXME: add zero length check?
  66. if (requestedParam == null) {
  67. throw new IllegalArgumentException();
  68. }
  69. this.requestedEventParam = requestedParam;
  70. }
  71. /**
  72. * This method gets the Request Events Params field of the event descriptor.
  73. * This method returns vector of objects of type RequsetedEventParams.
  74. *
  75. * @return Returns the vector of the request event params. If requested
  76. * event parameter has not been set for the event descriptor, then
  77. * this method would return NULL.
  78. */
  79. public final RequestedEventParam[] getRequestedEventParam() {
  80. return this.requestedEventParam;
  81. }
  82. }