com.sun.multicast.advertising
Class Advertisement

java.lang.Object
  |
  +--com.sun.multicast.advertising.Advertisement
All Implemented Interfaces:
java.lang.Cloneable

public class Advertisement
extends java.lang.Object
implements java.lang.Cloneable

An Advertisement object. This class is used for received as well as transmitted advertisements.


Constructor Summary
Advertisement(java.net.InetAddress address, int ttl)
          Creates an advertisement for an address and TTL.
 
Method Summary
 boolean addAdvertisementChangeListener(AdvertisementChangeListener changeListener)
          Adds a listener for any change in this Advertisement.
 void addAttribute(java.lang.String s)
          adds an attribute to this Advertisement.
 java.lang.Object clone()
          Clones this Advertisement object
 java.net.InetAddress getAdvertisedAddress()
          gets the advertised address.
 int getAdvertisedTTL()
          gets the advertised TTL.
 long getAdvertisementCount()
          Returns the number of times the Advertisement has been transmitted
 java.util.Date getAdvertisementTimestamp()
          Returns the Date of the last transmission of this Advertisement
 java.lang.String[] getAttributes()
          gets the global attributes of the session.
 int getBandwidth()
          gets the session bandwidth.
 int getCurrentAdvertisementInterval()
          Returns the number of seconds between the last two transmissions of this Advertisement
 java.lang.String getEMailAddress()
          gets the email address of the owner.
 java.util.Date getEndTime()
          gets the end time of the session.
 long getId()
          gets the session id.
 java.lang.String getInfo()
          gets the session description.
 java.util.Date getLastTime()
          gets the time the announcement of this session was heard.
 com.sun.multicast.advertising.Media[] getMedia()
          gets the array of media.
 java.lang.String getName()
          gets the session name.
 java.net.InetAddress getOriginAddress()
          gets the address of the announcer.
 java.lang.String getOwner()
          gets the owner name.
 java.lang.String getPhone()
          gets the phone number of the owner.
 java.util.Date getStartTime()
          gets the start time of the session.
 java.lang.String getUrl()
          gets the url.
 long getVersion()
          gets the version.
 boolean removeAdvertisementChangeListener(AdvertisementChangeListener changeListener)
          Removes a listener for any change in this Advertisement.
 void removeAttribute(java.lang.String s)
          removes an attribute.
 void setAdvertisedAddress(java.net.InetAddress address)
          sets the advertised address.
 void setAdvertisedAddress(java.lang.String addrString)
          sets the advertised address.
 void setAdvertisedTTL(int ttl)
          sets the advertised TTL.
 void setBandwidth(int bwidth)
          sets the session bandwidth.
 void setEMailAddress(java.lang.String s)
          sets the owner email address.
 void setEndTime(java.util.Date end)
          sets the end time of the session.
 void setEndTime(long end)
          sets the end time of the session.
 void setId(long id)
          sets the id.
 void setInfo(java.lang.String s)
          sets the session description.
 void setMedia(com.sun.multicast.advertising.Media media)
          adds a media entry.
 void setName(java.lang.String s)
          sets the session name.
 void setOriginAddress(java.net.InetAddress addr)
          sets the originator address.
 void setOriginAddress(java.lang.String addrString)
          sets the originator address.
 void setOwner(java.lang.String s)
          sets the owner name.
 void setPhone(java.lang.String s)
          sets the owner phone number.
 void setStartTime(java.util.Date start)
          sets the start time of the session.
 void setStartTime(long start)
          sets the start time of the session.
 void setUrl(java.lang.String s)
          sets the url associated with the session.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Advertisement

public Advertisement(java.net.InetAddress address,
                     int ttl)
              throws java.net.UnknownHostException
Creates an advertisement for an address and TTL.
Parameters:
address - the multicast address to advertise
ttl - the time-to-live to use in the Advertisement
Method Detail

getAdvertisementCount

public long getAdvertisementCount()
Returns the number of times the Advertisement has been transmitted
Returns:
the number of times the Advertisement has been transmitted

getCurrentAdvertisementInterval

public int getCurrentAdvertisementInterval()
Returns the number of seconds between the last two transmissions of this Advertisement
Returns:
the number of seconds between the last two transmissions of this Advertisement

getAdvertisementTimestamp

public java.util.Date getAdvertisementTimestamp()
Returns the Date of the last transmission of this Advertisement
Returns:
the timestamp of the last transmission of this Advertisement

addAdvertisementChangeListener

public boolean addAdvertisementChangeListener(AdvertisementChangeListener changeListener)
Adds a listener for any change in this Advertisement.
Parameters:
changelistener - an instance of AdvertisementChangeListener
Returns:
true if the Advertisement exists; false otherwise

removeAdvertisementChangeListener

public boolean removeAdvertisementChangeListener(AdvertisementChangeListener changeListener)
Removes a listener for any change in this Advertisement.
Parameters:
changelistener - an instance of AdvertisementChangeListener
Returns:
true if the Advertisement exists; false otherwise

clone

public java.lang.Object clone()
Clones this Advertisement object
Overrides:
clone in class java.lang.Object

getId

public long getId()
gets the session id.
Returns:
the id for the session

getVersion

public long getVersion()
gets the version.
Returns:
the version of the announcement

getOriginAddress

public java.net.InetAddress getOriginAddress()
gets the address of the announcer.
Returns:
the address of the source of the announcement

getOwner

public java.lang.String getOwner()
gets the owner name.
Returns:
the owner of the session

getName

public java.lang.String getName()
gets the session name.
Returns:
the name of the session

getInfo

public java.lang.String getInfo()
gets the session description.
Returns:
the session description

getUrl

public java.lang.String getUrl()
gets the url.
Returns:
the url for the session

getEMailAddress

public java.lang.String getEMailAddress()
gets the email address of the owner.
Returns:
email the e-mail address of the originator

getPhone

public java.lang.String getPhone()
gets the phone number of the owner.
Returns:
the phone number of the originator

getStartTime

public java.util.Date getStartTime()
gets the start time of the session.
Returns:
the start time of the session

getEndTime

public java.util.Date getEndTime()
gets the end time of the session.
Returns:
the end time of the session

getBandwidth

public int getBandwidth()
gets the session bandwidth.
Returns:
the session bandwidth

getAttributes

public java.lang.String[] getAttributes()
gets the global attributes of the session.
Returns:
an array of attributes for the session

getLastTime

public java.util.Date getLastTime()
gets the time the announcement of this session was heard.
Returns:
the last time an announcement was heard for the session

getAdvertisedAddress

public java.net.InetAddress getAdvertisedAddress()
gets the advertised address.

getAdvertisedTTL

public int getAdvertisedTTL()
gets the advertised TTL.
Returns:
the time-to-live to be used with the session address

getMedia

public com.sun.multicast.advertising.Media[] getMedia()
gets the array of media.
Returns:
array of media objects

setId

public void setId(long id)
sets the id.
Parameters:
id - session id.

setOriginAddress

public void setOriginAddress(java.net.InetAddress addr)
sets the originator address.
Parameters:
addr - InetAddress of the originator.

setOriginAddress

public void setOriginAddress(java.lang.String addrString)
                      throws java.net.UnknownHostException
sets the originator address.
Parameters:
address - IP address of the originator.

setOwner

public void setOwner(java.lang.String s)
sets the owner name.
Parameters:
s - owner name.

setName

public void setName(java.lang.String s)
sets the session name.
Parameters:
s - session name.

setInfo

public void setInfo(java.lang.String s)
sets the session description.
Parameters:
s - info about the session.

setUrl

public void setUrl(java.lang.String s)
sets the url associated with the session.
Parameters:
s - url associated with the session.

setEMailAddress

public void setEMailAddress(java.lang.String s)
sets the owner email address.
Parameters:
s - email address.

setPhone

public void setPhone(java.lang.String s)
sets the owner phone number.
Parameters:
s - phone number.

setStartTime

public void setStartTime(java.util.Date start)
sets the start time of the session.
Parameters:
start - start time.

setStartTime

public void setStartTime(long start)
sets the start time of the session.
Parameters:
start - start time (NTP time).

setEndTime

public void setEndTime(java.util.Date end)
sets the end time of the session.
Parameters:
end - end time.

setEndTime

public void setEndTime(long end)
sets the end time of the session.
Parameters:
end - end time (NTP time).

setBandwidth

public void setBandwidth(int bwidth)
sets the session bandwidth.
Parameters:
bwidth - the bandwidth of the session

addAttribute

public void addAttribute(java.lang.String s)
adds an attribute to this Advertisement.
Parameters:
s - session attribute to add

removeAttribute

public void removeAttribute(java.lang.String s)
removes an attribute.
Parameters:
s - session attribute to remove

setAdvertisedAddress

public void setAdvertisedAddress(java.net.InetAddress address)
sets the advertised address.
Parameters:
address - advertised address

setAdvertisedAddress

public void setAdvertisedAddress(java.lang.String addrString)
                          throws java.net.UnknownHostException
sets the advertised address.
Parameters:
addrString - advertised address

setAdvertisedTTL

public void setAdvertisedTTL(int ttl)
sets the advertised TTL.
Parameters:
ttl - time-to-live for this Advertisement

setMedia

public void setMedia(com.sun.multicast.advertising.Media media)
adds a media entry.
Parameters:
media - Media object


JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.