Merge "Issue #232 - Added guava lib project - Adding error checking/reporting - Added VenueInitationListener" into 11-Collaboration

Former-commit-id: 62d92c57d9d004427a74fc0353e2ca94411bf488
This commit is contained in:
Nate Jensen 2012-03-14 11:23:55 -05:00 committed by Gerrit Code Review
commit dc62171533
14 changed files with 596 additions and 332 deletions

View file

@ -101,4 +101,10 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.google.guava"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -8,7 +8,8 @@ Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ecf;bundle-version="3.1.300",
org.eclipse.ecf.presence;bundle-version="2.0.0",
org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0"
org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0",
com.google.guava;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.collaboration,

View file

@ -32,12 +32,16 @@ import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.security.ConnectContextFactory;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import org.eclipse.ecf.presence.chatroom.IChatRoomInvitationListener;
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
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.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IVenueInvitationListener;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationSession;
import com.raytheon.uf.viz.collaboration.comm.provider.Errors;
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
/**
@ -71,8 +75,11 @@ public class SessionManager {
private String password;
private IContainer container = null;
private IChatRoomInvitationListener intInvitationListener;
private IVenueInvitationListener invitationListener;
private IContainer container = null;
/**
* @throws ContainerCreateException
@ -84,14 +91,11 @@ public class SessionManager {
this.password = password;
}
/**
*
* @return
*/
public ISession createPeerToPeerSession() {
public ISession createPeerToPeerSession() throws CollaborationException {
return (ISession) createSession(SESSION_P2P);
}
@ -99,16 +103,15 @@ public class SessionManager {
*
* @return
*/
public IVenueSession createChatOnlySession() {
public IVenueSession createChatOnlySession() throws CollaborationException {
return (IVenueSession) createSession(SESSION_CHAT_ONLY);
}
/**
*
* @return
*/
public IVenueSession createCollaborationSession() {
public IVenueSession createCollaborationSession() throws CollaborationException {
return (IVenueSession) createSession(SESSION_COLLABORATION);
}
@ -117,7 +120,7 @@ public class SessionManager {
* @param sessionKind
* @return
*/
public ISession createSession(String sessionKind) {
public ISession createSession(String sessionKind) throws CollaborationException {
ISession session = null;
if(sessionKind != null) {
@ -133,9 +136,14 @@ public class SessionManager {
}
}
if(session != null) {
session.connect(account, password);
int errorCode = session.connect(account, password);
if(errorCode == Errors.BAD_NAME) {
throw new CollaborationException(String.format("Bad name [%s]", account));
} else if (errorCode == Errors.CANNOT_CONNECT) {
throw new CollaborationException(String.format("Count not connect using name [%s]", account));
}
} else {
System.out.println("Could not connect session");
throw new CollaborationException(String.format("Count not connect using name [%s]", account));
}
return session;
}
@ -164,6 +172,43 @@ public class SessionManager {
return info;
}
public IVenueInvitationListener setVenueInvitationListener(IVenueInvitationListener listener) {
connectToContainer();
IPresenceContainerAdapter presence = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
IChatRoomManager venueManager = presence.getChatRoomManager();
invitationListener = listener;
if(invitationListener != null) {
// Do we already have one set?
if(intInvitationListener != null) {
venueManager.removeInvitationListener(intInvitationListener);
}
intInvitationListener = new IChatRoomInvitationListener() {
@Override
public void handleInvitationReceived(ID roomID, ID from,
String subject, String body) {
invitationListener.handleInvitation(null, null, subject, body);
}
};
venueManager.addInvitationListener(intInvitationListener);
}
return listener;
}
public IVenueInvitationListener removeVenueInvitationListener(IVenueInvitationListener listener) {
connectToContainer();
IPresenceContainerAdapter presence = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
IChatRoomManager venueManager = presence.getChatRoomManager();
invitationListener = listener;
if(invitationListener != null) {
venueManager.removeInvitationListener(intInvitationListener);
}
return listener;
}
private void connectToContainer() {
if(container.getConnectedID() == null) {

View file

@ -73,8 +73,9 @@ public interface ISession {
*
* @param userName
* @param password
* @return An error status.
*/
void connect(String userName, String password);
int connect(String userName, String password);
/**
*
@ -106,6 +107,18 @@ public interface ISession {
*/
IRosterManager getRosterManager();
/**
*
* @param handler
*/
void registerEventHandler(Object handler);
/**
*
* @param handler
*/
void unRegisterEventHandler(Object handler);
/**
* Send a Text message.
* @param message

View file

@ -0,0 +1,53 @@
/**
* 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.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 13, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenueInvitationListener {
/**
*
* @param roomId
* @param from
* @param subject
* @param body
*/
void handleInvitation(IQualifiedID roomId, IChatID from, String subject, String body);
}

View file

@ -0,0 +1,73 @@
/**
* 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;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 8, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class CollaborationException extends Exception {
private static final long serialVersionUID = 2897604473798379699L;
/**
*
*/
public CollaborationException() {
}
/**
* @param message
*/
public CollaborationException(String message) {
super(message);
}
/**
*
* @param message
* @param cause
*/
public CollaborationException(String message, Throwable cause) {
super(message, cause);
}
/**
* @param cause
*/
public CollaborationException(Throwable cause) {
super(cause);
}
}

View file

@ -27,9 +27,9 @@ import java.util.List;
import java.util.Map;
import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.security.ConnectContextFactory;
@ -52,7 +52,7 @@ import org.eclipse.ecf.presence.im.IChatMessage;
import org.eclipse.ecf.presence.im.IChatMessageSender;
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
import com.raytheon.uf.viz.collaboration.comm.SessionManager;
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
@ -87,70 +87,6 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class CollaborationSession implements IVenueSession {
/**
@ -193,8 +129,7 @@ public class CollaborationSession implements IVenueSession {
* @param listener
* @param filter
*/
public InternalListener(IPresenceListener listener,
IMessageFilter filter) {
public InternalListener(IPresenceListener listener, IMessageFilter filter) {
presenceListener = listener;
this.filter = filter;
}
@ -226,7 +161,7 @@ public class CollaborationSession implements IVenueSession {
}
private IContainer container = null;
private IContainer connectionContainer = null;
private IPresenceContainerAdapter presence = null;
@ -236,10 +171,10 @@ public class CollaborationSession implements IVenueSession {
private IChatRoomManager venueManager = null;
private IChatRoomContainer venueContainer = null;
private IChatRoomInfo venueInfo = null;
private IChatRoomContainer venueContainer = null;
private List<InternalListener> messageListeners = null;
private List<IVenueParticipantListener> venueParticipantListeners = null;
@ -250,19 +185,25 @@ public class CollaborationSession implements IVenueSession {
private IIMMessageListener intListener = null;
private IChatRoomParticipantListener participantListener = null;
private IQualifiedID receiver = null;
private IQualifiedID userID = null;
private EventBus eventBus = new EventBus();
/**
*
*/
public CollaborationSession(IContainer container) {
this.container = container;
initListeners();
this.connectionContainer = container;
try {
setup();
} catch (ECFException e) {
} finally {
initListeners();
}
}
@ -270,26 +211,43 @@ public class CollaborationSession implements IVenueSession {
*
* @param userName
* @param password
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#connect(java.lang.String,
* java.lang.String)
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#connect(java.lang.String, java.lang.String)
*/
@Override
public void connect(String userName, String password) {
public int connect(String userName, String password) {
int errorStatus = Errors.NO_ERROR;
// Make sure we're not already connected.
if(!isConnected()) {
ID targetID = IDFactory.getDefault().createID(namespace, userName);
// Now connect
try {
container.connect(targetID, ConnectContextFactory
.createPasswordConnectContext(password));
System.out.println("Container connected as "
+ container.getConnectedID());
ID targetID = createID(userName);
// Now connect
connectionContainer.connect(targetID, ConnectContextFactory.createPasswordConnectContext(password));
} catch(IDCreateException e) {
errorStatus = Errors.BAD_NAME;
} catch (ContainerConnectException e) {
System.out.println("Error attempting to connect");
errorStatus = Errors.CANNOT_CONNECT;
e.printStackTrace();
}
} else {
errorStatus = Errors.ALREADY_CONNECTED;
}
return errorStatus;
}
/**
*
* @throws ECFException
*/
private void setup() throws ECFException {
// Check if the container has been set up previously.
if (connectionContainer != null) {
namespace = connectionContainer.getConnectNamespace();
presence = (IPresenceContainerAdapter) connectionContainer
.getAdapter(IPresenceContainerAdapter.class);
chatSender = presence.getChatManager().getChatMessageSender();
} else {
}
}
@ -309,24 +267,29 @@ public class CollaborationSession implements IVenueSession {
@Override
public boolean isConnected() {
boolean connected = false;
if (container != null) {
connected = (container.getConnectedID() != null);
if(connectionContainer != null) {
connected = (connectionContainer.getConnectedID() != null);
}
return connected;
}
/**
*
* Close this session. Closing clears all listeners and disposes of
* the container. No errors for attempting to close an already closed session.
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#close()
*/
@Override
public void close() {
if (container != null) {
if(connectionContainer != null) {
// Ensure the listeners are cleared first.
// unhook the internal listener first.
if(intListener != null) {
venueContainer.removeMessageListener(intListener);
}
if(participantListener != null) {
venueContainer.removeChatRoomParticipantListener(participantListener);
}
messageListeners.clear();
messageListeners = null;
@ -337,29 +300,21 @@ public class CollaborationSession implements IVenueSession {
presenceListeners.clear();
presenceListeners = null;
venueContainer.disconnect();
venueContainer = null;
presence = null;
chatSender = null;
namespace = null;
venueManager = null;
venueInfo = null;
// Now dispose of the comm container.
container.dispose();
container = null;
}
}
/**
*
* @throws ECFException
*/
private void setup() throws ECFException {
if (container == null) {
container = ContainerFactory.getDefault().createContainer(
SessionManager.PROVIDER);
}
if (container != null) {
namespace = container.getConnectNamespace();
presence = (IPresenceContainerAdapter) container
.getAdapter(IPresenceContainerAdapter.class);
chatSender = presence.getChatManager().getChatMessageSender();
connectionContainer = null;
}
}
@ -368,9 +323,12 @@ public class CollaborationSession implements IVenueSession {
* @param name
* @return
*/
private ID createID(String name) {
return IDFactory.getDefault().createID(container.getConnectNamespace(),
name);
private ID createID(String name) throws IDCreateException {
ID id = null;
if(namespace != null) {
id = IDFactory.getDefault().createID(namespace, name);
}
return id;
}
/**
@ -383,11 +341,16 @@ public class CollaborationSession implements IVenueSession {
try {
// Create chat room container from manager
venueManager = presence.getChatRoomManager();
if(venueManager != null) {
venueInfo = venueManager.getChatRoomInfo(venueName);
if(venueInfo != null) {
errorStatus = completeVenueConnection(venueInfo);
} else {
// Could not join venue.
}
} else {
}
} catch (Exception e) {
System.out.println(String.format("joinVenue(%s)", venueName));
@ -400,8 +363,7 @@ public class CollaborationSession implements IVenueSession {
*
* @param venueName
* @throws Exception
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String,
* java.lang.String)
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String, java.lang.String)
*/
@Override
public int createVenue(String venueName, String subject) {
@ -409,6 +371,7 @@ public class CollaborationSession implements IVenueSession {
try {
// Create chat room container from manager
venueManager = presence.getChatRoomManager();
if(venueManager != null) {
venueInfo = venueManager.getChatRoomInfo(venueName);
if(venueInfo == null) {
Map<String, String> props = null;
@ -419,8 +382,11 @@ public class CollaborationSession implements IVenueSession {
venueInfo = venueManager.createChatRoom(venueName, props);
errorStatus = completeVenueConnection(venueInfo);
} else {
// The venue already exists.
errorStatus = -2;
errorStatus = Errors.VENUE_EXISTS;
}
} else {
}
} catch (Exception e) {
System.out.println(String.format("createVenue(%s)", venueName));
@ -434,7 +400,7 @@ public class CollaborationSession implements IVenueSession {
* @return
*/
private int completeVenueConnection(IChatRoomInfo venueInfo) {
int errorStatus = 0;
int errorStatus = Errors.NO_ERROR;
if (venueInfo != null) {
try {
@ -458,9 +424,8 @@ public class CollaborationSession implements IVenueSession {
IChatRoomParticipantListener pListener = new IChatRoomParticipantListener() {
@Override
public void handleArrived(IUser participant) {
IVenueParticipant p = new VenueParticipant(
participant.getName(),
participant.getNickname());
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
eventBus.post(p);
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleArrived(p);
}
@ -468,9 +433,8 @@ public class CollaborationSession implements IVenueSession {
@Override
public void handleUpdated(IUser participant) {
IVenueParticipant p = new VenueParticipant(
participant.getName(),
participant.getNickname());
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
eventBus.post(p);
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleUpdated(p);
}
@ -478,16 +442,16 @@ public class CollaborationSession implements IVenueSession {
@Override
public void handleDeparted(IUser participant) {
IVenueParticipant p = new VenueParticipant(
participant.getName(),
participant.getNickname());
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
eventBus.post(p);
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleDeparted(p);
}
}
@Override
public void handlePresenceUpdated(ID fromID,
public void handlePresenceUpdated(
ID fromID,
org.eclipse.ecf.presence.IPresence presence) {
fromID.getName();
@ -495,7 +459,7 @@ public class CollaborationSession implements IVenueSession {
vp.setName(fromID.getName());
IPresence p = Presence.convertPresence(presence);
eventBus.post(p);
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handlePresenceUpdated(vp, p);
}
@ -512,12 +476,12 @@ public class CollaborationSession implements IVenueSession {
/**
*
* @return The information about this venue. May return a null reference if
* the venue is not connected.
* @return The information about this venue. May return a null reference
* if the venue is not connected.
*/
public IVenue getVenue() {
IVenue venue = null;
if (isConnected()) {
if(isConnected() && (venueContainer != null)) {
venue = new Venue();
ID [] ids = venueContainer.getChatRoomParticipants();
for(ID id : ids) {
@ -538,13 +502,11 @@ public class CollaborationSession implements IVenueSession {
@Override
public int sendPresence(IPresence userPresence) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
IPresenceSender sender = presence.getRosterManager()
.getPresenceSender();
IPresenceSender sender = presence.getRosterManager().getPresenceSender();
try {
sender.sendPresenceUpdate(null,
Presence.convertPresence(userPresence));
sender.sendPresenceUpdate(null, Presence.convertPresence(userPresence));
} catch (ECFException e) {
status = -1;
}
@ -559,13 +521,31 @@ public class CollaborationSession implements IVenueSession {
return null;
}
/**
*
* @param handler
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#registerEventHandler(java.lang.Object)
*/
public void registerEventHandler(Object handler) {
eventBus.register(handler);
}
/**
*
* @param handler
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#unRegisterEventHandler(java.lang.Object)
*/
public void unRegisterEventHandler(Object handler) {
eventBus.unregister(handler);
}
/**
*
*/
@Override
public int sendTextMessage(IMessage message) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
if(chatSender != null) {
ID toID = createID(message.getTo().getName());
String subject = message.getSubject();
@ -579,8 +559,7 @@ public class CollaborationSession implements IVenueSession {
}
}
try {
chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT,
subject, body, props);
chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT, subject, body, props);
} catch (ECFException e) {
System.out.println("Error sending message");
e.printStackTrace();
@ -598,7 +577,7 @@ public class CollaborationSession implements IVenueSession {
@Override
public int sendTextMessage(String to, String message) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
ID toID = createID(to);
try {
chatSender.sendChatMessage(toID, message);
@ -625,15 +604,13 @@ public class CollaborationSession implements IVenueSession {
}
/**
* @param message
* A message to send.
* @param message A message to send.
*/
public int sendMessageToVenue(String message) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
if(venueContainer != null) {
IChatRoomMessageSender sender = venueContainer
.getChatRoomMessageSender();
IChatRoomMessageSender sender = venueContainer.getChatRoomMessageSender();
try {
sender.sendMessage(message);
} catch (ECFException e) {
@ -651,7 +628,7 @@ public class CollaborationSession implements IVenueSession {
@Override
public int sendCollaborationMessage(IMessage message) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
// for now we're sending everything via regular messages.
return sendMessageToVenue(message.getBody());
}
@ -669,32 +646,22 @@ public class CollaborationSession implements IVenueSession {
/**
* Send an invitation from this venue to another user.
*
* @param room
* The target venue for this invitation.
* @param id
* The target user for this invitation.
* @param subject
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @param room The target venue for this invitation.
* @param id The target user for this invitation.
* @param subject The intended subject of the venue conversation.
* @param body Any text that the user may wish to include.
* @return
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public int sendInvitation(String room, String id, String subject,
String body) {
public int sendInvitation(String room, String id, String subject, String body) {
// Assume success
int status = 0;
IChatRoomInvitationSender sender = presence.getChatRoomManager()
.getInvitationSender();
int status = Errors.NO_ERROR;
IChatRoomInvitationSender sender = presence.getChatRoomManager().getInvitationSender();
if(sender != null) {
ID roomId = presence.getChatRoomManager().getChatRoomInfo(room)
.getConnectedID();
ID userId = IDFactory.getDefault().createID(namespace,
id + "@awipscm.omaha.us.ray.com");
ID roomId = presence.getChatRoomManager().getChatRoomInfo(room).getConnectedID();
ID userId = IDFactory.getDefault().createID(namespace, id + "@awipscm.omaha.us.ray.com");
try {
sender.sendInvitation(roomId, userId, subject, body);
@ -707,24 +674,17 @@ public class CollaborationSession implements IVenueSession {
/**
* Send an invitation from this venue to another user.
*
* @param room
* The target venue for this invitation.
* @param id
* The target user for this invitation.
* @param subject
* The intended subject of the venue conversation.
* @param body
* Any text that the user may wish to include.
* @param room The target venue for this invitation.
* @param id The target user for this invitation.
* @param subject The intended subject of the venue conversation.
* @param body Any text that the user may wish to include.
* @return
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public int sendInvitation(String room, List<String> ids, String subject,
String body) {
public int sendInvitation(String room, List<String> ids, String subject, String body) {
// Assume success
int status = 0;
int status = Errors.NO_ERROR;
if(ids != null) {
for(String id : ids) {
sendInvitation(room, id, subject, body);
@ -735,11 +695,11 @@ public class CollaborationSession implements IVenueSession {
return status;
}
@Override
public IMessageListener addMessageListener(IMessageListener listener,
IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener,
filter);
public IMessageListener addMessageListener(IMessageListener listener, IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener, filter);
messageListeners.add(messageListener);
return listener;
}
@ -774,8 +734,7 @@ public class CollaborationSession implements IVenueSession {
*
*/
@Override
public IVenueParticipantListener addVenueParticipantListener(
IVenueParticipantListener listener) {
public IVenueParticipantListener addVenueParticipantListener(IVenueParticipantListener listener) {
if(listener != null) {
venueParticipantListeners.add(listener);
} else {
@ -802,8 +761,7 @@ public class CollaborationSession implements IVenueSession {
*
*/
@Override
public IVenueParticipantListener removeVenueParticipantListener(
IVenueParticipantListener listener) {
public IVenueParticipantListener removeVenueParticipantListener(IVenueParticipantListener listener) {
IVenueParticipantListener removed = null;
if(venueParticipantListeners.remove(listener)) {
removed = listener;
@ -815,10 +773,8 @@ public class CollaborationSession implements IVenueSession {
*
*/
@Override
public IMessageListener addCollaborationListener(IMessageListener listener,
IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener,
filter);
public IMessageListener addCollaborationListener(IMessageListener listener, IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener, filter);
collaborationListeners.add(messageListener);
return listener;
}
@ -841,8 +797,7 @@ public class CollaborationSession implements IVenueSession {
*
*/
@Override
public IMessageListener removeCollaborationListener(
IMessageListener listener) {
public IMessageListener removeCollaborationListener(IMessageListener listener) {
IMessageListener removed = null;
if(collaborationListeners.remove(listener)) {
removed = listener;
@ -854,10 +809,8 @@ public class CollaborationSession implements IVenueSession {
*
*/
@Override
public IPresenceListener addPresenceListener(IPresenceListener listener,
IMessageFilter filter) {
InternalListener presenceListener = new InternalListener(listener,
filter);
public IPresenceListener addPresenceListener(IPresenceListener listener, IMessageFilter filter) {
InternalListener presenceListener = new InternalListener(listener, filter);
presenceListeners.add(presenceListener);
return listener;
}
@ -886,17 +839,14 @@ public class CollaborationSession implements IVenueSession {
}
/**
* Set up the various message listener lists.
* Set up the various message listener lists. Ensures that all listener collections
* are not null prior to use.
*/
private void initListeners() {
messageListeners = Collections
.synchronizedList(new ArrayList<InternalListener>());
venueParticipantListeners = Collections
.synchronizedList(new ArrayList<IVenueParticipantListener>());
presenceListeners = Collections
.synchronizedList(new ArrayList<InternalListener>());
collaborationListeners = Collections
.synchronizedList(new ArrayList<InternalListener>());
messageListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
venueParticipantListeners = Collections.synchronizedList(new ArrayList<IVenueParticipantListener>());
presenceListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
collaborationListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
}
/**
@ -907,11 +857,11 @@ public class CollaborationSession implements IVenueSession {
if(message != null) {
fireMessageListeners(message);
eventBus.post(message);
// if(IMessage.MessageType.CHAT.equals(message.getMessageType())) {
// fireMessageListeners(message);
// } else if
// (IMessage.MessageType.COLLABORATION.equals(message.getMessageType()))
// {
// } else if (IMessage.MessageType.COLLABORATION.equals(message.getMessageType())) {
// fireCollaborationListeners(message);
// }
}
@ -1008,8 +958,7 @@ public class CollaborationSession implements IVenueSession {
XMPPRoomID rID = (XMPPRoomID) msg.getChatRoomID();
System.out.println("nickname = " + rID.getNickname());
IQualifiedID id = new VenueUserId(cID.getUsername(),
rID.getHostname());
IQualifiedID id = new VenueUserId(cID.getUsername(), rID.getHostname());
message.setFrom(id);
}
return message;

View file

@ -0,0 +1,57 @@
/**
* 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;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 8, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public abstract class Errors {
public static final int NO_ERROR = 0;
public static final int CANNOT_CONNECT = -50;
public static final int ALREADY_CONNECTED = -51;
public static final int BAD_NAME = -52;
// Error - An attempt to use a Venue that has been disposed.
public static final int VENUE_DISPOSED = -100;
// Error - Venue exists when attempting to create a new venue.
public static final int VENUE_EXISTS = -101;
// Error - Venue not found when attempting to join an existing venue.
public static final int VENUE_NOT_FOUND = -102;
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="guava-11.0.2.jar" />
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.google.guava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
#Thu Mar 26 11:28:33 CDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -0,0 +1,23 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Google Common (Guava)
Bundle-SymbolicName: com.google.guava
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: GOOGLE
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: guava-11.0.2.jar
Export-Package:
com.google.common.annotations,
com.google.common.base,
com.google.common.base.internal,
com.google.common.cache,
com.google.common.collect,
com.google.common.eventbus,
com.google.common.hash,
com.google.common.io,
com.google.common.math,
com.google.common.net,
com.google.common.primitives,
com.google.common.util.concurrent
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -0,0 +1,2 @@
bin.includes = META-INF/,\
guava-11.0.2.jar

Binary file not shown.