/* * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.java.sip.communicator.service.protocol; import net.java.sip.communicator.util.*; /** * Provides the default implementation of the ConferenceMember * interface. * * @author Lubomir Marinov * @author Yana Stamcheva * @author Emil Ivov */ public class AbstractConferenceMember extends PropertyChangeNotifier implements ConferenceMember { /** * The CallPeer which is the conference focus of this * ConferenceMember. */ private final CallPeer conferenceFocusCallPeer; /** * The user-friendly display name of this ConferenceMember in * the conference. */ private String displayName; /** * The protocol address of this ConferenceMember. */ private String address; /** * The state of the device and signaling session of this * ConferenceMember in the conference. */ private ConferenceMemberState state = ConferenceMemberState.UNKNOWN; /** * The SSRC value if transmitted by the focus of the conference. */ private long ssrc = -1; /** * Creates an instance of AbstractConferenceMember by specifying * the corresponding conferenceFocusCallPeer, to which this member * is connected. * @param conferenceFocusCallPeer the CallPeer to which this member * is connected * @param address the protocol address of this ConferenceMember */ public AbstractConferenceMember(CallPeer conferenceFocusCallPeer, String address) { this.conferenceFocusCallPeer = conferenceFocusCallPeer; if (address == null) throw new NullPointerException("address"); this.address = address; } /** * Returns the CallPeer, to which this member is connected. * Implements ConferenceMember#getConferenceFocusCallPeer(). * @return the CallPeer, to which this member is connected */ public CallPeer getConferenceFocusCallPeer() { return conferenceFocusCallPeer; } /** * Returns the display name of this conference member. Implements * ConferenceMember#getDisplayName(). * @return the display name of this conference member */ public String getDisplayName() { return displayName; } /** * Returns the state of this conference member. Implements * ConferenceMember#getState(). * @return the state of this conference member */ public ConferenceMemberState getState() { return state; } /** * Returns the protocol address of this ConferenceMember. * * @return the protocol address of this ConferenceMember */ public String getAddress() { return address; } /** * Sets the user-friendly display name of this ConferenceMember * in the conference and fires a new PropertyChangeEvent for * the property #DISPLAY_NAME_PROPERTY_NAME. * * @param displayName * the user-friendly display name of this * ConferenceMember in the conference */ public void setDisplayName(String displayName) { if (((this.displayName == null) && (displayName != null)) || ((this.displayName != null) && !this.displayName.equals(displayName))) { String oldValue = this.displayName; this.displayName = displayName; firePropertyChange( DISPLAY_NAME_PROPERTY_NAME, oldValue, this.displayName); } } /** * Sets the state of the device and signaling session of this * ConferenceMember in the conference and fires a new * PropertyChangeEvent for the property * #STATE_PROPERTY_NAME. * * @param state * the state of the device and signaling session of this * ConferenceMember in the conference */ public void setState(ConferenceMemberState state) { if (this.state != state) { ConferenceMemberState oldValue = this.state; this.state = state; firePropertyChange(STATE_PROPERTY_NAME, oldValue, this.state); } } /** * Returns the SSRC value associated with this participant; * * @return the ssrc */ public long getSSRC() { return ssrc; } /** * Sets the SSRC identifier of this member. * * @param ssrc the SSRC ID to set for this member. */ public void setSSRC(long ssrc) { this.ssrc = ssrc; } }