From 5f44b3505bcb03f26bf4c2c843e848d0a51bd63c Mon Sep 17 00:00:00 2001 From: James Korman Date: Tue, 3 Apr 2012 12:45:00 -0500 Subject: [PATCH] Issue #232 - Corrected problem using participant identifiers Former-commit-id: 32d9bac2c56d05a52c08c50273a0dfcc19ef1b5f [formerly 9387e6154c17ba64d032d37d23f8d1aa8be9add2] [formerly b89a89def3ffe1b365004a5d07bd4369e7e3bdbe] [formerly 96cd7bea113e1422b03f112fead3cf4e932d61ce [formerly b89a89def3ffe1b365004a5d07bd4369e7e3bdbe [formerly 5b102692838b42ffab97186742338494df78b978]]] Former-commit-id: 96cd7bea113e1422b03f112fead3cf4e932d61ce Former-commit-id: f081524b8a1555bd32d5e7d61586122840674ca8 [formerly 46a646f7f7553ebdd793dd894217c897d9bba328] Former-commit-id: f86eef9ef6a0644b45999afc9cb48bced7bdf8da --- .../ui/role/DataProviderEventController.java | 2 +- .../comm/identity/ISharedDisplaySession.java | 4 ++-- .../comm/identity/user/IVenueParticipant.java | 8 ++++++- .../comm/provider/session/VenueSession.java | 20 ++++++++++------ .../comm/provider/user/VenueParticipant.java | 23 +++++++++++++++++++ 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java index 5a380b2e96..9faa7051e4 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java @@ -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 " diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java index 1867f8f7f7..11d66edb23 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java @@ -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; /** diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueParticipant.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueParticipant.java index 84f787b905..d6aed82ba2 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueParticipant.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueParticipant.java @@ -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(); } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java index 0d9c9fca17..9795119e73 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java @@ -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); } } } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java index 27be20c5d3..d4c17adad1 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java @@ -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 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; + } + }