PageRenderTime 37ms CodeModel.GetById 28ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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