Merge "Issue #2751 fixed chat room bugs" into development

Former-commit-id: 86d03d7d6741b176a23dd93efd996154d3beaecb
This commit is contained in:
Nate Jensen 2014-02-19 14:52:24 -06:00 committed by Gerrit Code Review
commit c72e2be969
5 changed files with 48 additions and 9 deletions

View file

@ -35,6 +35,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
* Feb 13, 2014 2751 bclement changed sendObjectToPeer id to VenueParticipant * Feb 13, 2014 2751 bclement changed sendObjectToPeer id to VenueParticipant
* Feb 13, 2014 2751 njensen Added changeLeader() * Feb 13, 2014 2751 njensen Added changeLeader()
* Feb 19, 2014 2751 bclement Added isClosed()
* *
* </pre> * </pre>
* *
@ -116,4 +117,11 @@ public interface ISharedDisplaySession extends IVenueSession {
public void changeLeader(VenueParticipant newLeader) public void changeLeader(VenueParticipant newLeader)
throws CollaborationException; throws CollaborationException;
/**
* Returns true if the session has been closed
*
* @return
*/
public boolean isClosed();
} }

View file

@ -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 12, 2014 2793 bclement added additional null check to sendObjectToVenue
* Feb 13, 2014 2751 bclement VenueParticipant refactor * Feb 13, 2014 2751 bclement VenueParticipant refactor
* Feb 13, 2014 2751 njensen Added changeLeader() * Feb 13, 2014 2751 njensen Added changeLeader()
* Feb 19, 2014 2751 bclement added isClosed()
* *
* </pre> * </pre>
* *
@ -102,6 +103,8 @@ public class SharedDisplaySession extends VenueSession implements
private XMPPConnection conn; private XMPPConnection conn;
private boolean closed = false;
public SharedDisplaySession(EventBus externalBus, public SharedDisplaySession(EventBus externalBus,
CollaborationConnection manager) { CollaborationConnection manager) {
super(externalBus, manager); super(externalBus, manager);
@ -175,7 +178,8 @@ public class SharedDisplaySession extends VenueSession implements
return; return;
} }
if (topic == null) { 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; return;
} }
SessionPayload payload = new SessionPayload(PayloadType.Command, obj); SessionPayload payload = new SessionPayload(PayloadType.Command, obj);
@ -437,10 +441,10 @@ public class SharedDisplaySession extends VenueSession implements
@Override @Override
public void close() { public void close() {
super.close(); super.close();
if (pubsubMgr == null || topic == null || !topicExists()) {
return;
}
try { try {
if (pubsubMgr == null || topic == null || !topicExists()) {
return;
}
Subscription sub = findSubscription(getAccount()); Subscription sub = findSubscription(getAccount());
if (sub == null) { if (sub == null) {
return; return;
@ -455,6 +459,10 @@ public class SharedDisplaySession extends VenueSession implements
pubsubMgr = null; pubsubMgr = null;
} catch (XMPPException e) { } catch (XMPPException e) {
log.error("Unable to close subscription", 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;
}
} }

View file

@ -94,6 +94,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* improved error handling for when room already exists * improved error handling for when room already exists
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, added handle * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, added handle
* Feb 13, 2014 2751 bclement VenueParticipant refactor * Feb 13, 2014 2751 bclement VenueParticipant refactor
* Feb 18, 2014 2751 bclement Fixed history message 'from' type
* *
* </pre> * </pre>
* *
@ -738,21 +739,21 @@ public class VenueSession extends BaseSession implements IVenueSession {
String timeString = vars[0] String timeString = vars[0]
.substring(SEND_HISTORY.length()); .substring(SEND_HISTORY.length());
long time = Long.parseLong(timeString); long time = Long.parseLong(timeString);
String username = vars[1]; String msgHandle = vars[1];
String site = vars[2]; String site = vars[2];
// add the SEND_HISTORY tag length, and the timestamp // add the SEND_HISTORY tag length, and the timestamp
// length, username length, and the site length plus the // length, username length, and the site length plus the
// three pipe characters // three pipe characters
String moddedBody = body.substring(SEND_HISTORY.length() String moddedBody = body.substring(SEND_HISTORY.length()
+ timeString.length() + username.length() + timeString.length() + msgHandle.length()
+ site.length() + 3); + site.length() + 3);
message.setBody(moddedBody); message.setBody(moddedBody);
TextMessage msg = new TextMessage(message.getFrom(), TextMessage msg = new TextMessage(message.getFrom(),
message.getBody()); message.getBody());
UserId account = CollaborationConnection.getConnection() UserId account = CollaborationConnection.getConnection()
.getUser(); .getUser();
UserId id = new UserId(username, account.getHost()); msg.setFrom(new VenueParticipant(this.venue.getName(),
msg.setFrom(id); getQualifiedHost(account.getHost()), msgHandle));
msg.setTimeStamp(time); msg.setTimeStamp(time);
msg.setSubject(site); msg.setSubject(site);
msg.setStatus(SEND_HISTORY); msg.setStatus(SEND_HISTORY);

View file

@ -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.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; 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.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.ICreationEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent; import com.raytheon.uf.viz.remote.graphics.events.rendering.BeginFrameEvent;
import com.raytheon.uf.viz.remote.graphics.events.rendering.EndFrameEvent; 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 19, 2012 mschenke Initial creation * Apr 19, 2012 mschenke Initial creation
* Feb 19, 2014 2751 bclement added check for closed session
* *
* </pre> * </pre>
* *
@ -201,6 +203,13 @@ public class CollaborationDispatcher extends Dispatcher {
// Set PERSISTENCE to true if testing persisting capabilities // Set PERSISTENCE to true if testing persisting capabilities
if (eventObject instanceof AbstractDispatchingObjectEvent if (eventObject instanceof AbstractDispatchingObjectEvent
&& eventObject instanceof IRenderEvent == false) { && 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; boolean immediateSend = true;
if (eventObject instanceof ICreationEvent == false) { if (eventObject instanceof ICreationEvent == false) {
// Not a creation event, check event size. All creation events // Not a creation event, check event size. All creation events

View file

@ -56,6 +56,7 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
* added JID and display name if available * added JID and display name if available
* Feb 13, 2014 2751 bclement VenueParticipant refactor * Feb 13, 2014 2751 bclement VenueParticipant refactor
* Feb 13, 2014 2751 njensen Added leader icons * Feb 13, 2014 2751 njensen Added leader icons
* Feb 18, 2014 2751 bclement changed tooltip from JID to UserId
* *
* </pre> * </pre>
* *
@ -228,7 +229,7 @@ public class ParticipantsLabelProvider extends
} }
if (user.hasActualUserId()) { if (user.hasActualUserId()) {
UserId actual = user.getUserid(); UserId actual = user.getUserid();
builder.append("\nJID: ").append(actual.getNormalizedId()); builder.append("\nUserId: ").append(actual.getNormalizedId());
builder.append("\nDisplay Name: ").append(getLocalAlias(actual)); builder.append("\nDisplay Name: ").append(getLocalAlias(actual));
} }
return builder.toString(); return builder.toString();