PageRenderTime 26ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 1ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/association/AssociationConfigReq.java

http://mobicents.googlecode.com/
Java | 496 lines | 197 code | 47 blank | 252 comment | 34 complexity | e750b698ad5269e9f4bf583d15907795 MD5 | raw file
  1package javax.megaco.association;
  2
  3import javax.megaco.AssociationEvent;
  4
  5import javax.megaco.ParameterNotSetException;
  6
  7public class AssociationConfigReq extends AssociationEvent {
  8
  9	protected Integer maxRegstRetries = -1;
 10	protected Integer restartAvalancheMWD = -1;
 11	protected Integer normalMGExecTime = -1;
 12	protected Integer provisionalRespTime = -1;
 13	protected Integer responseRetentionTimePresent = -1;
 14	protected Integer maxPndngRespCountPresent = -1;
 15	protected Integer maxRetransmissionCountPresent = -1;
 16	protected Integer initialRTT = -1;
 17	protected EncodingFormat endcodingFormat = null;
 18	protected TransportType transportType;
 19	protected Integer protocolVersion = -1;
 20	protected String srvChngProfile = null;
 21
 22	public AssociationConfigReq(Object source, int assocHandle)
 23			throws IllegalArgumentException {
 24		super(source, assocHandle);
 25		// TODO Auto-generated constructor stub
 26	}
 27
 28	@Override
 29	public int getAssocOperIdentifier() {
 30		return AssocEventType.M_ASSOC_CONFIG_REQ;
 31	}
 32
 33	/**
 34	 * Gets the integer value of maximum registration retries.
 35	 * 
 36	 * @return Returns the integer value of maximum registration retries.
 37	 * @throws javax.megaco.ParameterNotSetException
 38	 *             This exception is raised if the max registration retires has
 39	 *             not been specified.
 40	 */
 41	public int getMaxRegstRetries()
 42			throws javax.megaco.ParameterNotSetException {
 43		if (this.maxRegstRetries == null)
 44			throw new ParameterNotSetException();
 45
 46		return this.maxRegstRetries;
 47	}
 48
 49	/**
 50	 * Identifies whether the maximum registration retries is present.
 51	 * 
 52	 * @return Returns true if the maximum registration retries is present.
 53	 */
 54	public boolean isMaxRegstRetriesPresent() {
 55		return this.maxRegstRetries != null;
 56	}
 57
 58	// FIXME: name should me avalanche not avalance ?
 59
 60	/**
 61	 * Gets the integer value of MWD used during restart avalance prevention.
 62	 * 
 63	 * @return Returns the integer value of MWD used during restart avalance
 64	 *         prevention.
 65	 * @throws javax.megaco.ParameterNotSetException
 66	 *             This exception is raised if the restart avalanche MWD has not
 67	 *             been specified.
 68	 */
 69	public int getRestartAvalancheMWD()
 70			throws javax.megaco.ParameterNotSetException {
 71		if (!isRestartAvalanceMWDPresent())
 72			throw new ParameterNotSetException();
 73
 74		return this.restartAvalancheMWD;
 75	}
 76
 77	/**
 78	 * This method sets the MWD used during restart avalance prevention which is
 79	 * to be configured. This sets the Maximum Wait Delay parameter required to
 80	 * prevent the restart avalanche.
 81	 * 
 82	 * @param restartAvalancheTime
 83	 *            The integer value of MWD used during restart avalance
 84	 *            prevention .
 85	 * @throws IllegalArgumentException
 86	 *             This exception is raised if the value of restart avalanche
 87	 *             time passed to this method is less than 0.
 88	 */
 89	public void setRestartAvalancheMWD(int restartAvalancheTime)
 90			throws IllegalArgumentException {
 91
 92		if (restartAvalancheTime < 0)
 93			throw new IllegalArgumentException(
 94					"Restart Avalanche Time can not be less than zero");
 95		this.restartAvalancheMWD = restartAvalancheTime;
 96
 97	}
 98
 99	/**
100	 * Identifies whether the MWD used during restart avalance prevention is
101	 * present.
102	 * 
103	 * @return Returns true if the MWD used during restart avalanche prevention
104	 *         is present.
105	 */
106	public boolean isRestartAvalanceMWDPresent() {
107		return this.restartAvalancheMWD != null;
108	}
109
110	/**
111	 * This method sets the normal MG execution time which is to be configured.
112	 * This sets execution time beyond whih MG retransmits the message.
113	 * 
114	 * @return The integer value of normal MG execution time.
115	 * @throws javax.megaco.ParameterNotSetException
116	 *             This exception is raised if the MG Normal execution value has
117	 *             not been specified.
118	 */
119	public int getNormalMGExecTime()
120			throws javax.megaco.ParameterNotSetException {
121		// FIXME: isNormalMGCExecTimePresent !=isNormalMGExecTimePresent
122		if (!this.isNormalMGCExecTimePresent())
123			throw new ParameterNotSetException();
124		return normalMGExecTime;
125	}
126
127	/**
128	 * This method sets the normal MG execution time which is to be configured.
129	 * This sets execution time beyond whih MG retransmits the message.
130	 * 
131	 * @param mgExecTime
132	 *            The integer value of normal MG execution time.
133	 * @throws IllegalArgumentException
134	 *             This exception is raised if the value of normal MG execution
135	 *             time passed to this method is less than 0.
136	 */
137	public void setNormalMGExecTime(int mgExecTime)
138			throws IllegalArgumentException {
139		if (mgExecTime < 0)
140			throw new IllegalArgumentException(
141					"Exec Time can not be less than zero");
142		this.normalMGExecTime = mgExecTime;
143	}
144
145	/**
146	 * Identifies whether the normal MGC execution time is present.
147	 * 
148	 * @return Returns true if the normal MGC execution time is present is
149	 *         present.
150	 */
151	public boolean isNormalMGCExecTimePresent() {
152		return this.normalMGExecTime != null;
153	}
154
155	/**
156	 * Gets the integer value of provisional response timer.
157	 * 
158	 * @return Returns the integer value of provisional response timer.
159	 * @throws javax.megaco.ParameterNotSetException
160	 *             This exception is raised if the provisional response time has
161	 *             not been specified.
162	 */
163	public int getProvisionalRespTime()
164			throws javax.megaco.ParameterNotSetException {
165		if (!isProvisionalRespTimePresent()) {
166			throw new ParameterNotSetException();
167		}
168		return this.provisionalRespTime;
169	}
170
171	/**
172	 * This method sets the provisional response timer which is to be
173	 * configured. This sets the time when the provisional response has to be
174	 * sent by the stack, if the application does not send back a response by
175	 * that time.
176	 * 
177	 * 
178	 * @param provRespTime
179	 *            The integer value of provisional response timer.
180	 * @throws IllegalArgumentException
181	 *             This exception is raised if the value of provisional response
182	 *             time passed to this method is less than 0.
183	 */
184	public void setProvisionalRespTime(int provRespTime)
185			throws IllegalArgumentException {
186		if (provRespTime < 0) {
187			throw new IllegalArgumentException(
188					"value can not be less than zero");
189		}
190		this.provisionalRespTime = provRespTime;
191	}
192
193	/**
194	 * Identifies whether the provisional response timer is present.
195	 * 
196	 * @return Returns true if the provisional response timer is present is
197	 *         present.
198	 */
199	public boolean isProvisionalRespTimePresent() {
200		return this.provisionalRespTime != null;
201	}
202
203	/**
204	 * Identifies whether the response retention time is present.
205	 * 
206	 * @return Returns true if the response retention time is present is
207	 *         present.
208	 */
209	public boolean isResponseRetentionTimePresent() {
210		return this.responseRetentionTimePresent != null;
211	}
212
213	/**
214	 * This method sets the response retention time which is to be configured.
215	 * This sets the Maximum time during which the transaction has to be
216	 * retained after the receipt of the response.
217	 * 
218	 * @param responseTime
219	 *            The integer value of response retention time.
220	 * @throws IllegalArgumentException
221	 *             This exception is raised if the value of response retention
222	 *             time passed to this method is less than 0.
223	 */
224	public void setResponseRetentionTime(int responseTime)
225			throws IllegalArgumentException {
226		if (responseTime < 0) {
227			throw new IllegalArgumentException(
228					"value can not be less than zero");
229		}
230		this.responseRetentionTimePresent = responseTime;
231	}
232
233	// FIXME again TYPO ?
234	/**
235	 * Identifies whether the maximum pending response count is present.
236	 * 
237	 * @return Returns true if the maximum pending response count is present is
238	 *         present.
239	 */
240	public boolean isMaxPndngRespCountPresent() {
241		return this.maxPndngRespCountPresent != null;
242	}
243
244	/**
245	 * This method sets the maximum pending response count which is to be
246	 * configured. This sets the count, which gives the maximum provisional
247	 * responses beyond which the stack shall assume that the application could
248	 * not send the message back. The stack in this case will generate a error
249	 * response towards the peer.
250	 * 
251	 * @param responseTime
252	 *            The integer value of maximum pending response count.
253	 * @throws IllegalArgumentException
254	 *             This exception is raised if the value of response retention
255	 *             time passed to this method is less than 0.
256	 */
257	public void setMaxPndngRespCount(int pndngCount)
258			throws IllegalArgumentException {
259		if (pndngCount < 0) {
260			throw new IllegalArgumentException(
261					"value can not be less than zero");
262		}
263		this.maxPndngRespCountPresent = pndngCount;
264	}
265
266	/**
267	 * Gets the integer value of maximum pending response count.
268	 * 
269	 * @return Returns the integer value of maximum pending response count.
270	 * @throws javax.megaco.ParameterNotSetException
271	 *             This exception is raised if the value of maximum pending
272	 *             response count has not been specified.
273	 */
274	public int getMaxPndngRespCount()
275			throws javax.megaco.ParameterNotSetException {
276		if (!isMaxPndngRespCountPresent()) {
277			throw new ParameterNotSetException();
278		}
279
280		return this.maxPndngRespCountPresent;
281	}
282
283	/**
284	 * Identifies whether the maximum retransmission count is present.
285	 * 
286	 * @return Returns true if the maximum retransmission count is present.
287	 */
288	public boolean isMaxRetransmissionCountPresent() {
289		return this.maxRetransmissionCountPresent != null;
290	}
291
292	/**
293	 * This method sets the maximum retransmission count which is to be
294	 * configured. This sets the count, which gives the maximum retransmission
295	 * count, beyond which if stack still does not get back a response from
296	 * peer, the stack shall assume a network problem with the peer.
297	 * 
298	 * @param responseTime
299	 *            The integer value of maximum retransmission count.
300	 * @throws IllegalArgumentException
301	 *             This exception is raised if the value of response retention
302	 *             time passed to this method is less than 0.
303	 */
304	public void setMaxRetransmissionCount(int retransmissionCount)
305			throws IllegalArgumentException {
306		if (retransmissionCount < 0) {
307			throw new IllegalArgumentException(
308					"value can not be less than zero");
309		}
310		this.maxRetransmissionCountPresent = retransmissionCount;
311	}
312
313	/**
314	 * Gets the integer value of maximum retransmission count.
315	 * 
316	 * @return Returns the integer value of maximum retransmission count.
317	 * @throws javax.megaco.ParameterNotSetException
318	 *             This exception is raised if the value of maximum
319	 *             retransmission counthas not been specified.
320	 */
321	public int getMaxRetransmissionCount()
322			throws javax.megaco.ParameterNotSetException {
323		if (!isMaxRetransmissionCountPresent()) {
324			throw new ParameterNotSetException();
325		}
326		return this.maxRetransmissionCountPresent;
327	}
328
329	public boolean isInitialRTTPresent() {
330		return this.initialRTT != null;
331	}
332
333	/**
334	 * This method sets the initial rtt which is to be configured. This is used
335	 * for calculating the retransmission timer.
336	 * 
337	 * @param responseTime
338	 *            The integer value of initial rtt.
339	 * @throws IllegalArgumentException
340	 *             This exception is raised if the value passed to this method
341	 *             is less than 0.
342	 */
343	public void setInitialRTT(int rtt)
344			throws IllegalArgumentException {
345		if (rtt < 0) {
346			throw new IllegalArgumentException(
347					"value can not be less than zero");
348		}
349		this.initialRTT = rtt;
350	}
351
352	/**
353	 * Gets the integer value of initial rtt.
354	 * 
355	 * @return Returns the integer value of initial rtt.
356	 * @throws javax.megaco.ParameterNotSetException
357	 *             This exception is raised if the value of initial rtt has not
358	 *             been specified.
359	 */
360	public int getInitialRTT() throws javax.megaco.ParameterNotSetException {
361		if (!isInitialRTTPresent()) {
362			throw new ParameterNotSetException();
363		}
364
365		return this.initialRTT;
366	}
367
368	/**
369	 * Gets the object reference to the encoding format. The possible values are
370	 * field constants defined for the class EncodingFormat.
371	 * 
372	 * @return Returns the a derived object of the EncodingFormat class to
373	 *         represent the value of encoding format. If the encoding format
374	 *         has not been specified, then this method would return value 0.
375	 */
376	public int getEndcodingFormat() {
377		// FIXME 0 is valid value == TEXT ?
378		return endcodingFormat == null ? 0 : endcodingFormat
379				.getEncodingFormat();
380	}
381
382	/**
383	 * This method sets the encoding format which is to be configured.
384	 * 
385	 * @param endcodingFormat
386	 *            The object reference to derived class of EncodingFormat class
387	 *            which gives value of encoding format.
388	 * @throws IllegalArgumentException
389	 *             This exception is raised if the reference of Encoding Format
390	 *             passed to this method is NULL.
391	 */
392	public void setEndcodingFormat(EncodingFormat format)
393			throws IllegalArgumentException {
394		if (format == null) {
395			throw new IllegalArgumentException(
396					"Encoding format can not be null");
397		}
398		this.endcodingFormat = format;
399	}
400
401	/**
402	 * This method sets the transport type which is to be configured.
403	 * 
404	 * @param transport
405	 *            The object refenrece to transport type.
406	 * 
407	 * @throws IllegalArgumentException
408	 *             This exception is raised if the reference of Transport type
409	 *             passed to this method is NULL.
410	 */
411	public void setTransportType(TransportType transport)
412			throws IllegalArgumentException {
413		if (transport == null)
414			throw new IllegalArgumentException("Value can not be null");
415		this.transportType = transport;
416
417	}
418
419	/**
420	 * Gets the integer value which identifies the transport type. The possible
421	 * values are the field constants defined for the class TransportType.
422	 * 
423	 * @return Returns the object reference to transport type. If no transport
424	 *         type has been specified, then this method would return value 0.
425	 */
426	public int getTransportType() {
427		return this.transportType == null ? 0 : this.transportType
428				.getTransportType();
429	}
430
431	/**
432	 * This method sets the protocol version value that is to be used for the
433	 * specified association.
434	 * 
435	 * @param version
436	 *            The protocol version as an integer value.
437	 * @throws IllegalArgumentException
438	 *             This exception is raised if the value of protocol version
439	 *             passed to this method is less than 0.
440	 */
441	public void setProtocolVersion(int version)
442			throws IllegalArgumentException {
443		if (version < 0) {
444			throw new IllegalArgumentException(
445					"Value can not be less than zero");
446		}
447
448		this.protocolVersion = version;
449	}
450
451	/**
452	 * Identifies whether the protocol version is present.
453	 * 
454	 * @return Returns true if the protocol version is present.
455	 */
456	public boolean isProtocolVersionPresent() {
457		return this.protocolVersion != null;
458	}
459
460	/**
461	 * Gets the protocol version value received from peer in the service change.
462	 * This is ther protocol version after negotiation.
463	 * 
464	 * @return Returns the protocol version parameter as an integer value.
465	 * @throws javax.megaco.ParameterNotSetException
466	 *             This exception is raised if the service change delay has not
467	 *             been specified.
468	 */
469	public int getProtocolVersion()
470			throws javax.megaco.ParameterNotSetException {
471		if (!isProtocolVersionPresent()) {
472			throw new ParameterNotSetException();
473		}
474
475		return this.protocolVersion;
476	}
477
478	/**
479	 * Gets the service change profile value to be sent to peer in the service
480	 * change.
481	 * 
482	 * @return Returns the service change profile parameter as a string value.
483	 *         If service change profile is not set then a NULL value is
484	 *         returned.
485	 */
486	public java.lang.String getSrvChngProfile() {
487		return this.srvChngProfile;
488	}
489
490	public void setSrvChngProfile(java.lang.String profile)
491			throws IllegalArgumentException {
492		if (profile == null)
493			throw new IllegalArgumentException("Value can not be null");
494		this.srvChngProfile = profile;
495	}
496}