Issue #2698 added handles to venues

venues now handle identity differently with VenueParticipant instead of UserId
fixed alias bug due to roster entry change


Former-commit-id: 9a8b011683ffe7194c48b1827d3a4f0ddf4f9627
This commit is contained in:
Brian Clements 2014-01-30 08:28:22 -06:00
parent ee95e4de7e
commit 3250eb34f5
36 changed files with 725 additions and 351 deletions

View file

@ -21,10 +21,10 @@ 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.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
*
* Interface for sessions that have displays shared between clients
*
* <ul>
* <li>EventBus subscription events. Implementors may to post the following
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -92,28 +93,28 @@ public interface ISharedDisplaySession extends IVenueSession {
*
* @return
*/
public UserId getCurrentDataProvider();
public VenueParticipant getCurrentDataProvider();
/**
* Returns the current Session Leader for the session
*
* @return
*/
public UserId getCurrentSessionLeader();
public VenueParticipant getCurrentSessionLeader();
/**
* Sets the current Data Provider for the session
*
* @param participant
*/
public void setCurrentDataProvider(UserId participant);
public void setCurrentDataProvider(VenueParticipant participant);
/**
* Sets the current Session Leader for the session
*
* @param participant
*/
public void setCurrentSessionLeader(UserId participant);
public void setCurrentSessionLeader(VenueParticipant participant);
/**
* Checks if the currently logged in user has the role on this session

View file

@ -26,9 +26,10 @@ import org.jivesoftware.smack.packet.Presence;
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.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
*
* Interface for multi user sessions
*
* <ul>
* <li>EventBus subscription events. Implementors are required to post the
@ -50,7 +51,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
* Mar 5, 2012 jkorman Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -80,9 +82,8 @@ public interface IVenueSession extends ISession {
*
* @param id
* The target user for this invitation.
* @param subject
* The intended subject of the venue conversation.
* @return
* @param invite
* @throws CollaborationException
*/
public void sendInvitation(UserId id, VenueInvite invite)
throws CollaborationException;
@ -92,9 +93,8 @@ public interface IVenueSession extends ISession {
*
* @param ids
* A list of target users for this invitation.
* @param body
* Any text that the user may wish to include.
* @return
* @param invite
* @throws CollaborationException
*/
public void sendInvitation(List<UserId> ids, VenueInvite invite)
throws CollaborationException;
@ -106,4 +106,9 @@ public interface IVenueSession extends ISession {
*/
public void sendPresence(Presence presence) throws CollaborationException;
/**
*
* @return
*/
public VenueParticipant getUserID();
}

View file

@ -21,7 +21,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity.event;
import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Event fired when a venue participant has a change in status
@ -34,6 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- --------------------------
* Mar 20, 2012 jkorman Initial creation
* Dec 19, 2013 2563 bclement added description getter
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -51,7 +52,7 @@ public interface IVenueParticipantEvent {
/**
* @return user id of participant
*/
public UserId getParticipant();
public VenueParticipant getParticipant();
/**
* @return presence of participant, may be null

View file

@ -23,7 +23,7 @@ import java.util.Collection;
import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Provides information about a venue.
@ -36,6 +36,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
* Jan 28, 2014 2698 bclement removed getInfo, added methods to replace
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -47,7 +48,7 @@ public interface IVenue {
/**
* @return list of users in venue
*/
public Collection<UserId> getParticipants();
public Collection<VenueParticipant> getParticipants();
/**
* Get the presence for a user in the session.
@ -55,7 +56,7 @@ public interface IVenue {
* @param user
* @return
*/
public Presence getPresence(UserId user);
public Presence getPresence(VenueParticipant user);
/**
* @return id of venue "name@service"

View file

@ -28,7 +28,7 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Color information for a list of users
@ -41,6 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- --------------------------
* Apr 19, 2012 mnash Initial creation
* Dec 6, 2013 2561 bclement code cleanup
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -51,7 +52,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@DynamicSerialize
public class ColorPopulator {
@DynamicSerializeElement
private List<UserId> users;
private List<VenueParticipant> users;
@DynamicSerializeElement
private List<Integer> red;
@ -73,12 +74,12 @@ public class ColorPopulator {
* @param rgbs
* Map of user ids to color information
*/
public ColorPopulator(Map<UserId, RGB> rgbs) {
users = new ArrayList<UserId>();
public ColorPopulator(Map<VenueParticipant, RGB> rgbs) {
users = new ArrayList<VenueParticipant>();
red = new ArrayList<Integer>();
green = new ArrayList<Integer>();
blue = new ArrayList<Integer>();
for (UserId key : rgbs.keySet()) {
for (VenueParticipant key : rgbs.keySet()) {
users.add(key);
red.add(rgbs.get(key).red);
green.add(rgbs.get(key).green);
@ -89,8 +90,8 @@ public class ColorPopulator {
/**
* @return Map of user ids to color information
*/
public Map<UserId, RGB> getColors() {
Map<UserId, RGB> colors = new HashMap<UserId, RGB>();
public Map<VenueParticipant, RGB> getColors() {
Map<VenueParticipant, RGB> colors = new HashMap<VenueParticipant, RGB>();
for (int i = 0; i < users.size(); i++) {
colors.put(users.get(i),
new RGB(red.get(i), green.get(i), blue.get(i)));
@ -101,7 +102,7 @@ public class ColorPopulator {
/**
* @return the users
*/
public List<UserId> getUsers() {
public List<VenueParticipant> getUsers() {
return users;
}
@ -109,7 +110,7 @@ public class ColorPopulator {
* @param users
* the users to set
*/
public void setUsers(List<UserId> users) {
public void setUsers(List<VenueParticipant> users) {
this.users = users;
}

View file

@ -21,7 +21,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity.invite;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Invitation to shared display venue
@ -33,6 +33,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 19, 2012 mnash Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -44,24 +45,24 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public class SharedDisplayVenueInvite extends VenueInvite {
@DynamicSerializeElement
private UserId sessionLeader;
private VenueParticipant sessionLeader;
@DynamicSerializeElement
private UserId dataProvider;
private VenueParticipant dataProvider;
public UserId getSessionLeader() {
public VenueParticipant getSessionLeader() {
return sessionLeader;
}
public void setSessionLeader(UserId sessionLeader) {
public void setSessionLeader(VenueParticipant sessionLeader) {
this.sessionLeader = sessionLeader;
}
public UserId getDataProvider() {
public VenueParticipant getDataProvider() {
return dataProvider;
}
public void setDataProvider(UserId dataProvider) {
public void setDataProvider(VenueParticipant dataProvider) {
this.dataProvider = dataProvider;
}

View file

@ -19,7 +19,7 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.event;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* An event to put on a CollaborationConnection event bus when a users nickname
@ -33,6 +33,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 25, 2012 bsteffen Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -42,16 +43,16 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public class UserNicknameChangedEvent {
public final UserId user;
public final VenueParticipant user;
public final String nickname;
public UserNicknameChangedEvent(UserId user, String nickname) {
public UserNicknameChangedEvent(VenueParticipant user, String nickname) {
this.user = user;
this.nickname = nickname;
}
public UserId getUser() {
public VenueParticipant getUser() {
return user;
}

View file

@ -23,7 +23,7 @@ import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Event that is posted when a participant's status changes
@ -36,6 +36,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- --------------------------
* Mar 20, 2012 jkorman Initial creation
* Dec 19, 2013 2563 bclement added description
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -47,19 +48,20 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
private final ParticipantEventType eventType;
private final UserId participant;
private final VenueParticipant participant;
private Presence presence;
private String eventDescription;
public VenueParticipantEvent(UserId participant,
public VenueParticipantEvent(VenueParticipant participant,
ParticipantEventType eventType) {
this.participant = participant;
this.eventType = eventType;
}
public VenueParticipantEvent(UserId participant, Presence presence,
public VenueParticipantEvent(VenueParticipant participant,
Presence presence,
ParticipantEventType eventType) {
this.participant = participant;
this.eventType = eventType;
@ -78,7 +80,7 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getParticipant()
*/
@Override
public UserId getParticipant() {
public VenueParticipant getParticipant() {
return participant;
}

View file

@ -19,12 +19,12 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.info;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Presence;
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.muc.MultiUserChat;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
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.VenueParticipant;
/**
* Provides information about a venue.
@ -49,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Mar 1, 2012 jkorman Initial creation
* Dec 6, 2013 2561 bclement removed ECF
* Jan 28, 2014 2698 bclement removed getInfo, added methods to replace
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null
*
* </pre>
*
@ -66,8 +67,8 @@ public class Venue implements IVenue {
}
@Override
public Collection<UserId> getParticipants() {
Set<UserId> participants = new HashSet<UserId>();
public Collection<VenueParticipant> getParticipants() {
List<VenueParticipant> participants = new ArrayList<VenueParticipant>();
Iterator<String> iter = muc.getOccupants();
while (iter.hasNext()) {
String id = iter.next();
@ -77,8 +78,8 @@ public class Venue implements IVenue {
}
@Override
public Presence getPresence(UserId user) {
Presence presence = presenceMap.get(user.getNormalizedId());
public Presence getPresence(VenueParticipant user) {
Presence presence = presenceMap.get(user.getAlias());
if (presence == null) {
presence = new Presence(Type.unavailable);
presence.setMode(Mode.away);
@ -86,8 +87,8 @@ public class Venue implements IVenue {
return presence;
}
public void handlePresenceUpdated(UserId fromID, Presence presence) {
presenceMap.put(fromID.getNormalizedId(), presence);
public void handlePresenceUpdated(VenueParticipant fromID, Presence presence) {
presenceMap.put(fromID.getAlias(), presence);
}
/*
@ -129,7 +130,8 @@ public class Venue implements IVenue {
*/
@Override
public String getSubject() {
return muc.getSubject();
String rval = muc.getSubject();
return rval != null ? rval : "";
}
}

View file

@ -71,6 +71,7 @@ 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.UserSearch;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
*
@ -107,6 +108,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
* Jan 24, 2014 2701 bclement removed roster manager
* Jan 28, 2014 2698 bclement fixed compression default
* cleaned up createCollaborationVenue, removed getVenueInfo
* Jan 30, 2014 2698 bclement changed arguments to create sessions, moved room connection from SessionView
*
* </pre>
*
@ -365,13 +367,14 @@ public class CollaborationConnection implements IEventPublisher {
}
public ISharedDisplaySession joinCollaborationVenue(
IVenueInvitationEvent invitation) throws CollaborationException {
IVenueInvitationEvent invitation, String handle)
throws CollaborationException {
String venueName = invitation.getRoomId().getName();
String sessionId = invitation.getInvite().getSessionId();
SharedDisplaySession session = new SharedDisplaySession(eventBus, this,
sessionId);
session.configureVenue(venueName);
session.configureVenue(venueName, handle);
session.connectToRoom();
if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
.getInvite();
@ -390,14 +393,16 @@ public class CollaborationConnection implements IEventPublisher {
* @return
* @throws CollaborationException
*/
public ISharedDisplaySession createCollaborationVenue(String venueName,
String subject) throws CollaborationException {
public ISharedDisplaySession createCollaborationVenue(CreateSessionData data)
throws CollaborationException {
SharedDisplaySession session = null;
session = new SharedDisplaySession(eventBus, this);
session.createVenue(venueName, subject);
session.setCurrentSessionLeader(user);
session.setCurrentDataProvider(user);
session.createVenue(data);
VenueParticipant leader = session.getUserID();
leader.setAlias(session.getHandle());
session.setCurrentSessionLeader(leader);
session.setCurrentDataProvider(leader);
sessions.put(session.getSessionId(), session);
postEvent(session);
@ -410,11 +415,12 @@ public class CollaborationConnection implements IEventPublisher {
* @return
* @throws CollaborationException
*/
public IVenueSession joinTextOnlyVenue(String venueName)
public IVenueSession joinTextOnlyVenue(String venueName, String handle)
throws CollaborationException {
try {
VenueSession session = new VenueSession(eventBus, this);
session.configureVenue(venueName);
session.configureVenue(venueName, handle);
session.connectToRoom();
sessions.put(session.getSessionId(), session);
postEvent(session);
return session;
@ -447,10 +453,10 @@ public class CollaborationConnection implements IEventPublisher {
* @return
* @throws CollaborationException
*/
public IVenueSession createTextOnlyVenue(String venueName, String subject)
public IVenueSession createTextOnlyVenue(CreateSessionData data)
throws CollaborationException {
VenueSession session = new VenueSession(eventBus, this);
session.createVenue(venueName, subject);
session.createVenue(data);
sessions.put(session.getSessionId(), session);
postEvent(session);
return session;

View file

@ -17,10 +17,10 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui;
package com.raytheon.uf.viz.collaboration.comm.provider.session;
/**
* TODO Add Description
* Configuration used to create a new session
*
* <pre>
*
@ -29,16 +29,19 @@ package com.raytheon.uf.viz.collaboration.ui;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 rferrel Initial creation
* Jan 30, 2014 2698 bclement moved to collaboration.comm project from collaboration.ui
* added handle
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class CreateSessionData {
private String name;
private String handle;
private String subject;
private boolean inviteUsers;
@ -65,6 +68,21 @@ public class CreateSessionData {
this.name = name;
}
/**
* @return the handle
*/
public String getHandle() {
return handle;
}
/**
* @param handle
* the handle to set
*/
public void setHandle(String handle) {
this.handle = handle;
}
public String getSubject() {
return subject;
}

View file

@ -59,6 +59,7 @@ 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.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Chat room with shared display
@ -72,6 +73,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Apr 18, 2012 njensen Initial creation
* Dec 18, 2013 2562 bclement moved data to packet extension
* Jan 28, 2014 2698 bclement removed venue info
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
* changed args to create/configure venue
*
* </pre>
*
@ -85,9 +88,9 @@ public class SharedDisplaySession extends VenueSession implements
private static final transient IUFStatusHandler log = UFStatus
.getHandler(SharedDisplaySession.class);
private UserId sessionLeader = null;
private VenueParticipant sessionLeader = null;
private UserId dataProvider = null;
private VenueParticipant dataProvider = null;
private PubSubManager pubsubMgr;
@ -102,8 +105,7 @@ public class SharedDisplaySession extends VenueSession implements
}
public SharedDisplaySession(EventBus externalBus,
CollaborationConnection manager, String sessionId)
throws CollaborationException {
CollaborationConnection manager, String sessionId) {
super(externalBus, manager, sessionId);
init();
}
@ -205,7 +207,7 @@ public class SharedDisplaySession extends VenueSession implements
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentDataProvider()
*/
@Override
public UserId getCurrentDataProvider() {
public VenueParticipant getCurrentDataProvider() {
return dataProvider;
}
@ -216,7 +218,7 @@ public class SharedDisplaySession extends VenueSession implements
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentSessionLeader()
*/
@Override
public UserId getCurrentSessionLeader() {
public VenueParticipant getCurrentSessionLeader() {
return sessionLeader;
}
@ -245,7 +247,7 @@ public class SharedDisplaySession extends VenueSession implements
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
public void setCurrentSessionLeader(UserId id) {
public void setCurrentSessionLeader(VenueParticipant id) {
sessionLeader = id;
}
@ -258,7 +260,7 @@ public class SharedDisplaySession extends VenueSession implements
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
public void setCurrentDataProvider(UserId id) {
public void setCurrentDataProvider(VenueParticipant id) {
dataProvider = id;
}
@ -270,9 +272,9 @@ public class SharedDisplaySession extends VenueSession implements
* configureVenue(java.lang.String)
*/
@Override
protected void configureVenue(String venueName)
protected void configureVenue(String venueName, String handle)
throws CollaborationException {
super.configureVenue(venueName);
super.configureVenue(venueName, handle);
try {
configureSubscription();
} catch (XMPPException e) {
@ -331,9 +333,9 @@ public class SharedDisplaySession extends VenueSession implements
* createVenue(java.lang.String, java.lang.String)
*/
@Override
protected void createVenue(String venueName, String subject)
protected void createVenue(CreateSessionData data)
throws CollaborationException {
super.createVenue(venueName, subject);
super.createVenue(data);
try {
createNode(getSessionId());
} catch (XMPPException e) {

View file

@ -41,9 +41,6 @@ import org.jivesoftware.smackx.muc.UserStatusListener;
import org.jivesoftware.smackx.packet.DiscoverItems;
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.Activator;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
@ -51,6 +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.info.IVenue;
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.CollaborationMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload;
import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType;
@ -62,6 +60,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueUserEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue;
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.VenueParticipant;
/**
* Represents a multi-user chat room
@ -94,6 +93,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Jan 08, 2014 2563 bclement fixed service name in user IDs from chat history
* Jan 28, 2014 2698 bclement removed venue info, new rooms are now invite-only
* improved error handling for when room already exists
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, added handle
*
* </pre>
*
@ -106,9 +106,6 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public class VenueSession extends BaseSession implements IVenueSession {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(VenueSession.class);
private static final String SEND_TXT = "[[TEXT]]";
public static final String SEND_HISTORY = "[[HISTORY]]";
@ -119,6 +116,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
private PacketListener participantListener = null;
private String handle;
private Venue venue;
/**
@ -127,8 +126,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param eventBus
*/
protected VenueSession(EventBus externalBus,
CollaborationConnection manager, String sessionId)
throws CollaborationException {
CollaborationConnection manager, String sessionId) {
super(externalBus, manager, sessionId);
}
@ -177,20 +175,13 @@ public class VenueSession extends BaseSession implements IVenueSession {
return venue;
}
/**
* Send an invitation from this venue to another user.
/*
* (non-Javadoc)
*
* @param room
* The target venue for this invitation.
* @param id
* The target user for this invitation.
* @param subject
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @throws CollaborationException
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId,
* com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite)
*/
@Override
public void sendInvitation(UserId id, VenueInvite invite)
@ -211,19 +202,13 @@ public class VenueSession extends BaseSession implements IVenueSession {
muc.invite(msg, id.getNormalizedId(), reason);
}
/**
* Send an invitation from this venue to another user.
/*
* (non-Javadoc)
*
* @param room
* The target venue for this invitation.
* @param id
* The target user for this invitation.
* @param subject
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation
* (java.util.List,
* com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite)
*/
@Override
public void sendInvitation(List<UserId> ids, VenueInvite invite)
@ -235,6 +220,13 @@ public class VenueSession extends BaseSession implements IVenueSession {
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendChatMessage
* (java.lang.String)
*/
@Override
public void sendChatMessage(String message) throws CollaborationException {
// Assume success
@ -254,10 +246,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
* {@link VenueSession#connectToRoom()} to actually join room
*
* @param venueName
* @return
* @param handle
* @throws CollaborationException
*/
protected void configureVenue(String venueName)
protected void configureVenue(String venueName, String handle)
throws CollaborationException {
CollaborationConnection manager = getSessionManager();
XMPPConnection conn = manager.getXmppConnection();
@ -265,6 +257,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
this.muc = new MultiUserChat(conn, roomId);
this.venue = new Venue(conn, muc);
createListeners();
setHandle(manager, handle);
}
/**
@ -281,27 +274,24 @@ public class VenueSession extends BaseSession implements IVenueSession {
/**
* Create room and connect to it
*
* @param venueName
* @param data
* @throws CollaborationException
* @throws Exception
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String,
* java.lang.String)
*/
protected void createVenue(String venueName, String subject)
protected void createVenue(CreateSessionData data)
throws CollaborationException {
try {
CollaborationConnection manager = getSessionManager();
XMPPConnection conn = manager.getXmppConnection();
String roomId = getRoomId(conn.getServiceName(), venueName);
String roomId = getRoomId(conn.getServiceName(), data.getName());
if (roomExistsOnServer(conn, roomId)) {
throw new CollaborationException("Session name already in use");
}
this.muc = new MultiUserChat(conn, roomId);
createListeners();
UserId user = manager.getUser();
muc.create(user.getName());
muc.sendConfigurationForm(getRoomConfig(venueName));
muc.changeSubject(subject);
setHandle(manager, data.getHandle());
muc.create(this.handle);
muc.sendConfigurationForm(getRoomConfig(data.getName()));
muc.changeSubject(data.getSubject());
this.venue = new Venue(conn, muc);
sendPresence(CollaborationConnection.getConnection().getPresence());
} catch (XMPPException e) {
@ -317,12 +307,34 @@ public class VenueSession extends BaseSession implements IVenueSession {
msg = xmppError.getCondition();
}
} else {
msg = "Error creating venue " + venueName;
msg = "Error creating venue " + data.getName();
}
throw new CollaborationException(msg, e);
}
}
/**
* Change handle used in room. If handle is blank or null, the account's
* username is used.
*
* @param manager
* @param handle
*/
private void setHandle(CollaborationConnection manager, String handle) {
if (StringUtils.isBlank(handle)) {
UserId user = manager.getUser();
handle = user.getName();
}
this.handle = handle;
}
/**
* Get filled out configuration form for room creation
*
* @param roomName
* @return
* @throws CollaborationException
*/
protected Form getRoomConfig(String roomName) throws CollaborationException {
Form form;
try {
@ -365,6 +377,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
}
/**
* @param conn
* @param roomId
* @return true if room exists on server
* @throws XMPPException
@ -418,7 +431,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
@Override
public void nicknameChanged(String participant, String newNickname) {
UserId user = IDConverter.convertFromRoom(muc, participant);
VenueParticipant user = IDConverter.convertFromRoom(muc,
participant);
postEvent(new UserNicknameChangedEvent(user, newNickname));
}
@ -488,7 +502,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
private void sendParticipantEvent(String participant,
ParticipantEventType type, String desciption) {
UserId user = IDConverter.convertFromRoom(muc, participant);
VenueParticipant user = IDConverter.convertFromRoom(muc,
participant);
VenueParticipantEvent event = new VenueParticipantEvent(user,
ParticipantEventType.ARRIVED);
event.setEventDescription(desciption);
@ -504,7 +519,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
if (packet instanceof Presence) {
Presence p = (Presence) packet;
String fromID = p.getFrom();
UserId user = IDConverter.convertFromRoom(muc, fromID);
VenueParticipant user = IDConverter.convertFromRoom(muc,
fromID);
venue.handlePresenceUpdated(user, p);
postEvent(new VenueParticipantEvent(user, p,
ParticipantEventType.PRESENCE_UPDATED));
@ -520,8 +536,15 @@ public class VenueSession extends BaseSession implements IVenueSession {
Message m = (Message) packet;
Activator.getDefault().getNetworkStats()
.log(Activator.VENUE, 0, m.getBody().length());
if (accept(m)) {
distributeMessage(convertMessage(m));
String fromStr = m.getFrom();
IQualifiedID from;
if (IDConverter.isRoomSystemMessage(fromStr)) {
postEvent(new VenueUserEvent(m.getBody()));
} else {
from = IDConverter.convertFromRoom(muc, fromStr);
if (accept(m, from)) {
distributeMessage(convertMessage(m, from));
}
}
}
@ -630,20 +653,33 @@ public class VenueSession extends BaseSession implements IVenueSession {
* Allows users to connect after the fact so that they do not miss any
* messages coming from the room (after the dialog/view has been
* instantiated)
*
* @throws CollaborationException
*/
public void connectToRoom() {
public void connectToRoom() throws CollaborationException {
if (this.muc.isJoined()) {
return;
}
try {
UserId user = getSessionManager().getUser();
this.muc.join(user.getName());
this.muc.join(handle);
sendPresence(CollaborationConnection.getConnection().getPresence());
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} catch (XMPPException e) {
statusHandler.handle(Priority.ERROR,
"Unable to connect to container", e);
XMPPError xmppError = e.getXMPPError();
String msg;
if (xmppError != null) {
int code = xmppError.getCode();
if (code == 409) {
// 409: can't join due to handle conflict
msg = "Handle '"
+ handle
+ "' already in use. Please enter a different handle.";
} else {
msg = xmppError.getCondition();
}
} else {
msg = "Error joining venue " + muc.getRoom();
}
throw new CollaborationException(msg, e);
}
}
@ -653,29 +689,19 @@ public class VenueSession extends BaseSession implements IVenueSession {
*
* @param message
* A message to accept.
* @param from
* user that the message is from
* @return Should the message be accepted.
*/
private boolean accept(Message message) {
private boolean accept(Message message, IQualifiedID from) {
if (this.muc == null) {
// we don't seem to be in a room
return false;
}
String from = message.getFrom();
String roomName = Tools.parseName(from);
String thisRoom = Tools.parseName(this.muc.getRoom());
if (!thisRoom.equals(roomName)) {
// this message is for another room, they should have a listener to
// pick it up
return false;
}
UserId account = getSessionManager().getUser();
UserId fromUser = IDConverter.convertFromRoom(muc, from);
String body = message.getBody();
if (!body.startsWith(SEND_HISTORY) && fromUser.isSameUser(account)) {
if (!body.startsWith(SEND_HISTORY) && from.equals(getUserID())) {
// ignore from ourselves except for history
return false;
} else if (body.startsWith(Tools.CMD_PREAMBLE)
@ -687,6 +713,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
}
/**
* Process message and post event to bus
*
* @param message
*/
@ -736,9 +763,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
*
* @param msg
* The chat room message to convert.
* @param from
* user that the message is from
* @return The converted message.
*/
private IMessage convertMessage(Message msg) {
private IMessage convertMessage(Message msg, IQualifiedID from) {
IMessage message = null;
String body = msg.getBody();
@ -747,7 +776,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
body = body.substring(SEND_TXT.length());
}
message = new CollaborationMessage(null, body);
message.setFrom(IDConverter.convertFromRoom(muc, msg.getFrom()));
message.setFrom(from);
}
return message;
}
@ -766,4 +795,25 @@ public class VenueSession extends BaseSession implements IVenueSession {
conn.sendPacket(presence);
}
/**
* @return the handle
*/
public String getHandle() {
return handle;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.session.BaseSession#getUserID
* ()
*/
@Override
public VenueParticipant getUserID() {
UserId account = super.getUserID();
return new VenueParticipant(account.getName(), account.getHost(),
handle);
}
}

View file

@ -47,7 +47,6 @@ import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.collections.UpdatingSet;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
/**
@ -68,6 +67,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
* added shared groups
* Jan 27, 2014 2700 bclement fixed ungrouped entries being out of date
* added utility methods for subscription status
* Jan 30, 2014 2698 bclement removed unneeded nickname changed event
*
* </pre>
*
@ -403,7 +403,6 @@ public class ContactsManager {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
connection.postEvent(new UserNicknameChangedEvent(user, nickname));
}
}

View file

@ -35,6 +35,7 @@ import org.jivesoftware.smackx.muc.Occupant;
* ------------ ---------- ----------- --------------------------
* Mar 28, 2012 jkorman Initial creation
* Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement reworked convertFromRoom for venue participants
*
* </pre>
*
@ -60,25 +61,31 @@ public class IDConverter {
return rval;
}
public static UserId convertFromRoom(MultiUserChat room, String id) {
String nickname = StringUtils.parseResource(id);
if (nickname == null || nickname.trim().isEmpty()) {
// this message is from the room itself
return convertFrom(id);
/**
* Parse userId from room id string "room@host/handle". Name field on
* returned id may be null.
*
* @param room
* @param id
* @return
*/
public static VenueParticipant convertFromRoom(MultiUserChat room, String id) {
String handle = StringUtils.parseResource(id);
if (handle == null || handle.trim().isEmpty()) {
throw new IllegalArgumentException(
"Room participant ids must have handle in resource");
}
String host = StringUtils.parseServer(id);
String name;
String name = null;
Occupant occupant;
if (room != null && (occupant = room.getOccupant(id)) != null) {
// get actual user name
name = StringUtils.parseName(occupant.getJid());
} else {
// fallback to using room nickname
name = nickname;
if (occupant.getJid() != null) {
// get actual user name
name = StringUtils.parseName(occupant.getJid());
}
}
return new UserId(name, host);
return new VenueParticipant(name, host, handle);
}
public static String normalizeHostname(String hostname) {
@ -93,4 +100,11 @@ public class IDConverter {
return host.startsWith(CONF_ID);
}
public static boolean isRoomSystemMessage(String id) {
String handle = StringUtils.parseResource(id);
// system messages look like participant IDs, just without a handle
return isFromRoom(id)
&& org.apache.commons.lang.StringUtils.isBlank(handle);
}
}

View file

@ -21,10 +21,11 @@ package com.raytheon.uf.viz.collaboration.comm.provider.user;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.builder.EqualsBuilder;
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.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/**
* Parsed user id string
@ -38,6 +39,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
* Feb 24, 2012 jkorman Initial creation
* Apr 18, 2012 njensen Major refactor
* Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement removed unneeded isSameUser(string, string)
* improved other isSameUser so it won't blow up on nulls
*
* </pre>
*
@ -247,23 +250,14 @@ public class UserId implements IQualifiedID {
* @return if it is the same user
*/
public boolean isSameUser(String id) {
String name = Tools.parseName(id);
String host = Tools.parseHost(id);
return isSameUser(name, host);
return isSameUser(IDConverter.convertFrom(id));
}
public boolean isSameUser(UserId other) {
return isSameUser(other.getName(), other.getHost());
}
public boolean isSameUser(String name, String host) {
boolean result = false;
if (name != null && host != null) {
if (this.name.equals(name) && this.host.equals(host)) {
result = true;
}
}
return result;
EqualsBuilder builder = new EqualsBuilder();
builder.append(this.name, other.getName());
builder.append(this.host, other.getHost());
return builder.isEquals();
}
}

View file

@ -0,0 +1,141 @@
/**
* 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.user;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Parsed ID string from venue. Not guaranteed to have username, but will always
* have alias.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 29, 2014 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
@DynamicSerialize
@XmlRootElement(name = "participant")
public class VenueParticipant extends UserId {
/**
*
*/
public VenueParticipant() {
}
/**
* @param userName
* @param hostName
*/
public VenueParticipant(String userName, String hostName) {
super(userName, hostName);
}
/**
* @param userName
* @param hostName
* @param resource
*/
public VenueParticipant(String userName, String hostName, String handle) {
this(userName, hostName);
setAlias(handle);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#hashCode()
*/
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
builder.append(host);
builder.append(alias);
return builder.toHashCode();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#equals(java
* .lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (!(obj instanceof UserId)) {
return false;
}
UserId user = (UserId) obj;
EqualsBuilder builder = new EqualsBuilder();
builder.append(alias, user.alias);
builder.append(host, user.host);
return builder.isEquals();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser
* (java.lang.String)
*/
@Override
public boolean isSameUser(String id) {
if (!IDConverter.isFromRoom(id)) {
return false;
}
UserId other = IDConverter.convertFromRoom(null, id);
return isSameUser(other);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
public boolean isSameUser(UserId other) {
return equals(other);
}
}

View file

@ -23,7 +23,7 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
* Event for when a new user enters and a color is added
@ -35,6 +35,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2012 mnash Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -45,7 +46,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@DynamicSerialize
public class ColorChangeEvent {
@DynamicSerializeElement
private UserId userName;
private VenueParticipant userName;
@DynamicSerializeElement
private Integer red;
@ -59,7 +60,7 @@ public class ColorChangeEvent {
public ColorChangeEvent() {
}
public ColorChangeEvent(UserId user, RGB color) {
public ColorChangeEvent(VenueParticipant user, RGB color) {
this.userName = user;
if (color != null) {
red = color.red;
@ -72,14 +73,14 @@ public class ColorChangeEvent {
* @param userName
* the userName to set
*/
public void setUserName(UserId userName) {
public void setUserName(VenueParticipant userName) {
this.userName = userName;
}
/**
* @return the userName
*/
public UserId getUserName() {
public VenueParticipant getUserName() {
return userName;
}

View file

@ -24,7 +24,7 @@ import java.util.Map;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.raytheon.viz.core.ColorUtil;
/**
@ -38,6 +38,7 @@ import com.raytheon.viz.core.ColorUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 3, 2012 mnash Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -47,7 +48,7 @@ import com.raytheon.viz.core.ColorUtil;
public class SessionColorManager {
private Map<UserId, RGB> colors;
private Map<VenueParticipant, RGB> colors;
private static RGB[] rgbPresets = null;
@ -56,7 +57,7 @@ public class SessionColorManager {
*/
public SessionColorManager() {
if (colors == null) {
colors = new HashMap<UserId, RGB>();
colors = new HashMap<VenueParticipant, RGB>();
rgbPresets = ColorUtil.getResourceColorPresets();
}
}
@ -64,22 +65,22 @@ public class SessionColorManager {
/**
* @return the colors
*/
public Map<UserId, RGB> getColors() {
public Map<VenueParticipant, RGB> getColors() {
return colors;
}
public void setColors(Map<UserId, RGB> map) {
public void setColors(Map<VenueParticipant, RGB> map) {
colors = map;
}
public RGB getColorFromUser(UserId user) {
public RGB getColorFromUser(VenueParticipant user) {
if (colors.get(user) == null) {
addUser(user);
}
return colors.get(user);
}
public void setColorForUser(UserId id, RGB rgb) {
public void setColorForUser(VenueParticipant id, RGB rgb) {
colors.put(id, rgb);
}
@ -88,7 +89,7 @@ public class SessionColorManager {
*
* @param user
*/
public void addUser(UserId user) {
public void addUser(VenueParticipant user) {
int count = colors.size();
if (rgbPresets.length <= count) {
count = count % rgbPresets.length;

View file

@ -23,11 +23,11 @@ import java.util.List;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.vividsolutions.jts.geom.Coordinate;
/**
* TODO Add Description
* Event posted when a venue participant draws on shared display
*
* <pre>
*
@ -36,6 +36,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 3, 2012 mnash Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -57,7 +58,7 @@ public class CollaborationDrawingEvent {
private List<Coordinate> coordinates;
@DynamicSerializeElement
private UserId userName;
private VenueParticipant userName;
@DynamicSerializeElement
private CollaborationEventType type;
@ -103,7 +104,7 @@ public class CollaborationDrawingEvent {
/**
* @return the userName
*/
public UserId getUserName() {
public VenueParticipant getUserName() {
return userName;
}
@ -111,7 +112,7 @@ public class CollaborationDrawingEvent {
* @param userName
* the userName to set
*/
public void setUserName(UserId userName) {
public void setUserName(VenueParticipant userName) {
this.userName = userName;
}

View file

@ -30,6 +30,7 @@ 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.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.display.Activator;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
@ -61,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2012 mschenke Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -73,9 +75,9 @@ public class CollaborationDrawingResource extends
private SessionContainer container;
private UserId myUser;
private VenueParticipant myUser;
private Map<UserId, DrawingToolLayer> layerMap;
private Map<VenueParticipant, DrawingToolLayer> layerMap;
private CollaborationDrawingUIManager manager;
@ -97,7 +99,7 @@ public class CollaborationDrawingResource extends
}
myUser = container.getSession().getUserID();
layerMap = new HashMap<UserId, DrawingToolLayer>();
layerMap = new HashMap<VenueParticipant, DrawingToolLayer>();
}
/*
@ -111,7 +113,7 @@ public class CollaborationDrawingResource extends
protected void initInternal(IGraphicsTarget target) throws VizException {
EditableManager.makeEditable(this, true);
if (layerMap == null) {
layerMap = new HashMap<UserId, DrawingToolLayer>();
layerMap = new HashMap<VenueParticipant, DrawingToolLayer>();
}
OutlineCapability outline = getCapability(OutlineCapability.class);
@ -165,7 +167,7 @@ public class CollaborationDrawingResource extends
OutlineCapability outline = getCapability(OutlineCapability.class);
synchronized (layerMap) {
for (UserId user : layerMap.keySet()) {
for (VenueParticipant user : layerMap.keySet()) {
DrawingToolLayer layer = layerMap.get(user);
if (layer != null) {
layer.setEraserWidth(16); // Configure?
@ -203,7 +205,7 @@ public class CollaborationDrawingResource extends
/**
* @return the myUser
*/
public UserId getMyUser() {
public VenueParticipant getMyUser() {
return myUser;
}
@ -224,7 +226,7 @@ public class CollaborationDrawingResource extends
* @param user
* @return
*/
public DrawingToolLayer getDrawingLayerFor(UserId user) {
public DrawingToolLayer getDrawingLayerFor(VenueParticipant user) {
if (layerMap != null) {
synchronized (layerMap) {
DrawingToolLayer layer = layerMap.get(user);
@ -321,7 +323,7 @@ public class CollaborationDrawingResource extends
@Subscribe
public void handleDrawEvent(CollaborationDrawingEvent event) {
UserId user = event.getUserName();
VenueParticipant user = event.getUserName();
if (event.getDisplayId() != resourceData.getDisplayId()
|| user.equals(myUser)) {
// Early exit case, don't process my own events twice

View file

@ -24,7 +24,7 @@ import java.util.Stack;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.vividsolutions.jts.geom.Geometry;
/**
@ -38,6 +38,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 11, 2012 dgilling Initial creation
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -52,7 +53,7 @@ public class InitialCollaborationData {
private int displayId;
@DynamicSerializeElement
private UserId userName;
private VenueParticipant userName;
@DynamicSerializeElement
private boolean sessionLeader;
@ -77,7 +78,7 @@ public class InitialCollaborationData {
}
public InitialCollaborationData(UserId userName, int displayId,
public InitialCollaborationData(VenueParticipant userName, int displayId,
boolean sessionLeader, boolean drawingLocked,
CollaborationDrawingToolLayer layer) {
this.userName = userName;
@ -89,11 +90,11 @@ public class InitialCollaborationData {
this.redoData = layer.getRedoStack();
}
public UserId getUserName() {
public VenueParticipant getUserName() {
return userName;
}
public void setUserName(UserId userName) {
public void setUserName(VenueParticipant userName) {
this.userName = userName;
}

View file

@ -85,7 +85,6 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.event.ServerDisconnectEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChangedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
@ -140,6 +139,8 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* Jan 24, 2014 2701 bclement removed local groups, added shared groups
* removed option to create empty group
* Jan 27, 2014 2700 bclement fixed context menu for roster entries
* Jan 30, 2014 2698 bclement fixed alias not working for roster entries
* removed unneeded subscription for nickname changed events
*
* </pre>
*
@ -569,8 +570,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
}
protected void changeText(Object selectedObj, String newText) {
if (selectedObj instanceof UserId) {
UserId user = (UserId) selectedObj;
if (selectedObj instanceof RosterEntry) {
UserId user = IDConverter.convertFrom((RosterEntry) selectedObj);
user.setAlias(newText);
CollaborationConnection.getConnection().getContactsManager()
.setNickname(user, newText);
@ -906,11 +907,6 @@ public class CollaborationGroupView extends CaveFloatingView implements
refreshUsersTreeViewerAsync(group);
}
@Subscribe
public void userNicknameChanged(UserNicknameChangedEvent e) {
refreshUsersTreeViewerAsync(usersTreeViewer.getInput());
}
@Subscribe
public void serverDisconnected(final ServerDisconnectEvent e) {
if (logOut == null) {

View file

@ -39,8 +39,6 @@ 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.ITextMessageEvent;
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.VenueInvite;
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.provider.TextMessage;
@ -72,6 +70,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Dec 18, 2013 2562 bclement fixed venue invite
* Jan 14, 2014 2630 bclement added away timeout
* 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
*
* </pre>
*
@ -186,31 +185,15 @@ public class ConnectionSubscriber {
@Override
public void run() {
IQualifiedID inviter = event.getInviter();
IQualifiedID room = event.getRoomId();
Shell shell = new Shell(Display.getCurrent());
StringBuilder sb = new StringBuilder();
VenueInvite invite = event.getInvite();
boolean sharedDisplay = invite instanceof SharedDisplayVenueInvite;
sb.append("You are invited to a ");
if (sharedDisplay) {
sb.append("collaboration session.");
} else {
sb.append("chat room.");
}
InviteDialog inviteBox = new InviteDialog(shell, inviter
.getName(), invite.getSubject(), room.getName(), sb
.toString(), invite.getMessage());
InviteDialog inviteBox = new InviteDialog(shell, event);
if (!(Boolean) inviteBox.open()) {
return;
}
CollaborationConnection connection = CollaborationConnection
.getConnection();
try {
IVenueSession session;
if (sharedDisplay) {
session = connection.joinCollaborationVenue(event);
IVenueSession session = inviteBox.getSession();
if (inviteBox.isSharedDisplay()) {
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
SessionColorManager man = new SessionColorManager();
SharedDisplaySessionMgr.joinSession(displaySession,
@ -220,13 +203,10 @@ public class ConnectionSubscriber {
CollaborationSessionView.ID, session.getSessionId(),
IWorkbenchPage.VIEW_ACTIVATE);
} else {
session = connection.joinTextOnlyVenue(room.getName());
CaveWorkbenchPageManager.getActiveInstance().showView(
SessionView.ID, session.getSessionId(),
IWorkbenchPage.VIEW_ACTIVATE);
}
} catch (CollaborationException e) {
statusHandler.error("Unable to join session venue", e);
} catch (PartInitException e) {
statusHandler.error("Unable to display session view", e);
}

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CreateSessionData;
import com.raytheon.uf.viz.collaboration.comm.provider.session.PeerToPeerCommHelper;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
@ -85,6 +86,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Feb 15, 2012 rferrel Initial creation
* Dec 19, 2013 2563 bclement disable shared display option if not supported by server
* Jan 28, 2014 2698 bclement added error display text
* Jan 30, 2014 2698 bclement added handle to join room with
*
* </pre>
*
@ -98,6 +100,8 @@ public class CreateSessionDialog extends CaveSWTDialog {
private Text nameTF;
private Text handleTF;
private Text subjectTF;
private Button sharedSessionDisplay;
@ -122,8 +126,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
private Control createDialogArea(Composite parent) {
Composite body = new Composite(parent, SWT.NONE);
body.setLayout(new GridLayout(2, false));
// body.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
// | GridData.HORIZONTAL_ALIGN_FILL));
Label label = null;
label = new Label(body, SWT.NONE);
label.setText("Name: ");
@ -131,7 +134,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.minimumWidth = 200;
nameTF.setLayoutData(gd);
nameTF.addVerifyListener(new VerifyListener() {
VerifyListener validNameListener = new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
@ -140,7 +143,15 @@ public class CreateSessionDialog extends CaveSWTDialog {
// Toolkit.getDefaultToolkit().beep();
}
}
});
};
nameTF.addVerifyListener(validNameListener);
label = new Label(body, SWT.NONE);
label.setText("Handle: ");
handleTF = new Text(body, SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
handleTF.setLayoutData(gd);
handleTF.addVerifyListener(validNameListener);
label = new Label(body, SWT.NONE);
label.setText("Subject: ");
@ -438,11 +449,20 @@ public class CreateSessionDialog extends CaveSWTDialog {
focusField = nameTF;
errorMessages.add(err);
}
err = validateHandle();
String handle = handleTF.getText();
if (err != null) {
if (focusField == null) {
focusField = handleTF;
}
errorMessages.add(err);
}
if (focusField == null) {
CreateSessionData result = new CreateSessionData();
result.setName(name);
result.setSubject(subject);
result.setHandle(handle);
result.setCollaborationSessioh(sharedSessionDisplay
.getSelection());
if (inviteUsers == null) {
@ -457,15 +477,15 @@ public class CreateSessionDialog extends CaveSWTDialog {
CollaborationConnection connection = CollaborationConnection
.getConnection();
if (result.isCollaborationSession()) {
session = connection.createCollaborationVenue(
result.getName(), result.getSubject());
session = connection
.createCollaborationVenue(result);
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
SharedDisplaySessionMgr.joinSession(
displaySession,
SharedDisplayRole.DATA_PROVIDER, null);
} else {
session = connection.createTextOnlyVenue(
result.getName(), result.getSubject());
session = connection
.createTextOnlyVenue(result);
}
result.setSessionId(session.getSessionId());
setReturnValue(result);
@ -513,7 +533,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
if (name.length() <= 0) {
err = "Must have session name.";
} else if (!Tools.isValidId(name)) {
err = "Name contains invalid characters.";
err = "Session name contains invalid characters.";
} else {
try {
if (VenueSession.roomExistsOnServer(name)) {
@ -527,6 +547,16 @@ public class CreateSessionDialog extends CaveSWTDialog {
return err;
}
private String validateHandle() {
String handle = handleTF.getText().trim();
handleTF.setText(handle);
String err = null;
if (!Tools.isValidId(handle)) {
err = "Handle contains invalid characters.";
}
return err;
}
private void enableOrDisableSharedDisplays() {
boolean sharedSessionsEnabled = Activator
.getDefault()

View file

@ -23,6 +23,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
@ -33,7 +35,15 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
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.invite.SharedDisplayVenueInvite;
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.session.CollaborationConnection;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
/**
@ -47,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 14, 2012 lvenable Initial creation.
* Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed
*
* </pre>
*
@ -70,6 +81,16 @@ public class InviteDialog extends CaveSWTDialogBase {
private Font font;
private Text handleText;
private IVenueSession session;
private boolean sharedDisplay;
private IVenueInvitationEvent event;
private Text errorMessage;
/**
* Constructor.
*
@ -84,18 +105,27 @@ public class InviteDialog extends CaveSWTDialogBase {
* @param iconStyle
* Icon style to be displayed.
*/
public InviteDialog(Shell parentShell, String inviter, String subject,
String room, String inviteText, String message) {
public InviteDialog(Shell parentShell, IVenueInvitationEvent event) {
super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL
| SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL, CAVE.NONE);
setText("Session Invitation");
this.inviter = inviter;
this.subject = subject;
this.room = room;
this.inviteText = inviteText;
this.message = message;
IQualifiedID inviter = event.getInviter();
IQualifiedID room = event.getRoomId();
StringBuilder sb = new StringBuilder();
VenueInvite invite = event.getInvite();
this.sharedDisplay = invite instanceof SharedDisplayVenueInvite;
sb.append("You are invited to a ");
if (sharedDisplay) {
sb.append("collaboration session.");
} else {
sb.append("chat room.");
}
this.event = event;
this.inviter = inviter.getName();
this.subject = invite.getSubject();
this.room = room.getName();
this.inviteText = sb.toString();
this.message = invite.getMessage();
setReturnValue(Boolean.FALSE);
}
@ -156,6 +186,28 @@ public class InviteDialog extends CaveSWTDialogBase {
gd.horizontalSpan = 2;
text.setLayoutData(gd);
}
addLabel(labelTextComp, "Join With Handle:", true);
handleText = new Text(labelTextComp, SWT.BORDER);
handleText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
handleText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
if (" \t\"&'/,<>@".indexOf(e.character) >= 0) {
e.doit = false;
// Toolkit.getDefaultToolkit().beep();
}
}
});
GridData gd = new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
errorMessage = new Text(labelTextComp, SWT.READ_ONLY | SWT.WRAP);
errorMessage.setLayoutData(gd);
Display display = errorMessage.getDisplay();
errorMessage.setBackground(display
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
errorMessage.setForeground(display.getSystemColor(SWT.COLOR_RED));
font.dispose();
}
@ -206,9 +258,26 @@ public class InviteDialog extends CaveSWTDialogBase {
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setReturnValue(Boolean.TRUE);
close();
public void widgetSelected(SelectionEvent se) {
CollaborationConnection connection = CollaborationConnection
.getConnection();
String handle = handleText.getText();
try {
if (sharedDisplay) {
session = connection.joinCollaborationVenue(event,
handle);
} else {
session = connection.joinTextOnlyVenue(room, handle);
}
setReturnValue(Boolean.TRUE);
se.doit = true;
close();
} catch (CollaborationException ex) {
se.doit = false;
setReturnValue(Boolean.FALSE);
errorMessage.setText(ex.getLocalizedMessage());
errorMessage.setVisible(true);
}
}
});
@ -225,4 +294,16 @@ public class InviteDialog extends CaveSWTDialogBase {
}
});
}
public IVenueSession getSession() {
return session;
}
/**
* @return the sharedDisplay
*/
public boolean isSharedDisplay() {
return sharedDisplay;
}
}

View file

@ -30,9 +30,9 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CreateSessionData;
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.CreateSessionData;
import com.raytheon.uf.viz.collaboration.ui.CreateSessionDialog;
import com.raytheon.uf.viz.collaboration.ui.IUserSelector;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;

View file

@ -55,6 +55,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Jul 5, 2012 bsteffen Initial creation
* Dec 19, 2013 2563 bclement added check for feed venue existence
* Jan 28, 2014 2698 bclement changed feed venue filter to match whole name
* Jan 30, 2014 2698 bclement added default handle of username
*
* </pre>
*
@ -102,8 +103,9 @@ public class DisplayFeedAction extends Action {
}
if (sessionId == null && create) {
try {
IVenueSession session = connection
.joinTextOnlyVenue(FEED_VENUE);
// TODO auto join with handle from preferences
IVenueSession session = connection.joinTextOnlyVenue(
FEED_VENUE, connection.getUser().getName());
sessionId = session.getSessionId();
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenue
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
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.display.data.SharedDisplaySessionMgr;
/**
@ -58,6 +59,7 @@ import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
* Jul 3, 2012 bsteffen Initial creation
* Dec 6, 2013 2561 bclement removed ECF
* Jan 28, 2014 2698 bclement removed venue info
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -168,10 +170,10 @@ public class InviteAction extends Action {
.getSessions();
for (ISession session : sessions) {
if (session != null && session instanceof IVenueSession) {
Collection<UserId> participants = ((IVenueSession) session)
Collection<VenueParticipant> participants = ((IVenueSession) session)
.getVenue().getParticipants();
boolean notInRoom = true;
for (UserId pa : participants) {
for (VenueParticipant pa : participants) {
if (pa.isSameUser(user)) {
notInRoom = false;
break;

View file

@ -93,6 +93,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
* ------------ ---------- ----------- --------------------------
* Mar 16, 2012 244 rferrel Initial creation
* Dec 19, 2013 2563 bclement moved color lookup into runAsync block
* Jan 30, 2014 2698 bclement get display name from child class
*
* </pre>
*
@ -318,6 +319,8 @@ public abstract class AbstractSessionView extends CaveFloatingView {
appendMessage(userId, timestamp, body, subject);
}
protected abstract String getDisplayName(UserId userId);
public void appendMessage(final UserId userId, final long timestamp,
final String body, final String subject) {
VizApp.runAsync(new Runnable() {
@ -339,8 +342,7 @@ public abstract class AbstractSessionView extends CaveFloatingView {
Date date = new Date(timestamp);
String time = dateFormatter.format(date);
String name = connection.getContactsManager().getDisplayName(
userId);
String name = getDisplayName(userId);
UserId myUser = connection.getUser();
if (!myUser.equals(userId)

View file

@ -55,7 +55,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.ColorPopulator;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
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.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.IRemoteDisplayChangedListener;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteDisplay;
@ -92,6 +92,7 @@ import com.raytheon.viz.ui.input.EditableManager;
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
* Jan 28, 2014 2698 bclement removed venue info
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -206,7 +207,8 @@ public class CollaborationSessionView extends SessionView implements
if (rgb != null) {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
UserId entry = (UserId) selection.getFirstElement();
VenueParticipant entry = (VenueParticipant) selection
.getFirstElement();
ColorChangeEvent event = new ColorChangeEvent(entry, rgb);
try {
session.sendObjectToVenue(event);
@ -478,7 +480,7 @@ public class CollaborationSessionView extends SessionView implements
String message = getComposedMessage();
if (message.length() > 0) {
try {
UserId id = CollaborationConnection.getConnection().getUser();
VenueParticipant id = session.getUserID();
appendMessage(id, System.currentTimeMillis(), message, null);
((IVenueSession) session).sendChatMessage(message);
} catch (CollaborationException e) {
@ -511,7 +513,8 @@ public class CollaborationSessionView extends SessionView implements
public void modifyColors(ColorPopulator populator) {
SessionColorManager colorMan = SharedDisplaySessionMgr
.getSessionContainer(sessionId).getColorManager();
for (Entry<UserId, RGB> entry : populator.getColors().entrySet()) {
for (Entry<VenueParticipant, RGB> entry : populator.getColors()
.entrySet()) {
colorMan.setColorForUser(entry.getKey(), entry.getValue());
}
VizApp.runAsync(new Runnable() {

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformatio
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
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.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
@ -50,6 +51,8 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 mnash Initial creation
* Dec 6, 2013 2561 bclement removed ECF
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
* added JID and display name if available
*
* </pre>
*
@ -103,10 +106,10 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
@Override
public Font getFont(Object element) {
if (!(element instanceof UserId)) {
if (!(element instanceof VenueParticipant)) {
return null;
}
UserId user = (UserId) element;
VenueParticipant user = (VenueParticipant) element;
boolean leader = isSessionLeader(user);
boolean provider = isDataProvider(user);
if (leader && provider) {
@ -139,10 +142,10 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
@Override
public Color getForeground(Object element) {
if (!(element instanceof UserId)) {
if (!(element instanceof VenueParticipant)) {
return null;
}
UserId user = ((UserId) element);
VenueParticipant user = ((VenueParticipant) element);
RGB rgb = manager.getColorFromUser(user);
if (rgb == null) {
rgb = new RGB(0, 0, 0);
@ -172,22 +175,22 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
return connection.getSession(sessionId);
}
protected boolean isSessionLeader(UserId user) {
protected boolean isSessionLeader(VenueParticipant user) {
ISession session = getSession();
if (session instanceof SharedDisplaySession) {
UserId leader = ((SharedDisplaySession) session)
.getCurrentSessionLeader();
return user.equals(leader);
return user.getAlias().equals(leader.getAlias());
}
return false;
}
protected boolean isDataProvider(UserId user) {
protected boolean isDataProvider(VenueParticipant user) {
ISession session = getSession();
if (session instanceof SharedDisplaySession) {
UserId provider = ((SharedDisplaySession) session)
.getCurrentDataProvider();
return user.equals(provider);
return user.getAlias().equals(provider.getAlias());
}
return false;
}
@ -199,7 +202,7 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
return null;
}
StringBuilder builder = new StringBuilder(toolTip);
UserId user = (UserId) element;
VenueParticipant user = (VenueParticipant) element;
Presence presence = getPresence(user);
if (presence != null) {
String site = String.valueOf(presence
@ -228,6 +231,11 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
// }
}
}
if (user.getName() != null) {
builder.append("\nJID: ").append(user.getNormalizedId());
builder.append("\nDisplay Name: ").append(
super.getDisplayName(user));
}
return builder.toString();
}
@ -246,6 +254,19 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
@Override
protected Presence getPresence(UserId user) {
IVenueSession session = (IVenueSession) getSession();
return session.getVenue().getPresence(user);
return session.getVenue().getPresence((VenueParticipant) user);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider#getDisplayName
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
protected String getDisplayName(UserId user) {
return user.getAlias();
}
}

View file

@ -48,7 +48,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
/**
* TODO Add Description
* UI display for one-on-one chat sessions
*
* <pre>
*
@ -57,6 +57,7 @@ import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionIt
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
* Jan 30, 2014 2698 bclement added getDisplayName
*
* </pre>
*
@ -304,4 +305,17 @@ public class PeerToPeerView extends AbstractSessionView implements
+ ", Date: "
+ dateFormatter.format(msgArchive.getCreationTime());
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#
* getDisplayName
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
protected String getDisplayName(UserId userId) {
CollaborationConnection conn = CollaborationConnection.getConnection();
return conn.getContactsManager().getDisplayName(userId);
}
}

View file

@ -41,6 +41,7 @@ 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.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.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation;
import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation.SiteColor;
@ -60,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
* Dec 6, 2013 2561 bclement removed ECF
* 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 30, 2014 2698 bclement changed UserId to VenueParticipant
*
* </pre>
*
@ -109,7 +111,7 @@ public class SessionFeedView extends SessionView {
super.initComponents(parent);
colors = SiteConfigurationManager.getSiteColors();
if (colors != null) {
for (UserId user : session.getVenue().getParticipants()) {
for (VenueParticipant user : session.getVenue().getParticipants()) {
setColorForSite(user);
}
} else {
@ -147,7 +149,8 @@ public class SessionFeedView extends SessionView {
// loop through all the entries in the list so we can set the
// color for all sites corresponding to "selectedSite"
if (site != null) {
for (UserId user : session.getVenue().getParticipants()) {
for (VenueParticipant user : session.getVenue()
.getParticipants()) {
setColorForSite(user);
}
}
@ -254,9 +257,9 @@ public class SessionFeedView extends SessionView {
Object site = null;
if (isHistory) {
site = msg.getSubject();
} else if (msg.getFrom() instanceof UserId) {
} else if (msg.getFrom() instanceof VenueParticipant) {
Presence presence = session.getVenue().getPresence(
(UserId) msg.getFrom());
(VenueParticipant) msg.getFrom());
site = presence.getProperty(SiteConfigInformation.SITE_NAME);
}
@ -270,8 +273,8 @@ public class SessionFeedView extends SessionView {
@Override
protected void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, String subject, List<StyleRange> ranges) {
if (subject != null) {
setColorForSite(userId, subject);
if (subject != null && userId instanceof VenueParticipant) {
setColorForSite((VenueParticipant) userId, subject);
}
super.styleAndAppendText(sb, offset, name, userId, subject, ranges);
}
@ -285,7 +288,8 @@ public class SessionFeedView extends SessionView {
private String getSelectedSite() {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
UserId selectedEntry = (UserId) selection.getFirstElement();
VenueParticipant selectedEntry = (VenueParticipant) selection
.getFirstElement();
Presence pres = session.getVenue().getPresence(selectedEntry);
Object selectedSite = pres.getProperty(
SiteConfigInformation.SITE_NAME);
@ -299,7 +303,7 @@ public class SessionFeedView extends SessionView {
*
* @param user
*/
private void setColorForSite(UserId user) {
private void setColorForSite(VenueParticipant user) {
Presence presence = session.getVenue().getPresence(user);
setColorForSite(user, presence);
}
@ -310,7 +314,7 @@ public class SessionFeedView extends SessionView {
* @param id
* @param presence
*/
private void setColorForSite(UserId id, Presence presence) {
private void setColorForSite(VenueParticipant id, Presence presence) {
if (presence == null) {
return;
}
@ -321,7 +325,7 @@ public class SessionFeedView extends SessionView {
}
}
private void setColorForSite(UserId id, String site) {
private void setColorForSite(VenueParticipant id, String site) {
SiteColor siteColor = new SiteColor();
siteColor.setSite(site.toString());
int index = colors.indexOf(siteColor);
@ -364,7 +368,7 @@ public class SessionFeedView extends SessionView {
* java.lang.String)
*/
@Override
protected void sendParticipantSystemMessage(UserId participant,
protected void sendParticipantSystemMessage(VenueParticipant participant,
String message) {
Presence presence = session.getVenue().getPresence(participant);
Object siteObj = presence.getProperty(SiteConfigInformation.SITE_NAME);
@ -388,7 +392,7 @@ public class SessionFeedView extends SessionView {
* org.jivesoftware.smack.packet.Presence)
*/
@Override
protected void participantPresenceUpdated(UserId participant,
protected void participantPresenceUpdated(VenueParticipant participant,
Presence presence) {
setColorForSite(participant, presence);
super.participantPresenceUpdated(participant, presence);

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,9 +34,6 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
@ -80,8 +76,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueUserEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
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.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
@ -239,25 +235,6 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
}
@Subscribe
public void updateUserAlias(UserId id) {
Collection<?> entries = (Collection<?>) usersTable.getInput();
for (Object obj : entries) {
if (!(obj instanceof UserId)) {
statusHandler.error("Unexpected user table input type: "
+ obj.getClass());
return;
}
UserId uid = (UserId) obj;
if (uid.getFQName().equals(id.getFQName())) {
// TODO update on roster?
uid.setAlias(id.getAlias());
break;
}
}
usersTable.refresh();
}
protected void initColorManager() {
colorManager = new SessionColorManager();
}
@ -363,23 +340,24 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
UserId c1 = (UserId) e1;
UserId c2 = (UserId) e1;
return c1.getName().compareTo(c2.getName());
return c1.getAlias().compareTo(c2.getAlias());
}
});
ColumnViewerToolTipSupport.enableFor(usersTable, ToolTip.RECREATE);
usersTable.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
StructuredSelection selection = (StructuredSelection) usersTable
.getSelection();
Object o = selection.getFirstElement();
if (o instanceof UserId) {
new PeerToPeerChatAction((UserId) o).run();
}
}
});
// TODO this needs to be a private chat through the muc
// usersTable.addDoubleClickListener(new IDoubleClickListener() {
// @Override
// public void doubleClick(DoubleClickEvent event) {
// StructuredSelection selection = (StructuredSelection) usersTable
// .getSelection();
//
// Object o = selection.getFirstElement();
// if (o instanceof UserId) {
// new PeerToPeerChatAction((UserId) o).run();
// }
// }
// });
if (session != null) {
usersTable.setInput(session.getVenue().getParticipants());
@ -471,7 +449,12 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
@Override
protected void styleAndAppendText(StringBuilder sb, int offset,
String name, UserId userId, String subject, List<StyleRange> ranges) {
RGB rgb = colorManager.getColorFromUser(userId);
RGB rgb = null;
// messages from the venue itself will not be of type VenueParticipant,
// they default to black
if (userId instanceof VenueParticipant) {
rgb = colorManager.getColorFromUser((VenueParticipant) userId);
}
if (mappedColors.get(rgb) == null) {
if (rgb == null) {
rgb = new RGB(0, 0, 0);
@ -608,8 +591,6 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
CollaborationConnection.getConnection().registerEventHandler(this);
session.registerEventHandler(this);
((VenueSession) session).connectToRoom();
}
/*
@ -637,7 +618,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
final ParticipantEventType type = event.getEventType();
final Presence presence = event.getPresence();
final UserId participant = event.getParticipant();
final VenueParticipant participant = event.getParticipant();
final String description = event.getEventDescription();
VizApp.runAsync(new Runnable() {
@ -681,7 +662,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
*
* @param participant
*/
protected void participantArrived(UserId participant, String description) {
protected void participantArrived(VenueParticipant participant,
String description) {
usersTable.setInput(session.getVenue().getParticipants());
usersTable.refresh();
String message = description != null ? description
@ -694,7 +676,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
*
* @param participant
*/
protected void participantDeparted(UserId participant, String description) {
protected void participantDeparted(VenueParticipant participant,
String description) {
usersTable.setInput(session.getVenue().getParticipants());
usersTable.refresh();
String message = description != null ? description
@ -711,13 +694,12 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
* @param participant
* @param message
*/
protected void sendParticipantSystemMessage(UserId participant,
protected void sendParticipantSystemMessage(VenueParticipant participant,
String message) {
CollaborationConnection connection = CollaborationConnection
.getConnection();
if (connection != null) {
String name = connection.getContactsManager().getDisplayName(
participant);
String name = getDisplayName(participant);
StringBuilder builder = new StringBuilder(name);
builder.append(" ").append(message);
@ -729,7 +711,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
* @param participant
* @param presence
*/
protected void participantPresenceUpdated(UserId participant,
protected void participantPresenceUpdated(VenueParticipant participant,
Presence presence) {
usersTable.refresh();
}
@ -786,4 +768,16 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
+ ", Date: "
+ dateFormatter.format(msgArchive.getCreationTime());
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#
* getDisplayName
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
protected String getDisplayName(UserId userId) {
return userId.getAlias();
}
}

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Smack
Bundle-SymbolicName: org.jivesoftware.smack
Bundle-Version: 3.3.1
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: smack.jar,
.,
smackx.jar