/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/pkg/PkgEventItem.java

http://mobicents.googlecode.com/ · Java · 126 lines · 25 code · 12 blank · 89 comment · 0 complexity · fea76445ea964c4363a5569340652673 MD5 · raw file

  1. package javax.megaco.pkg;
  2. /**
  3. * The MEGACO event item class is an abstract class defined as the base class
  4. * for all the event items in the MEGACO Package. This class shall be used for
  5. * setting the events, list of parameters names and their values. This extends
  6. * the PkgItem class. This is an abstract class and hence cannot be created as a
  7. * separate object.
  8. *
  9. *
  10. */
  11. public abstract class PkgEventItem extends PkgItem {
  12. protected int eventId = -1;
  13. protected PkgItemParam[] paramInfo;
  14. /**
  15. * Constructs a Jain MEGACO Package Event Item Object. This is an abstract
  16. * class and can be called only by the derived classes.
  17. */
  18. public PkgEventItem() {
  19. }
  20. /**
  21. * The method can be used to get the event identifier. This method gives the
  22. * event id of the event item. This is an abstract method and is defined by
  23. * the methods of the derived class which shall return an hard coded value
  24. * for the event id.
  25. *
  26. * @return eventId - The integer corresponding to the event id.
  27. */
  28. public abstract int getEventId();
  29. /**
  30. * The method can be used to get the event identifier. This method gives the
  31. * item id of the event item. This is an abstract method and is defined by
  32. * the methods of the derived class which shall return an hard coded value
  33. * for the event id.
  34. *
  35. * eventId - The integer corresponding to the event id.
  36. */
  37. public abstract int getItemId();
  38. /**
  39. * This method overrides the corresponding method in PkgItem. This shall
  40. * return an hard coded value to indicate the item type is event.
  41. *
  42. * itemType - An integer value for the item type corresponding to the event.
  43. * This shall return {@link javax.megaco.pkg.PkgItemType.M_EVENT}
  44. */
  45. public final int getItemType() {
  46. return PkgItemType.M_EVENT;
  47. }
  48. /**
  49. * This method overrides the corresponding method in PkgItem. This method
  50. * would set a flag to indicate that the dynamic package has been associated
  51. * and would not allow the application to overwrite the package association
  52. * once the parameter has been set for the item. If the package name can be
  53. * linked, then this method inturn calls the corresponding method of the
  54. * PkgItem class.
  55. *
  56. * packageId - The object reference of the package object to which the item
  57. * is dynamically associated.
  58. *
  59. * IllegalArgumentException This exception will be raised in the following
  60. * cases 1. If the method is called to modify the associated package after
  61. * the parameter has been set. 2. If the package that is dynamically being
  62. * linked cannot be set due to the fact that the item does not belong to the
  63. * package or the package is not one of the ancestor package of the package,
  64. * to which the item belongs. 3. If the reference of package Id passed to
  65. * this method is NULL.
  66. */
  67. public void setAssociatedPkgId(MegacoPkg packageId)
  68. throws IllegalArgumentException {
  69. // TODO
  70. }
  71. /**
  72. * The method can be used to get the vector object identifier that specifies
  73. * the attached Parameter name and the corresponding values for the event.
  74. *
  75. * @return paramInfo - The vector of objectIdentifier corresponding to the
  76. * param information set for the package. If the parameter is not
  77. * set then this shall return a NULL value.
  78. */
  79. public final PkgItemParam[] getMegacoPkgItemParam() {
  80. return this.paramInfo;
  81. }
  82. /**
  83. * The method can be used to set the Parameter information. This method sets
  84. * the attached parameters for the event. This method should be called only
  85. * after a package has been associated with the item. Once the parameter has
  86. * been set, it shall not allow the associated item to be overwritten. This
  87. * method shall verify the following:
  88. *
  89. * <br>
  90. * 1. The parameter can be set for the relevant item. <br>
  91. * 2. The parameter too belongs to the same package for which the item
  92. * belongs. <br>
  93. * 3. If the parameter does not belong to the same package, then does it
  94. * belong to a package that extends the package to which the item belongs. <br>
  95. * 4. If the parameter and the item belong to different packages, but if the
  96. * package to which the parameter belongs extends the package to which the
  97. * item belongs, then it should validate that the current association of the
  98. * item is to the package to which the parameter belongs or should be such
  99. * that it extends the package to which the parameter belongs.
  100. *
  101. * @param paramInfo - The vector of objectIdentifier corresponding to the parameter information.
  102. * @throws IllegalArgumentException If the parameter cannot be linked to the current event.
  103. * @throws IllegalStateException If the item has not been associated with a package.
  104. */
  105. public final void setMegacoPkgItemParam(PkgItemParam[] paramInfo) throws IllegalArgumentException, IllegalStateException {
  106. // FIXME: add checks for exceptions
  107. this.paramInfo = paramInfo;
  108. }
  109. @Override
  110. public java.lang.String toString() {
  111. // TODO
  112. return super.toString() +" : EventId = "+eventId;
  113. }
  114. }