Merge "Issue #2848 fixed session create, listen, join ordering" into development
Former-commit-id:722216e319
[formerly 89427f93a4459a2f5feeac4f9df00db3143eb998] Former-commit-id:fb2677db7d
This commit is contained in:
commit
9633d5f252
26 changed files with 470 additions and 221 deletions
|
@ -51,9 +51,10 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 5, 2012 jkorman Initial creation
|
||||
* Mar 05, 2012 jkorman Initial creation
|
||||
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
|
||||
* Mar 06, 2014 2751 bclement added isAdmin()
|
||||
* Mar 07, 2014 2848 bclement added getVenueName() and hasOtherParticipants()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,6 +71,11 @@ public interface IVenueSession extends ISession {
|
|||
*/
|
||||
public IVenue getVenue();
|
||||
|
||||
/**
|
||||
* @return name of chat room serving as venue
|
||||
*/
|
||||
public String getVenueName();
|
||||
|
||||
/**
|
||||
* Send a chat message.
|
||||
*
|
||||
|
@ -117,4 +123,8 @@ public interface IVenueSession extends ISession {
|
|||
*/
|
||||
public boolean isAdmin();
|
||||
|
||||
/**
|
||||
* @return false if current user is the only participant in the session
|
||||
*/
|
||||
public boolean hasOtherParticipants();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Feb 13, 2014 2751 bclement changed to use VenueParticipant handle instead of alias
|
||||
* Mar 05, 2014 2798 mpduff Get Presence from MUC.
|
||||
* Mar 06, 2014 2751 bclement added getParticipantUserid()
|
||||
* Mar 07, 2014 2848 bclement added hasOtherParticipants()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,6 +78,13 @@ public class Venue implements IVenue {
|
|||
this.muc = muc;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public Collection<VenueParticipant> getParticipants() {
|
||||
List<VenueParticipant> participants = new ArrayList<VenueParticipant>();
|
||||
|
@ -88,6 +96,13 @@ public class Venue implements IVenue {
|
|||
return participants;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getPresence
|
||||
* (com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant)
|
||||
*/
|
||||
@Override
|
||||
public Presence getPresence(VenueParticipant user) {
|
||||
Presence presence = muc.getOccupantPresence(user.getFQName());
|
||||
|
@ -172,4 +187,12 @@ public class Venue implements IVenue {
|
|||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false if current user is the only participant in the venue
|
||||
*/
|
||||
public boolean hasOtherParticipants() {
|
||||
// current user is included in participant count
|
||||
return getParticipantCount() > 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
|
@ -54,8 +55,6 @@ import com.raytheon.uf.common.xmpp.iq.AuthInfoProvider;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||
|
@ -118,6 +117,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Feb 18, 2014 2793 bclement improved disconnection notification and handling
|
||||
* Feb 24, 2014 2632 mpduff Fix roster change type for presence change.
|
||||
* Feb 28, 2014 2756 bclement added authManager
|
||||
* Mar 07, 2014 2848 bclement removed join*Venue methods, now only creates venue objects
|
||||
* changed session map to a concurrent hash map
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -190,7 +191,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
Tools.setProperties(initialPresence, connectionData.getAttributes());
|
||||
|
||||
eventBus = new EventBus();
|
||||
sessions = new HashMap<String, ISession>();
|
||||
sessions = new ConcurrentHashMap<String, ISession>();
|
||||
|
||||
HostAndPort hnp = HostAndPort.fromString(connectionData.getServer());
|
||||
ConnectionConfiguration conConfig;
|
||||
|
@ -383,62 +384,84 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
return chatInstance;
|
||||
}
|
||||
|
||||
public ISharedDisplaySession joinCollaborationVenue(
|
||||
IVenueInvitationEvent invitation, String handle)
|
||||
throws CollaborationException {
|
||||
String venueName = invitation.getRoomId().getName();
|
||||
/**
|
||||
* Create shared display venue object. This does not create the venue on the
|
||||
* server. The session should be unregistered when no longer active using
|
||||
* {@link CollaborationConnection#removeSession(ISession)}
|
||||
*
|
||||
* @param invitation
|
||||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
public SharedDisplaySession createCollaborationVenue(
|
||||
IVenueInvitationEvent invitation, String handle) {
|
||||
SharedDisplayVenueInvite sdvInvite = (SharedDisplayVenueInvite) invitation
|
||||
.getInvite();
|
||||
String sessionId = invitation.getInvite().getSessionId();
|
||||
SharedDisplaySession session = new SharedDisplaySession(eventBus, this,
|
||||
sessionId);
|
||||
session.configureVenue(venueName, handle);
|
||||
session.connectToRoom();
|
||||
if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
|
||||
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
|
||||
.getInvite();
|
||||
session.setCurrentDataProvider(invite.getDataProvider());
|
||||
session.setCurrentSessionLeader(invite.getSessionLeader());
|
||||
}
|
||||
|
||||
sessions.put(session.getSessionId(), session);
|
||||
postEvent(session);
|
||||
return session;
|
||||
String venueName = invitation.getRoomId().getName();
|
||||
SharedDisplaySession rval = new SharedDisplaySession(eventBus, this,
|
||||
venueName, handle, sessionId);
|
||||
setupCollaborationVenue(rval, sdvInvite.getSessionLeader(),
|
||||
sdvInvite.getDataProvider());
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure shared display venue object and register with session map
|
||||
*
|
||||
* @param venueName
|
||||
* @return
|
||||
* @throws CollaborationException
|
||||
* @param session
|
||||
* @param leader
|
||||
* @param provider
|
||||
*/
|
||||
public ISharedDisplaySession createCollaborationVenue(CreateSessionData data)
|
||||
throws CollaborationException {
|
||||
SharedDisplaySession session = null;
|
||||
session = new SharedDisplaySession(eventBus, this);
|
||||
|
||||
session.createVenue(data);
|
||||
VenueParticipant leader = session.getUserID();
|
||||
leader.setHandle(session.getHandle());
|
||||
private void setupCollaborationVenue(SharedDisplaySession session,
|
||||
VenueParticipant leader, VenueParticipant provider) {
|
||||
session.setCurrentSessionLeader(leader);
|
||||
session.setCurrentDataProvider(leader);
|
||||
|
||||
session.setCurrentDataProvider(provider);
|
||||
sessions.put(session.getSessionId(), session);
|
||||
postEvent(session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create shared display venue object. This does not create the venue on the
|
||||
* server. The session should be unregistered when no longer active using
|
||||
* {@link CollaborationConnection#removeSession(ISession)}
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public SharedDisplaySession createCollaborationVenue(CreateSessionData data) {
|
||||
SharedDisplaySession session = new SharedDisplaySession(eventBus, this,
|
||||
data);
|
||||
VenueParticipant leader = session.getUserID();
|
||||
setupCollaborationVenue(session, leader, leader);
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create text only venue object. This does not create the venue on the
|
||||
* server. The session should be unregistered when no longer active using
|
||||
* {@link CollaborationConnection#removeSession(ISession)}
|
||||
*
|
||||
* @param venueName
|
||||
* @param handle
|
||||
* @return
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public IVenueSession joinTextOnlyVenue(String venueName, String handle)
|
||||
throws CollaborationException {
|
||||
VenueSession session = new VenueSession(eventBus, this);
|
||||
session.configureVenue(venueName, handle);
|
||||
session.connectToRoom();
|
||||
public VenueSession createTextOnlyVenue(String venueName, String handle) {
|
||||
return createTextOnlyVenue(new CreateSessionData(venueName, handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create text only venue object. This does not create the venue on the
|
||||
* server. The session should be unregistered when no longer active using
|
||||
* {@link CollaborationConnection#removeSession(ISession)}
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public VenueSession createTextOnlyVenue(CreateSessionData data) {
|
||||
VenueSession session = new VenueSession(eventBus, this, data);
|
||||
sessions.put(session.getSessionId(), session);
|
||||
postEvent(session);
|
||||
return session;
|
||||
}
|
||||
|
||||
|
@ -459,26 +482,11 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param venueName
|
||||
* @return
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public IVenueSession createTextOnlyVenue(CreateSessionData data)
|
||||
throws CollaborationException {
|
||||
VenueSession session = new VenueSession(eventBus, this);
|
||||
session.createVenue(data);
|
||||
sessions.put(session.getSessionId(), session);
|
||||
postEvent(session);
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param session
|
||||
*/
|
||||
protected void removeSession(ISession session) {
|
||||
public void removeSession(ISession session) {
|
||||
sessions.remove(session.getSessionId());
|
||||
postEvent(session);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
|||
* Mar 7, 2012 rferrel Initial creation
|
||||
* Jan 30, 2014 2698 bclement moved to collaboration.comm project from collaboration.ui
|
||||
* added handle
|
||||
* Mar 10, 2014 2848 bclement added constructor with required fields
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,6 +53,18 @@ public class CreateSessionData {
|
|||
|
||||
private String sessionId;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* name of session venue
|
||||
* @param handle
|
||||
* name user is known by in venue
|
||||
*/
|
||||
public CreateSessionData(String name, String handle) {
|
||||
this.name = name;
|
||||
this.handle = handle;
|
||||
this.collaborationSession = false;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Feb 24, 2014 2751 bclement added validation for change leader event
|
||||
* Feb 28, 2014 2756 bclement added cleanUpHttpStorage()
|
||||
* Mar 06, 2014 2751 bclement added calls to getParticipantUserid()
|
||||
* Mar 07, 2014 2848 bclement moved pubsub close logic to closePubSub()
|
||||
* ensure that subscription is setup before joining room
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,14 +117,15 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
private boolean closed = false;
|
||||
|
||||
public SharedDisplaySession(EventBus externalBus,
|
||||
CollaborationConnection manager) {
|
||||
super(externalBus, manager);
|
||||
CollaborationConnection manager, String venueName, String handle,
|
||||
String sessionId) {
|
||||
super(externalBus, manager, venueName, handle, sessionId);
|
||||
init();
|
||||
}
|
||||
|
||||
public SharedDisplaySession(EventBus externalBus,
|
||||
CollaborationConnection manager, String sessionId) {
|
||||
super(externalBus, manager, sessionId);
|
||||
CollaborationConnection manager, CreateSessionData data) {
|
||||
super(externalBus, manager, data);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -297,15 +300,21 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
* configureVenue(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void configureVenue(String venueName, String handle)
|
||||
public void configureVenue()
|
||||
throws CollaborationException {
|
||||
super.configureVenue(venueName, handle);
|
||||
try {
|
||||
configureSubscription();
|
||||
} catch (XMPPException e) {
|
||||
closePubSub();
|
||||
throw new CollaborationException(
|
||||
"Unable to configure subscription", e);
|
||||
}
|
||||
try {
|
||||
super.configureVenue();
|
||||
} catch (CollaborationException e) {
|
||||
closePubSub();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,19 +366,22 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
* createVenue(java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void createVenue(CreateSessionData data)
|
||||
public void createVenue(CreateSessionData data)
|
||||
throws CollaborationException {
|
||||
super.createVenue(data);
|
||||
boolean topicCreated = false;
|
||||
try {
|
||||
createNode(getSessionId());
|
||||
} catch (XMPPException e) {
|
||||
throw new CollaborationException("Unable to create topic", e);
|
||||
}
|
||||
try {
|
||||
topicCreated = true;
|
||||
configureSubscription();
|
||||
super.createVenue(data);
|
||||
} catch (XMPPException e) {
|
||||
throw new CollaborationException(
|
||||
"Unable to configure pubsub topic", e);
|
||||
closePubSub();
|
||||
String action = topicCreated ? "configure" : "create";
|
||||
throw new CollaborationException("Unable to " + action
|
||||
+ " session topic", e);
|
||||
} catch (CollaborationException e) {
|
||||
closePubSub();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,6 +494,10 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
closePubSub();
|
||||
}
|
||||
|
||||
private void closePubSub() {
|
||||
try {
|
||||
if (pubsubMgr == null || topic == null || !topicExists()) {
|
||||
return;
|
||||
|
|
|
@ -102,6 +102,10 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Feb 24, 2014 2751 bclement added isRoomOwner()
|
||||
* Mar 05, 2014 2798 mpduff Don't handle Presence, get from MUC instead..
|
||||
* Mar 06, 2014 2751 bclement added isAdmin()
|
||||
* Mar 07, 2014 2848 bclement added getVenueName() and hasOtherParticipants()
|
||||
* moved muc close logic to closeMuc()
|
||||
* handle is now set in constructor
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -132,14 +136,21 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
|
||||
private volatile boolean admin = false;
|
||||
|
||||
private String venueName;
|
||||
|
||||
private volatile boolean otherParticipants = false;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param container
|
||||
* @param eventBus
|
||||
*/
|
||||
protected VenueSession(EventBus externalBus,
|
||||
CollaborationConnection manager, String sessionId) {
|
||||
CollaborationConnection manager, String venueName, String handle,
|
||||
String sessionId) {
|
||||
super(externalBus, manager, sessionId);
|
||||
this.venueName = venueName;
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,8 +158,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
* @param container
|
||||
* @param eventBus
|
||||
*/
|
||||
protected VenueSession(EventBus externalBus, CollaborationConnection manager) {
|
||||
protected VenueSession(EventBus externalBus,
|
||||
CollaborationConnection manager, CreateSessionData data) {
|
||||
super(externalBus, manager);
|
||||
this.venueName = data.getName();
|
||||
this.handle = data.getHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,6 +173,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
closeMuc();
|
||||
super.close();
|
||||
}
|
||||
|
||||
private void closeMuc() {
|
||||
if (muc == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -172,8 +191,6 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
}
|
||||
muc.leave();
|
||||
muc = null;
|
||||
|
||||
super.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,8 +279,12 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
* @param handle
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
protected void configureVenue(String venueName, String handle)
|
||||
throws CollaborationException {
|
||||
public void configureVenue() throws CollaborationException {
|
||||
/*
|
||||
* the throws statement is for subclasses. if this method ever actually
|
||||
* throws an exception, it needs to call closeMuc() to ensure that we
|
||||
* remove the listeners
|
||||
*/
|
||||
CollaborationConnection manager = getSessionManager();
|
||||
XMPPConnection conn = manager.getXmppConnection();
|
||||
String roomId = getRoomId(conn.getServiceName(), venueName);
|
||||
|
@ -300,7 +321,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
* @param data
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
protected void createVenue(CreateSessionData data)
|
||||
public void createVenue(CreateSessionData data)
|
||||
throws CollaborationException {
|
||||
try {
|
||||
CollaborationConnection manager = getSessionManager();
|
||||
|
@ -333,6 +354,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
} else {
|
||||
msg = "Error creating venue " + data.getName();
|
||||
}
|
||||
closeMuc();
|
||||
throw new CollaborationException(msg, e);
|
||||
}
|
||||
}
|
||||
|
@ -527,8 +549,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
private void logParticipantEvent(String participant,
|
||||
ParticipantEventType type, String desciption) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
IVenue v = getVenue();
|
||||
builder.append("In session '").append(v.getName())
|
||||
builder.append("In session '").append(getVenueName())
|
||||
.append("': ");
|
||||
builder.append(participant).append(" ").append(desciption);
|
||||
log.debug(builder.toString());
|
||||
|
@ -536,6 +557,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
|
||||
private void sendParticipantEvent(String participant,
|
||||
ParticipantEventType type, String desciption) {
|
||||
if (type.equals(ParticipantEventType.ARRIVED)) {
|
||||
otherParticipants = true;
|
||||
} else if (type.equals(ParticipantEventType.DEPARTED)) {
|
||||
otherParticipants = venue.hasOtherParticipants();
|
||||
}
|
||||
VenueParticipant user = IDConverter.convertFromRoom(muc,
|
||||
participant);
|
||||
VenueParticipantEvent event = new VenueParticipantEvent(user,
|
||||
|
@ -663,8 +689,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
|
||||
private void logUserEvent(String message) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
IVenue v = getVenue();
|
||||
builder.append("In session '").append(v.getName())
|
||||
builder.append("In session '").append(getVenueName())
|
||||
.append("': ");
|
||||
builder.append(message);
|
||||
log.info(builder.toString());
|
||||
|
@ -711,6 +736,13 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
try {
|
||||
this.muc.join(handle);
|
||||
sendPresence(CollaborationConnection.getConnection().getPresence());
|
||||
/*
|
||||
* can't rely on having received any presence updates yet (used in
|
||||
* venue.getParticipantCount()). This code should only happen when
|
||||
* the client is joining an existing room, so error on the side of
|
||||
* caution and assume that the room isn't empty
|
||||
*/
|
||||
otherParticipants = true;
|
||||
} catch (XMPPException e) {
|
||||
XMPPError xmppError = e.getXMPPError();
|
||||
String msg;
|
||||
|
@ -788,7 +820,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
message.getBody());
|
||||
UserId account = CollaborationConnection.getConnection()
|
||||
.getUser();
|
||||
msg.setFrom(new VenueParticipant(this.venue.getName(),
|
||||
msg.setFrom(new VenueParticipant(this.getVenueName(),
|
||||
getQualifiedHost(account.getHost()), msgHandle));
|
||||
msg.setTimeStamp(time);
|
||||
msg.setSubject(site);
|
||||
|
@ -867,7 +899,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
@Override
|
||||
public VenueParticipant getUserID() {
|
||||
UserId account = getAccount();
|
||||
return new VenueParticipant(this.venue.getName(),
|
||||
return new VenueParticipant(this.getVenueName(),
|
||||
getQualifiedHost(account.getHost()), handle, account);
|
||||
}
|
||||
|
||||
|
@ -902,4 +934,26 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
return admin;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#getVenueName
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String getVenueName() {
|
||||
return venueName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#
|
||||
* hasOtherParticipants()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasOtherParticipants() {
|
||||
return otherParticipants;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ import com.raytheon.viz.core.ColorUtil;
|
|||
|
||||
/**
|
||||
*
|
||||
* Manages colors of different users for a session
|
||||
* Manages colors of different users for a session. Participants have different
|
||||
* colors for text and telestration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -37,8 +38,9 @@ import com.raytheon.viz.core.ColorUtil;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 3, 2012 mnash Initial creation
|
||||
* Apr 03, 2012 mnash Initial creation
|
||||
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
|
||||
* Mar 06, 2014 2848 bclement synchronized color access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,56 +50,75 @@ import com.raytheon.viz.core.ColorUtil;
|
|||
|
||||
public class SessionColorManager {
|
||||
|
||||
private Map<VenueParticipant, RGB> colors;
|
||||
private final Map<VenueParticipant, RGB> colors = new HashMap<VenueParticipant, RGB>();
|
||||
|
||||
private static RGB[] rgbPresets = null;
|
||||
private static final RGB[] rgbPresets = ColorUtil.getResourceColorPresets();
|
||||
|
||||
/**
|
||||
* Get a map of venue participants to their assigned colors used for
|
||||
*
|
||||
*/
|
||||
public SessionColorManager() {
|
||||
if (colors == null) {
|
||||
colors = new HashMap<VenueParticipant, RGB>();
|
||||
rgbPresets = ColorUtil.getResourceColorPresets();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the colors
|
||||
* @return
|
||||
*/
|
||||
public Map<VenueParticipant, RGB> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
public void setColors(Map<VenueParticipant, RGB> map) {
|
||||
colors = map;
|
||||
}
|
||||
|
||||
public RGB getColorFromUser(VenueParticipant user) {
|
||||
if (colors.get(user) == null) {
|
||||
addUser(user);
|
||||
Map<VenueParticipant, RGB> rval;
|
||||
synchronized (colors) {
|
||||
rval = new HashMap<VenueParticipant, RGB>(colors);
|
||||
}
|
||||
return colors.get(user);
|
||||
}
|
||||
|
||||
public void setColorForUser(VenueParticipant id, RGB rgb) {
|
||||
colors.put(id, rgb);
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user with a new color value
|
||||
* Clear color assignments and repopulate with supplied map
|
||||
*
|
||||
* @param user
|
||||
* @param map
|
||||
*/
|
||||
public void addUser(VenueParticipant user) {
|
||||
int count = colors.size();
|
||||
if (rgbPresets.length <= count) {
|
||||
count = count % rgbPresets.length;
|
||||
public void setColors(Map<VenueParticipant, RGB> map) {
|
||||
synchronized (colors) {
|
||||
colors.clear();
|
||||
colors.putAll(map);
|
||||
}
|
||||
colors.put(user, rgbPresets[count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get participant's assigned color
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public RGB getColorForUser(VenueParticipant user) {
|
||||
RGB rval;
|
||||
synchronized (colors) {
|
||||
rval = colors.get(user);
|
||||
if (rval == null) {
|
||||
int count = colors.size();
|
||||
if (rgbPresets.length <= count) {
|
||||
count = count % rgbPresets.length;
|
||||
}
|
||||
rval = rgbPresets[count];
|
||||
colors.put(user, rval);
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign color to participant
|
||||
*
|
||||
* @param id
|
||||
* @param rgb
|
||||
*/
|
||||
public void setColorForUser(VenueParticipant id, RGB rgb) {
|
||||
synchronized (colors) {
|
||||
colors.put(id, rgb);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear color assignments
|
||||
*/
|
||||
public void clearColors() {
|
||||
colors.clear();
|
||||
synchronized (colors) {
|
||||
colors.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.ColorPopulator;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.LeaderChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
|
||||
|
@ -47,6 +48,7 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 16, 2012 njensen Initial creation
|
||||
* Feb 11, 2014 2751 njensen Added leaderChanged() and listeners
|
||||
* Mar 07, 2014 2848 bclement made colorManager final, added modifyColors() listeners
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,7 +67,7 @@ public class SessionContainer {
|
|||
/** subscribes to events related to the session based on role **/
|
||||
private IRoleEventController roleEventController;
|
||||
|
||||
private SessionColorManager colorManager;
|
||||
private final SessionColorManager colorManager = new SessionColorManager();
|
||||
|
||||
private IRemoteDisplayContainer displayContainer;
|
||||
|
||||
|
@ -116,19 +118,9 @@ public class SessionContainer {
|
|||
* @return the colorManager
|
||||
*/
|
||||
public SessionColorManager getColorManager() {
|
||||
if (colorManager == null) {
|
||||
colorManager = new SessionColorManager();
|
||||
}
|
||||
return colorManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colorManager
|
||||
* the colorManager to set
|
||||
*/
|
||||
public void setColorManager(SessionColorManager colorManager) {
|
||||
this.colorManager = colorManager;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void leaderChanged(LeaderChangeEvent event) {
|
||||
|
@ -143,7 +135,7 @@ public class SessionContainer {
|
|||
if (!(formerRole instanceof DataProviderEventController)) {
|
||||
throw new IllegalStateException(
|
||||
"Shared Display Session "
|
||||
+ session.getVenue().getName()
|
||||
+ session.getVenueName()
|
||||
+ " attempted to surrender leadership when it's not the leader!");
|
||||
}
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
@ -164,7 +156,7 @@ public class SessionContainer {
|
|||
if (!(formerRole instanceof ParticipantEventController)) {
|
||||
throw new IllegalStateException(
|
||||
"Shared Display Session "
|
||||
+ session.getVenue().getName()
|
||||
+ session.getVenueName()
|
||||
+ " attempted to acquire leadership when it wasn't a participant!");
|
||||
}
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
@ -180,6 +172,16 @@ public class SessionContainer {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void modifyColors(ColorPopulator populator) {
|
||||
colorManager.setColors(populator.getColors());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void modifyColors(ColorChangeEvent event) {
|
||||
colorManager.setColorForUser(event.getUserName(), event.getColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for listening if a remote display container associated with a
|
||||
* session changed. This only applies if the reference to a remote display
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.raytheon.uf.viz.collaboration.display.roles.ParticipantEventControlle
|
|||
* Apr 16, 2012 njensen Initial creation
|
||||
* Jan 28, 2014 2698 bclement removed false throws statement
|
||||
* Feb 12, 2014 2751 njensen Register session containers to session event bus
|
||||
* Mar 07, 2014 2848 bclement split event handler registration from joinSession() to registerSession()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,8 +62,15 @@ public class SharedDisplaySessionMgr {
|
|||
return sharedDisplaySessionMap.keySet();
|
||||
}
|
||||
|
||||
public static void joinSession(ISharedDisplaySession session,
|
||||
SharedDisplayRole initialRole, SessionColorManager colors) {
|
||||
/**
|
||||
* Add a session to the manager and register listeners with session event
|
||||
* bus.
|
||||
*
|
||||
* @param session
|
||||
* @param initialRole
|
||||
*/
|
||||
public static void registerSession(ISharedDisplaySession session,
|
||||
SharedDisplayRole initialRole) {
|
||||
SessionContainer container = new SessionContainer();
|
||||
container.setSessionId(session.getSessionId());
|
||||
container.setSession(session);
|
||||
|
@ -80,15 +88,22 @@ public class SharedDisplaySessionMgr {
|
|||
"ParticipantRole must be DataProvider or Participant for initialization");
|
||||
}
|
||||
container.setRoleEventController(rec);
|
||||
if (colors != null) {
|
||||
container.setColorManager(colors);
|
||||
}
|
||||
sharedDisplaySessionMap.put(session.getSessionId(), container);
|
||||
|
||||
rec.startup();
|
||||
session.registerEventHandler(container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join a session registered in the manager
|
||||
*
|
||||
* @param sessionId
|
||||
*/
|
||||
public static void joinSession(String sessionId) {
|
||||
SessionContainer container = sharedDisplaySessionMap.get(sessionId);
|
||||
if (container != null) {
|
||||
container.getRoleEventController().startup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a session from the manager.
|
||||
*
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2012 njensen Initial creation
|
||||
* Feb 12, 2014 2751 njensen Renamed container to displayContainer
|
||||
* Mar 07, 2014 2848 bclement moved event handler registration to constructor
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,11 +53,11 @@ public abstract class AbstractRoleEventController<T extends IRemoteDisplayContai
|
|||
|
||||
protected AbstractRoleEventController(ISharedDisplaySession session) {
|
||||
this.session = session;
|
||||
session.registerEventHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
session.registerEventHandler(this);
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId());
|
||||
displayContainer = createDisplayContainer();
|
||||
|
@ -69,8 +70,10 @@ public abstract class AbstractRoleEventController<T extends IRemoteDisplayContai
|
|||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId());
|
||||
sc.setDisplayContainer(null);
|
||||
displayContainer.disposeContainer();
|
||||
displayContainer = null;
|
||||
if (displayContainer != null) {
|
||||
displayContainer.disposeContainer();
|
||||
displayContainer = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract T createDisplayContainer();
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* Mar 26, 2012 njensen Initial creation
|
||||
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
||||
* Feb 13, 2014 2751 njensen Renamed container to displayContainer
|
||||
* Mar 06, 2014 2848 bclement removed check for self from participantChanged
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,10 +73,14 @@ public class DataProviderEventController extends
|
|||
super(session);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void participantChanged(IVenueParticipantEvent event) {
|
||||
if (event.getEventType().equals(ParticipantEventType.ARRIVED)
|
||||
&& !event.getParticipant().isSameUser(session.getUserID())) {
|
||||
/*
|
||||
* arrived events only trigger when others join the venue, no need to
|
||||
* check if the event is about us
|
||||
*/
|
||||
if (event.getEventType().equals(ParticipantEventType.ARRIVED)) {
|
||||
try {
|
||||
AbstractEditor active = displayContainer
|
||||
.getActiveSharedEditor();
|
||||
|
@ -93,7 +98,7 @@ public class DataProviderEventController extends
|
|||
SessionColorManager scm = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId())
|
||||
.getColorManager();
|
||||
RGB color = scm.getColorFromUser(event.getParticipant());
|
||||
RGB color = scm.getColorForUser(event.getParticipant());
|
||||
|
||||
ColorChangeEvent cce = new ColorChangeEvent(
|
||||
event.getParticipant(), color);
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 26, 2012 njensen Initial creation
|
||||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Mar 06, 2014 2848 bclement get venueName direct from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,7 +61,7 @@ public class ParticipantEventController extends
|
|||
*/
|
||||
@Override
|
||||
protected ICollaborationEditor createDisplayContainer() {
|
||||
String name = session.getVenue().getName();
|
||||
String name = session.getVenueName();
|
||||
CollaborationEditorInput input = new CollaborationEditorInput(
|
||||
session.getSessionId(), name);
|
||||
try {
|
||||
|
|
|
@ -67,6 +67,7 @@ import com.raytheon.viz.ui.input.InputAdapter;
|
|||
* Apr 19, 2012 mschenke Initial creation
|
||||
* Feb 19, 2014 2751 bclement added check for closed session
|
||||
* Mar 05, 2014 2843 bsteffen Prevent exceptions on dispose.
|
||||
* Mar 06, 2014 2848 bclement only send to venue if non empty
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -329,7 +330,13 @@ public class CollaborationDispatcher extends Dispatcher {
|
|||
|
||||
private void send(Object obj) {
|
||||
try {
|
||||
session.sendObjectToVenue(obj);
|
||||
if (session.hasOtherParticipants()) {
|
||||
session.sendObjectToVenue(obj);
|
||||
} else {
|
||||
Activator.statusHandler
|
||||
.debug("Skipping sending event to empty room: "
|
||||
+ obj.getClass());
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -80,9 +80,10 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 8, 2012 mschenke Initial creation
|
||||
* Jun 08, 2012 mschenke Initial creation
|
||||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
||||
* Mar 06, 2014 2848 bclement only send to venue if non empty
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -445,7 +446,7 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
private SharedEditorsManager(ISharedDisplaySession session) {
|
||||
this.session = session;
|
||||
session.registerEventHandler(eventHandler);
|
||||
String title = session.getVenue().getName();
|
||||
String title = session.getVenueName();
|
||||
editorTitleSuffix = " (" + title + ")";
|
||||
}
|
||||
|
||||
|
@ -854,7 +855,13 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
*/
|
||||
private void sendEvent(Object event) {
|
||||
try {
|
||||
session.sendObjectToVenue(event);
|
||||
if (session.hasOtherParticipants()) {
|
||||
session.sendObjectToVenue(event);
|
||||
} else {
|
||||
Activator.statusHandler
|
||||
.debug("Skipping sending event to empty room: "
|
||||
+ event.getClass());
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
|||
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.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||
import com.raytheon.uf.viz.collaboration.display.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
|
@ -58,6 +57,7 @@ import com.raytheon.uf.viz.remote.graphics.DispatchGraphicsTarget;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2012 njensen Initial creation
|
||||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Mar 06, 2014 2848 bclement get subject dynamically from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,8 +70,6 @@ public class DataProviderRsc extends
|
|||
|
||||
private String roomName;
|
||||
|
||||
private String subject;
|
||||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
private SessionColorManager colorManager;
|
||||
|
@ -86,9 +84,7 @@ public class DataProviderRsc extends
|
|||
if (container != null) {
|
||||
session = container.getSession();
|
||||
colorManager = container.getColorManager();
|
||||
IVenue venue = session.getVenue();
|
||||
roomName = venue.getName();
|
||||
subject = venue.getSubject();
|
||||
roomName = session.getVenueName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +101,7 @@ public class DataProviderRsc extends
|
|||
}
|
||||
target.clearClippingPlane();
|
||||
IExtent extent = paintProps.getView().getExtent();
|
||||
RGB color = colorManager.getColorFromUser(session.getUserID());
|
||||
RGB color = colorManager.getColorForUser(session.getUserID());
|
||||
target.drawRect(extent, color, 3.0f, 1.0f);
|
||||
|
||||
DrawableString string = new DrawableString(getName(), color);
|
||||
|
@ -153,8 +149,12 @@ public class DataProviderRsc extends
|
|||
|
||||
public String getName() {
|
||||
String text = "Sharing with " + roomName;
|
||||
if (subject.isEmpty() == false) {
|
||||
text += " (" + subject + ")";
|
||||
if (session.getVenue() != null) {
|
||||
// session subject could change
|
||||
String subject = session.getVenue().getSubject();
|
||||
if (subject.isEmpty() == false) {
|
||||
text += " (" + subject + ")";
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public class CollaborationDrawingResource extends
|
|||
layer.setLineStyle(outline.getLineStyle());
|
||||
layer.setLineWidth(outline.getOutlineWidth());
|
||||
layer.setColor(container.getColorManager()
|
||||
.getColorFromUser(user));
|
||||
.getColorForUser(user));
|
||||
layer.paint(target, paintProps);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,14 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
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.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
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.user.IUser;
|
||||
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.session.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
|
||||
import com.raytheon.uf.viz.collaboration.ui.jobs.AwayTimeOut;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.AutoSubscribePropertyListener;
|
||||
|
@ -70,8 +66,9 @@ 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
|
||||
* Feb 13, 2014 2751 bclement messages return IUser instead of IQualifiedID
|
||||
* 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
|
||||
* Mar 06, 2014 2848 bclement moved SharedDisplaySessionMgr.joinSession call to InviteDialog
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -195,11 +192,6 @@ public class ConnectionSubscriber {
|
|||
try {
|
||||
IVenueSession session = inviteBox.getSession();
|
||||
if (inviteBox.isSharedDisplay()) {
|
||||
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
|
||||
SessionColorManager man = new SessionColorManager();
|
||||
SharedDisplaySessionMgr.joinSession(displaySession,
|
||||
SharedDisplayRole.PARTICIPANT, man);
|
||||
|
||||
CaveWorkbenchPageManager.getActiveInstance().showView(
|
||||
CollaborationSessionView.ID, session.getSessionId(),
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
|
|
|
@ -59,6 +59,7 @@ 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.SharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.ISharedEditorsManagerListener;
|
||||
|
@ -91,6 +92,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
|||
* Feb 3, 2014 2699 bclement added default handle preference
|
||||
* Feb 7, 2014 2699 bclement removed handle validation
|
||||
* Feb 11, 2014 2699 bclement require non-blank handle
|
||||
* Mar 06, 2014 2848 bclement moved session creation logic to separate method
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -463,10 +465,9 @@ public class CreateSessionDialog extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
if (focusField == null) {
|
||||
CreateSessionData result = new CreateSessionData();
|
||||
result.setName(name);
|
||||
CreateSessionData result = new CreateSessionData(name,
|
||||
handle);
|
||||
result.setSubject(subject);
|
||||
result.setHandle(handle);
|
||||
result.setCollaborationSessioh(sharedSessionDisplay
|
||||
.getSelection());
|
||||
if (inviteUsers == null) {
|
||||
|
@ -478,19 +479,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
|
|||
|
||||
IVenueSession session = null;
|
||||
try {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
if (result.isCollaborationSession()) {
|
||||
session = connection
|
||||
.createCollaborationVenue(result);
|
||||
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
|
||||
SharedDisplaySessionMgr.joinSession(
|
||||
displaySession,
|
||||
SharedDisplayRole.DATA_PROVIDER, null);
|
||||
} else {
|
||||
session = connection
|
||||
.createTextOnlyVenue(result);
|
||||
}
|
||||
session = create(result);
|
||||
result.setSessionId(session.getSessionId());
|
||||
setReturnValue(result);
|
||||
CreateSessionDialog.this.getShell().dispose();
|
||||
|
@ -528,6 +517,47 @@ public class CreateSessionDialog extends CaveSWTDialog {
|
|||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create session object, register required listeners and join.
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
private IVenueSession create(CreateSessionData data)
|
||||
throws CollaborationException {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
VenueSession session;
|
||||
if (data.isCollaborationSession()) {
|
||||
SharedDisplaySession displaySession = connection
|
||||
.createCollaborationVenue(data);
|
||||
/*
|
||||
* this will register event bus listeners, needs to be done before
|
||||
* connecting to venue
|
||||
*/
|
||||
SharedDisplaySessionMgr.registerSession(displaySession,
|
||||
SharedDisplayRole.DATA_PROVIDER);
|
||||
session = displaySession;
|
||||
} else {
|
||||
session = connection.createTextOnlyVenue(data);
|
||||
}
|
||||
try {
|
||||
session.createVenue(data);
|
||||
if (data.isCollaborationSession()) {
|
||||
SharedDisplaySessionMgr.joinSession(session.getSessionId());
|
||||
}
|
||||
} catch (CollaborationException e) {
|
||||
if (data.isCollaborationSession()) {
|
||||
SharedDisplaySessionMgr.exitSession(session.getSessionId());
|
||||
}
|
||||
connection.removeSession(session);
|
||||
throw e;
|
||||
}
|
||||
connection.postEvent(session);
|
||||
return session;
|
||||
}
|
||||
|
||||
private String validateVenueName() {
|
||||
String name = nameTF.getText().trim();
|
||||
nameTF.setText(name);
|
||||
|
|
|
@ -41,8 +41,12 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEve
|
|||
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.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
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.session.VenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
|
||||
|
||||
|
@ -61,6 +65,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
|
|||
* Feb 3, 2014 2699 bclement added default handle preference
|
||||
* Feb 11, 2014 2699 bclement require non-blank handle
|
||||
* Feb 13, 2014 2751 bclement better types for roomid and inviter
|
||||
* Mar 06, 2014 2848 bclement moved join logic to separate method
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -86,7 +91,7 @@ public class InviteDialog extends CaveSWTDialogBase {
|
|||
|
||||
private Text handleText;
|
||||
|
||||
private IVenueSession session;
|
||||
private VenueSession session;
|
||||
|
||||
private boolean sharedDisplay;
|
||||
|
||||
|
@ -256,20 +261,13 @@ public class InviteDialog extends CaveSWTDialogBase {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent se) {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
String handle = handleText.getText().trim();
|
||||
try {
|
||||
if (handle.isEmpty()) {
|
||||
throw new CollaborationException(
|
||||
"Handle cannot be empty.");
|
||||
}
|
||||
if (sharedDisplay) {
|
||||
session = connection.joinCollaborationVenue(event,
|
||||
handle);
|
||||
} else {
|
||||
session = connection.joinTextOnlyVenue(room, handle);
|
||||
}
|
||||
join(event, handle);
|
||||
setReturnValue(Boolean.TRUE);
|
||||
se.doit = true;
|
||||
close();
|
||||
|
@ -296,6 +294,49 @@ public class InviteDialog extends CaveSWTDialogBase {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create session object, register listeners and join.
|
||||
*
|
||||
* @param invitation
|
||||
* @param handle
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public void join(IVenueInvitationEvent invitation, String handle)
|
||||
throws CollaborationException {
|
||||
String venueName = invitation.getRoomId().getName();
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
// create session object
|
||||
if (sharedDisplay) {
|
||||
SharedDisplaySession displaySession = connection
|
||||
.createCollaborationVenue(invitation, handle);
|
||||
/*
|
||||
* this will register event bus listeners, needs to be done before
|
||||
* connecting to venue
|
||||
*/
|
||||
SharedDisplaySessionMgr.registerSession(displaySession,
|
||||
SharedDisplayRole.PARTICIPANT);
|
||||
session = displaySession;
|
||||
} else {
|
||||
session = connection.createTextOnlyVenue(venueName, handle);
|
||||
}
|
||||
try {
|
||||
// join session
|
||||
session.configureVenue();
|
||||
session.connectToRoom();
|
||||
if (sharedDisplay) {
|
||||
SharedDisplaySessionMgr.joinSession(session.getSessionId());
|
||||
}
|
||||
connection.postEvent(session);
|
||||
} catch (CollaborationException e) {
|
||||
if (sharedDisplay) {
|
||||
SharedDisplaySessionMgr.exitSession(session.getSessionId());
|
||||
}
|
||||
connection.removeSession(session);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public IVenueSession getSession() {
|
||||
return session;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
|||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Feb 13, 2014 2751 bclement made AbstractUsersLabelProvider generic
|
||||
* Feb 17, 2014 2751 bclement added block image logic to userLabelProvider
|
||||
* Mar 06, 2014 2848 bclement get venueName directly from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -193,7 +194,7 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
|
|||
if (venue.getVenue() == null) {
|
||||
return null;
|
||||
}
|
||||
return venue.getVenue().getName();
|
||||
return venue.getVenueName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ 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.IVenueSession;
|
||||
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.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionFeedView;
|
||||
|
@ -62,6 +63,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
|||
* Jan 28, 2014 2698 bclement changed feed venue filter to match whole name
|
||||
* Jan 30, 2014 2698 bclement added default handle of username
|
||||
* Feb 3, 2014 2699 bclement use preference handle default, display error if handle taken
|
||||
* Mar 06, 2014 2848 bclement removed CollaborationConnection.joinTextOnlyVenue()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -104,7 +106,7 @@ public class DisplayFeedAction extends Action {
|
|||
String sessionId = null;
|
||||
for (ISession session : connection.getSessions()) {
|
||||
if (session instanceof IVenueSession) {
|
||||
if (((IVenueSession) session).getVenue().getName()
|
||||
if (((IVenueSession) session).getVenueName()
|
||||
.equalsIgnoreCase(FEED_VENUE)) {
|
||||
sessionId = session.getSessionId();
|
||||
}
|
||||
|
@ -121,13 +123,18 @@ public class DisplayFeedAction extends Action {
|
|||
* @return
|
||||
*/
|
||||
private String joinFeedVenue() {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
String defaultHandle = HandleUtil.getDefaultHandle();
|
||||
VenueSession session = connection.createTextOnlyVenue(FEED_VENUE,
|
||||
defaultHandle);
|
||||
try {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
IVenueSession session = connection.joinTextOnlyVenue(FEED_VENUE,
|
||||
HandleUtil.getDefaultHandle());
|
||||
session.configureVenue();
|
||||
session.connectToRoom();
|
||||
connection.postEvent(session);
|
||||
return session.getSessionId();
|
||||
} catch (CollaborationException e) {
|
||||
connection.removeSession(session);
|
||||
final String msg = e.getLocalizedMessage()
|
||||
+ "\n\nDefault handle options can be set in the Collaboration Preferences page.";
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
|||
* Dec 6, 2013 2561 bclement removed ECF
|
||||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant
|
||||
* Mar 06, 2014 2848 bclement get venueName directly from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -212,7 +213,7 @@ public class InviteAction extends Action {
|
|||
|
||||
private void fill() {
|
||||
for (IVenueSession session : getNewSessions()) {
|
||||
String name = session.getVenue().getName();
|
||||
String name = session.getVenueName();
|
||||
Action action = new InviteAction(session, name, users);
|
||||
IContributionItem contrib = new ActionContributionItem(action);
|
||||
contrib.fill(menu, -1);
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* Mar 21, 2012 mnash Initial creation
|
||||
* Jan 28, 2014 2698 bclement removed venue info
|
||||
* Feb 11, 2014 2751 njensen Fixed scary ==
|
||||
* Mar 06, 2014 2848 bclement get venueName directly from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -143,7 +144,7 @@ public class ShareEditorAction extends ContributedEditorMenuAction implements
|
|||
if (editor != null) {
|
||||
List<ISharedDisplaySession> sessions = getSessions();
|
||||
for (final ISharedDisplaySession session : sessions) {
|
||||
String sessionName = session.getVenue().getName();
|
||||
String sessionName = session.getVenueName();
|
||||
ActionContributionItem aci = new ActionContributionItem(
|
||||
new Action(sessionName) {
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
|
@ -62,7 +61,6 @@ import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.IRemote
|
|||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteDisplay;
|
||||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteDisplayChangeType;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer.IDisplayContainerChangedListener;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
|
@ -99,6 +97,7 @@ import com.raytheon.viz.ui.input.EditableManager;
|
|||
* Feb 18, 2014 2751 bclement update participants list and notify on leader change
|
||||
* Feb 19, 2014 2751 bclement add change color and transfer leader icons
|
||||
* Mar 06, 2014 2751 bclement moved users table refresh logic to refreshParticipantList()
|
||||
* Mar 06, 2014 2848 bclement moved colormanager update code to session container
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -544,12 +543,6 @@ public class CollaborationSessionView extends SessionView implements
|
|||
|
||||
@Subscribe
|
||||
public void modifyColors(ColorPopulator populator) {
|
||||
SessionColorManager colorMan = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId).getColorManager();
|
||||
for (Entry<VenueParticipant, RGB> entry : populator.getColors()
|
||||
.entrySet()) {
|
||||
colorMan.setColorForUser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -560,9 +553,6 @@ public class CollaborationSessionView extends SessionView implements
|
|||
|
||||
@Subscribe
|
||||
public void modifyColors(ColorChangeEvent event) {
|
||||
SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getColorManager()
|
||||
.setColorForUser(event.getUserName(), event.getColor());
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -159,7 +159,7 @@ public class ParticipantsLabelProvider extends
|
|||
return null;
|
||||
}
|
||||
VenueParticipant user = ((VenueParticipant) element);
|
||||
RGB rgb = manager.getColorFromUser(user);
|
||||
RGB rgb = manager.getColorForUser(user);
|
||||
if (rgb == null) {
|
||||
rgb = new RGB(0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
|||
* Mar 05, 2014 2798 mpduff Moved processJoinAlert() call from participantHandler
|
||||
* to participantArrived.
|
||||
* Mar 06, 2014 2751 bclement moved users table refresh logic to refreshParticipantList()
|
||||
* Mar 06, 2014 2848 bclement get venueName directly from session
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -462,7 +463,7 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
protected void styleAndAppendText(StringBuilder sb, int offset,
|
||||
String name, VenueParticipant userId, String subject,
|
||||
List<StyleRange> ranges) {
|
||||
RGB rgb = colorManager.getColorFromUser(userId);
|
||||
RGB rgb = colorManager.getColorForUser(userId);
|
||||
if (mappedColors.get(rgb) == null) {
|
||||
Color col = new Color(Display.getCurrent(), rgb);
|
||||
mappedColors.put(rgb, col);
|
||||
|
@ -610,7 +611,7 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
if (session == null) {
|
||||
return sessionId;
|
||||
}
|
||||
return session.getVenue().getName();
|
||||
return session.getVenueName();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
Loading…
Add table
Reference in a new issue