Issue #427 consolidated user ids

Change-Id: I008c47320bbb5819db0607e7f695b3ecffa30387

Former-commit-id: 9e137757a7ed7bd9f319a1984aed40b6de960a35
This commit is contained in:
Nate Jensen 2012-04-19 10:45:25 -05:00
parent 47639de899
commit 006785e374
32 changed files with 279 additions and 716 deletions

View file

@ -58,13 +58,13 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEve
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
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.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry; import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager; import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils; import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor; import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.login.LoginData; import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
@ -658,7 +658,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
presence.setStatusMessage(loginData.getModeMessage()); presence.setStatusMessage(loginData.getModeMessage());
try { try {
sessionManager.getAccountManager().sendPresence(presence); sessionManager.getAccountManager().sendPresence(presence);
IChatID id = sessionManager.getUser(); UserId id = sessionManager.getUser();
RosterEntry rosterEntry = new RosterEntry(id); RosterEntry rosterEntry = new RosterEntry(id);
rosterEntry.setPresence(presence); rosterEntry.setPresence(presence);
handleModifiedPresence(rosterEntry); handleModifiedPresence(rosterEntry);

View file

@ -2,7 +2,7 @@ package com.raytheon.uf.viz.collaboration.data;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
@ -44,7 +44,7 @@ public class CollaborationUser extends CollaborationNode {
String session; String session;
IChatID iChatID; UserId iChatID;
public CollaborationUser(String id) { public CollaborationUser(String id) {
super(id); super(id);

View file

@ -29,9 +29,8 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; 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.data.CollaborationNode; import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
import com.raytheon.uf.viz.core.icon.IconUtil; import com.raytheon.uf.viz.core.icon.IconUtil;
@ -97,7 +96,7 @@ public class CollaborationUtils {
* @return userId * @return userId
*/ */
public static String makeUserId(IRosterEntry rosterEntry) { public static String makeUserId(IRosterEntry rosterEntry) {
IChatID chatId = rosterEntry.getUser(); UserId chatId = rosterEntry.getUser();
String userId = chatId.getName() + Tools.NAME_DELIM + chatId.getHost(); String userId = chatId.getName() + Tools.NAME_DELIM + chatId.getHost();
return userId; return userId;
} }
@ -109,7 +108,7 @@ public class CollaborationUtils {
* @param participant * @param participant
* @return userId * @return userId
*/ */
public static String makeUserId(IVenueParticipant participant) { public static String makeUserId(UserId participant) {
StringBuilder sb = new StringBuilder(participant.getName()); StringBuilder sb = new StringBuilder(participant.getName());
sb.append(Tools.NAME_DELIM); sb.append(Tools.NAME_DELIM);
int start = sb.length(); int start = sb.length();

View file

@ -28,10 +28,10 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
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.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand; import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.data.SessionContainer; import com.raytheon.uf.viz.collaboration.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup; import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
@ -85,7 +85,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
} }
@Subscribe @Subscribe
public void participantChanged(VenueParticipantEvent event) { public void participantChanged(IVenueParticipantEvent event) {
if (event.getEventType().equals(ParticipantEventType.ARRIVED)) { if (event.getEventType().equals(ParticipantEventType.ARRIVED)) {
// TODO this seems to trigger when you create the room, in which // TODO this seems to trigger when you create the room, in which
// case you don't need to send it for yourself // case you don't need to send it for yourself
@ -95,8 +95,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
.getActiveEditorAs(AbstractEditor.class); .getActiveEditorAs(AbstractEditor.class);
SharedEditorData se = EditorSetup.extractSharedEditorData(editor); SharedEditorData se = EditorSetup.extractSharedEditorData(editor);
try { try {
session.sendObjectToPeer(event.getParticipant() session.sendObjectToPeer(event.getParticipant(), se);
.getQualifiedId(), se);
} catch (CollaborationException e) { } catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error sending initialization data to new participant " "Error sending initialization data to new participant "

View file

@ -44,7 +44,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand; import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser; import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
@ -149,8 +149,7 @@ public class CollaborationSessionView extends SessionView {
// TODO need to send invite/request for transfer, and then if successful // TODO need to send invite/request for transfer, and then if successful
// deactivate the local ones since we won't receive the message // deactivate the local ones since we won't receive the message
TransferRoleCommand trc = new TransferRoleCommand(); TransferRoleCommand trc = new TransferRoleCommand();
VenueParticipant vp = new VenueParticipant(Tools.parseName(fqname), UserId vp = new UserId(Tools.parseName(fqname), Tools.parseHost(fqname));
Tools.parseHost(fqname));
trc.setUser(vp); trc.setUser(vp);
session.setCurrentSessionLeader(vp); session.setCurrentSessionLeader(vp);
trc.setRole(ParticipantRole.SESSION_LEADER); trc.setRole(ParticipantRole.SESSION_LEADER);

View file

@ -67,9 +67,9 @@ 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.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager; import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser; import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils; import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
@ -355,8 +355,7 @@ public class SessionView extends AbstractSessionView {
List<CollaborationUser> users = new ArrayList<CollaborationUser>(); List<CollaborationUser> users = new ArrayList<CollaborationUser>();
if (session != null) { if (session != null) {
for (IVenueParticipant participant : session.getVenue() for (UserId participant : session.getVenue().getParticipants()) {
.getParticipants()) {
String userId = CollaborationUtils.makeUserId(participant); String userId = CollaborationUtils.makeUserId(participant);
CollaborationUser user = new CollaborationUser(userId, CollaborationUser user = new CollaborationUser(userId,
@ -562,7 +561,7 @@ public class SessionView extends AbstractSessionView {
throws Exception { throws Exception {
System.out.println("++ ParticipantHander type " + event.getEventType()); System.out.println("++ ParticipantHander type " + event.getEventType());
final ParticipantEventType type = event.getEventType(); final ParticipantEventType type = event.getEventType();
final IVenueParticipant participant = event.getParticipant(); final UserId participant = event.getParticipant();
final IPresence presence = event.getPresence(); final IPresence presence = event.getPresence();
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@ -591,7 +590,7 @@ public class SessionView extends AbstractSessionView {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantArrived(IVenueParticipant participant) { private void participantArrived(UserId participant) {
List<CollaborationUser> users = (List<CollaborationUser>) usersTable List<CollaborationUser> users = (List<CollaborationUser>) usersTable
.getInput(); .getInput();
String name = participant.getFQName(); String name = participant.getFQName();
@ -608,7 +607,7 @@ public class SessionView extends AbstractSessionView {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantDeparted(IVenueParticipant participant) { private void participantDeparted(UserId participant) {
System.out.println("++++ handle departed here: " System.out.println("++++ handle departed here: "
+ participant.getName() + ", " + participant.getFQName()); + participant.getName() + ", " + participant.getFQName());
String userId = CollaborationUtils.makeUserId(participant); String userId = CollaborationUtils.makeUserId(participant);
@ -628,7 +627,7 @@ public class SessionView extends AbstractSessionView {
* @param presence * @param presence
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantPresenceUpdated(IVenueParticipant participant, private void participantPresenceUpdated(UserId participant,
IPresence presence) { IPresence presence) {
// Ignore the presence's mode/type. May not be the same as the user's. // Ignore the presence's mode/type. May not be the same as the user's.
// TODO Keep as a place holder for now since it may be needed to set // TODO Keep as a place holder for now since it may be needed to set

View file

@ -1 +0,0 @@
com.raytheon.uf.viz.collaboration.comm.provider.session.TestJAXBObject

View file

@ -20,8 +20,8 @@
package com.raytheon.uf.viz.collaboration.comm.identity; package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; 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; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* *
@ -92,28 +92,28 @@ public interface ISharedDisplaySession extends IVenueSession {
* *
* @return * @return
*/ */
public IVenueParticipant getCurrentDataProvider(); public UserId getCurrentDataProvider();
/** /**
* Returns the current Session Leader for the session * Returns the current Session Leader for the session
* *
* @return * @return
*/ */
public IVenueParticipant getCurrentSessionLeader(); public UserId getCurrentSessionLeader();
/** /**
* Sets the current Data Provider for the session * Sets the current Data Provider for the session
* *
* @param participant * @param participant
*/ */
public void setCurrentDataProvider(IVenueParticipant participant); public void setCurrentDataProvider(UserId participant);
/** /**
* Sets the current Session Leader for the session * Sets the current Session Leader for the session
* *
* @param participant * @param participant
*/ */
public void setCurrentSessionLeader(IVenueParticipant participant); public void setCurrentSessionLeader(UserId participant);
/** /**
* Checks if the currently logged in user has the role on this session * Checks if the currently logged in user has the role on this session

View file

@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event; package com.raytheon.uf.viz.collaboration.comm.identity.event;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -51,7 +51,7 @@ public interface IVenueParticipantEvent {
* *
* @return * @return
*/ */
IVenueParticipant getParticipant(); UserId getParticipant();
/** /**
* *

View file

@ -21,11 +21,11 @@ package com.raytheon.uf.viz.collaboration.comm.identity.info;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* Provides information about a venue. In addition implementations will * Provides information about a venue. In addition implementations will act as a
* act as a target for participant updates such as * target for participant updates such as
* *
* <pre> * <pre>
* *
@ -59,18 +59,18 @@ public interface IVenue {
* *
* @return * @return
*/ */
Collection<IVenueParticipant> getParticipants(); Collection<UserId> getParticipants();
/** /**
* *
* @return * @return
*/ */
void addParticipant(IVenueParticipant participant); void addParticipant(UserId participant);
/** /**
* *
* @return * @return
*/ */
void removeParticipant(IVenueParticipant participant); void removeParticipant(UserId participant);
} }

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.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* An invite message for inviting another user to a venue. * An invite message for inviting another user to a venue.
@ -50,10 +50,10 @@ public class VenueInvite {
private String message; private String message;
@DynamicSerializeElement @DynamicSerializeElement
private IVenueParticipant sessionLeader; private UserId sessionLeader;
@DynamicSerializeElement @DynamicSerializeElement
private IVenueParticipant dataProvider; private UserId dataProvider;
@DynamicSerializeElement @DynamicSerializeElement
private String sessionId; private String sessionId;
@ -74,19 +74,19 @@ public class VenueInvite {
this.message = message; this.message = message;
} }
public IVenueParticipant getSessionLeader() { public UserId getSessionLeader() {
return sessionLeader; return sessionLeader;
} }
public void setSessionLeader(IVenueParticipant sessionLeader) { public void setSessionLeader(UserId sessionLeader) {
this.sessionLeader = sessionLeader; this.sessionLeader = sessionLeader;
} }
public IVenueParticipant getDataProvider() { public UserId getDataProvider() {
return dataProvider; return dataProvider;
} }
public void setDataProvider(IVenueParticipant dataProvider) { public void setDataProvider(UserId dataProvider) {
this.dataProvider = dataProvider; this.dataProvider = dataProvider;
} }

View file

@ -19,9 +19,8 @@
**/ **/
package com.raytheon.uf.viz.collaboration.comm.identity.listener; package com.raytheon.uf.viz.collaboration.comm.identity.listener;
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.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -49,5 +48,6 @@ public interface IVenueInvitationListener {
* @param subject * @param subject
* @param body * @param body
*/ */
void handleInvitation(IQualifiedID roomId, IChatID from, String subject, String body); void handleInvitation(IQualifiedID roomId, UserId from, String subject,
String body);
} }

View file

@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity.listener; package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -43,28 +43,35 @@ public interface IVenueParticipantListener {
/** /**
* A participant has arrived in the venue. * A participant has arrived in the venue.
* @param participant The participant who has arrived. *
* @param participant
* The participant who has arrived.
*/ */
public void handleArrived(IVenueParticipant participant); public void handleArrived(UserId participant);
/** /**
* A participant has has updated their information. * A participant has has updated their information.
* @param participant The participant whose information has been updated. *
* @param participant
* The participant whose information has been updated.
*/ */
public void handleUpdated(IVenueParticipant participant); public void handleUpdated(UserId participant);
/** /**
* A participant has departed this venue. * A participant has departed this venue.
* @param participant The participant who has departed. *
* @param participant
* The participant who has departed.
*/ */
public void handleDeparted(IVenueParticipant participant); public void handleDeparted(UserId participant);
/** /**
* Presence information about the participant who has arrived, updated, or * Presence information about the participant who has arrived, updated, or
* departed the venue. * departed the venue.
*
* @param fromID * @param fromID
* @param presence * @param presence
*/ */
public void handlePresenceUpdated(IVenueParticipant fromID, IPresence presence); public void handlePresenceUpdated(UserId fromID, IPresence presence);
} }

View file

@ -22,16 +22,15 @@ package com.raytheon.uf.viz.collaboration.comm.identity.roster;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ID; import com.raytheon.uf.viz.collaboration.comm.identity.user.ID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* The Roster provides a structure to maintain user contacts. These * The Roster provides a structure to maintain user contacts. These contacts may
* contacts may be organized into groups beneath the Roster. A single * be organized into groups beneath the Roster. A single user contact may be
* user contact may be associated with more than a single group. As * associated with more than a single group. As of this time nesting is not
* of this time nesting is not allowed, that is groups may not contain * allowed, that is groups may not contain groups.
* groups.
* *
* <pre> * <pre>
* *
@ -51,53 +50,65 @@ public interface IRoster {
/** /**
* Add an entry directly to the roster. * Add an entry directly to the roster.
*
* @param item * @param item
*/ */
void addRosterEntry(IRosterEntry entry); void addRosterEntry(IRosterEntry entry);
/** /**
* Add this user to the roster. * Add this user to the roster.
*
* @param user * @param user
* @param nickName * @param nickName
* @param groups * @param groups
*/ */
void addRosterEntry(IQualifiedID user, String nickName, String [] groups); void addRosterEntry(IQualifiedID user, String nickName, String[] groups);
/** /**
* Request that the specified entry be modified in the roster. * Request that the specified entry be modified in the roster.
* @param entry The entry to modify. This entry will contain the modifications *
* to apply. * @param entry
* The entry to modify. This entry will contain the modifications
* to apply.
* @return The modified roster entry. * @return The modified roster entry.
*/ */
IRosterEntry modifyRosterEntry(IRosterEntry entry); IRosterEntry modifyRosterEntry(IRosterEntry entry);
/** /**
* Request that the user be removed from the roster. * Request that the user be removed from the roster.
* @param user The identification of the user to be removed. *
* @param user
* The identification of the user to be removed.
*/ */
void removeFromRoster(ID user); void removeFromRoster(ID user);
/** /**
* Get all entries associated with this roster. * Get all entries associated with this roster.
*
* @return A Collection of entries belonging to this Roster. * @return A Collection of entries belonging to this Roster.
*/ */
Collection<IRosterEntry> getEntries(); Collection<IRosterEntry> getEntries();
/** /**
* Add a group to the roster. This method adds to the roster * Add a group to the roster. This method adds to the roster level groups
* level groups only. * only.
* @param group A group to add. *
* @param group
* A group to add.
*/ */
void addGroup(IRosterGroup group); void addGroup(IRosterGroup group);
/** /**
* Removes a group from the roster level groups. * Removes a group from the roster level groups.
* @param groupName Name of the group to remove. *
* @param groupName
* Name of the group to remove.
*/ */
void removeGroup(String groupName); void removeGroup(String groupName);
/** /**
* Get all groups associated with this roster. * Get all groups associated with this roster.
*
* @return A Collection of groups belonging to this Roster. * @return A Collection of groups belonging to this Roster.
*/ */
Collection<IRosterGroup> getGroups(); Collection<IRosterGroup> getGroups();
@ -106,16 +117,18 @@ public interface IRoster {
* *
* @return * @return
*/ */
IChatID getUser(); UserId getUser();
/** /**
* Does this roster support nested groups? * Does this roster support nested groups?
*
* @return This roster supports nested groups. * @return This roster supports nested groups.
*/ */
boolean supportsNestedGroups(); boolean supportsNestedGroups();
/** /**
* Signifies whether this roster associated with a chat room. * Signifies whether this roster associated with a chat room.
*
* @return Is this roster associated with a chat room. * @return Is this roster associated with a chat room.
*/ */
boolean isRoomRoster(); boolean isRoomRoster();
@ -133,6 +146,6 @@ public interface IRoster {
* *
* @param userId * @param userId
*/ */
void sendRosterRemove(IChatID userId) throws CollaborationException; void sendRosterRemove(UserId userId) throws CollaborationException;
} }

View file

@ -3,14 +3,14 @@ package com.raytheon.uf.viz.collaboration.comm.identity.roster;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public interface IRosterEntry extends IRosterItem { public interface IRosterEntry extends IRosterItem {
/** /**
* Get a collection of groups that contain this entry. If the * Get a collection of groups that contain this entry. If the entry is not
* entry is not contained by a group a not null empty collection * contained by a group a not null empty collection shall be returned.
* shall be returned. *
* @return Collection that contains this entry. * @return Collection that contains this entry.
*/ */
Collection<IRosterGroup> getGroups(); Collection<IRosterGroup> getGroups();
@ -25,5 +25,5 @@ public interface IRosterEntry extends IRosterItem {
* *
* @return * @return
*/ */
IChatID getUser(); UserId getUser();
} }

View file

@ -23,7 +23,7 @@ import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener; import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO * TODO
@ -88,6 +88,6 @@ public interface IRosterManager {
* *
* @param userId * @param userId
*/ */
void sendRosterRemove(IChatID userId) throws CollaborationException; void sendRosterRemove(UserId userId) throws CollaborationException;
} }

View file

@ -1,53 +0,0 @@
/**
a * 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.identity.user;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IChatID extends IQualifiedID {
/**
*
* @param nickname
*/
void setNickname(String nickname);
/**
*
* @return
*/
String getNickname();
}

View file

@ -1,49 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.user;
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenueParticipant extends IChatID, IPropertied {
/**
* Return the identifier as a qualified field. Removes the "domain"
* conference from the host string if found.
* @return The qualified id.
*/
IQualifiedID getQualifiedId();
}

View file

@ -21,8 +21,8 @@ package com.raytheon.uf.viz.collaboration.comm.provider;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* A command to transfer a role to a different user on the session. * A command to transfer a role to a different user on the session.
@ -48,7 +48,7 @@ public class TransferRoleCommand {
private ParticipantRole role; private ParticipantRole role;
@DynamicSerializeElement @DynamicSerializeElement
private IVenueParticipant user; private UserId user;
public ParticipantRole getRole() { public ParticipantRole getRole() {
return role; return role;
@ -58,11 +58,11 @@ public class TransferRoleCommand {
this.role = role; this.role = role;
} }
public IVenueParticipant getUser() { public UserId getUser() {
return user; return user;
} }
public void setUser(IVenueParticipant user) { public void setUser(UserId user) {
this.user = user; this.user = user;
} }

View file

@ -22,7 +22,7 @@ package com.raytheon.uf.viz.collaboration.comm.provider.event;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType; import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -45,18 +45,18 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
private final ParticipantEventType eventType; private final ParticipantEventType eventType;
private final IVenueParticipant participant; private final UserId participant;
private IPresence presence; private IPresence presence;
public VenueParticipantEvent(IVenueParticipant participant, public VenueParticipantEvent(UserId participant,
ParticipantEventType eventType) { ParticipantEventType eventType) {
this.participant = participant; this.participant = participant;
this.eventType = eventType; this.eventType = eventType;
} }
public VenueParticipantEvent(IVenueParticipant participant, public VenueParticipantEvent(UserId participant, IPresence presence,
IPresence presence, ParticipantEventType eventType) { ParticipantEventType eventType) {
this.participant = participant; this.participant = participant;
this.eventType = eventType; this.eventType = eventType;
this.presence = presence; this.presence = presence;
@ -74,7 +74,7 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getParticipant() * @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getParticipant()
*/ */
@Override @Override
public IVenueParticipant getParticipant() { public UserId getParticipant() {
return participant; return participant;
} }

View file

@ -25,7 +25,7 @@ import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -48,13 +48,13 @@ public class Venue implements IVenue {
private IVenueInfo info; private IVenueInfo info;
private Map<String, IVenueParticipant> participants; private Map<String, UserId> participants;
/** /**
* *
*/ */
public Venue() { public Venue() {
participants = new HashMap<String, IVenueParticipant>(); participants = new HashMap<String, UserId>();
} }
/** /**
@ -78,7 +78,7 @@ public class Venue implements IVenue {
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants() * @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants()
*/ */
@Override @Override
public Collection<IVenueParticipant> getParticipants() { public Collection<UserId> getParticipants() {
return participants.values(); return participants.values();
} }
@ -87,7 +87,7 @@ public class Venue implements IVenue {
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#addParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant) * @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#addParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant)
*/ */
@Override @Override
public void addParticipant(IVenueParticipant participant) { public void addParticipant(UserId participant) {
participants.put(participant.getName(), participant); participants.put(participant.getName(), participant);
} }
@ -96,7 +96,7 @@ public class Venue implements IVenue {
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#removeParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant) * @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#removeParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant)
*/ */
@Override @Override
public void removeParticipant(IVenueParticipant participant) { public void removeParticipant(UserId participant) {
participants.remove(participant).getName(); participants.remove(participant).getName();
} }

View file

@ -29,11 +29,11 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager; 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.ID; import com.raytheon.uf.viz.collaboration.comm.identity.user.ID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -62,7 +62,7 @@ public class Roster extends RosterItem implements IRoster {
// Map of all roster groups in this roster. // Map of all roster groups in this roster.
private Map<String, IRosterGroup> groups = null; private Map<String, IRosterGroup> groups = null;
private final IChatID user; private final UserId user;
private boolean roomRoster = false; private boolean roomRoster = false;
@ -72,7 +72,7 @@ public class Roster extends RosterItem implements IRoster {
* *
* @param user * @param user
*/ */
public Roster(IChatID user, IRosterManager manager) { public Roster(UserId user, IRosterManager manager) {
rosterManager = manager; rosterManager = manager;
this.user = user; this.user = user;
internalEntries = new HashMap<IQualifiedID, IRosterEntry>(); internalEntries = new HashMap<IQualifiedID, IRosterEntry>();
@ -85,7 +85,7 @@ public class Roster extends RosterItem implements IRoster {
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getUser() * @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getUser()
*/ */
@Override @Override
public IChatID getUser() { public UserId getUser() {
return user; return user;
} }
@ -121,11 +121,11 @@ public class Roster extends RosterItem implements IRoster {
IQualifiedID id = entry.getUser(); IQualifiedID id = entry.getUser();
re = internalEntries.get(id); re = internalEntries.get(id);
// ensure the entry is not present! // ensure the entry is not present!
if(re == null) { if (re == null) {
// put in the internal entries first. // put in the internal entries first.
internalEntries.put(entry.getUser(), entry); internalEntries.put(entry.getUser(), entry);
for(IRosterGroup g : entry.getGroups()) { for (IRosterGroup g : entry.getGroups()) {
RosterGroup rg = (RosterGroup) g; RosterGroup rg = (RosterGroup) g;
rg.setRoster(this); rg.setRoster(this);
} }
@ -207,8 +207,8 @@ public class Roster extends RosterItem implements IRoster {
if (user != null) { if (user != null) {
IRosterEntry entry = internalEntries.get(user.getFQName()); IRosterEntry entry = internalEntries.get(user.getFQName());
if (entry == null) { if (entry == null) {
RosterId id = new RosterId(user.getName(), user.getHost(), UserId id = new UserId(user.getName(), user.getHost(),
null, user.getResource()); user.getResource());
entry = new RosterEntry(id); entry = new RosterEntry(id);
} }
internalEntries.put(entry.getUser(), entry); internalEntries.put(entry.getUser(), entry);
@ -272,7 +272,7 @@ public class Roster extends RosterItem implements IRoster {
* @param userId * @param userId
*/ */
@Override @Override
public void sendRosterRemove(IChatID userId) throws CollaborationException { public void sendRosterRemove(UserId userId) throws CollaborationException {
rosterManager.sendRosterRemove(userId); rosterManager.sendRosterRemove(userId);
} }
@ -289,7 +289,7 @@ public class Roster extends RosterItem implements IRoster {
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) { if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o; org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
IChatID id = RosterId.convertFrom(entry.getUser()); UserId id = IDConverter.convertFrom(entry.getUser());
RosterEntry re = new RosterEntry(id); RosterEntry re = new RosterEntry(id);
// Check to see if we already have an entry // Check to see if we already have an entry
@ -318,34 +318,32 @@ public class Roster extends RosterItem implements IRoster {
// </pre> // </pre>
// ******************************************* // *******************************************
public void listRoster() { public void listRoster() {
System.out.println("##########################################################################"); System.out
.println("##########################################################################");
System.out.println("Roster for : " + user.getFQName()); System.out.println("Roster for : " + user.getFQName());
System.out.println("#####################################"); System.out.println("#####################################");
System.out.println("# Ungrouped entries"); System.out.println("# Ungrouped entries");
System.out.println("-------------------------------------"); System.out.println("-------------------------------------");
Collection<IRosterEntry> entries = getEntries(); Collection<IRosterEntry> entries = getEntries();
for(IRosterEntry r : entries) { for (IRosterEntry r : entries) {
System.out.print(" " + r.getName()); System.out.print(" " + r.getName());
} }
System.out.println("#####################################"); System.out.println("#####################################");
System.out.println("# Groups "); System.out.println("# Groups ");
System.out.println("-------------------------------------"); System.out.println("-------------------------------------");
Collection<IRosterGroup> groups = getGroups(); Collection<IRosterGroup> groups = getGroups();
for(IRosterGroup g : groups) { for (IRosterGroup g : groups) {
System.out.print(" " + g.getName()); System.out.print(" " + g.getName());
entries = g.getEntries(); entries = g.getEntries();
for(IRosterEntry r : entries) { for (IRosterEntry r : entries) {
System.out.print(" " + r.getName()); System.out.print(" " + r.getName());
} }
System.out.println("-----------------"); System.out.println("-----------------");
} }
System.out.println("##########################################################################"); System.out
.println("##########################################################################");
} }
} }

View file

@ -28,10 +28,9 @@ import org.eclipse.ecf.core.identity.ID;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -53,7 +52,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
public class RosterEntry extends RosterItem implements IRosterEntry, public class RosterEntry extends RosterItem implements IRosterEntry,
IMutableRosterEntry { IMutableRosterEntry {
private IChatID userId = null; private UserId userId = null;
private IPresence presence = null; private IPresence presence = null;
@ -63,7 +62,7 @@ public class RosterEntry extends RosterItem implements IRosterEntry,
* *
* @param id * @param id
*/ */
public RosterEntry(IChatID id) { public RosterEntry(UserId id) {
userId = id; userId = id;
setName(id.getFQName()); setName(id.getFQName());
groups = new HashMap<IRosterGroup, IRosterGroup>(); groups = new HashMap<IRosterGroup, IRosterGroup>();
@ -73,7 +72,7 @@ public class RosterEntry extends RosterItem implements IRosterEntry,
* *
*/ */
@Override @Override
public IChatID getUser() { public UserId getUser() {
return userId; return userId;
} }
@ -152,15 +151,16 @@ public class RosterEntry extends RosterItem implements IRosterEntry,
* @param entry * @param entry
* @return * @return
*/ */
public static IRosterEntry convertEntry(org.eclipse.ecf.presence.roster.IRosterEntry entry) { public static IRosterEntry convertEntry(
org.eclipse.ecf.presence.roster.IRosterEntry entry) {
RosterEntry rosterEntry = null; RosterEntry rosterEntry = null;
if(entry != null) { if (entry != null) {
ID id = entry.getUser().getID(); ID id = entry.getUser().getID();
String name = Tools.parseName(id.getName()); String name = Tools.parseName(id.getName());
String host = Tools.parseHost(id.getName()); String host = Tools.parseHost(id.getName());
String resource = Tools.parseResource(id.getName()); String resource = Tools.parseResource(id.getName());
IChatID rosterId = new RosterId(name, host, resource); UserId rosterId = new UserId(name, host, resource);
rosterEntry = new RosterEntry(rosterId); rosterEntry = new RosterEntry(rosterId);
IPresence p = Presence.convertPresence(entry.getPresence()); IPresence p = Presence.convertPresence(entry.getPresence());
@ -168,94 +168,14 @@ public class RosterEntry extends RosterItem implements IRosterEntry,
// Now check the groups // Now check the groups
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Collection<org.eclipse.ecf.presence.roster.IRosterGroup> inGroups = entry.getGroups(); Collection<org.eclipse.ecf.presence.roster.IRosterGroup> inGroups = entry
for(org.eclipse.ecf.presence.roster.IRosterGroup g : inGroups) { .getGroups();
RosterGroup group = new RosterGroup(g.getName(), null,null); for (org.eclipse.ecf.presence.roster.IRosterGroup g : inGroups) {
RosterGroup group = new RosterGroup(g.getName(), null, null);
rosterEntry.addGroup(group); rosterEntry.addGroup(group);
} }
} }
return rosterEntry; return rosterEntry;
} }
public static final void main(String[] args) {
IChatID id = new IChatID() {
private String name = null;
private String nickName = null;
private String host = null;
private String resource = null;
@Override
public void setName(String userName) {
name = userName;
}
@Override
public String getName() {
return name;
}
@Override
public void setNickname(String nickname) {
nickName = nickname;
}
@Override
public String getNickname() {
return nickName;
}
@Override
public void setHost(String hostName) {
host = hostName;
}
@Override
public String getHost() {
return host;
}
@Override
public String getResource() {
return resource;
}
@Override
public void setResource(String resource) {
this.resource = resource;
}
@Override
public String getFQName() {
StringBuilder sb = new StringBuilder(name);
sb.append("@");
sb.append(host);
if (resource != null) {
sb.append("/");
sb.append(resource);
}
return sb.toString();
}
};
id.setName("fred");
id.setHost("awipscm.omaha.us.ray.com");
id.setResource("smack");
IMutableRosterEntry entry = new RosterEntry(id);
entry.setPresence(new Presence());
IRosterEntry en = entry;
System.out.println(id.getFQName());
}
} }

View file

@ -28,7 +28,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -71,7 +71,7 @@ public class RosterGroup extends RosterItem implements IRosterGroup {
IRosterEntry re = entries.get(entry.getUser()); IRosterEntry re = entries.get(entry.getUser());
if (re == null) { if (re == null) {
IQualifiedID user = entry.getUser(); IQualifiedID user = entry.getUser();
RosterId id = new RosterId(user.getName(), user.getHost(), null, UserId id = new UserId(user.getName(), user.getHost(),
user.getResource()); user.getResource());
re = new RosterEntry(id); re = new RosterEntry(id);

View file

@ -32,11 +32,10 @@ import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager; 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.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager; import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -72,7 +71,7 @@ public class RosterManager implements IRosterManager {
public RosterManager(SessionManager manager) { public RosterManager(SessionManager manager) {
sessionManager = manager; sessionManager = manager;
updateRoster(); updateRoster();
} }
/** /**
* *
@ -85,7 +84,8 @@ public class RosterManager implements IRosterManager {
} }
private void updateRoster() { private void updateRoster() {
baseRoster = sessionManager.getPresenceContainerAdapter().getRosterManager().getRoster(); baseRoster = sessionManager.getPresenceContainerAdapter()
.getRosterManager().getRoster();
roster = toLocalRoster(baseRoster); roster = toLocalRoster(baseRoster);
} }
@ -149,7 +149,7 @@ public class RosterManager implements IRosterManager {
* @param userId * @param userId
*/ */
@Override @Override
public void sendRosterRemove(IChatID userId) throws CollaborationException { public void sendRosterRemove(UserId userId) throws CollaborationException {
IPresenceContainerAdapter adapter = baseRoster IPresenceContainerAdapter adapter = baseRoster
.getPresenceContainerAdapter(); .getPresenceContainerAdapter();
@ -174,12 +174,12 @@ public class RosterManager implements IRosterManager {
* @param fromId * @param fromId
* @param presence * @param presence
*/ */
public void updateEntry(IChatID fromId, IPresence presence) { public void updateEntry(UserId fromId, IPresence presence) {
RosterEntry re = new RosterEntry(fromId); RosterEntry re = new RosterEntry(fromId);
re.setPresence(presence); re.setPresence(presence);
IRosterEntry modified = roster.modifyRosterEntry(re); IRosterEntry modified = roster.modifyRosterEntry(re);
if(modified != null) { if (modified != null) {
sessionManager.getEventPublisher().post(re); sessionManager.getEventPublisher().post(re);
} }
} }
@ -191,7 +191,7 @@ public class RosterManager implements IRosterManager {
*/ */
public void updateEntry(IRosterEntry entry) { public void updateEntry(IRosterEntry entry) {
IRosterEntry modified = roster.modifyRosterEntry(entry); IRosterEntry modified = roster.modifyRosterEntry(entry);
if(modified != null) { if (modified != null) {
sessionManager.getEventPublisher().post(entry); sessionManager.getEventPublisher().post(entry);
} }
} }
@ -205,7 +205,7 @@ public class RosterManager implements IRosterManager {
Roster newRoster = null; Roster newRoster = null;
if (roster != null) { if (roster != null) {
IChatID id = IDConverter.convertFrom(roster.getUser()); UserId id = IDConverter.convertFrom(roster.getUser());
newRoster = new Roster(id, this); newRoster = new Roster(id, this);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -214,7 +214,7 @@ public class RosterManager implements IRosterManager {
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) { if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o; org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
id = RosterId.convertFrom(entry.getUser()); id = IDConverter.convertFrom(entry.getUser());
RosterEntry re = new RosterEntry(id); RosterEntry re = new RosterEntry(id);
if (!newRoster.getEntries().contains(re)) { if (!newRoster.getEntries().contains(re)) {
IPresence p = Presence.convertPresence(entry IPresence p = Presence.convertPresence(entry
@ -231,7 +231,8 @@ public class RosterManager implements IRosterManager {
newRoster.populateGroup(newGroup, group.getEntries()); newRoster.populateGroup(newGroup, group.getEntries());
newRoster.addGroup(newGroup); newRoster.addGroup(newGroup);
} else { } else {
System.out.println("RosterManager.toLocalRoster " + o.getClass().getName()); System.out.println("RosterManager.toLocalRoster "
+ o.getClass().getName());
} }
} }
} }
@ -246,10 +247,8 @@ public class RosterManager implements IRosterManager {
return sessionManager; return sessionManager;
} }
private void printRoster(IRoster roster) { private void printRoster(IRoster roster) {
} }
} }

View file

@ -65,9 +65,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager; 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.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.event.RosterChangeEvent; import com.raytheon.uf.viz.collaboration.comm.provider.event.RosterChangeEvent;
@ -76,9 +74,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry; import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager; import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/** /**
* *
@ -125,7 +122,7 @@ public class SessionManager implements IEventPublisher {
private String password; private String password;
private IChatID user; private UserId user;
private IPresence userPresence; private IPresence userPresence;
@ -245,7 +242,7 @@ public class SessionManager implements IEventPublisher {
String name = Tools.parseName(id.getName()); String name = Tools.parseName(id.getName());
String host = Tools.parseHost(id.getName()); String host = Tools.parseHost(id.getName());
String resource = Tools.parseResource(id.getName()); String resource = Tools.parseResource(id.getName());
user = new RosterId(name, host, resource); user = new UserId(name, host, resource);
} }
setupAccountManager(); setupAccountManager();
@ -261,7 +258,7 @@ public class SessionManager implements IEventPublisher {
* @return * @return
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getUser() * @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getUser()
*/ */
public IChatID getUser() { public UserId getUser() {
return user; return user;
} }
@ -426,7 +423,7 @@ public class SessionManager implements IEventPublisher {
String name = Tools.parseName(account); String name = Tools.parseName(account);
String host = Tools.parseHost(account); String host = Tools.parseHost(account);
IVenueParticipant me = new VenueParticipant(name, host); UserId me = new UserId(name, host);
session.setUserId(me); session.setUserId(me);
session.setCurrentDataProvider(invitation.getInvite() session.setCurrentDataProvider(invitation.getInvite()
.getDataProvider()); .getDataProvider());
@ -458,7 +455,7 @@ public class SessionManager implements IEventPublisher {
String name = Tools.parseName(account); String name = Tools.parseName(account);
String host = Tools.parseHost(account); String host = Tools.parseHost(account);
IVenueParticipant me = new VenueParticipant(name, host); UserId me = new UserId(name, host);
session.setCurrentSessionLeader(me); session.setCurrentSessionLeader(me);
session.setCurrentDataProvider(me); session.setCurrentDataProvider(me);
@ -577,7 +574,7 @@ public class SessionManager implements IEventPublisher {
String host = Tools.parseHost(fromId.getName()); String host = Tools.parseHost(fromId.getName());
String resource = Tools.parseResource(fromId.getName()); String resource = Tools.parseResource(fromId.getName());
IChatID id = new RosterId(name, host, resource); UserId id = new UserId(name, host, resource);
if (rosterManager != null) { if (rosterManager != null) {
((RosterManager) rosterManager).updateEntry(id, p); ((RosterManager) rosterManager).updateEntry(id, p);
@ -680,7 +677,7 @@ public class SessionManager implements IEventPublisher {
if (venueId != null) { if (venueId != null) {
IQualifiedID id = IDConverter.convertFrom(from); IQualifiedID id = IDConverter.convertFrom(from);
IChatID invitor = new RosterId(id.getName(), UserId invitor = new UserId(id.getName(),
id.getHost(), id.getResource()); id.getHost(), id.getResource());
VenueInvite received; VenueInvite received;

View file

@ -25,10 +25,10 @@ import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole; import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* TODO Add Description * TODO Add Description
@ -50,9 +50,9 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
public class SharedDisplaySession extends VenueSession implements public class SharedDisplaySession extends VenueSession implements
ISharedDisplaySession { ISharedDisplaySession {
private IVenueParticipant sessionLeader = null; private UserId sessionLeader = null;
private IVenueParticipant dataProvider = null; private UserId dataProvider = null;
public SharedDisplaySession(IContainer container, EventBus externalBus, public SharedDisplaySession(IContainer container, EventBus externalBus,
SessionManager manager) throws CollaborationException { SessionManager manager) throws CollaborationException {
@ -99,7 +99,7 @@ public class SharedDisplaySession extends VenueSession implements
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentDataProvider() * @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentDataProvider()
*/ */
@Override @Override
public IVenueParticipant getCurrentDataProvider() { public UserId getCurrentDataProvider() {
return dataProvider; return dataProvider;
} }
@ -110,7 +110,7 @@ public class SharedDisplaySession extends VenueSession implements
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentSessionLeader() * @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentSessionLeader()
*/ */
@Override @Override
public IVenueParticipant getCurrentSessionLeader() { public UserId getCurrentSessionLeader() {
return sessionLeader; return sessionLeader;
} }
@ -131,12 +131,12 @@ public class SharedDisplaySession extends VenueSession implements
} }
@Override @Override
public void setCurrentSessionLeader(IVenueParticipant id) { public void setCurrentSessionLeader(UserId id) {
sessionLeader = id; sessionLeader = id;
} }
@Override @Override
public void setCurrentDataProvider(IVenueParticipant id) { public void setCurrentDataProvider(UserId id) {
dataProvider = id; dataProvider = id;
} }

View file

@ -52,7 +52,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventTyp
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage; import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence; import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
@ -60,8 +59,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent; import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter; import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue; import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue;
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId; import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* *
@ -191,11 +190,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
venue = new Venue(); venue = new Venue();
ID[] ids = venueContainer.getChatRoomParticipants(); ID[] ids = venueContainer.getChatRoomParticipants();
for (ID id : ids) { for (ID id : ids) {
String fullName = id.getName(); UserId vp = IDConverter.convertFrom(id);
IVenueParticipant vp = new VenueParticipant();
vp.setName(Tools.parseName(fullName));
vp.setHost(Tools.parseHost(fullName));
vp.setResource(Tools.parseResource(fullName));
venue.addParticipant(vp); venue.addParticipant(vp);
} }
venue.setInfo(InfoAdapter.createVenueInfo(venueInfo)); venue.setInfo(InfoAdapter.createVenueInfo(venueInfo));
@ -302,7 +297,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
} }
} }
protected void setUserId(IVenueParticipant id) { protected void setUserId(UserId id) {
this.userID = id; this.userID = id;
} }
@ -383,11 +378,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
public void handlePresenceUpdated(ID fromID, public void handlePresenceUpdated(ID fromID,
org.eclipse.ecf.presence.IPresence presence) { org.eclipse.ecf.presence.IPresence presence) {
IVenueParticipant vp = new VenueParticipant(); UserId vp = IDConverter.convertFrom(fromID);
String fullName = fromID.getName();
vp.setName(Tools.parseName(fullName));
vp.setHost(Tools.parseHost(fullName));
vp.setResource(Tools.parseResource(fullName));
IPresence p = Presence.convertPresence(presence); IPresence p = Presence.convertPresence(presence);
IVenueParticipantEvent event = null; IVenueParticipantEvent event = null;
if (IPresence.Type.AVAILABLE.equals(p.getType())) { if (IPresence.Type.AVAILABLE.equals(p.getType())) {
@ -514,7 +505,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
.getFromID(); .getFromID();
XMPPRoomID rID = (XMPPRoomID) msg.getChatRoomID(); XMPPRoomID rID = (XMPPRoomID) msg.getChatRoomID();
IQualifiedID id = new RosterId(cID.getUsername(), rID.getHostname()); IQualifiedID id = new UserId(cID.getUsername(), rID.getHostname());
message.setFrom(id); message.setFrom(id);
} }
return message; return message;

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.collaboration.comm.provider.user; package com.raytheon.uf.viz.collaboration.comm.provider.user;
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.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/** /**
@ -47,7 +45,7 @@ public class IDConverter {
* @param user * @param user
* @return * @return
*/ */
public static IQualifiedID convertFrom(org.eclipse.ecf.core.identity.ID id) { public static UserId convertFrom(org.eclipse.ecf.core.identity.ID id) {
String name = Tools.parseName(id.getName()); String name = Tools.parseName(id.getName());
String host = Tools.parseHost(id.getName()); String host = Tools.parseHost(id.getName());
String rsc = Tools.parseResource(id.getName()); String rsc = Tools.parseResource(id.getName());
@ -59,11 +57,11 @@ public class IDConverter {
* @param user * @param user
* @return * @return
*/ */
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) { public static UserId convertFrom(org.eclipse.ecf.core.user.IUser user) {
String name = Tools.parseName(user.getID().getName()); String name = Tools.parseName(user.getID().getName());
String host = Tools.parseHost(user.getID().getName()); String host = Tools.parseHost(user.getID().getName());
RosterId rosterId = new RosterId(name, host); UserId rosterId = new UserId(name, host);
rosterId.setNickname(user.getNickname()); rosterId.setAlias(user.getNickname());
return rosterId; return rosterId;
} }

View file

@ -1,142 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
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.IChatID;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
@DynamicSerialize
public class RosterId extends UserId implements IChatID {
@DynamicSerializeElement
protected String nickname;
/**
*
* @param userName
* @param hostName
*/
public RosterId(String userName, String hostName) {
super(userName, hostName);
}
/**
*
* @param userName
* @param hostName
* @param nickName
* @param resource
*/
public RosterId(String userName, String hostName, String resource) {
super(userName, hostName, resource);
}
/**
*
* @param userName
* @param hostName
* @param nickName
* @param resource
*/
public RosterId(String userName, String hostName, String resource,
String nickName) {
super(userName, hostName, resource);
nickname = nickName;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#setNickname(java.lang.String)
*/
@Override
public void setNickname(String nickname) {
this.nickname = nickname;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#getNickname()
*/
@Override
public String getNickname() {
return nickname;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
RosterId other = (RosterId) obj;
if (nickname == null) {
if (other.nickname != null)
return false;
}
return true;
}
/**
*
* @param user
* @return
*/
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) {
String name = Tools.parseName(user.getID().getName());
String host = Tools.parseHost(user.getID().getName());
return new RosterId(name, host, user.getNickname(), null);
}
}

View file

@ -42,6 +42,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
@DynamicSerialize @DynamicSerialize
public class UserId implements IQualifiedID { public class UserId implements IQualifiedID {
private static final String CONF_ID = "conference.";
@DynamicSerializeElement @DynamicSerializeElement
protected String name; protected String name;
@ -51,9 +53,9 @@ public class UserId implements IQualifiedID {
@DynamicSerializeElement @DynamicSerializeElement
protected String resource; protected String resource;
/** @DynamicSerializeElement
* protected String alias;
*/
public UserId() { public UserId() {
} }
@ -64,9 +66,7 @@ public class UserId implements IQualifiedID {
* @param hostName * @param hostName
*/ */
public UserId(String userName, String hostName) { public UserId(String userName, String hostName) {
this.name = userName; this(userName, hostName, null);
this.host = hostName;
resource = null;
} }
/** /**
@ -75,10 +75,16 @@ public class UserId implements IQualifiedID {
* @param hostName * @param hostName
* @param resourceName * @param resourceName
*/ */
public UserId(String userName, String hostName, String resourceName) { public UserId(String userName, String hostName, String resource) {
this(userName, hostName, resource, null);
}
public UserId(String userName, String hostName, String resource,
String alias) {
this.name = userName; this.name = userName;
this.host = hostName; this.host = hostName;
resource = resourceName; this.resource = resource;
this.alias = alias;
} }
/** /**
@ -148,7 +154,11 @@ public class UserId implements IQualifiedID {
public String getFQName() { public String getFQName() {
StringBuilder sb = new StringBuilder(name); StringBuilder sb = new StringBuilder(name);
sb.append("@"); sb.append("@");
sb.append(host); String hostname = host;
if (hostname.startsWith(CONF_ID)) {
hostname = hostname.substring(CONF_ID.length());
}
sb.append(hostname);
sb.append("/"); sb.append("/");
if (resource != null) { if (resource != null) {
sb.append(resource); sb.append(resource);
@ -157,6 +167,7 @@ public class UserId implements IQualifiedID {
// requiring a resource for peerToPeer to go through // requiring a resource for peerToPeer to go through
sb.append("resource"); sb.append("resource");
} }
System.out.println(sb.toString());
return sb.toString(); return sb.toString();
} }
@ -208,4 +219,17 @@ public class UserId implements IQualifiedID {
return true; return true;
} }
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
@Override
public String toString() {
return this.getFQName();
}
} }

View file

@ -1,135 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
@DynamicSerialize
public class VenueParticipant extends RosterId implements IVenueParticipant {
private static String CONF_ID = "conference.";
private Map<String, String> properties;
public VenueParticipant() {
this(null, null);
}
/**
*
*/
public VenueParticipant(String name, String host) {
this(name, host, null);
}
/**
*
*/
public VenueParticipant(String name, String host, String resource) {
super(name, host, resource);
this.name = name;
this.host = host;
this.properties = new HashMap<String, String>();
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#setProperty(java.lang.String,
* java.lang.String)
*/
@Override
public void setProperty(String key, String value) {
properties.put(key, value);
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperty(java.lang.String,
* java.lang.String)
*/
@Override
public String getProperty(String key, String defaultValue) {
String value = properties.get(key);
if (value == null) {
value = defaultValue;
}
return value;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperties()
*/
@Override
public Collection<Property> getProperties() {
return null;
}
/**
* Return the identifier as a qualified field. Removes the "domain"
* conference from the host string if found.
*
* @return The qualified id.
*/
@Override
public IQualifiedID getQualifiedId() {
String hostName = host;
if (hostName != null) {
if (hostName.startsWith(CONF_ID)) {
hostName = hostName.substring(CONF_ID.length());
}
}
UserId id = new UserId(getName(), hostName);
id.setResource(resource);
return id;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
@Override
public String toString() {
return this.getFQName();
}
}