/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

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