/** * Notifies this instance that there was a change in the value of a property of an * <tt>Endpoint</tt> participating in this multipoint conference. * * @param endpoint the <tt>Endpoint</tt> which is the source of the event/notification and is * participating in this multipoint conference * @param ev a <tt>PropertyChangeEvent</tt> which specifies the source of the event/notification, * the name of the property and the old and new values of that property */ private void endpointPropertyChange(Endpoint endpoint, PropertyChangeEvent ev) { String propertyName = ev.getPropertyName(); boolean maybeRemoveEndpoint; if (Endpoint.SCTP_CONNECTION_PROPERTY_NAME.equals(propertyName)) { // The SctpConnection of/associated with an Endpoint has changed. We // may want to fire initial events over that SctpConnection (as soon // as it is ready). SctpConnection oldValue = (SctpConnection) ev.getOldValue(); SctpConnection newValue = (SctpConnection) ev.getNewValue(); endpointSctpConnectionChanged(endpoint, oldValue, newValue); // The SctpConnection may have expired. maybeRemoveEndpoint = (newValue == null); } else if (Endpoint.CHANNELS_PROPERTY_NAME.equals(propertyName)) { // An RtpChannel may have expired. maybeRemoveEndpoint = true; } else { maybeRemoveEndpoint = false; } if (maybeRemoveEndpoint) { // It looks like there is a chance that the Endpoint may have // expired. Endpoints are held by this Conference via WeakReferences // but WeakReferences are unpredictable. We have functionality // though which could benefit from discovering that an Endpoint has // expired as quickly as possible (e.g. ConferenceSpeechActivity). // Consequently, try to expedite the removal of expired Endpoints. if (endpoint.getSctpConnection() == null && endpoint.getChannelCount(null) == 0) { removeEndpoint(endpoint); } } }
/** * This method gets called when a property we're interested in is about to change. In case we * don't like the new value we throw a PropertyVetoException to prevent the actual change from * happening. * * @param evt a <tt>PropertyChangeEvent</tt> object describing the event source and the property * that will change. * @exception PropertyVetoException if we don't want the change to happen. */ public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if (evt.getPropertyName().equals(PROP_STUN_SERVER_ADDRESS)) { // make sure that we have a valid fqdn or ip address. // null or empty port is ok since it implies turning STUN off. if (evt.getNewValue() == null) return; String host = evt.getNewValue().toString(); if (host.trim().length() == 0) return; boolean ipv6Expected = false; if (host.charAt(0) == '[') { // This is supposed to be an IPv6 litteral if (host.length() > 2 && host.charAt(host.length() - 1) == ']') { host = host.substring(1, host.length() - 1); ipv6Expected = true; } else { // This was supposed to be a IPv6 address, but it's not! throw new PropertyVetoException("Invalid address string" + host, evt); } } for (int i = 0; i < host.length(); i++) { char c = host.charAt(i); if (Character.isLetterOrDigit(c)) continue; if ((c != '.' && c != ':') || (c == '.' && ipv6Expected) || (c == ':' && !ipv6Expected)) throw new PropertyVetoException(host + " is not a valid address nor host name", evt); } } // is prop_stun_server_address else if (evt.getPropertyName().equals(PROP_STUN_SERVER_PORT)) { // null or empty port is ok since it implies turning STUN off. if (evt.getNewValue() == null) return; String port = evt.getNewValue().toString(); if (port.trim().length() == 0) return; try { Integer.valueOf(evt.getNewValue().toString()); } catch (NumberFormatException ex) { throw new PropertyVetoException(port + " is not a valid port! " + ex.getMessage(), evt); } } }