From c4209795567e12ebb2d3792471ed3b600f540cfc Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Wed, 19 Feb 2014 08:29:24 -0600 Subject: [PATCH] Issue #2751 fixed chat room bugs fixed history messages having incorrect 'from' type added ignore to dispose messages after room is closed renamed tool tip for userid to match how JIDs are labled in client Former-commit-id: abc01f54755f8f110bdeeb9d41b08a8bf29003f3 [formerly 06c16118e192df89cc02e4220337f2a1c80ee082] [formerly dc074a9650d1f29109ebd561431a024f016f771e] [formerly abc01f54755f8f110bdeeb9d41b08a8bf29003f3 [formerly 06c16118e192df89cc02e4220337f2a1c80ee082] [formerly dc074a9650d1f29109ebd561431a024f016f771e] [formerly 3a135b8eacc350d6bde84ea2d96ed1c4c305d5ff [formerly dc074a9650d1f29109ebd561431a024f016f771e [formerly 453604eca5fca9e5d14ba1842dc7f76f1e0180ca]]]] Former-commit-id: 3a135b8eacc350d6bde84ea2d96ed1c4c305d5ff Former-commit-id: 30027665aca8b9f902ff6d917253924d0d1c7ddf [formerly 77bb396c9ada2bb3cbdf2d1d188755d725f5c9af] [formerly 7c130f893c124249133b51cb750375f7ea62663d [formerly bee7cdb71a03058edc51b4caf1947242750d9a0c]] Former-commit-id: 2bd4a38066d755ff2faaae6125ca4744d0e08564 [formerly ddc0945e40e39f519e856b2c8097d38650ff0fd0] Former-commit-id: b47b1945645bca403d14d46e493a566bb3a25d4f --- .../comm/identity/ISharedDisplaySession.java | 8 ++++++ .../session/SharedDisplaySession.java | 28 ++++++++++++++++--- .../comm/provider/session/VenueSession.java | 9 +++--- .../dataprovider/CollaborationDispatcher.java | 9 ++++++ .../ui/session/ParticipantsLabelProvider.java | 3 +- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java index fa2880f302..af3affa717 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java @@ -35,6 +35,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Feb 13, 2014 2751 bclement changed sendObjectToPeer id to VenueParticipant * Feb 13, 2014 2751 njensen Added changeLeader() + * Feb 19, 2014 2751 bclement Added isClosed() * * * @@ -116,4 +117,11 @@ public interface ISharedDisplaySession extends IVenueSession { public void changeLeader(VenueParticipant newLeader) throws CollaborationException; + /** + * Returns true if the session has been closed + * + * @return + */ + public boolean isClosed(); + } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java index 42dcf67f9d..5ea3324861 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java @@ -79,6 +79,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * Feb 12, 2014 2793 bclement added additional null check to sendObjectToVenue * Feb 13, 2014 2751 bclement VenueParticipant refactor * Feb 13, 2014 2751 njensen Added changeLeader() + * Feb 19, 2014 2751 bclement added isClosed() * * * @@ -102,6 +103,8 @@ public class SharedDisplaySession extends VenueSession implements private XMPPConnection conn; + private boolean closed = false; + public SharedDisplaySession(EventBus externalBus, CollaborationConnection manager) { super(externalBus, manager); @@ -175,7 +178,8 @@ public class SharedDisplaySession extends VenueSession implements return; } if (topic == null) { - log.warn("Attempted to send object when topic not configured"); + log.warn("Attempted to send object when topic not configured: " + + obj); return; } SessionPayload payload = new SessionPayload(PayloadType.Command, obj); @@ -437,10 +441,10 @@ public class SharedDisplaySession extends VenueSession implements @Override public void close() { super.close(); - if (pubsubMgr == null || topic == null || !topicExists()) { - return; - } try { + if (pubsubMgr == null || topic == null || !topicExists()) { + return; + } Subscription sub = findSubscription(getAccount()); if (sub == null) { return; @@ -455,6 +459,10 @@ public class SharedDisplaySession extends VenueSession implements pubsubMgr = null; } catch (XMPPException e) { log.error("Unable to close subscription", e); + } finally { + // if an error happens, we still want to advertise that we were + // closed + closed = true; } } @@ -532,4 +540,16 @@ public class SharedDisplaySession extends VenueSession implements } } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession + * #isClosed() + */ + @Override + public boolean isClosed() { + return closed; + } + } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java index 3ed72b0ada..63694249cd 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java @@ -94,6 +94,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * improved error handling for when room already exists * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, added handle * Feb 13, 2014 2751 bclement VenueParticipant refactor + * Feb 18, 2014 2751 bclement Fixed history message 'from' type * * * @@ -738,21 +739,21 @@ public class VenueSession extends BaseSession implements IVenueSession { String timeString = vars[0] .substring(SEND_HISTORY.length()); long time = Long.parseLong(timeString); - String username = vars[1]; + String msgHandle = vars[1]; String site = vars[2]; // add the SEND_HISTORY tag length, and the timestamp // length, username length, and the site length plus the // three pipe characters String moddedBody = body.substring(SEND_HISTORY.length() - + timeString.length() + username.length() + + timeString.length() + msgHandle.length() + site.length() + 3); message.setBody(moddedBody); TextMessage msg = new TextMessage(message.getFrom(), message.getBody()); UserId account = CollaborationConnection.getConnection() .getUser(); - UserId id = new UserId(username, account.getHost()); - msg.setFrom(id); + msg.setFrom(new VenueParticipant(this.venue.getName(), + getQualifiedHost(account.getHost()), msgHandle)); msg.setTimeStamp(time); msg.setSubject(site); msg.setStatus(SEND_HISTORY); diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/CollaborationDispatcher.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/CollaborationDispatcher.java index f568b70a2e..0b2296fa99 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/CollaborationDispatcher.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/CollaborationDispatcher.java @@ -48,6 +48,7 @@ import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.raytheon.uf.viz.remote.graphics.Dispatcher; import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; import com.raytheon.uf.viz.remote.graphics.events.AbstractRemoteGraphicsEvent; +import com.raytheon.uf.viz.remote.graphics.events.DisposeObjectEvent; import com.raytheon.uf.viz.remote.graphics.events.ICreationEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent; @@ -64,6 +65,7 @@ import com.raytheon.viz.ui.input.InputAdapter; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 19, 2012 mschenke Initial creation + * Feb 19, 2014 2751 bclement added check for closed session * * * @@ -201,6 +203,13 @@ public class CollaborationDispatcher extends Dispatcher { // Set PERSISTENCE to true if testing persisting capabilities if (eventObject instanceof AbstractDispatchingObjectEvent && eventObject instanceof IRenderEvent == false) { + if (eventObject instanceof DisposeObjectEvent && session.isClosed()) { + // object disposal is asynchronous and dispose events could + // happen after session has been closed. If any participants are + // still connected to session, their objects will be disposed + // when they close the view. + return; + } boolean immediateSend = true; if (eventObject instanceof ICreationEvent == false) { // Not a creation event, check event size. All creation events diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java index 103ac6d785..d0b71f823a 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java @@ -56,6 +56,7 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider; * added JID and display name if available * Feb 13, 2014 2751 bclement VenueParticipant refactor * Feb 13, 2014 2751 njensen Added leader icons + * Feb 18, 2014 2751 bclement changed tooltip from JID to UserId * * * @@ -228,7 +229,7 @@ public class ParticipantsLabelProvider extends } if (user.hasActualUserId()) { UserId actual = user.getUserid(); - builder.append("\nJID: ").append(actual.getNormalizedId()); + builder.append("\nUserId: ").append(actual.getNormalizedId()); builder.append("\nDisplay Name: ").append(getLocalAlias(actual)); } return builder.toString();