PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 88 lines | 31 code | 10 blank | 47 comment | 6 complexity | 72a51d5b1e4c94cd9ed7c6e2fe050ee3 MD5 | raw file
 1package javax.megaco.message.descriptor;
 2
 3
 4import javax.megaco.message.Descriptor;
 5import javax.megaco.message.DescriptorType;
 6import javax.megaco.message.Termination;
 7
 8/**
 9 * The class extends JAIN MEGACO Descriptor. This class describes the topology
10 * descriptor.
11 */
12public class TopologyDescriptor extends Descriptor {
13
14	private Termination termA = null;
15	private Termination termB = null;
16	private TopologyDirection topologyDirect = null;
17
18	/**
19	 * Constructs a Topology Descriptor with the mandatory parameters of the
20	 * termination-A, termination-B and the topology direction between these
21	 * terminations.
22	 * 
23	 * @param termA
24	 *            - This specifies an object identifier for the termination A.
25	 * @param termB
26	 *            - This specifies an object identifier for the termination B.
27	 * @param topologyDirect
28	 *            - This specifies topology direction between the terminations.
29	 * @throws IllegalArgumentException
30	 *             : This exception is raised if the reference of either of
31	 *             Termination Ids or the Topology Direction passed to this
32	 *             method is NULL.
33	 */
34	public TopologyDescriptor(Termination termA, Termination termB, TopologyDirection topologyDirect) throws IllegalArgumentException {
35		if (termA == null || termB == null || topologyDirect == null) {
36			IllegalArgumentException invalidArgumentException = new IllegalArgumentException("None of Termination A,b and TopologyDirection can be null");
37			throw invalidArgumentException;
38		}
39
40		this.termA = termA;
41		this.termB = termB;
42		this.topologyDirect = topologyDirect;
43		super.descriptorId = DescriptorType.M_TOPOLOGY_DESC;
44	}
45
46	/**
47	 * This method cannot be overridden by the derived class. This method
48	 * returns that the descriptor identifier is of type Topology descriptor.
49	 * This method overrides the corresponding method of the base class
50	 * Descriptor.
51	 * 
52	 * @return Returns an integer value that identifies this object as the type
53	 *         of topology descriptor. It returns that it is Topology Descriptor
54	 *         i.e., M_TOPOLOGY_DESC.
55	 */
56	public final int getDescriptorId() {
57		return super.descriptorId;
58	}
59
60	/**
61	 * This method retrieves the termination A set in the topology descriptor.
62	 * 
63	 * @return Returns the termination A for the topology.
64	 */
65	public Termination getTermA() {
66		return this.termA;
67	}
68
69	/**
70	 * This method retrieves the termination B set in the topology descriptor.
71	 * 
72	 * @return Returns the termination B for the topology.
73	 */
74	public Termination getTermB() {
75		return this.termB;
76	}
77
78	/**
79	 * This method retrieves the integer value of the topology direction set in
80	 * the topology descriptor.
81	 * 
82	 * @return Returns the integer value for the topology direction. It can take
83	 *         only the values set in TopologyDirection
84	 */
85	public int getTopologyDirection() {
86		return this.topologyDirect.getTopologyDirection();
87	}
88}