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

http://mobicents.googlecode.com/ · Java · 172 lines · 52 code · 14 blank · 106 comment · 8 complexity · 9bf21bf319cc55baa784195b3a60356a MD5 · raw file

  1. package javax.megaco.pkg;
  2. import java.io.Serializable;
  3. import javax.megaco.ExceptionInfoCode;
  4. /**
  5. * The MEGACO Package Item String class is used to define the Package, Items and
  6. * Parameters in the string format. If the implementations uses a MEGACO package
  7. * which is not defined in the javax.megaco.pkg package, then the values of
  8. * Package, Item and Parameter, are exchanged using this class. This class has
  9. * been provided to take care of the extensibility within the protocol using
  10. * protocol packages. The descriptor classes have necessary method to pass
  11. * reference to the object of the PkgItemStr class in addition to the existing
  12. * interface for PkgEventItem or PkgSignalItem etc.
  13. *
  14. * Note: Since there is no configuration of the package parameters passed in
  15. * this class, the parameters passed are not validated.
  16. */
  17. public class PkgItemStr implements Serializable {
  18. private String pkgName;
  19. private String itemName;
  20. private String parameter;
  21. private PkgItemType itemType;
  22. /**
  23. * Constructs a MEGACO Package Item class to specify the package parameters
  24. * in the string format. This class would be used to specify the package
  25. * parameters for the package which is not defined in the javax.megaco.pkg
  26. * package.
  27. *
  28. *
  29. */
  30. public PkgItemStr() {
  31. }
  32. /**
  33. * This method is used to set the package name. The package name specified
  34. * must be in the syntax defined by the MEGACO protocol.Since the pkgName
  35. * specified is not configured in the class, therefore its value cannot be
  36. * validated.
  37. *
  38. * @param pkgName
  39. * The string corresponding to the package name.
  40. * @throws IllegalArgumentException
  41. * This exception is raised if the reference of Package name
  42. * string passed to this method is NULL.
  43. */
  44. public final void setPkgName(java.lang.String pkgName) throws IllegalArgumentException {
  45. if (pkgName == null) {
  46. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("Package name cannot be null for PkgItemStr");
  47. // invalidArgumentException.setInfoCode(ExceptionInfoCode.MISSING_PKG_NAME);
  48. throw invalidArgumentException;
  49. }
  50. this.pkgName = pkgName;
  51. }
  52. /**
  53. * This method is used to get the package name. The package name returned is
  54. * in the string format.
  55. *
  56. * @return String corresponding to the package name. In case no value for
  57. * package name is present, then this method shall return NULL.
  58. */
  59. public final java.lang.String getAssociatedPkgName() {
  60. return this.pkgName;
  61. }
  62. /**
  63. * This method is used to set the item name. The item name specified must be
  64. * in the syntax defined by the MEGACO protocol.Since the item name
  65. * specified is not configured in the class, therefore its value cannot be
  66. * validated.
  67. *
  68. * @param itemName
  69. * The string corresponding to the item name.
  70. * @throws IllegalArgumentException
  71. * This exception is raised if the reference of Item name string
  72. * passed to this method is NULL.
  73. */
  74. public final void setItemName(java.lang.String itemName) throws IllegalArgumentException {
  75. if (itemName == null) {
  76. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("Item name cannot be null for PkgItemStr");
  77. // invalidArgumentException.setInfoCode(ExceptionInfoCode.MISSING_ITEM_NAME);
  78. throw invalidArgumentException;
  79. }
  80. this.itemName = itemName;
  81. }
  82. /**
  83. * This method is used to get the item name. The item name returned is in
  84. * the string format.
  85. *
  86. * @return String corresponding to the item name. In case no value for item
  87. * name is present, then this method shall return NULL.
  88. */
  89. public final java.lang.String getItemName() {
  90. return this.itemName;
  91. }
  92. /**
  93. * This method is used to set the package parameter. The parameter specified
  94. * here has parameter name followed by the relational operator and then
  95. * followed by the parameter values. The parameter specified must be in the
  96. * syntax defined by the MEGACO protocol.Since the parameter is not
  97. * configured in the class, therefore its value cannot be validated.
  98. *
  99. * @param parameter
  100. * The string corresponding to the package parameters.
  101. * @throws IllegalArgumentException
  102. * This exception is raised if the reference of Package Item
  103. * object passed to this method is NULL.
  104. */
  105. public final void setParameter(java.lang.String parameter) throws IllegalArgumentException {
  106. if (itemName == null) {
  107. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("Parameter cannot be null for PkgItemStr");
  108. // invalidArgumentException.setInfoCode(ExceptionInfoCode.MISSING_PKG_PARAM);
  109. throw invalidArgumentException;
  110. }
  111. this.parameter = parameter;
  112. }
  113. /**
  114. * This method is used to get the package parameter. The parameter returnes
  115. * here has parameter name followed by the relational operator and then
  116. * followed by the parameter values.
  117. *
  118. * @return String corresponding to the package parameter. In case no value
  119. * for parameter is specified, then this methos shall return NULL.
  120. */
  121. public final java.lang.String getParameter() {
  122. return this.parameter;
  123. }
  124. /**
  125. * This method is used to set the Item type for which the parameters are
  126. * specified. The item_type is set to
  127. * {@link javax.megaco.pkg.PkgItemType.M_ALL} if the item_name is '*'. The
  128. * item_type is set to {@link javax.megaco.pkg.PkgItemType.M_EVENT}, if the
  129. * descriptor for which the parameters are specified is one of Event
  130. * Descriptor, Observed Event Descriptor or Event Buffer Descriptor. The
  131. * item_type is set to {@link javax.megaco.pkg.PkgItemType.M_STATISTICS}, if
  132. * the descriptor for which the parameters are specified is Statistics
  133. * Descriptor. The item_type is set to
  134. * {@link javax.megaco.pkg.PkgItemType.M_SIGNAL}, if the descriptor for
  135. * which the parameters are specified is Signal Descriptor. The item_type is
  136. * set to {@link javax.megaco.pkg.PkgItemType.M_PROPERTY}, if the descriptor
  137. * for which the parameters are specified is Media Descriptor.
  138. *
  139. * @param itemType
  140. * The object reference of the class PkgItemType which identifies
  141. * the item type to which the parameter belongs.
  142. * @throws IllegalArgumentException
  143. * This exception is raised if the reference of Package Item
  144. * object passed to this method is NULL.
  145. */
  146. public final void setItemType(PkgItemType itemType) throws IllegalArgumentException {
  147. if (itemType == null) {
  148. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("Package Item Type cannot be null for PkgItemStr");
  149. // invalidArgumentException.setInfoCode(ExceptionInfoCode.INV_PKG_ITEM_TYPE);
  150. throw invalidArgumentException;
  151. }
  152. this.itemType = itemType;
  153. }
  154. @Override
  155. public java.lang.String toString() {
  156. return this.pkgName + " " + this.parameter + " " + this.itemName + " " + this.itemType;
  157. }
  158. }