Issue #232 - Corrected problem using participant identifiers

Former-commit-id: b89a89def3 [formerly 5b102692838b42ffab97186742338494df78b978]
Former-commit-id: 96cd7bea11
This commit is contained in:
James Korman 2012-04-03 12:45:00 -05:00
parent ce79d3bec3
commit 46a646f7f7
5 changed files with 46 additions and 11 deletions

View file

@ -75,7 +75,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
.getInstance().getActiveEditor();
SharedEditor se = EditorSetup.extractSharedEditor(editor);
try {
session.sendInitData(event.getParticipant(), se);
session.sendInitData(event.getParticipant().getQualifiedId(), se);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
"Error sending initialization data to new participant "

View file

@ -73,7 +73,7 @@ public interface ISharedDisplaySession extends IEventPublisher {
* @param participant
* @param initData
*/
void sendInitData(IChatID participant, IInitData initData)
void sendInitData(IQualifiedID participant, IInitData initData)
throws CollaborationException;
/**
@ -95,7 +95,7 @@ public interface ISharedDisplaySession extends IEventPublisher {
*/
void sendEvent(IDisplayEvent event) throws CollaborationException;
void sendEvent(IChatID participant, IDisplayEvent event)
void sendEvent(IQualifiedID participant, IDisplayEvent event)
throws CollaborationException;
/**

View file

@ -39,5 +39,11 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied;
*/
public interface IVenueParticipant extends IChatID, IPropertied {
/**
* Return the identifier as a qualified field. Removes the "domain"
* conference from the host string if found.
* @return The qualified id.
*/
IQualifiedID getQualifiedId();
}

View file

@ -345,16 +345,19 @@ public class VenueSession extends BaseSession implements IVenueSession,
*/
@Override
public void sendInitData(
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant,
IInitData initData) throws CollaborationException {
PeerToPeerChat session = getP2PSession();
if (session != null) {
String message = Tools.marshallData(initData);
IMessage msg = new CollaborationMessage(participant, message);
msg.setProperty(Tools.PROP_SESSION_ID, this.getSessionId());
session.sendPeerToPeer(msg);
if (message != null) {
TextMessage msg = new TextMessage(participant, message);
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
session.sendPeerToPeer(msg);
}
}
}
@ -403,7 +406,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
*/
@Override
public void sendEvent(
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant,
IDisplayEvent event) throws CollaborationException {
PeerToPeerChat session = null;
@ -411,7 +414,10 @@ public class VenueSession extends BaseSession implements IVenueSession,
if (session != null) {
String message = Tools.marshallData(event);
if (message != null) {
session.sendPeerToPeer(participant.getFQName(), message);
TextMessage msg = new TextMessage(participant, message);
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
session.sendPeerToPeer(msg);
}
}
}

View file

@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
@ -44,6 +45,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
public class VenueParticipant implements IVenueParticipant {
private static String CONF_ID = "conference.";
private Map<String, String> properties;
private String name;
@ -187,4 +190,24 @@ public class VenueParticipant implements IVenueParticipant {
return sb.toString();
}
/**
* Return the identifier as a qualified field. Removes the "domain"
* conference from the host string if found.
* @return The qualified id.
*/
@Override
public IQualifiedID getQualifiedId() {
String hostName = host;
if(hostName != null) {
if(hostName.startsWith(CONF_ID)) {
hostName = hostName.substring(CONF_ID.length());
}
}
UserId id = new UserId(getName(), hostName);
id.setResource(resource);
return id;
}
}