Issue #427 more cleanup

Change-Id: Id2ad63a51e9a891801d2422547f855cd769a83d3

Former-commit-id: 258df7c2187c1ebcecf1abf905ec2cc4e60464e0
This commit is contained in:
Nate Jensen 2012-04-18 14:15:18 -05:00
parent 29f24e3ec5
commit c33cf2538c
6 changed files with 35 additions and 106 deletions

View file

@ -503,8 +503,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
sessionId = session.getSessionId();
// TODO throw an exception if unable to make connection?
if (session.isConnected()) {
ISharedDisplaySession displaySession = session
.spawnSharedDisplaySession();
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
sessionsMap.put(sessionId, session);
SharedDisplaySessionMgr.joinSession(displaySession,
ParticipantRole.DATA_PROVIDER);
@ -577,8 +576,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
String sessionId = session.getSessionId();
sessionsMap.put(sessionId, session);
if (sharedDisplay) {
ISharedDisplaySession displaySession = session
.spawnSharedDisplaySession();
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
SharedDisplaySessionMgr.joinSession(displaySession,
ParticipantRole.PARTICIPANT);
@ -785,13 +783,12 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
try {
session = getSessionManager().joinCollaborationVenue(venueName);
result = session.getSessionId();
ISharedDisplaySession displaySession = session
.spawnSharedDisplaySession();
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
sessionsMap.put(result, session);
ParticipantEventController pec = new ParticipantEventController(
displaySession);
pec.startup();
// TODO this is broken and should be removed
// TODO this method is broken and should be removed
} catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.

View file

@ -218,7 +218,7 @@ public class CollaborationSessionView extends SessionView {
String message = getComposedMessage();
if (message.length() > 0) {
try {
((IVenueSession) session).sendTextMessage(message);
((IVenueSession) session).sendChatMessage(message);
} catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.

View file

@ -415,7 +415,7 @@ public class SessionView extends AbstractSessionView {
String message = getComposedMessage();
if (message.length() > 0) {
try {
session.sendTextMessage(message);
session.sendChatMessage(message);
} catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.

View file

@ -89,22 +89,35 @@ public interface ISharedDisplaySession extends IEventPublisher {
throws CollaborationException;
/**
* Returns the current Data Provider for the session
*
* @return
*/
public IVenueParticipant getCurrentDataProvider();
/**
* Returns the current Session Leader for the session
*
* @return
*/
public IVenueParticipant getCurrentSessionLeader();
/**
* Sets the current Data Provider for the session
*
* @param participant
*/
public void setCurrentDataProvider(IVenueParticipant participant);
/**
* Sets the current Session Leader for the session
*
* @param participant
*/
public void setCurrentSessionLeader(IVenueParticipant participant);
/**
* Checks if the currently logged in user has the role on this session
*
* @param role
* @return

View file

@ -57,28 +57,20 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
public interface IVenueSession extends ISession, IEventPublisher {
/**
* Return this session as an ISharedDisplaySession if it is supported. If
* the interface is not supported the method must return a null reference.
*
* @return
*/
ISharedDisplaySession spawnSharedDisplaySession();
/**
* Returns information about a venue.
*
* @return Information about a venue
*/
IVenue getVenue();
public IVenue getVenue();
/**
* Send a Collaboration message.
* Send a chat message.
*
* @param message
* The message to send.
*/
void sendTextMessage(String message) throws CollaborationException;
public void sendChatMessage(String message) throws CollaborationException;
/**
* Send an invitation from this venue to another user.
@ -89,11 +81,11 @@ public interface IVenueSession extends ISession, IEventPublisher {
* The intended subject of the venue conversation.
* @return
*/
public int sendInvitation(String id, String body)
public void sendInvitation(String id, String body)
throws CollaborationException;
/**
* Send an invitation from this venue to one or more users.
* Send an invitation from this venue to a list of users.
*
* @param ids
* A list of target users for this invitation.
@ -101,7 +93,7 @@ public interface IVenueSession extends ISession, IEventPublisher {
* Any text that the user may wish to include.
* @return
*/
public int sendInvitation(List<String> ids, String body)
public void sendInvitation(List<String> ids, String body)
throws CollaborationException;
}

View file

@ -30,7 +30,6 @@ import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.presence.IIMMessageEvent;
import org.eclipse.ecf.presence.IIMMessageListener;
import org.eclipse.ecf.presence.IPresenceSender;
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import org.eclipse.ecf.presence.chatroom.IChatRoomInvitationSender;
@ -51,8 +50,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEv
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.roster.IRosterManager;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
@ -155,17 +152,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
return userID;
}
/**
* Return this session as an ISharedDisplaySession if it is supported. If
* the interface is not supported the method must return a null reference.
*
* @return
*/
@Override
public ISharedDisplaySession spawnSharedDisplaySession() {
return this;
}
/**
* Close this session. Closing clears all listeners and disposes of the
* container. No errors for attempting to close an already closed session.
@ -248,16 +234,13 @@ public class VenueSession extends BaseSession implements IVenueSession,
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @return
* @throws CollaborationException
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public int sendInvitation(String id, String body)
public void sendInvitation(String id, String body)
throws CollaborationException {
// Assume success
int status = Errors.NO_ERROR;
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
.getChatRoomManager().getInvitationSender();
if (sender != null) {
@ -277,10 +260,10 @@ public class VenueSession extends BaseSession implements IVenueSession,
try {
sender.sendInvitation(roomId, userId, subject, msgBody);
} catch (ECFException e) {
// TODO fix
e.printStackTrace();
}
}
return status;
}
/**
@ -294,23 +277,17 @@ public class VenueSession extends BaseSession implements IVenueSession,
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @return
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public int sendInvitation(List<String> ids, String body)
public void sendInvitation(List<String> ids, String body)
throws CollaborationException {
// Assume success
int status = Errors.NO_ERROR;
if (ids != null) {
for (String id : ids) {
sendInvitation(id, body);
}
} else {
status = -1;
}
return status;
}
/**
@ -331,7 +308,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
if (obj != null) {
String message = Tools.marshallData(obj);
if (message != null) {
sendTextMessage(message);
sendMessageToVenue(message);
}
}
}
@ -397,13 +374,12 @@ public class VenueSession extends BaseSession implements IVenueSession,
// ISharedDisplaySession
// ***************************
/**
* @param message
* A message to send.
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendTextMessage(java.lang.String)
*/
@Override
public void sendTextMessage(String message) throws CollaborationException {
public void sendChatMessage(String message) throws CollaborationException {
this.sendMessageToVenue(message);
}
protected void sendMessageToVenue(String message)
throws CollaborationException {
// Assume success
if ((venueContainer != null) && (message != null)) {
IChatRoomMessageSender sender = venueContainer
@ -498,58 +474,9 @@ public class VenueSession extends BaseSession implements IVenueSession,
e.printStackTrace();
errorStatus = Errors.BAD_NAME;
}
// TODO :
// sendSubscription(subject);
return errorStatus;
}
private void sendSubscription(final String name) {
Runnable r = new Runnable() {
@Override
public void run() {
try {
System.out.println("Sending subscribe message.");
boolean remove = "remove".equals(name);
String[] groups = { "group2", };
// String [] groups = new String [];
IRosterManager r = getSessionManager().getRosterManager();
if (remove) {
IChatID id = new RosterId("pkorman",
"awipscm.omaha.us.ray.com", null);
r.sendRosterRemove(id);
} else {
r.sendRosterAdd("pkorman@awipscm.omaha.us.ray.com",
"Paul", groups);
}
if ("subscribe".equals(name)) {
IPresenceSender sender = getConnectionPresenceAdapter()
.getRosterManager().getPresenceSender();
org.eclipse.ecf.presence.IPresence presence = new org.eclipse.ecf.presence.Presence(
org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBE);
sender.sendPresenceUpdate(
createID("pkorman@awipscm.omaha.us.ray.com"),
presence);
}
System.out.println("Subscribe message sent.");
} catch (Exception e) {
e.printStackTrace();
}
}
};
Thread t = new Thread(r);
t.start();
System.out.println("The subscribe test has started.");
}
/**
*
* @return