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

http://mobicents.googlecode.com/ · Java · 86 lines · 15 code · 4 blank · 67 comment · 2 complexity · a946d2b4234cf16502fbab02f3f2bf57 MD5 · raw file

  1. package javax.megaco.message;
  2. import javax.megaco.CommandEvent;
  3. /**
  4. * The class extends JAIN MEGACO Command Events. This class is used to represent
  5. * megaco context information response event. It is used when the application
  6. * needs to respond to a command or an action request received with context
  7. * properties only. Through this the application would be able to respond with
  8. * context properties only. This event would be received by the application when
  9. * the application is only expecting a context property in the response with no
  10. * accompanying commands.
  11. *
  12. *
  13. */
  14. public class ContextInfoResp extends CommandEvent {
  15. /**
  16. * Constructs a Context Information Response Event object.
  17. *
  18. * @param source
  19. * - A reference to the object, the "source", that is logically
  20. * deemed to be the object upon which the Event in question
  21. * initially occurred.
  22. * @param assocHandle
  23. * - The association handle to uniquely identify the MG-MGC pair.
  24. * This is allocated by the stack when the Listener registers
  25. * with the provider with a unique MG-MGC identity.
  26. * @param txnHandle
  27. * - The transaction handle that shall uniquely identify the
  28. * transaction id for the transaction in which the command shall
  29. * be sent.
  30. *
  31. * <br>
  32. * 1. The transaction handle is allocated by the stack either on
  33. * request from User application or on receipt of the transaction
  34. * indication from peer. <br>
  35. * 2. If the response is to be sent for the transaction received,
  36. * then the application sends the same transaction handle that
  37. * has been received by it in the indication. <br>
  38. * 3. If the confirmation is to be sent by the stack to the
  39. * application due to receipt of a response from the peer stack
  40. * for a request sent by the stack, then the transaction handle
  41. * shall be same as received in the command request by the stack.
  42. *
  43. * @param actionHandle
  44. * - The action handle uniquely identifies the action within a
  45. * transaction. The action handle field is used for
  46. * request-response synchronisation.
  47. *
  48. * <br>
  49. * 1. If the request is sent from application to the remote
  50. * entity, then the action handle is allocated by the
  51. * application. On receipt of the response from the peer for the
  52. * same request, the stack will use the same action handle when
  53. * giving the confirmation to the application. <br>
  54. * 2. If the indication received from stack is to be sent to the
  55. * application, then the action handle is allocated by the stack.
  56. * The response sent by the application to the stack mus have the
  57. * same action handle as received in the indication.
  58. *
  59. * Note: The action handle can be different from the context id
  60. * when there are multiple action in the same transaction all
  61. * having context id as 'null' or 'choose' or '*'.
  62. * isLastActionInTxn - This parameter specifies whether the
  63. * action is last action in the transaction.
  64. * @param isLastActionInTxn
  65. *
  66. * @throws IllegalArgumentException
  67. * : This exception is raised if the value of transaction handle
  68. * or the action handle passed to this method is less than 0.
  69. */
  70. public ContextInfoResp(java.lang.Object source, int assocHandle, int txnHandle, int actionHandle, boolean isLastActionInTxn) throws IllegalArgumentException {
  71. super(source, assocHandle, txnHandle, actionHandle, false, isLastActionInTxn);
  72. if (txnHandle < 0 || actionHandle < 0) {
  73. IllegalArgumentException invalidArgumentException = new IllegalArgumentException("txnHandle or actionHandle cannot be less than 0 for ContextInfoResp");
  74. // invalidArgumentException.setAssocHandle(assocHandle);
  75. throw invalidArgumentException;
  76. }
  77. }
  78. @Override
  79. public int getCommandIdentifier() {
  80. return CommandType.M_ACTION_RESP;
  81. }
  82. }