Moves ID attribute to ChannelCommon class, so that it can be reused by SctpConnection.

fix-message-formatting
paweldomas 11 years ago
parent 600b658216
commit ab08cd7a00

@ -87,7 +87,7 @@ public ColibriConferenceIQ()
/**
* Adds a specific {@link Content} instance to the list of <tt>Content</tt>
* instances included into this <tt>conference</tt> IQ.
* @param the <tt>ChannelBundle</tt> to add.
* @param channelBundle the <tt>ChannelBundle</tt> to add.
*/
public boolean addChannelBundle(ChannelBundle channelBundle)
{
@ -367,14 +367,6 @@ public static class Channel
@Deprecated
public static final String HOST_ATTR_NAME = "host";
/**
* The XML name of the <tt>id</tt> attribute of a <tt>channel</tt> of a
* <tt>content</tt> of a <tt>conference</tt> IQ which represents the
* value of the <tt>id</tt> property of
* <tt>ColibriConferenceIQ.Channel</tt>.
*/
public static final String ID_ATTR_NAME = "id";
/**
* The XML name of the <tt>last-n</tt> attribute of a video
* <tt>channel</tt> which specifies the maximum number of video RTP
@ -443,11 +435,6 @@ public static class Channel
@Deprecated
private String host;
/**
* The ID of the <tt>channel</tt> represented by this instance.
*/
private String id;
/**
* The maximum number of video RTP streams to be sent from Jitsi
* Videobridge to the endpoint associated with this video
@ -645,16 +632,6 @@ public String getHost()
return host;
}
/**
* Gets the ID of the <tt>channel</tt> represented by this instance.
*
* @return the ID of the <tt>channel</tt> represented by this instance
*/
public String getID()
{
return id;
}
/**
* Gets the maximum number of video RTP streams to be sent from Jitsi
* Videobridge to the endpoint associated with this video
@ -818,15 +795,6 @@ protected void printAttributes(StringBuilder xml)
.append('\'');
}
// id
String id = getID();
if (id != null)
{
xml.append(' ').append(ID_ATTR_NAME).append("='").append(id)
.append('\'');
}
// lastN
Integer lastN = getLastN();
@ -996,16 +964,6 @@ public void setHost(String host)
this.host = host;
}
/**
* Sets the ID of the <tt>channel</tt> represented by this instance.
*
* @param id the ID of the <tt>channel</tt> represented by this instance
*/
public void setID(String id)
{
this.id = id;
}
/**
* Sets the maximum number of video RTP streams to be sent from Jitsi
* Videobridge to the endpoint associated with this video
@ -1243,6 +1201,14 @@ public static abstract class ChannelCommon
*/
public static final int EXPIRE_NOT_SPECIFIED = -1;
/**
* The XML name of the <tt>id</tt> attribute of a <tt>channel</tt> of a
* <tt>content</tt> of a <tt>conference</tt> IQ which represents the
* value of the <tt>id</tt> property of
* <tt>ColibriConferenceIQ.Channel</tt>.
*/
public static final String ID_ATTR_NAME = "id";
/**
* The XML name of the <tt>initiator</tt> attribute of a
* <tt>channel</tt> of a <tt>content</tt> of a <tt>conference</tt> IQ
@ -1273,6 +1239,11 @@ public static abstract class ChannelCommon
*/
private int expire = EXPIRE_NOT_SPECIFIED;
/**
* The ID of the <tt>channel</tt> represented by this instance.
*/
private String id;
/**
* The indicator which determines whether the conference focus is the
* initiator/offerer (as opposed to the responder/answerer) of the media
@ -1326,6 +1297,16 @@ public int getExpire()
return expire;
}
/**
* Gets the ID of the <tt>channel</tt> represented by this instance.
*
* @return the ID of the <tt>channel</tt> represented by this instance
*/
public String getID()
{
return id;
}
public IceUdpTransportPacketExtension getTransport()
{
return transport;
@ -1416,6 +1397,16 @@ public void setExpire(int expire)
this.expire = expire;
}
/*
* Sets the ID of the <tt>channel</tt> represented by this instance.
*
* @param id the ID of the <tt>channel</tt> represented by this instance
*/
public void setID(String id)
{
this.id = id;
}
/**
* Sets the indicator which determines whether the conference focus is
* the initiator/offerer (as opposed to the responder/answerer) of the
@ -1467,6 +1458,15 @@ public void toXML(StringBuilder xml)
.append(expire).append('\'');
}
// id
String id = getID();
if (id != null)
{
xml.append(' ').append(ID_ATTR_NAME).append("='")
.append(id).append('\'');
}
// initiator
Boolean initiator = isInitiator();
@ -1636,6 +1636,21 @@ public Channel getChannel(String channelID)
return null;
}
/**
* Finds an SCTP connection identified by given <tt>connectionID</tt>.
* @param connectionID the ID of the SCTP connection to find.
* @return <tt>SctpConnection</tt> instance identified by given ID
* or <tt>null</tt> if no such connection is contained in
* this IQ.
*/
public SctpConnection getSctpConnection(String connectionID)
{
for (SctpConnection conn : getSctpConnections())
if (connectionID.equals(conn.getID()))
return conn;
return null;
}
/**
* Gets the number of <tt>Channel</tt>s included into/associated with
* this <tt>Content</tt>.
@ -1744,6 +1759,17 @@ public void toXML(StringBuilder xml)
xml.append("</").append(ELEMENT_NAME).append('>');
}
}
/**
* Removes given SCTP connection from this IQ.
* @param connection the SCTP connection instance to be removed.
* @return <tt>true</tt> if given <tt>connection</tt> was contained in
* this IQ and has been removed successfully.
*/
public boolean removeSctpConnection(SctpConnection connection)
{
return sctpConnections.remove(connection);
}
}
/**

@ -199,7 +199,9 @@ else if (ColibriConferenceIQ.Channel.ELEMENT_NAME.equals(
else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
.equals(name))
{
if (sctpConnection != null)
content.addSctpConnection(sctpConnection);
sctpConnection = null;
}
else if (ColibriConferenceIQ.Endpoint.ELEMENT_NAME
@ -450,19 +452,27 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
ColibriConferenceIQ.
SctpConnection.ENDPOINT_ATTR_NAME);
if(!StringUtils.isNullOrEmpty(endpoint))
// id
String connID
= parser.getAttributeValue(
"",
ColibriConferenceIQ.
ChannelCommon.ID_ATTR_NAME);
if(StringUtils.isNullOrEmpty(connID)
&& StringUtils.isNullOrEmpty(endpoint))
{
sctpConnection = null;
continue;
}
sctpConnection
= new ColibriConferenceIQ.SctpConnection();
}
else
{
throw new RuntimeException(
"Endpoint is mandatory attribute"
+ " for SCTP connection"
);
}
if (!StringUtils.isNullOrEmpty(connID))
sctpConnection.setID(connID);
if (!StringUtils.isNullOrEmpty(endpoint))
sctpConnection.setEndpoint(endpoint);
// port

Loading…
Cancel
Save