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

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