PageRenderTime 49ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

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