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

http://mobicents.googlecode.com/ · Java · 111 lines · 31 code · 17 blank · 63 comment · 4 complexity · 1cf829b86d014259454b783d72829054 MD5 · raw file

  1. package javax.megaco.message.descriptor;
  2. import java.io.Serializable; //FIXME: this requires JSIP
  3. import javax.sdp.SessionDescription;
  4. /**
  5. * The SDPInfo object is a class that shall be used to set the Media
  6. * description, Session Description and Time description of the SDP. These would
  7. * be defined in javax.sdp package. This is an independent class derived from
  8. * java.util.Object and shall not have any derived classes.
  9. */
  10. public class SDPInfo implements Serializable {
  11. private SessionDescription sessionDescription = null;
  12. private String sessionDescStr = null;
  13. /**
  14. * Constructs an object of type megaco SDP info which shall be used within
  15. * the media descriptor to set the local and remote descriptor.
  16. */
  17. public SDPInfo() {
  18. }
  19. /**
  20. * The method is used to get the session description of the SDP which would
  21. * be set in local or remote descriptor. In an SDP this information
  22. * necessarily needs to be set.
  23. *
  24. * @return session - The reference to the object corresponding to the
  25. * session description. If the session description is not set then
  26. * it shall return a null value.
  27. */
  28. public SessionDescription getSessionDescription() {
  29. return this.sessionDescription;
  30. }
  31. /**
  32. * The method can be used to set the session description within an SDP for
  33. * local/remote descriptor.
  34. *
  35. * @param session
  36. * - The reference to the object corresponding to the session
  37. * description.
  38. * @throws IllegalArgumentException
  39. * - Thrown if parameters set in the session description are
  40. * such that the object cannot be set for the local/remote
  41. * descriptor.
  42. * @throws javax.megaco.ParamNotSupportedException
  43. * - Thrown if parameters set in the session description are
  44. * such that they are not supported.
  45. */
  46. public void setSessionDescription(SessionDescription session) throws IllegalArgumentException, javax.megaco.ParamNotSupportedException {
  47. // FIXME: add checks
  48. if (session == null) {
  49. throw new IllegalArgumentException("SessionDescription must not be null.");
  50. }
  51. this.sessionDescription = session;
  52. }
  53. /**
  54. * The method is used to get the session description of the SDP which would
  55. * be set in local or remote descriptor. The SDP info returned is in the
  56. * string format. The applications may use this method if it is not
  57. * concerned with the parameters contained in the SDP info. The SDP string
  58. * obtained may be processed later or may be tunnelled to the other layer
  59. * for processing.
  60. *
  61. * @return session - The reference to the object corresponding to the
  62. * session description string. If the session description string is
  63. * not set then it shall return a null value.
  64. */
  65. public java.lang.String getSessionDescStr() {
  66. return this.sessionDescStr;
  67. }
  68. /**
  69. * The method can be used to set the session description string within an
  70. * SDP for local/remote descriptor. The applications may use this method in
  71. * case it has pre-encoded SDP string with itself. The pre-encoded SDP
  72. * string may be obtained either at the time of configuration of the
  73. * application or may be obtained in the commands exchanged for the call.
  74. * The SDP info string as set in this method must be in the format as
  75. * defined by the RFC 2327 for IN SDP and RFC 3018 for ATM SDP.
  76. *
  77. * @param session
  78. * - The reference to the object corresponding to the session
  79. * description string.
  80. * @throws IllegalArgumentException
  81. * This exception is raised if the reference of session
  82. * description string passed to this method is NULL.
  83. */
  84. public void setSessionDescStr(java.lang.String session)
  85. throws IllegalArgumentException {
  86. if (session == null) {
  87. throw new IllegalArgumentException("SessionDescription must not be null.");
  88. }
  89. this.sessionDescStr = session;
  90. }
  91. public java.lang.String toString() {
  92. return super.toString();
  93. }
  94. }