Adds a channel-bundle-id attribute to Channel and SctpConnection, and a

ChannelBundle element.
fix-message-formatting
Boris Grozev 11 years ago
parent c7b0d7f958
commit e39aa4067d

@ -54,6 +54,9 @@ public class ColibriConferenceIQ
*/
private final List<Content> contents = new LinkedList<Content>();
private final List<ChannelBundle> channelBundles
= new LinkedList<ChannelBundle>();
/**
* The ID of the conference represented by this IQ.
*/
@ -112,6 +115,17 @@ public boolean addContent(Content content)
return contents.contains(content) ? false : contents.add(content);
}
public boolean addChannelBundle(ChannelBundle channelBundle)
{
if (channelBundle == null)
throw new NullPointerException("channelBundle");
return channelBundles.contains(channelBundles)
? false
: channelBundles.add(channelBundle);
}
/**
* Returns an XML <tt>String</tt> representation of this <tt>IQ</tt>.
*
@ -132,12 +146,14 @@ public String getChildElementXML()
.append('\'');
List<Content> contents = getContents();
List<ChannelBundle> channelBundles = getChannelBundles();
int childrenCount = contents.size();
if (recording != null)
childrenCount++;
boolean hasChildren = recording != null
|| rtcpTerminationStrategy != null
|| contents.size() > 0
|| channelBundles.size() > 0;
if (childrenCount == 0)
if (!hasChildren)
{
xml.append(" />");
}
@ -146,6 +162,8 @@ public String getChildElementXML()
xml.append('>');
for (Content content : contents)
content.toXML(xml);
for (ChannelBundle channelBundle : channelBundles)
channelBundle.toXML(xml);
if (recording != null)
recording.toXML(xml);
@ -187,6 +205,11 @@ public List<Content> getContents()
return Collections.unmodifiableList(contents);
}
public List<ChannelBundle> getChannelBundles()
{
return Collections.unmodifiableList(channelBundles);
}
/**
* Gets the ID of the conference represented by this IQ.
*
@ -318,6 +341,12 @@ public static abstract class ChannelCommon
*/
public static final String EXPIRE_ATTR_NAME = "expire";
/**
* The name of the "channel-bundle-id" attribute.
*/
public static final String CHANNEL_BUNDLE_ID_ATTR_NAME
= "channel-bundle-id";
/**
* The value of the <tt>expire</tt> property of
* <tt>ColibriConferenceIQ.Channel</tt> which indicates that no actual
@ -359,6 +388,11 @@ public static abstract class ChannelCommon
*/
private String elementName;
/**
* The channel-bundle-id attribute of this <tt>CommonChannel</tt>.
*/
private String channelBundleId = null;
/**
* Initializes this class with given XML <tt>elementName</tt>.
* @param elementName XML element name to be used for producing XML
@ -414,6 +448,16 @@ public Boolean isInitiator()
return initiator;
}
/**
* Get the channel-bundle-id attribute of this <tt>CommonChannel</tt>.
* @return the channel-bundle-id attribute of this
* <tt>CommonChannel</tt>.
*/
public String getChannelBundleId()
{
return channelBundleId;
}
/**
* Sets the identifier of the endpoint of the conference participant
* associated with this <tt>Channel</tt>.
@ -465,6 +509,15 @@ public void setTransport(IceUdpTransportPacketExtension transport)
this.transport = transport;
}
/**
* Sets the channel-bundle-id attribute of this <tt>CommonChannel</tt>.
* @param channelBundleId the value to set.
*/
public void setChannelBundleId(String channelBundleId)
{
this.channelBundleId = channelBundleId;
}
/**
* Derived class implements this method in order to print additional
* attributes to main XML element.
@ -534,6 +587,13 @@ public void toXML(StringBuilder xml)
.append(initiator).append('\'');
}
String channelBundleId = getChannelBundleId();
if (channelBundleId != null)
{
xml.append(' ').append(CHANNEL_BUNDLE_ID_ATTR_NAME)
.append("='").append(channelBundleId).append('\'');
}
// Print derived class attributes
printAttributes(xml);
@ -582,6 +642,55 @@ public void toXML(StringBuilder xml)
}
}
public static class ChannelBundle
{
public static final String ID_ATTR_NAME = "id";
public static final String ELEMENT_NAME = "channel-bundle";
private String id;
private IceUdpTransportPacketExtension transport;
public IceUdpTransportPacketExtension getTransport()
{
return transport;
}
public ChannelBundle(String id)
{
this.id = id;
}
public void setTransport(IceUdpTransportPacketExtension transport)
{
this.transport = transport;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public void toXML(StringBuilder xml)
{
xml.append('<').append(ELEMENT_NAME).append(' ')
.append(ID_ATTR_NAME).append("='").append(id).append('\'');
if (transport != null)
{
xml.append('>');
xml.append(transport.toXML());
xml.append("</").append(ELEMENT_NAME).append('>');
}
else
{
xml.append(" />");
}
}
}
/**
* Represents a <tt>channel</tt> included into a <tt>content</tt> of a Jitsi
* Videobridge <tt>conference</tt> IQ.

@ -271,6 +271,14 @@ else if (ColibriConferenceIQ.Recording.ELEMENT_NAME.equals(
if ((endpoint != null) && (endpoint.length() != 0))
channel.setEndpoint(endpoint);
String channelBundleId
= parser.getAttributeValue(
"",
ColibriConferenceIQ.ChannelCommon
.CHANNEL_BUNDLE_ID_ATTR_NAME);
if (!StringUtils.isNullOrEmpty(channelBundleId))
channel.setChannelBundleId(channelBundleId);
// expire
String expire
= parser.getAttributeValue(
@ -438,9 +446,17 @@ else if (ColibriConferenceIQ.SctpConnection.ELEMENT_NAME
= parser.getAttributeValue(
"",
ColibriConferenceIQ.SctpConnection.PORT_ATTR_NAME);
if(!StringUtils.isNullOrEmpty(port))
if (!StringUtils.isNullOrEmpty(port))
sctpConnection.setPort(Integer.parseInt(port));
String channelBundleId
= parser.getAttributeValue(
"",
ColibriConferenceIQ.ChannelCommon
.CHANNEL_BUNDLE_ID_ATTR_NAME);
if (!StringUtils.isNullOrEmpty(channelBundleId))
sctpConnection.setChannelBundleId(channelBundleId);
// initiator
String initiator
= parser.getAttributeValue(

Loading…
Cancel
Save