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

http://mobicents.googlecode.com/ · Java · 105 lines · 39 code · 17 blank · 49 comment · 8 complexity · bad1bbc2c4fa6a9336bf1fba720ca86a MD5 · raw file

  1. package javax.megaco.message.descriptor;
  2. import java.io.Serializable;
  3. import javax.megaco.message.Descriptor;
  4. import javax.megaco.message.DescriptorType;
  5. import javax.megaco.pkg.PkgItemStr;
  6. import javax.megaco.pkg.PkgStatsItem;
  7. /**
  8. * The class extends JAIN MEGACO Descriptor. This class describes the statistics
  9. * descriptor. It stores the statistics values against a statistics identity.
  10. */
  11. public class StatsDescriptor extends Descriptor implements Serializable {
  12. private PkgStatsItem[] pkgStatsItem;
  13. private PkgItemStr[] pkgItemStr;
  14. /**
  15. * Constructs a Statistics Descriptor. This contains the statistics id and
  16. * its associated value.
  17. *
  18. * @param statsItem
  19. * @throws IllegalArgumentException
  20. * - Thrown if an invalid statistics id is set.
  21. */
  22. public StatsDescriptor(PkgStatsItem[] statsItem) throws IllegalArgumentException {
  23. super.descriptorId = DescriptorType.M_STATISTICS_DESC;
  24. if (statsItem == null) {
  25. throw new IllegalArgumentException("PkgStatsItem[] must not be null.");
  26. }
  27. if (statsItem.length == 0) {
  28. throw new IllegalArgumentException("PkgStatsItem[] must not be empty.");
  29. }
  30. this.pkgStatsItem = statsItem;
  31. }
  32. /**
  33. * Constructs Statistics descriptor object with the PkgItemStr object. This
  34. * method would be used if the package parameters are to be conveyed in the
  35. * string format.
  36. *
  37. * @param statsItemStr
  38. * @throws IllegalArgumentException
  39. * - Thrown if an invalid statsItemStr object reference is set.
  40. */
  41. public StatsDescriptor(PkgItemStr[] statsItemStr) throws IllegalArgumentException {
  42. super.descriptorId = DescriptorType.M_STATISTICS_DESC;
  43. if (statsItemStr == null) {
  44. throw new IllegalArgumentException("PkgItemStr[] must not be null.");
  45. }
  46. if (statsItemStr.length == 0) {
  47. throw new IllegalArgumentException("PkgItemStr[] must not be empty.");
  48. }
  49. this.pkgItemStr = statsItemStr;
  50. }
  51. /**
  52. * This method cannot be overridden by the derived class. This method
  53. * returns that the descriptor identifier is of type Statistics descriptor.
  54. * This method overrides the corresponding method of the base class
  55. * Descriptor.
  56. *
  57. * @return Returns an integer value that identifies this object as the type
  58. * of Statistics descriptor. It returns that it is Statistics
  59. * Descriptor i.e., M_STATISTICS_DESC.
  60. */
  61. public int getDescriptorId() {
  62. return super.descriptorId;
  63. }
  64. /**
  65. * The method can be used to get the statistics id and its associated value.
  66. *
  67. * @return stats - The object reference for the megaco statistics identity
  68. * and the associated value.
  69. */
  70. public PkgStatsItem[] getMegacoPkgStatsItem() {
  71. return this.pkgStatsItem;
  72. }
  73. /**
  74. * The method can be used to get the pkdgName as set in the statistics
  75. * descriptor. This method gives the package information, the attached event
  76. * information and the parameter name and value. As comapres to the
  77. * getMegacoPkgStatsItem() method, this method returnes the package
  78. * parameters in the string format.
  79. *
  80. * @return The object reference for the megaco package item. This class
  81. * holds information about package name, item name and the
  82. * parameters in the string format. If the parameter has not been
  83. * set, then this method shall return NULL.
  84. */
  85. public PkgItemStr[] getMegacoPkgItemStr() {
  86. return this.pkgItemStr;
  87. }
  88. }