PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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