Issue #2751 user identity refactor

VenueParticipant no longer a subtype of UserId
New interface for both
refactored base classes to be generic for user types


Former-commit-id: e91ae6eacf4af9e25afc213c3cd0c269c8d465f4
This commit is contained in:
Brian Clements 2014-02-13 13:27:54 -06:00
parent 6093312861
commit ef52908906
34 changed files with 455 additions and 343 deletions

View file

@ -19,7 +19,7 @@
**/ **/
package com.raytheon.uf.viz.collaboration.comm.identity; package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
@ -32,6 +32,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation * Feb 24, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement changed to/from objects to IUser
* *
* </pre> * </pre>
* *
@ -50,24 +51,24 @@ public interface IMessage extends IPropertied {
/** /**
* @return the to * @return the to
*/ */
public IQualifiedID getTo(); public IUser getTo();
/** /**
* @param to * @param to
* the to to set * the to to set
*/ */
public void setTo(IQualifiedID to); public void setTo(IUser to);
/** /**
* @return the from * @return the from
*/ */
public IQualifiedID getFrom(); public IUser getFrom();
/** /**
* @param from * @param from
* the from to set * the from to set
*/ */
public void setFrom(IQualifiedID from); public void setFrom(IUser from);
/** /**
* Get the subject of this message. * Get the subject of this message.

View file

@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity; package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher; import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* Peer to peer chat messaging interface * Peer to peer chat messaging interface
@ -32,6 +32,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation * Mar 21, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement changed 'to' object to UserId
* *
* </pre> * </pre>
* *
@ -57,7 +58,7 @@ public interface IPeerToPeer extends ISession, IEventPublisher {
* @param message * @param message
* The message to send. * The message to send.
*/ */
public void sendPeerToPeer(IQualifiedID to, String message) public void sendPeerToPeer(UserId to, String message)
throws CollaborationException; throws CollaborationException;
} }

View file

@ -39,8 +39,8 @@
package com.raytheon.uf.viz.collaboration.comm.identity; package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher; import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* Base interface for sessions in which the client is interacting with others on * Base interface for sessions in which the client is interacting with others on
@ -58,6 +58,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation * Feb 24, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement changed user object to IUser
* *
* </pre> * </pre>
* *
@ -77,7 +78,7 @@ public interface ISession extends IEventPublisher {
* *
* @return * @return
*/ */
public UserId getUserID(); public IUser getUserID();
/** /**
* Gets the connection status of the session. * Gets the connection status of the session.

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.uf.viz.collaboration.comm.identity; package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
@ -54,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation * Mar 21, 2012 jkorman Initial creation
* 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
* *
* </pre> * </pre>
* *
@ -85,7 +85,7 @@ public interface ISharedDisplaySession extends IVenueSession {
* the serializable object to send * the serializable object to send
* @throws CollaborationException * @throws CollaborationException
*/ */
public void sendObjectToPeer(IQualifiedID id, Object obj) public void sendObjectToPeer(VenueParticipant id, Object obj)
throws CollaborationException; throws CollaborationException;
/** /**

View file

@ -20,7 +20,8 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event; package com.raytheon.uf.viz.collaboration.comm.identity.event;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
/** /**
* Encapsulates a venue invitation to the user. * Encapsulates a venue invitation to the user.
@ -33,6 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation * Mar 21, 2012 jkorman Initial creation
* Dec 18, 2013 2562 bclement removed subject getter (subject in invite) * Dec 18, 2013 2562 bclement removed subject getter (subject in invite)
* Feb 13, 2014 2751 bclement better types for roomid and inviter
* *
* </pre> * </pre>
* *
@ -47,13 +49,13 @@ public interface IVenueInvitationEvent {
* *
* @return id in {room}@conference.{host} format * @return id in {room}@conference.{host} format
*/ */
public IQualifiedID getRoomId(); public VenueId getRoomId();
/** /**
* *
* @return id of user that sent invitation * @return id of user that sent invitation
*/ */
public IQualifiedID getInviter(); public IUser getInviter();
/** /**
* Get detailed invitation which includes subject and message if provided * Get detailed invitation which includes subject and message if provided

View file

@ -20,7 +20,8 @@
package com.raytheon.uf.viz.collaboration.comm.identity.user; package com.raytheon.uf.viz.collaboration.comm.identity.user;
/** /**
* TODO Add Description * Top level interface for objects that represent identified items on the server
* (users, rooms, etc)
* *
* <pre> * <pre>
* *
@ -29,6 +30,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation * Feb 24, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement refactor to remove ID interface
* *
* </pre> * </pre>
* *
@ -36,30 +38,24 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user;
* @version 1.0 * @version 1.0
*/ */
public interface IQualifiedID extends ID { public interface IQualifiedID {
/** /**
* * @return server name for item
* @param hostName
*/ */
void setHost(String hostName); public String getHost();
/** /**
* * @return name of item
* @return
*/ */
String getHost(); public String getName();
/** /**
* * @return fully qualified string addressing item
* @param resource
*/ */
void setResource(String resource); public String getFQName();
/**
*
* @return
*/
String getResource();
} }

View file

@ -20,7 +20,8 @@
package com.raytheon.uf.viz.collaboration.comm.identity.user; package com.raytheon.uf.viz.collaboration.comm.identity.user;
/** /**
* TODO Add Description * Interface for users on server. Can represent user accounts or users in a
* chatroom.
* *
* <pre> * <pre>
* *
@ -28,31 +29,20 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation * Feb 13, 2014 2751 bclement Initial creation
* *
* </pre> * </pre>
* *
* @author jkorman * @author bclement
* @version 1.0 * @version 1.0
*/ */
public interface ID { public interface IUser extends IQualifiedID {
/** /**
* * @param other
* @param userName * @return true if other user represents same person as this user
*/ */
void setName(String userName); public boolean isSameUser(IUser other);
/**
*
*/
String getName();
/**
*
* @return
*/
String getFQName();
} }

View file

@ -26,10 +26,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
* TODO Add Description * Base concrete implementation for chat message objects
* *
* <pre> * <pre>
* *
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation * Feb 24, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser
* *
* </pre> * </pre>
* *
@ -53,9 +54,9 @@ public abstract class BaseMessage implements Serializable, IMessage {
private String body; private String body;
private IQualifiedID to; private IUser to;
private IQualifiedID from; private IUser from;
private String subject; private String subject;
@ -68,7 +69,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
* @param to * @param to
* @param body * @param body
*/ */
protected BaseMessage(IQualifiedID to, String body) { protected BaseMessage(IUser to, String body) {
this.body = body; this.body = body;
this.to = to; this.to = to;
initProperties(); initProperties();
@ -79,7 +80,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
* @return the to * @return the to
*/ */
@Override @Override
public IQualifiedID getTo() { public IUser getTo() {
return to; return to;
} }
@ -88,7 +89,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
* the to to set * the to to set
*/ */
@Override @Override
public void setTo(IQualifiedID to) { public void setTo(IUser to) {
this.to = to; this.to = to;
} }
@ -96,7 +97,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
* @return the from * @return the from
*/ */
@Override @Override
public IQualifiedID getFrom() { public IUser getFrom() {
return from; return from;
} }
@ -105,7 +106,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
* the from to set * the from to set
*/ */
@Override @Override
public void setFrom(IQualifiedID from) { public void setFrom(IUser from) {
this.from = from; this.from = from;
} }

View file

@ -1,71 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.provider;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class CollaborationMessage extends BaseMessage {
private static final long serialVersionUID = 1L;
/**
*
* @param to
* @param body
*/
public CollaborationMessage(IQualifiedID to, String body) {
super(to, body);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getMessageType()
*/
@Override
public MessageType getMessageType() {
return MessageType.COLLABORATION;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getBodyAsBinary(byte[])
*/
@Override
public void getBodyAsBinary(byte[] body) {
}
}

View file

@ -19,10 +19,10 @@
**/ **/
package com.raytheon.uf.viz.collaboration.comm.provider; package com.raytheon.uf.viz.collaboration.comm.provider;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
* TODO Add Description * Chat message object
* *
* <pre> * <pre>
* *
@ -31,6 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation * Feb 24, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser
* *
* </pre> * </pre>
* *
@ -47,7 +48,7 @@ public class TextMessage extends BaseMessage {
* @param to * @param to
* @param body * @param body
*/ */
public TextMessage(IQualifiedID to, String body) { public TextMessage(IUser to, String body) {
super(to, body); super(to, body);
} }

View file

@ -21,7 +21,8 @@ package com.raytheon.uf.viz.collaboration.comm.provider.event;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
/** /**
* Event that is posted when a venue invitation is sent * Event that is posted when a venue invitation is sent
@ -34,6 +35,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 27, 2012 jkorman Initial creation * Mar 27, 2012 jkorman Initial creation
* Dec 18, 2013 2562 bclement removed subject (subject in invite) * Dec 18, 2013 2562 bclement removed subject (subject in invite)
* Feb 13, 2014 2751 bclement better types for venueid and invitor
* *
* </pre> * </pre>
* *
@ -43,9 +45,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
public class VenueInvitationEvent implements IVenueInvitationEvent { public class VenueInvitationEvent implements IVenueInvitationEvent {
private IQualifiedID venueId; private VenueId venueId;
private IQualifiedID invitor; private UserId invitor;
private VenueInvite invite; private VenueInvite invite;
@ -56,7 +58,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent {
* @param subject * @param subject
* @param body * @param body
*/ */
public VenueInvitationEvent(IQualifiedID venueId, IQualifiedID invitor, public VenueInvitationEvent(VenueId venueId, UserId invitor,
VenueInvite invite) { VenueInvite invite) {
this.venueId = venueId; this.venueId = venueId;
this.invitor = invitor; this.invitor = invitor;
@ -69,7 +71,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getRoomId() * @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getRoomId()
*/ */
@Override @Override
public IQualifiedID getRoomId() { public VenueId getRoomId() {
return venueId; return venueId;
} }
@ -77,7 +79,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getInviter() * @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getInviter()
*/ */
@Override @Override
public IQualifiedID getInviter() { public UserId getInviter() {
return invitor; return invitor;
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Jan 28, 2014 2698 bclement removed getInfo, added methods to replace * Jan 28, 2014 2698 bclement removed getInfo, added methods to replace
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null
* Feb 13, 2014 2751 bclement changed to use VenueParticipant handle instead of alias
* *
* </pre> * </pre>
* *
@ -79,7 +80,7 @@ public class Venue implements IVenue {
@Override @Override
public Presence getPresence(VenueParticipant user) { public Presence getPresence(VenueParticipant user) {
Presence presence = presenceMap.get(user.getAlias()); Presence presence = presenceMap.get(user.getHandle());
if (presence == null) { if (presence == null) {
presence = new Presence(Type.unavailable); presence = new Presence(Type.unavailable);
presence.setMode(Mode.away); presence.setMode(Mode.away);
@ -88,7 +89,7 @@ public class Venue implements IVenue {
} }
public void handlePresenceUpdated(VenueParticipant fromID, Presence presence) { public void handlePresenceUpdated(VenueParticipant fromID, Presence presence) {
presenceMap.put(fromID.getAlias(), presence); presenceMap.put(fromID.getHandle(), presence);
} }
/* /*

View file

@ -26,7 +26,7 @@ import java.util.UUID;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession; import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
* Base class for chat and collaboration sessions * Base class for chat and collaboration sessions
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Mar 21, 2012 jkorman Initial creation * Mar 21, 2012 jkorman Initial creation
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Jan 28, 2014 2698 bclement removed false throws statements * Jan 28, 2014 2698 bclement removed false throws statements
* Feb 13, 2014 2751 bclement changed UserId object to IUser
* *
* </pre> * </pre>
* *
@ -119,7 +120,7 @@ public abstract class BaseSession implements ISession {
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID() * @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
*/ */
@Override @Override
public UserId getUserID() { public IUser getUserID() {
return connection.getUser(); return connection.getUser();
} }

View file

@ -58,7 +58,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEve
import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType; import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayloadProvider; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayloadProvider;
@ -110,6 +109,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* cleaned up createCollaborationVenue, removed getVenueInfo * cleaned up createCollaborationVenue, removed getVenueInfo
* Jan 30, 2014 2698 bclement changed arguments to create sessions, moved room connection from SessionView * Jan 30, 2014 2698 bclement changed arguments to create sessions, moved room connection from SessionView
* Feb 3, 2014 2699 bclement removed unneeded catch in joinTextOnlyVenue * Feb 3, 2014 2699 bclement removed unneeded catch in joinTextOnlyVenue
* Feb 13, 2014 2751 bclement better types for venueid and invitor
* *
* </pre> * </pre>
* *
@ -401,7 +401,7 @@ public class CollaborationConnection implements IEventPublisher {
session.createVenue(data); session.createVenue(data);
VenueParticipant leader = session.getUserID(); VenueParticipant leader = session.getUserID();
leader.setAlias(session.getHandle()); leader.setHandle(session.getHandle());
session.setCurrentSessionLeader(leader); session.setCurrentSessionLeader(leader);
session.setCurrentDataProvider(leader); session.setCurrentDataProvider(leader);
@ -616,8 +616,9 @@ public class CollaborationConnection implements IEventPublisher {
String room, String inviter, String reason, String room, String inviter, String reason,
String password, Message message) { String password, Message message) {
// TODO handle password protected rooms // TODO handle password protected rooms
IQualifiedID venueId = new VenueId(); VenueId venueId = new VenueId();
venueId.setName(Tools.parseName(room)); venueId.setName(Tools.parseName(room));
venueId.setHost(Tools.parseHost(room));
UserId invitor = IDConverter.convertFrom(inviter); UserId invitor = IDConverter.convertFrom(inviter);
if (message != null) { if (message != null) {
@ -641,7 +642,7 @@ public class CollaborationConnection implements IEventPublisher {
} }
} }
private void handleChatRoomInvite(IQualifiedID venueId, UserId invitor, private void handleChatRoomInvite(VenueId venueId, UserId invitor,
String reason, Message message) { String reason, Message message) {
VenueInvite invite = new VenueInvite(); VenueInvite invite = new VenueInvite();
if (!StringUtils.isBlank(reason)) { if (!StringUtils.isBlank(reason)) {
@ -657,7 +658,7 @@ public class CollaborationConnection implements IEventPublisher {
eventBus.post(event); eventBus.post(event);
} }
private void handleCollabInvite(IQualifiedID venueId, UserId invitor, private void handleCollabInvite(VenueId venueId, UserId invitor,
SessionPayload payload) { SessionPayload payload) {
Object obj = payload.getData(); Object obj = payload.getData();
if (obj == null if (obj == null

View file

@ -32,8 +32,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer; import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer;
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property; import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* *
@ -49,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
* Mar 21, 2012 jkorman Initial creation * Mar 21, 2012 jkorman Initial creation
* Apr 18, 2012 njensen Cleanup * Apr 18, 2012 njensen Cleanup
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser
* *
* </pre> * </pre>
* *
@ -77,7 +79,7 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
public void sendPeerToPeer(IMessage message) throws CollaborationException { public void sendPeerToPeer(IMessage message) throws CollaborationException {
CollaborationConnection manager = getConnection(); CollaborationConnection manager = getConnection();
XMPPConnection conn = manager.getXmppConnection(); XMPPConnection conn = manager.getXmppConnection();
IQualifiedID to = message.getTo(); IUser to = message.getTo();
String toId = to.getFQName(); String toId = to.getFQName();
Message xmppMessage = new Message(toId, Type.chat); Message xmppMessage = new Message(toId, Type.chat);
xmppMessage.setBody(message.getBody()); xmppMessage.setBody(message.getBody());
@ -116,7 +118,7 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
* @throws CollaborationException * @throws CollaborationException
*/ */
@Override @Override
public void sendPeerToPeer(IQualifiedID to, String message) public void sendPeerToPeer(UserId to, String message)
throws CollaborationException { throws CollaborationException {
TextMessage msg = new TextMessage(to, message); TextMessage msg = new TextMessage(to, message);
this.sendPeerToPeer(msg); this.sendPeerToPeer(msg);

View file

@ -31,7 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdXmppMessage; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdXmppMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
* Dec 18, 2013 2562 bclement added timeout for HTTP config, * Dec 18, 2013 2562 bclement added timeout for HTTP config,
* data now in packet extension * data now in packet extension
* Dec 19, 2013 2563 bclement removed wait for HTTP config, added reset * Dec 19, 2013 2563 bclement removed wait for HTTP config, added reset
* Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser
* *
* </pre> * </pre>
* *
@ -168,7 +169,7 @@ public class PeerToPeerCommHelper implements PacketListener {
* @param message * @param message
*/ */
private void routeMessage(Message message) { private void routeMessage(Message message) {
IQualifiedID fromId = IDConverter.convertFrom(message.getFrom()); IUser fromId = IDConverter.convertFrom(message.getFrom());
TextMessage textMsg = new TextMessage(fromId, message.getBody()); TextMessage textMsg = new TextMessage(fromId, message.getBody());
textMsg.setFrom(fromId); textMsg.setFrom(fromId);
textMsg.setBody(message.getBody()); textMsg.setBody(message.getBody());

View file

@ -76,6 +76,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
* changed args to create/configure venue * changed args to create/configure venue
* 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
* *
* </pre> * </pre>
* *
@ -190,15 +191,20 @@ public class SharedDisplaySession extends VenueSession implements
* java.lang.Object) * java.lang.Object)
*/ */
@Override @Override
public void sendObjectToPeer( public void sendObjectToPeer(VenueParticipant participant, Object obj)
com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant, throws CollaborationException {
Object obj) throws CollaborationException {
// TODO should only send to CAVE clients // TODO should only send to CAVE clients
if (obj == null) { if (obj == null) {
return; return;
} }
// TODO should we use MUC private chat for this?
if (!participant.hasActualUserId()) {
log.warn("Attempted to send object to peer when actual userid is unknown");
return;
}
UserId userid = participant.getUserid();
SessionPayload payload = new SessionPayload(PayloadType.Command, obj); SessionPayload payload = new SessionPayload(PayloadType.Command, obj);
Message msg = new Message(participant.getFQName(), Type.normal); Message msg = new Message(userid.getFQName(), Type.normal);
msg.addExtension(payload); msg.addExtension(payload);
msg.setFrom(conn.getUser()); msg.setFrom(conn.getUser());
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId()); msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
@ -299,7 +305,7 @@ public class SharedDisplaySession extends VenueSession implements
topic = pubsubMgr.getNode(getSessionId()); topic = pubsubMgr.getNode(getSessionId());
topic.addItemEventListener(this); topic.addItemEventListener(this);
topic.addItemDeleteListener(this); topic.addItemDeleteListener(this);
Subscription sub = findSubscription(getUserID()); Subscription sub = findSubscription(getAccount());
if (sub == null) { if (sub == null) {
sub = topic.subscribe(conn.getUser()); sub = topic.subscribe(conn.getUser());
} }
@ -435,7 +441,7 @@ public class SharedDisplaySession extends VenueSession implements
return; return;
} }
try { try {
Subscription sub = findSubscription(getUserID()); Subscription sub = findSubscription(getAccount());
if (sub == null) { if (sub == null) {
return; return;
} }

View file

@ -48,8 +48,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType; import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
@ -94,6 +93,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Jan 28, 2014 2698 bclement removed venue info, new rooms are now invite-only * Jan 28, 2014 2698 bclement removed venue info, new rooms are now invite-only
* 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
* *
* </pre> * </pre>
* *
@ -110,7 +110,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
public static final String SEND_HISTORY = "[[HISTORY]]"; public static final String SEND_HISTORY = "[[HISTORY]]";
private MultiUserChat muc = null; protected MultiUserChat muc = null;
private PacketListener intListener = null; private PacketListener intListener = null;
@ -190,7 +190,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
invite); invite);
Message msg = new Message(); Message msg = new Message();
msg.setTo(id.getNormalizedId()); msg.setTo(id.getNormalizedId());
msg.setFrom(getUserID().getNormalizedId()); UserId user = getAccount();
msg.setFrom(user.getNormalizedId());
msg.setType(Type.normal); msg.setType(Type.normal);
msg.addExtension(payload); msg.addExtension(payload);
String reason = ""; String reason = "";
@ -268,7 +269,17 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @return * @return
*/ */
public static String getRoomId(String host, String roomName) { public static String getRoomId(String host, String roomName) {
return roomName + "@conference." + host; return roomName + "@" + getQualifiedHost(host);
}
/**
* Prepend conference subdomain on host
*
* @param host
* @return
*/
public static String getQualifiedHost(String host) {
return "conference." + host;
} }
/** /**
@ -505,7 +516,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
VenueParticipant user = IDConverter.convertFromRoom(muc, VenueParticipant user = IDConverter.convertFromRoom(muc,
participant); participant);
VenueParticipantEvent event = new VenueParticipantEvent(user, VenueParticipantEvent event = new VenueParticipantEvent(user,
ParticipantEventType.ARRIVED); type);
event.setEventDescription(desciption); event.setEventDescription(desciption);
postEvent(event); postEvent(event);
} }
@ -537,7 +548,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
Activator.getDefault().getNetworkStats() Activator.getDefault().getNetworkStats()
.log(Activator.VENUE, 0, m.getBody().length()); .log(Activator.VENUE, 0, m.getBody().length());
String fromStr = m.getFrom(); String fromStr = m.getFrom();
IQualifiedID from; IUser from;
if (IDConverter.isRoomSystemMessage(fromStr)) { if (IDConverter.isRoomSystemMessage(fromStr)) {
postEvent(new VenueUserEvent(m.getBody())); postEvent(new VenueUserEvent(m.getBody()));
} else { } else {
@ -693,7 +704,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
* user that the message is from * user that the message is from
* @return Should the message be accepted. * @return Should the message be accepted.
*/ */
private boolean accept(Message message, IQualifiedID from) { private boolean accept(Message message, IUser from) {
if (this.muc == null) { if (this.muc == null) {
// we don't seem to be in a room // we don't seem to be in a room
return false; return false;
@ -767,7 +778,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
* user that the message is from * user that the message is from
* @return The converted message. * @return The converted message.
*/ */
private IMessage convertMessage(Message msg, IQualifiedID from) { private IMessage convertMessage(Message msg, IUser from) {
IMessage message = null; IMessage message = null;
String body = msg.getBody(); String body = msg.getBody();
@ -775,7 +786,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
if (body.startsWith(SEND_TXT)) { if (body.startsWith(SEND_TXT)) {
body = body.substring(SEND_TXT.length()); body = body.substring(SEND_TXT.length());
} }
message = new CollaborationMessage(null, body); message = new TextMessage(null, body);
message.setFrom(from); message.setFrom(from);
} }
return message; return message;
@ -802,6 +813,13 @@ public class VenueSession extends BaseSession implements IVenueSession {
return handle; return handle;
} }
/**
* @return userid of this account
*/
public UserId getAccount() {
return getConnection().getUser();
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -811,9 +829,9 @@ public class VenueSession extends BaseSession implements IVenueSession {
*/ */
@Override @Override
public VenueParticipant getUserID() { public VenueParticipant getUserID() {
UserId account = super.getUserID(); UserId account = getAccount();
return new VenueParticipant(account.getName(), account.getHost(), return new VenueParticipant(this.venue.getName(),
handle); getQualifiedHost(account.getHost()), handle, account);
} }
} }

View file

@ -37,6 +37,7 @@ import org.jivesoftware.smackx.muc.Occupant;
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement reworked convertFromRoom for venue participants * Jan 30, 2014 2698 bclement reworked convertFromRoom for venue participants
* Feb 3, 2014 2699 bclement fixed room id parsing when handle has special characters * Feb 3, 2014 2699 bclement fixed room id parsing when handle has special characters
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
@ -78,16 +79,16 @@ public class IDConverter {
} }
String cleanId = id.substring(0, id.length() - handle.length()); String cleanId = id.substring(0, id.length() - handle.length());
String host = StringUtils.parseServer(cleanId); String host = StringUtils.parseServer(cleanId);
String roomName = StringUtils.parseName(id);
String name = null; VenueParticipant rval = new VenueParticipant(roomName, host, handle);
Occupant occupant; Occupant occupant;
if (room != null && (occupant = room.getOccupant(id)) != null) { if (room != null && (occupant = room.getOccupant(id)) != null) {
if (occupant.getJid() != null) { if (occupant.getJid() != null) {
// get actual user name // get actual user name
name = StringUtils.parseName(occupant.getJid()); rval.setUserid(convertFrom(occupant.getJid()));
} }
} }
return new VenueParticipant(name, host, handle); return rval;
} }
public static String normalizeHostname(String hostname) { public static String normalizeHostname(String hostname) {

View file

@ -25,7 +25,7 @@ import org.apache.commons.lang.builder.EqualsBuilder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
* Parsed user id string * Parsed user id string
@ -41,6 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement removed unneeded isSameUser(string, string) * Jan 30, 2014 2698 bclement removed unneeded isSameUser(string, string)
* improved other isSameUser so it won't blow up on nulls * improved other isSameUser so it won't blow up on nulls
* Feb 13, 2014 2751 bclement changed to implement IUser
* *
* </pre> * </pre>
* *
@ -49,7 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
*/ */
@DynamicSerialize @DynamicSerialize
@XmlRootElement(name = "userId") @XmlRootElement(name = "userId")
public class UserId implements IQualifiedID { public class UserId implements IUser {
@DynamicSerializeElement @DynamicSerializeElement
protected String name; protected String name;
@ -102,7 +103,6 @@ public class UserId implements IQualifiedID {
* @param userName * @param userName
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setUserName(java.lang.String) * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setUserName(java.lang.String)
*/ */
@Override
public void setName(String userName) { public void setName(String userName) {
name = userName; name = userName;
} }
@ -121,7 +121,6 @@ public class UserId implements IQualifiedID {
* @param hostName * @param hostName
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String) * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String)
*/ */
@Override
public void setHost(String hostname) { public void setHost(String hostname) {
host = IDConverter.normalizeHostname(hostname); host = IDConverter.normalizeHostname(hostname);
} }
@ -136,23 +135,18 @@ public class UserId implements IQualifiedID {
return host; return host;
} }
/** /**
*
* @param resourceName * @param resourceName
* The resource associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResourceName(java.lang.String)
*/ */
@Override
public void setResource(String resourceName) { public void setResource(String resourceName) {
resource = resourceName; resource = resourceName;
} }
/** /**
* * @return
* @return The resource associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource()
*/ */
@Override
public String getResource() { public String getResource() {
return resource; return resource;
} }
@ -253,7 +247,22 @@ public class UserId implements IQualifiedID {
return isSameUser(IDConverter.convertFrom(id)); return isSameUser(IDConverter.convertFrom(id));
} }
public boolean isSameUser(UserId other) { /*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.user.IUser#isSameUser
* (com.raytheon.uf.viz.collaboration.comm.identity.user.IUser)
*/
@Override
public boolean isSameUser(IUser other) {
if (other instanceof VenueParticipant) {
VenueParticipant vp = (VenueParticipant) other;
if (!vp.hasActualUserId()) {
return false;
}
other = vp.getUserid();
}
EqualsBuilder builder = new EqualsBuilder(); EqualsBuilder builder = new EqualsBuilder();
builder.append(this.name, other.getName()); builder.append(this.name, other.getName());
builder.append(this.host, other.getHost()); builder.append(this.host, other.getHost());

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 29, 2012 jkorman Initial creation * Mar 29, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement removed resource, fixed getFQN
* *
* </pre> * </pre>
* *
@ -42,14 +43,11 @@ public class VenueId implements IQualifiedID {
private String host; private String host;
private String resource;
private String name; private String name;
/** /**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHost(java.lang.String) * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHost(java.lang.String)
*/ */
@Override
public void setHost(String hostName) { public void setHost(String hostName) {
host = hostName; host = hostName;
} }
@ -62,26 +60,9 @@ public class VenueId implements IQualifiedID {
return host; return host;
} }
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResource(java.lang.String)
*/
@Override
public void setResource(String resource) {
this.resource = resource;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource()
*/
@Override
public String getResource() {
return resource;
}
/** /**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.ID#setName(java.lang.String) * @see com.raytheon.uf.viz.collaboration.comm.identity.user.ID#setName(java.lang.String)
*/ */
@Override
public void setName(String venueName) { public void setName(String venueName) {
name = venueName; name = venueName;
} }
@ -99,8 +80,7 @@ public class VenueId implements IQualifiedID {
*/ */
@Override @Override
public String getFQName() { public String getFQName() {
// FIXME return name + "@" + host;
return null;
} }
} }

View file

@ -25,6 +25,8 @@ import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
/** /**
* Parsed ID string from venue. Not guaranteed to have username, but will always * Parsed ID string from venue. Not guaranteed to have username, but will always
@ -37,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 29, 2014 bclement Initial creation * Jan 29, 2014 bclement Initial creation
* Feb 13, 2014 2751 bclement no longer is a subclass of UserId
* *
* </pre> * </pre>
* *
@ -45,7 +48,19 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/ */
@DynamicSerialize @DynamicSerialize
@XmlRootElement(name = "participant") @XmlRootElement(name = "participant")
public class VenueParticipant extends UserId { public class VenueParticipant implements IUser {
@DynamicSerializeElement
private String handle;
@DynamicSerializeElement
private String host;
@DynamicSerializeElement
private UserId userid;
@DynamicSerializeElement
private String room;
/** /**
* *
@ -54,21 +69,33 @@ public class VenueParticipant extends UserId {
} }
/** /**
* @param userName * @param room
* name of venue
* @param hostName * @param hostName
* qualified name of host including conference subdomain
* @param handle
* public name of user in room
* @param userid
* actual userid of user
*/ */
public VenueParticipant(String userName, String hostName) { public VenueParticipant(String room, String hostName, String handle,
super(userName, hostName); UserId userid) {
this(room, hostName, handle);
this.userid = userid;
} }
/** /**
* @param userName * @param room
* name of venue
* @param hostName * @param hostName
* @param resource * qualified name of host including conference subdomain
* @param handle
* public name of user in room
*/ */
public VenueParticipant(String userName, String hostName, String handle) { public VenueParticipant(String room, String hostName, String handle) {
this(userName, hostName); this.room = room;
setAlias(handle); this.host = hostName;
this.handle = handle;
} }
/* /*
@ -81,7 +108,8 @@ public class VenueParticipant extends UserId {
public int hashCode() { public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder(); HashCodeBuilder builder = new HashCodeBuilder();
builder.append(host); builder.append(host);
builder.append(alias); builder.append(handle);
builder.append(room);
return builder.toHashCode(); return builder.toHashCode();
} }
@ -100,29 +128,26 @@ public class VenueParticipant extends UserId {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (!(obj instanceof UserId)) { if (!(obj instanceof VenueParticipant)) {
return false; return false;
} }
UserId user = (UserId) obj; VenueParticipant other = (VenueParticipant) obj;
EqualsBuilder builder = new EqualsBuilder(); EqualsBuilder builder = new EqualsBuilder();
builder.append(alias, user.alias); builder.append(handle, other.handle);
builder.append(host, user.host); builder.append(host, other.host);
builder.append(room, other.room);
return builder.isEquals(); return builder.isEquals();
} }
/* /**
* (non-Javadoc) * @param id
* * @return true if id represents same venue participant as this one
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser
* (java.lang.String)
*/ */
@Override
public boolean isSameUser(String id) { public boolean isSameUser(String id) {
if (!IDConverter.isFromRoom(id)) { if (!IDConverter.isFromRoom(id)) {
return false; return hasActualUserId() && userid.isSameUser(id);
} }
UserId other = IDConverter.convertFromRoom(null, id); VenueParticipant other = IDConverter.convertFromRoom(null, id);
return isSameUser(other); return isSameUser(other);
} }
@ -130,12 +155,123 @@ public class VenueParticipant extends UserId {
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser * com.raytheon.uf.viz.collaboration.comm.identity.user.IUser#isSameUser
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) * (com.raytheon.uf.viz.collaboration.comm.identity.user.IUser)
*/ */
@Override @Override
public boolean isSameUser(UserId other) { public boolean isSameUser(IUser other) {
if (other instanceof UserId) {
return hasActualUserId() && userid.isSameUser(other);
}
if (!(other instanceof VenueParticipant)) {
return false;
}
return equals(other); return equals(other);
} }
@Override
public String toString() {
return getFQName();
}
/**
* @return id of room that this participant is in (includes hostname)
*/
public String getRoomId() {
return room + "@" + host;
}
/**
* @return true if actually userid of participant is known
*/
public boolean hasActualUserId() {
return this.userid != null;
}
/**
* @return the handle
*/
public String getHandle() {
return handle;
}
/**
* @param handle
* the handle to set
*/
public void setHandle(String handle) {
this.handle = handle;
}
/**
* @return the host
*/
public String getHost() {
return host;
}
/**
* @param host
* the host to set
*/
public void setHost(String host) {
this.host = host;
}
/**
* @return the userid
*/
public UserId getUserid() {
return userid;
}
/**
* @param userid
* the userid to set
*/
public void setUserid(UserId userid) {
this.userid = userid;
}
/**
* name of venue
*
* @return the room
*/
public String getRoom() {
return room;
}
/**
* @param room
* name of venue
*/
public void setRoom(String room) {
this.room = room;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getName
* ()
*/
@Override
public String getName() {
return handle;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getFQName
* ()
*/
@Override
public String getFQName() {
return getRoomId() + "/" + handle;
}
} }

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 26, 2012 njensen Initial creation * Mar 26, 2012 njensen Initial creation
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
@ -72,7 +73,7 @@ public class DataProviderEventController extends
@Subscribe @Subscribe
public void participantChanged(IVenueParticipantEvent event) { public void participantChanged(IVenueParticipantEvent event) {
if (event.getEventType().equals(ParticipantEventType.ARRIVED) if (event.getEventType().equals(ParticipantEventType.ARRIVED)
&& !event.getParticipant().equals(session.getUserID())) { && !event.getParticipant().isSameUser(session.getUserID())) {
try { try {
AbstractEditor active = container.getActiveSharedEditor(); AbstractEditor active = container.getActiveSharedEditor();
if (active != null) { if (active != null) {

View file

@ -39,7 +39,7 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.raytheon.uf.viz.collaboration.display.Activator; import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer; import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay; import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay;
@ -82,6 +82,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation * Jun 8, 2012 mschenke Initial creation
* Jan 28, 2014 2698 bclement removed venue info * Jan 28, 2014 2698 bclement removed venue info
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
@ -95,8 +96,8 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
@Subscribe @Subscribe
public void remoteDisplayRequested(RemoteDisplayRequested event) { public void remoteDisplayRequested(RemoteDisplayRequested event) {
String userId = event.getUserId(); String userId = event.getUserId();
UserId user = null; VenueParticipant user = null;
for (UserId uid : session.getVenue().getParticipants()) { for (VenueParticipant uid : session.getVenue().getParticipants()) {
if (uid.getFQName().equals(userId)) { if (uid.getFQName().equals(userId)) {
user = uid; user = uid;
break; break;

View file

@ -29,7 +29,6 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.raytheon.uf.viz.collaboration.display.Activator; import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer; import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
@ -305,7 +304,7 @@ public class CollaborationDrawingResource extends
@Subscribe @Subscribe
public void participantChanged(IVenueParticipantEvent event) { public void participantChanged(IVenueParticipantEvent event) {
UserId user = event.getParticipant(); VenueParticipant user = event.getParticipant();
switch (event.getEventType()) { switch (event.getEventType()) {
case DEPARTED: case DEPARTED:
synchronized (layerMap) { synchronized (layerMap) {
@ -415,7 +414,7 @@ public class CollaborationDrawingResource extends
} }
} }
public void sendEventToUser(Object event, UserId user) { public void sendEventToUser(Object event, VenueParticipant user) {
try { try {
container.getSession().sendObjectToPeer(user, event); container.getSession().sendObjectToPeer(user, event);
} catch (CollaborationException e) { } catch (CollaborationException e) {

View file

@ -34,9 +34,9 @@ import org.jivesoftware.smack.packet.RosterPacket.ItemStatus;
import org.jivesoftware.smack.packet.RosterPacket.ItemType; import org.jivesoftware.smack.packet.RosterPacket.ItemType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation; import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager; import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
@ -50,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 24, 2012 bsteffen Initial creation * Jul 24, 2012 bsteffen Initial creation
* Jan 27, 2014 2700 bclement added roster entry support * Jan 27, 2014 2700 bclement added roster entry support
* Feb 13, 2014 2751 bclement made generic for IUsers
* *
* </pre> * </pre>
* *
@ -57,18 +58,15 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* @version 1.0 * @version 1.0
*/ */
public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { public abstract class AbstractUserLabelProvider<T extends IUser> extends
ColumnLabelProvider {
protected Map<String, Image> imageMap = new HashMap<String, Image>(); protected Map<String, Image> imageMap = new HashMap<String, Image>();
@Override @Override
public String getText(Object element) { public String getText(Object element) {
UserId user; T user = convertObject(element);
if (element instanceof UserId) { if (user == null) {
user = (UserId) element;
} else if ( element instanceof RosterEntry){
user = IDConverter.convertFrom((RosterEntry) element);
} else {
return null; return null;
} }
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();
@ -91,14 +89,18 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
return name.toString(); return name.toString();
} }
/**
* Cast object to appropriate type
*
* @param element
* @return null if object cannot be cast
*/
abstract protected T convertObject(Object element);
@Override @Override
public Image getImage(Object element) { public Image getImage(Object element) {
UserId user; T user = convertObject(element);
if (element instanceof UserId) { if (user == null) {
user = (UserId) element;
} else if (element instanceof RosterEntry) {
user = IDConverter.convertFrom((RosterEntry) element);
} else {
return null; return null;
} }
Presence presence = getPresence(user); Presence presence = getPresence(user);
@ -125,12 +127,8 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
@Override @Override
public String getToolTipText(Object element) { public String getToolTipText(Object element) {
UserId user; T user = convertObject(element);
if (element instanceof UserId) { if (user == null) {
user = (UserId) element;
} else if (element instanceof RosterEntry) {
user = IDConverter.convertFrom((RosterEntry) element);
} else {
return null; return null;
} }
Presence presence = getPresence(user); Presence presence = getPresence(user);
@ -187,7 +185,7 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
imageMap.clear(); imageMap.clear();
} }
protected String getDisplayName(UserId user) { protected static String getLocalAlias(UserId user) {
CollaborationConnection connection = CollaborationConnection CollaborationConnection connection = CollaborationConnection
.getConnection(); .getConnection();
if (connection == null) { if (connection == null) {
@ -201,6 +199,16 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
} }
} }
protected abstract Presence getPresence(UserId user); /**
* @param user
* @return display text for user name
*/
abstract protected String getDisplayName(T user);
/**
* @param user
* @return last known presence for user
*/
abstract protected Presence getPresence(T user);
} }

View file

@ -39,7 +39,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
@ -71,6 +71,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Jan 14, 2014 2630 bclement added away timeout * Jan 14, 2014 2630 bclement added away timeout
* Jan 27, 2014 2700 bclement added auto subscribe property listener * Jan 27, 2014 2700 bclement added auto subscribe property listener
* Jan 30, 2014 2698 bclement moved xmpp join logic to dialog so we can reprompt user on failure * Jan 30, 2014 2698 bclement moved xmpp join logic to dialog so we can reprompt user on failure
* Feb 13, 2014 2751 bclement messages return IUser instead of IQualifiedID
* *
* </pre> * </pre>
* *
@ -226,7 +227,7 @@ public class ConnectionSubscriber {
@Override @Override
public void run() { public void run() {
IQualifiedID peer = message.getFrom(); IUser peer = message.getFrom();
UserId user = null; UserId user = null;
if (peer instanceof UserId) { if (peer instanceof UserId) {

View file

@ -40,8 +40,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil; import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase; import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
@ -59,6 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
* Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed * Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed
* Feb 3, 2014 2699 bclement added default handle preference * Feb 3, 2014 2699 bclement added default handle preference
* Feb 11, 2014 2699 bclement require non-blank handle * Feb 11, 2014 2699 bclement require non-blank handle
* Feb 13, 2014 2751 bclement better types for roomid and inviter
* *
* </pre> * </pre>
* *
@ -110,8 +112,8 @@ public class InviteDialog extends CaveSWTDialogBase {
super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL
| SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL, CAVE.NONE); | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL, CAVE.NONE);
setText("Session Invitation"); setText("Session Invitation");
IQualifiedID inviter = event.getInviter(); IUser inviter = event.getInviter();
IQualifiedID room = event.getRoomId(); VenueId room = event.getRoomId();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
VenueInvite invite = event.getInvite(); VenueInvite invite = event.getInvite();
this.sharedDisplay = invite instanceof SharedDisplayVenueInvite; this.sharedDisplay = invite instanceof SharedDisplayVenueInvite;

View file

@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.SharedGroup; import com.raytheon.uf.viz.collaboration.comm.provider.user.SharedGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer; import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
@ -58,6 +59,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
* Jan 24, 2014 2701 bclement removed local groups, added shared groups * Jan 24, 2014 2701 bclement removed local groups, added shared groups
* Jan 27, 2014 2700 bclement pass roster entries directly to userLabelProvider * Jan 27, 2014 2700 bclement pass roster entries directly to userLabelProvider
* Jan 28, 2014 2698 bclement removed venue info * Jan 28, 2014 2698 bclement removed venue info
* Feb 13, 2014 2751 bclement made AbstractUsersLabelProvider generic
* *
* </pre> * </pre>
* *
@ -66,7 +68,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
*/ */
public class UsersTreeLabelProvider extends ColumnLabelProvider { public class UsersTreeLabelProvider extends ColumnLabelProvider {
private AbstractUserLabelProvider userLabelProvider = new AbstractUserLabelProvider() { private AbstractUserLabelProvider<UserId> userLabelProvider = new AbstractUserLabelProvider<UserId>() {
@Override @Override
protected Presence getPresence(UserId user) { protected Presence getPresence(UserId user) {
@ -77,6 +79,22 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
} }
return connection.getContactsManager().getPresence(user); return connection.getContactsManager().getPresence(user);
} }
protected String getDisplayName(UserId user) {
return getLocalAlias(user);
}
@Override
protected UserId convertObject(Object element) {
if (element instanceof RosterEntry) {
return IDConverter.convertFrom((RosterEntry) element);
} else if (element instanceof UserId) {
return (UserId) element;
} else {
return null;
}
}
}; };
private List<ILabelProviderListener> listeners; private List<ILabelProviderListener> listeners;

View file

@ -68,6 +68,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator; import com.raytheon.uf.viz.collaboration.ui.Activator;
@ -94,6 +95,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* Mar 16, 2012 244 rferrel Initial creation * Mar 16, 2012 244 rferrel Initial creation
* Dec 19, 2013 2563 bclement moved color lookup into runAsync block * Dec 19, 2013 2563 bclement moved color lookup into runAsync block
* Jan 30, 2014 2698 bclement get display name from child class * Jan 30, 2014 2698 bclement get display name from child class
* Feb 13, 2014 2751 bclement made generic
* *
* </pre> * </pre>
* *
@ -101,7 +103,8 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* @version 1.0 * @version 1.0
*/ */
public abstract class AbstractSessionView extends CaveFloatingView { public abstract class AbstractSessionView<T extends IUser> extends
CaveFloatingView {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractSessionView.class); .getHandler(AbstractSessionView.class);
@ -123,8 +126,6 @@ public abstract class AbstractSessionView extends CaveFloatingView {
private StyledText composeText; private StyledText composeText;
private UserId[] userIds = null;
protected SessionMsgArchive msgArchive; protected SessionMsgArchive msgArchive;
private List<AlertWord> alertWords = null; private List<AlertWord> alertWords = null;
@ -149,7 +150,6 @@ public abstract class AbstractSessionView extends CaveFloatingView {
public AbstractSessionView() { public AbstractSessionView() {
imageMap = new HashMap<String, Image>(); imageMap = new HashMap<String, Image>();
userIds = CollaborationUtils.getIds();
fonts = new HashMap<String, Font>(); fonts = new HashMap<String, Font>();
colors = new HashMap<RGB, Color>(); colors = new HashMap<RGB, Color>();
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
@ -311,17 +311,18 @@ public abstract class AbstractSessionView extends CaveFloatingView {
* *
* @param message * @param message
*/ */
@SuppressWarnings("unchecked")
public void appendMessage(IMessage message) { public void appendMessage(IMessage message) {
UserId userId = (UserId) message.getFrom(); T userId = (T) message.getFrom();
long timestamp = message.getTimeStamp(); long timestamp = message.getTimeStamp();
String body = message.getBody(); String body = message.getBody();
String subject = message.getSubject(); String subject = message.getSubject();
appendMessage(userId, timestamp, body, subject); appendMessage(userId, timestamp, body, subject);
} }
protected abstract String getDisplayName(UserId userId); protected abstract String getDisplayName(T userId);
public void appendMessage(final UserId userId, final long timestamp, public void appendMessage(final T userId, final long timestamp,
final String body, final String subject) { final String body, final String subject) {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
@ -345,7 +346,7 @@ public abstract class AbstractSessionView extends CaveFloatingView {
String name = getDisplayName(userId); String name = getDisplayName(userId);
UserId myUser = connection.getUser(); UserId myUser = connection.getUser();
if (!myUser.equals(userId) if (!myUser.isSameUser(userId)
&& Activator.getDefault().getPreferenceStore() && Activator.getDefault().getPreferenceStore()
.getBoolean("notifications")) { .getBoolean("notifications")) {
createNotifier(name, time, body); createNotifier(name, time, body);
@ -443,10 +444,10 @@ public abstract class AbstractSessionView extends CaveFloatingView {
} }
protected abstract void styleAndAppendText(StringBuilder sb, int offset, protected abstract void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, String subject, List<StyleRange> ranges); String name, T userId, String subject, List<StyleRange> ranges);
protected abstract void styleAndAppendText(StringBuilder sb, int offset, protected abstract void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, List<StyleRange> ranges, Color color); String name, T userId, List<StyleRange> ranges, Color color);
/** /**
* Find keys words in body of message starting at offset. /** * Find keys words in body of message starting at offset. /**
@ -567,21 +568,6 @@ public abstract class AbstractSessionView extends CaveFloatingView {
messagesText.setFont(new Font(Display.getCurrent(), data)); messagesText.setFont(new Font(Display.getCurrent(), data));
} }
/**
* @return the userIds
*/
public UserId[] getUserIds() {
return userIds;
}
/**
* @param userIds
* the userIds to set
*/
public void setUserIds(UserId[] userIds) {
this.userIds = userIds;
}
public void setAlertWords(List<AlertWord> words) { public void setAlertWords(List<AlertWord> words) {
alertWords = words; alertWords = words;
} }

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
* added JID and display name if available * added JID and display name if available
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
@ -60,7 +61,8 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
* @version 1.0 * @version 1.0
*/ */
public class ParticipantsLabelProvider extends AbstractUserLabelProvider { public class ParticipantsLabelProvider extends
AbstractUserLabelProvider<VenueParticipant> {
protected String sessionId = null; protected String sessionId = null;
@ -178,9 +180,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
protected boolean isSessionLeader(VenueParticipant user) { protected boolean isSessionLeader(VenueParticipant user) {
ISession session = getSession(); ISession session = getSession();
if (session instanceof SharedDisplaySession) { if (session instanceof SharedDisplaySession) {
UserId leader = ((SharedDisplaySession) session) VenueParticipant leader = ((SharedDisplaySession) session)
.getCurrentSessionLeader(); .getCurrentSessionLeader();
return user.getAlias().equals(leader.getAlias()); return user.getHandle().equals(leader.getHandle());
} }
return false; return false;
} }
@ -188,9 +190,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
protected boolean isDataProvider(VenueParticipant user) { protected boolean isDataProvider(VenueParticipant user) {
ISession session = getSession(); ISession session = getSession();
if (session instanceof SharedDisplaySession) { if (session instanceof SharedDisplaySession) {
UserId provider = ((SharedDisplaySession) session) VenueParticipant provider = ((SharedDisplaySession) session)
.getCurrentDataProvider(); .getCurrentDataProvider();
return user.getAlias().equals(provider.getAlias()); return user.getHandle().equals(provider.getHandle());
} }
return false; return false;
} }
@ -231,10 +233,10 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
// } // }
} }
} }
if (user.getName() != null) { if (user.hasActualUserId()) {
builder.append("\nJID: ").append(user.getNormalizedId()); UserId actual = user.getUserid();
builder.append("\nDisplay Name: ").append( builder.append("\nJID: ").append(actual.getNormalizedId());
super.getDisplayName(user)); builder.append("\nDisplay Name: ").append(getLocalAlias(actual));
} }
return builder.toString(); return builder.toString();
} }
@ -252,9 +254,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
} }
@Override @Override
protected Presence getPresence(UserId user) { protected Presence getPresence(VenueParticipant user) {
IVenueSession session = (IVenueSession) getSession(); IVenueSession session = (IVenueSession) getSession();
return session.getVenue().getPresence((VenueParticipant) user); return session.getVenue().getPresence(user);
} }
/* /*
@ -265,8 +267,24 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) * (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/ */
@Override @Override
protected String getDisplayName(UserId user) { protected String getDisplayName(VenueParticipant user) {
return user.getAlias(); return user.getHandle();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider#convertObject
* (java.lang.Object)
*/
@Override
protected VenueParticipant convertObject(Object element) {
if (element instanceof VenueParticipant) {
return (VenueParticipant) element;
} else {
return null;
}
} }
} }

View file

@ -41,7 +41,6 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer; import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterItem; import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterItem;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@ -58,13 +57,14 @@ import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionIt
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation * Mar 1, 2012 rferrel Initial creation
* Jan 30, 2014 2698 bclement added getDisplayName * Jan 30, 2014 2698 bclement added getDisplayName
* Feb 13, 2014 2751 bclement made parent generic
* *
* </pre> * </pre>
* *
* @author rferrel * @author rferrel
* @version 1.0 * @version 1.0
*/ */
public class PeerToPeerView extends AbstractSessionView implements public class PeerToPeerView extends AbstractSessionView<UserId> implements
IPrintableView { IPrintableView {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PeerToPeerView.class); .getHandler(PeerToPeerView.class);
@ -79,7 +79,7 @@ public class PeerToPeerView extends AbstractSessionView implements
private static Color black = null; private static Color black = null;
private IQualifiedID peer; private UserId peer;
private boolean online = true; private boolean online = true;
@ -238,13 +238,13 @@ public class PeerToPeerView extends AbstractSessionView implements
return new SessionMsgArchive(me.getHost(), me.getName(), peer.getName()); return new SessionMsgArchive(me.getHost(), me.getName(), peer.getName());
} }
public void setPeer(IQualifiedID peer) { public void setPeer(UserId peer) {
this.peer = peer; this.peer = peer;
setPartName(getSessionName()); setPartName(getSessionName());
initMessageArchive(); initMessageArchive();
} }
public IQualifiedID getPeer() { public UserId getPeer() {
return peer; return peer;
} }

View file

@ -40,7 +40,6 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation; import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.raytheon.uf.viz.collaboration.ui.Activator; import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation; import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation;
@ -62,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
* Dec 19, 2013 2563 bclement moved participant filter logic to one method * Dec 19, 2013 2563 bclement moved participant filter logic to one method
* Jan 08, 2014 2563 bclement changes to match SiteConfigurationManager user sites config * Jan 08, 2014 2563 bclement changes to match SiteConfigurationManager user sites config
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
@ -272,9 +272,10 @@ public class SessionFeedView extends SessionView {
@Override @Override
protected void styleAndAppendText(StringBuilder sb, int offset, protected void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, String subject, List<StyleRange> ranges) { String name, VenueParticipant userId, String subject,
if (subject != null && userId instanceof VenueParticipant) { List<StyleRange> ranges) {
setColorForSite((VenueParticipant) userId, subject); if (subject != null) {
setColorForSite(userId, subject);
} }
super.styleAndAppendText(sb, offset, name, userId, subject, ranges); super.styleAndAppendText(sb, offset, name, userId, subject, ranges);
} }

View file

@ -96,13 +96,15 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Dec 6, 2013 2561 bclement removed ECF * Dec 6, 2013 2561 bclement removed ECF
* Dec 19, 2013 2563 bclement reworked participant event logic * Dec 19, 2013 2563 bclement reworked participant event logic
* Jan 28, 2014 2698 bclement removed venue info * Jan 28, 2014 2698 bclement removed venue info
* Feb 13, 2014 2751 bclement VenueParticipant refactor
* *
* </pre> * </pre>
* *
* @author rferrel * @author rferrel
* @version 1.0 * @version 1.0
*/ */
public class SessionView extends AbstractSessionView implements IPrintableView { public class SessionView extends AbstractSessionView<VenueParticipant>
implements IPrintableView {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SessionView.class); .getHandler(SessionView.class);
@ -337,10 +339,10 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
usersTable.setSorter(new ViewerSorter() { usersTable.setSorter(new ViewerSorter() {
@Override @Override
public int compare(Viewer viewer, Object e1, Object e2) { public int compare(Viewer viewer, Object e1, Object e2) {
UserId c1 = (UserId) e1; VenueParticipant c1 = (VenueParticipant) e1;
UserId c2 = (UserId) e1; VenueParticipant c2 = (VenueParticipant) e1;
return c1.getAlias().compareTo(c2.getAlias()); return c1.getHandle().compareTo(c2.getHandle());
} }
}); });
@ -427,8 +429,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
String message = getComposedMessage(); String message = getComposedMessage();
if (message.length() > 0) { if (message.length() > 0) {
try { try {
UserId id = CollaborationConnection.getConnection().getUser(); appendMessage(session.getUserID(), System.currentTimeMillis(),
appendMessage(id, System.currentTimeMillis(), message, null); message, null);
session.sendChatMessage(message); session.sendChatMessage(message);
} catch (CollaborationException e) { } catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as // TODO Auto-generated catch block. Please revise as
@ -448,17 +450,10 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
*/ */
@Override @Override
protected void styleAndAppendText(StringBuilder sb, int offset, protected void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, String subject, List<StyleRange> ranges) { String name, VenueParticipant userId, String subject,
RGB rgb = null; List<StyleRange> ranges) {
// messages from the venue itself will not be of type VenueParticipant, RGB rgb = colorManager.getColorFromUser((VenueParticipant) userId);
// they default to black
if (userId instanceof VenueParticipant) {
rgb = colorManager.getColorFromUser((VenueParticipant) userId);
}
if (mappedColors.get(rgb) == null) { if (mappedColors.get(rgb) == null) {
if (rgb == null) {
rgb = new RGB(0, 0, 0);
}
Color col = new Color(Display.getCurrent(), rgb); Color col = new Color(Display.getCurrent(), rgb);
mappedColors.put(rgb, col); mappedColors.put(rgb, col);
} }
@ -476,7 +471,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
*/ */
@Override @Override
protected void styleAndAppendText(StringBuilder sb, int offset, protected void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, List<StyleRange> ranges, Color color) { String name, VenueParticipant userId, List<StyleRange> ranges,
Color color) {
StyleRange range = new StyleRange(messagesText.getCharCount(), offset, StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
color, null, SWT.NORMAL); color, null, SWT.NORMAL);
ranges.add(range); ranges.add(range);
@ -774,10 +770,11 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
* *
* @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView# * @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#
* getDisplayName * getDisplayName
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) * (com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID)
*/ */
@Override @Override
protected String getDisplayName(UserId userId) { protected String getDisplayName(VenueParticipant userId) {
return userId.getAlias(); return userId.getHandle();
} }
} }