NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sdp
Class SessionDescriptionImpl

java.lang.Object
  extended by gov.nist.javax.sdp.SessionDescriptionImpl
All Implemented Interfaces:
Serializable, Cloneable, SessionDescription

public class SessionDescriptionImpl
extends Object
implements SessionDescription

Implementation of the SessionDescription interface.

Version:
JSR141-PUBLIC-REVIEW
Author:
Olivier Deruelle, M. Ranganathan
See Also:
Serialized Form

Constructor Summary
SessionDescriptionImpl()
          Creates new SessionDescriptionImpl
SessionDescriptionImpl(SessionDescription otherSessionDescription)
          Copy constructor, creates a deep copy of another SessionDescription.
 
Method Summary
 void addField(SDPField sdpField)
           
 Object clone()
          Creates and returns a deep copy of this object
 String getAttribute(String name)
          Returns the value of the specified attribute.
 Vector getAttributes(boolean create)
          Returns the set of attributes for this Description as a Vector of Attribute objects in the order they were parsed.
 int getBandwidth(String name)
          Returns the integer value of the specified bandwidth name.
 Vector getBandwidths(boolean create)
          Returns the Bandwidth of the specified type.
 Connection getConnection()
          Returns the connection information associated with this object.
 Vector getEmails(boolean create)
          Returns an email address to contact for further information about the session.
 Info getInfo()
          Returns value of the info field (i=) of this object.
 Key getKey()
          Returns the key data.
 Vector getMediaDescriptions(boolean create)
          Adds a MediaDescription to the session description.
 Origin getOrigin()
          Returns information about the originator of the session.
 Vector getPhones(boolean create)
          Returns a phone number to contact for further information about the session.
 SessionName getSessionName()
          Returns the name of the session.
 Vector getTimeDescriptions(boolean create)
          Returns a TimeField indicating the start, stop, repetition and time zone information of the session.
 URI getURI()
          Returns a uri to the location of more details about the session.
 Version getVersion()
          Returns the version of SDP in use.
 Vector getZoneAdjustments(boolean create)
          Returns the time zone adjustments for the Session
 void removeAttribute(String name)
          Removes the attribute specified by the value parameter.
 void removeBandwidth(String name)
          Removes the specified bandwidth type.
 void setAttribute(String name, String value)
          Sets the value of the specified attribute.
 void setAttributes(Vector attributes)
          Adds the specified Attribute to this Description object.
 void setBandwidth(String name, int value)
          Sets the value of the specified bandwidth type.
 void setBandwidths(Vector bandwidthList)
          set the value of the Bandwidth with the specified type.
 void setConnection(Connection conn)
          Set the connection data for this entity.
 void setEmails(Vector emails)
          Sets a an email address to contact for further information about the session.
 void setInfo(Info i)
          Sets the i= field of this object.
 void setKey(Key key)
          Sets encryption key information.
 void setMediaDescriptions(Vector mediaDescriptions)
          Removes all MediaDescriptions from the session description.
 void setOrigin(Origin origin)
          Sets information about the originator of the session.
 void setPhones(Vector phones)
          Sets a phone number to contact for further information about the session.
 void setSessionName(SessionName sessionName)
          Sets the name of the session.
 void setTimeDescriptions(Vector times)
          Sets a TimeField indicating the start, stop, repetition and time zone information of the session.
 void setURI(URI uri)
          Sets the uri to the location of more details about the session.
 void setVersion(Version v)
          Sets the version of SDP in use.
 void setZoneAdjustments(Vector zoneAdjustments)
          Sets the time zone adjustment for the TimeField.
 String toString()
          Returns the canonical string representation of the current SessionDescrption.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SessionDescriptionImpl

public SessionDescriptionImpl()
Creates new SessionDescriptionImpl


SessionDescriptionImpl

public SessionDescriptionImpl(SessionDescription otherSessionDescription)
                       throws SdpException
Copy constructor, creates a deep copy of another SessionDescription.

Parameters:
otherSessionDescription - - the SessionDescription to copy from.
Throws:
SdpException - - if there is a problem constructing the SessionDescription.
Method Detail

addField

public void addField(SDPField sdpField)
              throws ParseException
Throws:
ParseException

clone

public Object clone()
             throws CloneNotSupportedException
Creates and returns a deep copy of this object

Specified by:
clone in interface SessionDescription
Overrides:
clone in class Object
Returns:
a clone of this instance.
Throws:
CloneNotSupportedException - if this instance cannot be cloned.

getVersion

public Version getVersion()
Returns the version of SDP in use. This corresponds to the v= field of the SDP data.

Specified by:
getVersion in interface SessionDescription
Returns:
the integer version (-1 if not set).

setVersion

public void setVersion(Version v)
                throws SdpException
Sets the version of SDP in use. This corresponds to the v= field of the SDP data.

Specified by:
setVersion in interface SessionDescription
Parameters:
v - version - the integer version.
Throws:
SdpException - if the version is null

getOrigin

public Origin getOrigin()
Returns information about the originator of the session. This corresponds to the o= field of the SDP data.

Specified by:
getOrigin in interface SessionDescription
Returns:
the originator data.

setOrigin

public void setOrigin(Origin origin)
               throws SdpException
Sets information about the originator of the session. This corresponds to the o= field of the SDP data.

Specified by:
setOrigin in interface SessionDescription
Parameters:
origin - origin - the originator data.
Throws:
SdpException - if the origin is null

getSessionName

public SessionName getSessionName()
Returns the name of the session. This corresponds to the s= field of the SDP data.

Specified by:
getSessionName in interface SessionDescription
Returns:
the session name.

setSessionName

public void setSessionName(SessionName sessionName)
                    throws SdpException
Sets the name of the session. This corresponds to the s= field of the SDP data.

Specified by:
setSessionName in interface SessionDescription
Parameters:
sessionName - name - the session name.
Throws:
SdpException - if the sessionName is null

getInfo

public Info getInfo()
Returns value of the info field (i=) of this object.

Specified by:
getInfo in interface SessionDescription
Returns:
info

setInfo

public void setInfo(Info i)
             throws SdpException
Sets the i= field of this object.

Specified by:
setInfo in interface SessionDescription
Parameters:
i - s - new i= value; if null removes the field
Throws:
SdpException - if the info is null

getURI

public URI getURI()
Returns a uri to the location of more details about the session. This corresponds to the u= field of the SDP data.

Specified by:
getURI in interface SessionDescription
Returns:
the uri.

setURI

public void setURI(URI uri)
            throws SdpException
Sets the uri to the location of more details about the session. This corresponds to the u= field of the SDP data.

Specified by:
setURI in interface SessionDescription
Parameters:
uri - uri - the uri.
Throws:
SdpException - if the uri is null

getEmails

public Vector getEmails(boolean create)
                 throws SdpParseException
Returns an email address to contact for further information about the session. This corresponds to the e= field of the SDP data.

Specified by:
getEmails in interface SessionDescription
Parameters:
create - boolean to set
Returns:
the email address.
Throws:
SdpParseException

setEmails

public void setEmails(Vector emails)
               throws SdpException
Sets a an email address to contact for further information about the session. This corresponds to the e= field of the SDP data.

Specified by:
setEmails in interface SessionDescription
Parameters:
emails - email - the email address.
Throws:
SdpException - if the vector is null

getPhones

public Vector getPhones(boolean create)
                 throws SdpException
Returns a phone number to contact for further information about the session. This corresponds to the p= field of the SDP data.

Specified by:
getPhones in interface SessionDescription
Parameters:
create - boolean to set
Returns:
the phone number.
Throws:
SdpException

setPhones

public void setPhones(Vector phones)
               throws SdpException
Sets a phone number to contact for further information about the session. This corresponds to the p= field of the SDP data.

Specified by:
setPhones in interface SessionDescription
Parameters:
phones - phone - the phone number.
Throws:
SdpException - if the vector is null

getTimeDescriptions

public Vector getTimeDescriptions(boolean create)
                           throws SdpException
Returns a TimeField indicating the start, stop, repetition and time zone information of the session. This corresponds to the t= field of the SDP data.

Specified by:
getTimeDescriptions in interface SessionDescription
Parameters:
create - boolean to set
Returns:
the Time Field.
Throws:
SdpException

setTimeDescriptions

public void setTimeDescriptions(Vector times)
                         throws SdpException
Sets a TimeField indicating the start, stop, repetition and time zone information of the session. This corresponds to the t= field of the SDP data.

Specified by:
setTimeDescriptions in interface SessionDescription
Parameters:
times - time - the TimeField.
Throws:
SdpException - if the vector is null

getZoneAdjustments

public Vector getZoneAdjustments(boolean create)
                          throws SdpException
Returns the time zone adjustments for the Session

Specified by:
getZoneAdjustments in interface SessionDescription
Parameters:
create - boolean to set
Returns:
a Hashtable containing the zone adjustments, where the key is the Adjusted Time Zone and the value is the offset.
Throws:
SdpException

setZoneAdjustments

public void setZoneAdjustments(Vector zoneAdjustments)
                        throws SdpException
Sets the time zone adjustment for the TimeField.

Specified by:
setZoneAdjustments in interface SessionDescription
Parameters:
zoneAdjustments - zoneAdjustments - a Hashtable containing the zone adjustments, where the key is the Adjusted Time Zone and the value is the offset.
Throws:
SdpException - if the vector is null

getConnection

public Connection getConnection()
Returns the connection information associated with this object. This may be null for SessionDescriptions if all Media objects have a connection object and may be null for Media objects if the corresponding session connection is non-null.

Specified by:
getConnection in interface SessionDescription
Returns:
connection

setConnection

public void setConnection(Connection conn)
                   throws SdpException
Set the connection data for this entity.

Specified by:
setConnection in interface SessionDescription
Parameters:
conn - to set
Throws:
SdpException - if the parameter is null

getBandwidths

public Vector getBandwidths(boolean create)
Returns the Bandwidth of the specified type.

Specified by:
getBandwidths in interface SessionDescription
Parameters:
create - type - type of the Bandwidth to return
Returns:
the Bandwidth or null if undefined

setBandwidths

public void setBandwidths(Vector bandwidthList)
                   throws SdpException
set the value of the Bandwidth with the specified type.

Specified by:
setBandwidths in interface SessionDescription
Parameters:
bandwidthList - to set
Throws:
SdpException - if the vector is null

getBandwidth

public int getBandwidth(String name)
                 throws SdpParseException
Returns the integer value of the specified bandwidth name.

Specified by:
getBandwidth in interface SessionDescription
Parameters:
name - name - the name of the bandwidth type
Returns:
the value of the named bandwidth
Throws:
SdpParseException

setBandwidth

public void setBandwidth(String name,
                         int value)
                  throws SdpException
Sets the value of the specified bandwidth type.

Specified by:
setBandwidth in interface SessionDescription
Parameters:
name - name - the name of the bandwidth type.
value - value - the value of the named bandwidth type.
Throws:
SdpException - if the name is null

removeBandwidth

public void removeBandwidth(String name)
Removes the specified bandwidth type.

Specified by:
removeBandwidth in interface SessionDescription
Parameters:
name - name - the name of the bandwidth type

getKey

public Key getKey()
Returns the key data.

Specified by:
getKey in interface SessionDescription
Returns:
key

setKey

public void setKey(Key key)
            throws SdpException
Sets encryption key information. This consists of a method and an encryption key included inline.

Specified by:
setKey in interface SessionDescription
Parameters:
key - key - the encryption key data; depending on method may be null
Throws:
SdpException - if the parameter is null

getAttribute

public String getAttribute(String name)
                    throws SdpParseException
Returns the value of the specified attribute.

Specified by:
getAttribute in interface SessionDescription
Parameters:
name - name - the name of the attribute
Returns:
the value of the named attribute
Throws:
SdpParseException

getAttributes

public Vector getAttributes(boolean create)
Returns the set of attributes for this Description as a Vector of Attribute objects in the order they were parsed.

Specified by:
getAttributes in interface SessionDescription
Parameters:
create - create - specifies whether to return null or a new empty Vector in case no attributes exists for this Description
Returns:
attributes for this Description

removeAttribute

public void removeAttribute(String name)
Removes the attribute specified by the value parameter.

Specified by:
removeAttribute in interface SessionDescription
Parameters:
name - name - the name of the attribute

setAttribute

public void setAttribute(String name,
                         String value)
                  throws SdpException
Sets the value of the specified attribute.

Specified by:
setAttribute in interface SessionDescription
Parameters:
name - name - the name of the attribute.
value - value - the value of the named attribute.
Throws:
SdpException - if the name or the value is null

setAttributes

public void setAttributes(Vector attributes)
                   throws SdpException
Adds the specified Attribute to this Description object.

Specified by:
setAttributes in interface SessionDescription
Parameters:
attributes - - the attribute to add
Throws:
SdpException - if the vector is null

getMediaDescriptions

public Vector getMediaDescriptions(boolean create)
                            throws SdpException
Adds a MediaDescription to the session description. These correspond to the m= fields of the SDP data.

Specified by:
getMediaDescriptions in interface SessionDescription
Parameters:
create - boolean to set
Returns:
media - the field to add.
Throws:
SdpException

setMediaDescriptions

public void setMediaDescriptions(Vector mediaDescriptions)
                          throws SdpException
Removes all MediaDescriptions from the session description.

Specified by:
setMediaDescriptions in interface SessionDescription
Parameters:
mediaDescriptions - to set
Throws:
SdpException - if the parameter is null

toString

public String toString()
Returns the canonical string representation of the current SessionDescrption. Acknowledgement - this code was contributed by Emil Ivov.

Overrides:
toString in class Object
Returns:
Returns the canonical string representation of the current SessionDescrption.

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.