PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 205 lines | 51 code | 21 blank | 133 comment | 8 complexity | f23d41a26d283e7554e1ed96d746246d MD5 | raw file
  1package javax.megaco.message.descriptor;
  2
  3
  4import javax.megaco.pkg.PkgEventItem;
  5import javax.megaco.pkg.PkgItemStr;
  6
  7/**
  8 * The class constructs the embedded event descriptor within an event
  9 * descriptor.
 10 */
 11public class EmbedFirstEventParam {
 12
 13	private int requestId = -1;
 14	private PkgEventItem eventItem = null;
 15	private PkgItemStr itemStr = null;
 16
 17	private EventParam eventParam = null;
 18	private PkgEventItem pkgEventItem = null;
 19
 20	/**
 21	 * 
 22	 * Constructs a Embedded Event Descriptor with specific request identifier.
 23	 * 
 24	 * @param requestId
 25	 *            - An integer value specifying the request identifier, which
 26	 *            uniquely identifies the event.
 27	 * @throws IllegalArgumentException
 28	 *             - Thrown if request id is set to an invalid value.
 29	 */
 30	public EmbedFirstEventParam(int requestId) throws IllegalArgumentException {
 31		// FIXME: what is invalid value?
 32		this.requestId = requestId;
 33
 34	}
 35
 36	/**
 37	 * 
 38	 * Constructs a Embedded Event Descriptor with specific request identifier
 39	 * and the PkgEventItem object. The PkgEventItem object contains the package
 40	 * parameters for the event to be detected.
 41	 * 
 42	 * @param requestId
 43	 *            - An integer value specifying the request identifier, which
 44	 *            uniquely identifies the event.
 45	 * @param eventItem
 46	 *            - An PkgEventItem object which identifies the event to be
 47	 *            detected and corresponding package parameters.
 48	 * @throws IllegalArgumentException
 49	 *             - Thrown if request id is set to an invalid value or the
 50	 *             reference of Package Event Item object is set to NULL.
 51	 */
 52	public EmbedFirstEventParam(int requestId, PkgEventItem eventItem) throws IllegalArgumentException {
 53		this(requestId);
 54		if (eventItem == null) {
 55			throw new IllegalArgumentException("PkgEventItem must nto be null");
 56		}
 57		this.eventItem = eventItem;
 58	}
 59
 60	/**
 61	 * Constructs a Event Descriptor with specific request identifier and the
 62	 * PkgItemStr object. The PkgItemStr object contains the package parameters
 63	 * for the event to be detected in the string format. This constructor will
 64	 * be used for the MEGACO packages which are not part of the
 65	 * javax.megaco.pkg package.
 66	 * 
 67	 * @param requestId
 68	 *            - An integer value specifying the request identifier, which
 69	 *            uniquely identifies the event.
 70	 * @param eventItem
 71	 *            - An PkgItemStr object which identifies the event to be
 72	 *            detected and corresponding package parameters in the string
 73	 *            format.
 74	 * @throws IllegalArgumentException
 75	 *             - Thrown if request id is set to an invalid value or the
 76	 *             reference of Package Item String object is set to NULL.
 77	 */
 78	public EmbedFirstEventParam(int requestId, PkgItemStr eventItemStr) throws IllegalArgumentException {
 79		this(requestId);
 80
 81		if (eventItemStr == null) {
 82			throw new IllegalArgumentException("PkgItemStr must nto be null");
 83		}
 84		this.itemStr = eventItemStr;
 85	}
 86
 87	/**
 88	 * This method returns an integer value corresponding to the unique
 89	 * requested event.
 90	 * 
 91	 * @return Returns an integer value that identifies request identifier which
 92	 *         uniquely identifies the event descriptor.
 93	 */
 94	public int getRequestIdentifier() {
 95		return this.requestId;
 96	}
 97
 98	/**
 99	 * The method can be used the to retrieve the parameters corresponding to
100	 * whether the keep alive token is set, the digit map name or digit map
101	 * value is set or the embeded signal is set or stream id is set.
102	 * 
103	 * @return EventParam - object identifier corresponding to the event
104	 *         parameters corresponding to the non embedded event id. This
105	 *         object interface may optionally be there. If the event parameter
106	 *         is not set then this returns a null value.
107	 */
108	public EventParam getEventParam() {
109		return this.eventParam;
110	}
111
112	/**
113	 * The method can be used the to set the object reference to the event
114	 * parameter which has reference to whether keepactive token is present,
115	 * signal descriptor, digit map descriptor stream id. In case of an error,
116	 * an exception is raised.
117	 * 
118	 * @param EventParam
119	 *            The objectIdentifier corresponding to the event paramater of
120	 *            first level event.
121	 * @throws IllegalArgumentException
122	 *             Thrown if an illegal event is set in the embedded event
123	 *             descriptor.
124	 */
125	public void setEventParam(EventParam eventParam) throws IllegalArgumentException {
126
127		// FIXME: add checks
128		// if(eventItem == null)
129		// throw new IllegalArgumentException("EventParam must not be null.");
130		this.eventParam = eventParam;
131	}
132
133	/**
134	 * The method can be used to get the package name in the Embedded Event
135	 * descriptor. This method gives the package information, the attached event
136	 * information and the parameter name and value for the event id.
137	 * 
138	 * @return The object reference for the Event Item. This has the object
139	 *         reference of corresponding megaco package and has the reference
140	 *         of the parameter info associated with it. If the parameter has
141	 *         not been set, then this method shall return NULL.
142	 */
143	public PkgEventItem getMegacoPkgEventItem() {
144		return this.pkgEventItem;
145	}
146
147	/**
148	 * The method can be used to get the pkdgName as set in the Embedded Event
149	 * descriptor. This method gives the package information, the attached event
150	 * information and the parameter name and value. Compared to the
151	 * getMegacoPkgEventItem( ) method, this method returnes the package
152	 * parameters in the string format.
153	 * 
154	 * @return The object reference for the megaco package item. This class
155	 *         holds information about package name, item name and the
156	 *         parameters in the string format. If the parameter has not been
157	 *         set, then this method shall return NULL.
158	 */
159	public PkgItemStr getMegacoPkgItemStr() {
160		return this.itemStr;
161	}
162
163	/**
164	 * The method can be used to set the package name in the Embedded Event
165	 * descriptor. The Package Event Item object contains package information,
166	 * the attached event information and the parameter name and value for the
167	 * event id.
168	 * 
169	 * @param eventItem
170	 *            - The object reference for the Event Item. This has the object
171	 *            reference of corresponding megaco package and has the
172	 *            reference of the parameter info associated with it.
173	 * @throws IllegalArgumentException
174	 *             : This exception is raised if the reference of Package Event
175	 *             Item passed to this method is NULL.
176	 */
177	public void setMegacoPkgEventItem(PkgEventItem eventItem) throws IllegalArgumentException {
178		if (eventItem == null)
179			throw new IllegalArgumentException("PkgEventItem must not be null.");
180	}
181
182	/**
183	 * The method can be used to set the pkdgName as set in the Embedded Event
184	 * descriptor. The Package Item String contains package information, the
185	 * attached event information and the parameter name and value. Compared to
186	 * the setMegacoPkgEventItem( ) method, this method takes the package
187	 * parameters in the string format.
188	 * 
189	 * @param eventItemStr
190	 *            - The object reference for the megaco package item. This class
191	 *            holds information about package name, item name and the
192	 *            parameters in the string format.
193	 * @throws IllegalArgumentException
194	 *             : This exception is raised if the reference of package item
195	 *             string passed to this method is NULL.
196	 */
197	public void setMegacoPkgItemStr(PkgItemStr eventItemStr) throws IllegalArgumentException {
198		if (eventItemStr == null)
199			throw new IllegalArgumentException("PkgItemStr must not be null.");
200
201		this.itemStr = eventItemStr;
202
203	}
204
205}