(presenceListeners);
- }
- for (IPresenceListener l : toNotify) {
- l.handlePresence(fromID, presence);
- }
- }
-
- @Override
- public IRoster getRoster() {
- return getSuperRosterManager().getRoster();
- }
-
- @Override
- public void addRosterListener(IRosterListener listener) {
- getSuperRosterManager().addRosterListener(listener);
- synchronized (rosterUpdateListeners) {
- rosterUpdateListeners.add(listener);
- }
- }
-
- @Override
- public void removeRosterListener(IRosterListener listener) {
- getSuperRosterManager().removeRosterListener(listener);
- synchronized (rosterUpdateListeners) {
- rosterUpdateListeners.remove(listener);
- }
-
- }
-
- @Override
- public void addRosterSubscriptionListener(
- IRosterSubscriptionListener listener) {
- getSuperRosterManager().addRosterSubscriptionListener(listener);
- }
-
- @Override
- public void removeRosterSubscriptionListener(
- IRosterSubscriptionListener listener) {
- getSuperRosterManager().removeRosterSubscriptionListener(listener);
- }
-
- @Override
- public IRosterSubscriptionSender getRosterSubscriptionSender() {
- return getSuperRosterManager().getRosterSubscriptionSender();
- }
-
- @Override
- public IPresenceSender getPresenceSender() {
- return getSuperRosterManager().getPresenceSender();
- }
-
- @Override
- public void addPresenceListener(IPresenceListener listener) {
- getSuperRosterManager().addPresenceListener(listener);
- synchronized (presenceListeners) {
- presenceListeners.add(listener);
- }
- }
-
- @Override
- public void removePresenceListener(IPresenceListener listener) {
- getSuperRosterManager().removePresenceListener(listener);
- synchronized (presenceListeners) {
- presenceListeners.remove(listener);
- }
- }
-
- }
-
-}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/src/com/raytheon/uf/viz/collaboration/comm/xmpp/internal/smack/ECFConnection.java b/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/src/com/raytheon/uf/viz/collaboration/comm/xmpp/internal/smack/ECFConnection.java
deleted file mode 100644
index 7722529a6c..0000000000
--- a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/src/com/raytheon/uf/viz/collaboration/comm/xmpp/internal/smack/ECFConnection.java
+++ /dev/null
@@ -1,71 +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.xmpp.internal.smack;
-
-import java.io.IOException;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.identity.Namespace;
-import org.eclipse.ecf.provider.comm.IAsynchEventHandler;
-import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
-import org.jivesoftware.smack.packet.Presence;
-
-/**
- * Extends ECFConnection from xmpp provider, adds ability to send presence to a
- * room using the roomId.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jul 20, 2012 bsteffen Initial creation
- *
- *
- *
- * @author bsteffen
- * @version 1.0
- */
-@SuppressWarnings("restriction")
-public class ECFConnection extends
- org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection {
-
- public ECFConnection(boolean google, Namespace ns, IAsynchEventHandler h) {
- super(google, ns, h);
- }
-
- @Override
- public void sendPresenceUpdate(ID target, Presence presence)
- throws IOException {
- if (target instanceof XMPPRoomID) {
- // sendPresenceUpdate uses target.getName to determine where to send
- // the presence to, this does not work for roomId because getName
- // will return the room name without the host, so instead of using
- // the super version directly we will setTo on the presence here and
- // then send no target to super.
- presence.setTo(((XMPPRoomID) target).getMucString());
- super.sendPresenceUpdate(null, presence);
- } else {
- super.sendPresenceUpdate(target, presence);
- }
- }
-
-}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration.comm/META-INF/MANIFEST.MF
index 2b0fd469df..1753deb5f7 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/META-INF/MANIFEST.MF
@@ -9,14 +9,11 @@ Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ecf,
- org.eclipse.ecf.presence,
- org.eclipse.ecf.provider.xmpp,
org.apache.commons.lang,
com.google.guava;visibility:=reexport,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.status,
- org.jivesoftware.smack,
+ org.jivesoftware.smack;bundle-version="3.3.0",
org.eclipse.swt,
com.raytheon.uf.common.comm,
com.raytheon.uf.common.localization,
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/Activator.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/Activator.java
index e0b071ee2f..7ba4d0186a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/Activator.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/Activator.java
@@ -25,7 +25,7 @@ import org.osgi.framework.BundleContext;
import com.raytheon.uf.common.comm.NetworkStatistics;
/**
- * TODO Add Description
+ * Activator for Collaboration Communication
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/CollaborationException.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/CollaborationException.java
index 7d92652551..bff94a9342 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/CollaborationException.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/CollaborationException.java
@@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity;
/**
- * TODO Add Description
+ * Exception class for collaboration component
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IAccountManager.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IAccountManager.java
index 79d504feea..3d9f0faae0 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IAccountManager.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IAccountManager.java
@@ -21,12 +21,12 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.Map;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.ISubscriptionResponder;
/**
- * TODO Add Description
+ * Chat server account management interface
*
*
*
@@ -55,31 +55,25 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.ISubscriptionRespo
public interface IAccountManager {
/**
- * Set whether the account manager will auto subscribe to subscription
- * requests.
- *
- * @param mode
- * The auto subscription mode.
+ * Disable automatically accepting subscribe requests
*/
- void setAutoSubscriptionMode(boolean mode);
+ public void disableAutoSubscribe();
/**
- * Get the account manager auto subscription mode.
- *
- * @return The auto subscription mode.
+ * @return true if automatically accepts subscribe requests
*/
- boolean getAutoSubscriptionMode();
+ public boolean autoSubscribeEnabled();
/**
*
* @param responder
*/
- void setSubscriptionRequestResponder(ISubscriptionResponder responder);
+ public void setSubscriptionRequestResponder(ISubscriptionResponder responder);
/**
* Removes the current subscription request responder.
*/
- void removeSubscriptionRequestResponder();
+ public void removeSubscriptionRequestResponder();
/**
*
@@ -88,7 +82,7 @@ public interface IAccountManager {
* @param attributes
* @throws CollaborationException
*/
- void createAccount(String name, char[] password,
+ public void createAccount(String name, char[] password,
Map attributes) throws CollaborationException;
/**
@@ -98,7 +92,7 @@ public interface IAccountManager {
* @param password
* @throws CollaborationException
*/
- void changePassword(char[] password) throws CollaborationException;
+ public void changePassword(char[] password) throws CollaborationException;
/**
* Allows the user to delete this account on the server. An exception will
@@ -108,7 +102,7 @@ public interface IAccountManager {
*
* @throws CollaborationException
*/
- void deleteAccount() throws CollaborationException;
+ public void deleteAccount() throws CollaborationException;
/**
* Can an account be created on the server.
@@ -117,7 +111,7 @@ public interface IAccountManager {
* @throws CollaborationException
* The query failed.
*/
- boolean canCreateAccount() throws CollaborationException;
+ public boolean canCreateAccount() throws CollaborationException;
/**
* Allow the user to send presence information to the transport provider.
@@ -126,5 +120,5 @@ public interface IAccountManager {
* @return Return status information.
* @throws CollaborationException
*/
- public void sendPresence(IPresence presence) throws CollaborationException;
+ public void sendPresence(Presence presence) throws CollaborationException;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ICollaborationMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ICollaborationMessage.java
deleted file mode 100644
index 0e1b7b021a..0000000000
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ICollaborationMessage.java
+++ /dev/null
@@ -1,41 +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;
-
-/**
- * TODO Add Description
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Mar 19, 2012 jkorman Initial creation
- *
- *
- *
- * @author jkorman
- * @version 1.0
- */
-
-public interface ICollaborationMessage extends IMessage {
-
-}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java
index 3706886387..af618b75a8 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java
@@ -23,20 +23,20 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
- * TODO Add Description
+ * Collaboration message wrapper interface
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
- *
+ *
*
- *
+ *
* @author jkorman
- * @version 1.0
+ * @version 1.0
*/
public interface IMessage extends IPropertied {
@@ -50,80 +50,80 @@ public interface IMessage extends IPropertied {
/**
* @return the to
*/
- IQualifiedID getTo();
+ public IQualifiedID getTo();
/**
* @param to
* the to to set
*/
- void setTo(IQualifiedID to);
+ public void setTo(IQualifiedID to);
/**
* @return the from
*/
- IQualifiedID getFrom();
+ public IQualifiedID getFrom();
/**
* @param from
* the from to set
*/
- void setFrom(IQualifiedID from);
+ public void setFrom(IQualifiedID from);
/**
* Get the subject of this message.
* @return The subject of this message. The subject may be null.
*/
- String getSubject();
+ public String getSubject();
/**
* Set the subject of this message. If not set the
* subject is set to null.
* @param subject The subject of this message.
*/
- void setSubject(String subject);
+ public void setSubject(String subject);
/**
*
* @return
*/
- MessageType getMessageType();
+ public MessageType getMessageType();
/**
* Get the body of this message.
* @return The body of this message. The body may be null.
*/
- String getBody();
+ public String getBody();
/**
* Set the data to be transmitted in the message. If not set the
* body is set to null.
* @param body The data to be transmitted in the message.
*/
- void setBody(String body);
+ public void setBody(String body);
/**
* Returns the body of the message as a byte array.
* @return The body of the message as binary data.
*/
- byte [] getBodyAsBinary();
+ public byte[] getBodyAsBinary();
/**
* Set the body of the message as a byte array.
* @param body The binary data to be transmitted in the message.
*/
- void getBodyAsBinary(byte [] body);
+ public void getBodyAsBinary(byte[] body);
/**
* Get the status of this message.
* @return The message status.
*/
- String getStatus();
+ public String getStatus();
/**
* Set the status of this message.
* @param The message status.
*/
- void setStatus(String status);
+ public void setStatus(String status);
/**
@@ -131,6 +131,6 @@ public interface IMessage extends IPropertied {
* Jan 1, 1970.
* @return The receipt time stamp.
*/
- long getTimeStamp();
+ public long getTimeStamp();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java
index 1debda9b0f..e8beca6af6 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java
@@ -23,7 +23,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
- * TODO Add Description
+ * Peer to peer chat messaging interface
*
*
*
@@ -47,7 +47,7 @@ public interface IPeerToPeer extends ISession, IEventPublisher {
*
* @param message
*/
- void sendPeerToPeer(IMessage message) throws CollaborationException;
+ public void sendPeerToPeer(IMessage message) throws CollaborationException;
/**
* Send a Text message to a specific receiver.
@@ -57,7 +57,7 @@ public interface IPeerToPeer extends ISession, IEventPublisher {
* @param message
* The message to send.
*/
- void sendPeerToPeer(IQualifiedID to, String message)
+ public void sendPeerToPeer(IQualifiedID to, String message)
throws CollaborationException;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPropertied.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPropertied.java
index 513717ec09..4d24b8dac6 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPropertied.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPropertied.java
@@ -22,24 +22,28 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.Collection;
/**
- * TODO Add Description
+ * Property interface for collaboration messages
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
- *
+ *
*
- *
+ *
* @author jkorman
- * @version 1.0
+ * @version 1.0
*/
public interface IPropertied {
+ /**
+ * Simple key/value type for collaboration
+ *
+ */
public static class Property {
private String value;
@@ -132,7 +136,7 @@ public interface IPropertied {
* @param defaultValue
* @return
*/
- void setProperty(String key, String value);
+ public void setProperty(String key, String value);
/**
*
@@ -140,14 +144,14 @@ public interface IPropertied {
* @param defaultValue
* @return
*/
- String getProperty(String key, String defaultValue);
+ public String getProperty(String key, String defaultValue);
/**
* Gets the message properties as a collection of key, value
* pairs. Always returns a not-null value.
* @return
*/
- Collection getProperties();
+ public Collection getProperties();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java
index 12781442ad..bf94345301 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java
@@ -43,7 +43,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Base interface for sessions in which the client is interacting with others on
+ * the server
*
*
* Implementations of ISession do not support polling for messages but instead
@@ -92,5 +93,8 @@ public interface ISession extends IEventPublisher {
*/
public String getSessionId();
+ /**
+ * @return underlying communication connection
+ */
public CollaborationConnection getConnection();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueMessage.java
deleted file mode 100644
index 164d4a6a51..0000000000
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueMessage.java
+++ /dev/null
@@ -1,41 +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;
-
-/**
- * TODO Add Description
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Mar 19, 2012 jkorman Initial creation
- *
- *
- *
- * @author jkorman
- * @version 1.0
- */
-
-public interface IVenueMessage extends IMessage {
-
-}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java
index a5f0ed61cb..18ece3b051 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java
@@ -21,7 +21,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.List;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
@@ -104,6 +104,6 @@ public interface IVenueSession extends ISession {
*
* @param presence
*/
- public void sendPresence(IPresence presence) throws CollaborationException;
+ public void sendPresence(Presence presence) throws CollaborationException;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/UsernamePasswordException.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/UsernamePasswordException.java
index 4bced873f6..56efa3244d 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/UsernamePasswordException.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/UsernamePasswordException.java
@@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity;
/**
- * TODO Add Description
+ * User authentication specific collaboration exception
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IEventPublisher.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IEventPublisher.java
index 5a01c69ba5..fbc22debea 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IEventPublisher.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IEventPublisher.java
@@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event;
/**
- * TODO Add Description
+ * Interface for components that publish events to the event bus
*
*
*
@@ -39,9 +39,24 @@ package com.raytheon.uf.viz.collaboration.comm.identity.event;
public interface IEventPublisher {
+ /**
+ * Register handler to receive events from this publisher
+ *
+ * @param handler
+ */
public void registerEventHandler(Object handler);
+ /**
+ * Unregister handler to no longer receive events from this publisher
+ *
+ * @param handler
+ */
public void unregisterEventHandler(Object handler);
+ /**
+ * Send event to all handlers registered to this publisher
+ *
+ * @param event
+ */
public void postEvent(Object event);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IHttpdCollaborationConfigurationEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IHttpdCollaborationConfigurationEvent.java
index 53c11497d8..8dd3247d3e 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IHttpdCollaborationConfigurationEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IHttpdCollaborationConfigurationEvent.java
@@ -20,28 +20,28 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event;
/**
- * TODO Add Description
+ * Event fired when the configuration has changed
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 11, 2012 bkowal Initial creation
- *
+ *
*
- *
+ *
* @author bkowal
- * @version 1.0
+ * @version 1.0
*/
public interface IHttpdCollaborationConfigurationEvent {
/**
+ * Get the url used to connect to the collaboration httpd server.
*
- * @return the url used to connect to the collaboration
- * httpd server.
+ * @return null if collaboration has been disabled
*/
- String getHttpdCollaborationURL();
+ public String getHttpdCollaborationURL();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IRosterChangeEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IRosterChangeEvent.java
index c831a2abc6..0565b546c4 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IRosterChangeEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IRosterChangeEvent.java
@@ -19,10 +19,10 @@
**/
package com.raytheon.uf.viz.collaboration.comm.identity.event;
-import org.eclipse.ecf.presence.roster.IRosterItem;
+import org.jivesoftware.smack.RosterEntry;
/**
- * TODO Add Description
+ * Event fired when the roster has changed
*
*
*
@@ -45,13 +45,13 @@ public interface IRosterChangeEvent {
*
* @return The event type.
*/
- RosterChangeType getType();
+ public RosterChangeType getType();
/**
* Get the changed entry
*
* @return The changed entry.
*/
- IRosterItem getItem();
+ public RosterEntry getItem();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ITextMessageEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ITextMessageEvent.java
index ec34f05d93..c38ded47a8 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ITextMessageEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ITextMessageEvent.java
@@ -22,28 +22,27 @@ package com.raytheon.uf.viz.collaboration.comm.identity.event;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
/**
- * TODO Add Description
+ * Event indicating that a new message has been received
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2012 jkorman Initial creation
- *
+ *
*
- *
+ *
* @author jkorman
- * @version 1.0
+ * @version 1.0
*/
public interface ITextMessageEvent {
+
/**
- *
- * @return
- *
+ * @return the message
*/
- TextMessage getMessage();
+ public TextMessage getMessage();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java
index 5cb4f0e07b..306bc2222b 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java
@@ -43,20 +43,24 @@ public interface IVenueInvitationEvent {
/**
*
- * @return
+ * @return room id for venue
*/
- IQualifiedID getRoomId();
+ public IQualifiedID getRoomId();
/**
*
- * @return
+ * @return id of user that sent invitation
*/
- IQualifiedID getInviter();
+ public IQualifiedID getInviter();
+
/**
- *
+ * @return subject for venue, may be empty
*/
- String getSubject();
+ public String getSubject();
+ /**
+ * @return
+ */
public VenueInvite getInvite();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueParticipantEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueParticipantEvent.java
index dc66178d10..745f155623 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueParticipantEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueParticipantEvent.java
@@ -19,12 +19,12 @@
**/
package com.raytheon.uf.viz.collaboration.comm.identity.event;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Event fired when a venue participant has a change in status
*
*
*
@@ -43,20 +43,17 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public interface IVenueParticipantEvent {
/**
- *
- * @return
+ * @return type of event
*/
- ParticipantEventType getEventType();
+ public ParticipantEventType getEventType();
/**
- *
- * @return
+ * @return user id of participant
*/
- UserId getParticipant();
+ public UserId getParticipant();
/**
- *
- * @return
+ * @return presence of participant, may be null
*/
- IPresence getPresence();
+ public Presence getPresence();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ParticipantEventType.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ParticipantEventType.java
index 38b52d20d0..49dfdaafa0 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ParticipantEventType.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ParticipantEventType.java
@@ -20,20 +20,20 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event;
/**
- * TODO Add Description
+ * Type of event for participant updates
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 20, 2012 jkorman Initial creation
- *
+ *
*
- *
+ *
* @author jkorman
- * @version 1.0
+ * @version 1.0
*/
public enum ParticipantEventType {
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/RosterChangeType.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/RosterChangeType.java
index 9a70f8528c..2889f3fccb 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/RosterChangeType.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/RosterChangeType.java
@@ -20,20 +20,20 @@
package com.raytheon.uf.viz.collaboration.comm.identity.event;
/**
- * TODO Add Description
+ * Type of event for roster changes
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2012 jkorman Initial creation
- *
+ *
*
- *
+ *
* @author jkorman
- * @version 1.0
+ * @version 1.0
*/
public enum RosterChangeType {
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenue.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenue.java
index 924c9dff95..4f1595af27 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenue.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenue.java
@@ -21,9 +21,9 @@ package com.raytheon.uf.viz.collaboration.comm.identity.info;
import java.util.Collection;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
@@ -47,14 +47,15 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public interface IVenue {
/**
+ * Get venue information. This contains information that may change over
+ * time
*
* @return
*/
- public IVenueInfo getInfo();
+ public IVenueInfo getInfo() throws CollaborationException;
/**
- *
- * @return
+ * @return list of users in venue
*/
public Collection getParticipants();
@@ -64,6 +65,11 @@ public interface IVenue {
* @param user
* @return
*/
- public IPresence getPresence(IUser user);
+ public Presence getPresence(UserId user);
+
+ /**
+ * @return id of venue "name@service"
+ */
+ public String getName();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenueInfo.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenueInfo.java
index 6b3f73fb22..4bc4e873f3 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenueInfo.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/IVenueInfo.java
@@ -20,7 +20,7 @@
package com.raytheon.uf.viz.collaboration.comm.identity.info;
/**
- * TODO Add Description
+ * Information on a venue. Information may become outdated.
*
*
*
@@ -39,53 +39,47 @@ package com.raytheon.uf.viz.collaboration.comm.identity.info;
public interface IVenueInfo {
/**
- *
- * @return
+ * @return description, may be empty
*/
- String getVenueDescription();
+ public String getVenueDescription();
/**
- * Get a long name for venue
- *
+ * Get venue name
* @return
*/
- String getVenueName();
+ public String getVenueName();
/**
- *
- * @return
+ * @return subject, may be empty
*/
- String getVenueSubject();
+ public String getVenueSubject();
/**
- *
- * @return
+ * @return id of venue "name@service"
*/
- String getVenueID();
+ public String getVenueID();
/**
* Get a count of the current number of room participants
*
* @return Count of the current number of room participants
*/
- int getParticipantCount();
+ public int getParticipantCount();
/**
- *
- * @return
+ * @return true if venue is divided into participants and occupants who
+ * can't speak
*/
- boolean isModerated();
+ public boolean isModerated();
/**
- *
- * @return
+ * @return true if venue persists after participants have left
*/
- boolean isPersistent();
+ public boolean isPersistent();
/**
- *
- * @return
+ * @return true if venue is password protected
*/
- boolean requiresPassword();
+ public boolean requiresPassword();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/SiteConfigInformation.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/SiteConfigInformation.java
index caa53e5db0..18c5462036 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/SiteConfigInformation.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/info/SiteConfigInformation.java
@@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
- * TODO Add Description
+ * Persisted site configuration information
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/ColorPopulator.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/ColorPopulator.java
index 11322ead92..8d02c036c8 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/ColorPopulator.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/ColorPopulator.java
@@ -31,7 +31,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Color information for a list of users
*
*
*
@@ -40,6 +40,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 19, 2012 mnash Initial creation
+ * Dec 6, 2013 2561 bclement code cleanup
*
*
*
@@ -50,7 +51,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@DynamicSerialize
public class ColorPopulator {
@DynamicSerializeElement
- private List userName;
+ private List users;
@DynamicSerializeElement
private List red;
@@ -61,44 +62,55 @@ public class ColorPopulator {
@DynamicSerializeElement
private List blue;
+ /**
+ * For serialization only, use {@link ColorPopulator#ColorPopulator(Map)}
+ */
+ @Deprecated
public ColorPopulator() {
}
+ /**
+ * @param rgbs
+ * Map of user ids to color information
+ */
public ColorPopulator(Map rgbs) {
- userName = new ArrayList();
+ users = new ArrayList();
red = new ArrayList();
green = new ArrayList();
blue = new ArrayList();
for (UserId key : rgbs.keySet()) {
- userName.add(key);
+ users.add(key);
red.add(rgbs.get(key).red);
green.add(rgbs.get(key).green);
blue.add(rgbs.get(key).blue);
}
}
+ /**
+ * @return Map of user ids to color information
+ */
public Map getColors() {
Map colors = new HashMap();
- for (int i = 0; i < userName.size(); i++) {
- colors.put(userName.get(i),
+ for (int i = 0; i < users.size(); i++) {
+ colors.put(users.get(i),
new RGB(red.get(i), green.get(i), blue.get(i)));
}
return colors;
}
/**
- * @return the userName
+ * @return the users
*/
- public List getUserName() {
- return userName;
+ public List getUsers() {
+ return users;
}
/**
- * @param userName
- * the userName to set
+ * @param users
+ * the users to set
*/
- public void setUserName(List userName) {
- this.userName = userName;
+ public void setUsers(List users) {
+ this.users = users;
}
/**
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/SharedDisplayVenueInvite.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/SharedDisplayVenueInvite.java
index 4ccc65240d..f0285fb9e6 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/SharedDisplayVenueInvite.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/invite/SharedDisplayVenueInvite.java
@@ -24,7 +24,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Invitation to shared display venue
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/roster/ISubscriptionResponder.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/roster/ISubscriptionResponder.java
index 4fa37429bd..56844a4ae1 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/roster/ISubscriptionResponder.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/roster/ISubscriptionResponder.java
@@ -19,12 +19,12 @@
**/
package com.raytheon.uf.viz.collaboration.comm.identity.roster;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
- * TODO Add Description
+ * Interface for handling subscription invitation events from other users
*
*
*
@@ -47,18 +47,18 @@ public interface ISubscriptionResponder {
* @param fromID
* @return The response that should be returned to the subscriber.
*/
- IPresence.Type handleSubscribeRequest(IQualifiedID fromID);
+ public Presence.Type handleSubscribeRequest(IQualifiedID fromID);
/**
*
* @param fromID
*/
- void handleSubscribed(IQualifiedID fromID);
+ public void handleSubscribed(IQualifiedID fromID);
/**
*
* @param fromID
*/
- void handleUnsubscribed(IQualifiedID fromID);
+ public void handleUnsubscribed(IQualifiedID fromID);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueId.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueId.java
deleted file mode 100644
index f6e8677f28..0000000000
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IVenueId.java
+++ /dev/null
@@ -1,43 +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;
-
-/**
- * TODO Add Description
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Mar 29, 2012 jkorman Initial creation
- *
- *
- *
- * @author jkorman
- * @version 1.0
- */
-
-public interface IVenueId extends IQualifiedID {
-
- String getVenueName();
-
-}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java
index 07eb43309b..49ee328314 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java
@@ -19,8 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.util.Base64;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.util.Base64;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
@@ -39,6 +44,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
* Mar 07, 2012 jkorman Initial creation
* Oct 31, 2013 2491 bsteffen Use CollaborationXmlManager for xml
* serialization.
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -102,18 +108,8 @@ public abstract class Tools {
}
}
- /**
- *
- * @param
- * @param container
- * @param c
- * @return
- */
- @SuppressWarnings("unchecked")
- public static T getPresenceContainerAdapter(IContainer container,
- Class c) {
- return (T) container.getAdapter(c);
- }
+ public static final Pattern JID_RESERVED_CHARACTERS = Pattern
+ .compile("[ \"&'/:<>@]");
/**
*
@@ -236,7 +232,7 @@ public abstract class Tools {
* @return The encoded data as a String.
*/
public static String encodeToBase64(byte[] message) {
- return Base64.encode(message);
+ return Base64.encodeBytes(message);
}
/**
@@ -392,4 +388,40 @@ public abstract class Tools {
return unMarshalledData;
}
+ /**
+ * Add properties to packet
+ *
+ * @param p
+ * @param props
+ */
+ public static void setProperties(Packet p, Map props) {
+ for (Entry e : props.entrySet()) {
+ p.setProperty(e.getKey(), e.getValue());
+ }
+ }
+
+ /**
+ * Copy properties from packet
+ *
+ * @param p
+ * @param props
+ */
+ public static void copyProperties(Packet source, Packet dest) {
+ for (String key : source.getPropertyNames()) {
+ dest.setProperty(key, source.getProperty(key));
+ }
+ }
+
+ /**
+ * @param id
+ * @return true if id doesn't contain any invalid characters
+ */
+ public static boolean isValidId(String id) {
+ if (id == null) {
+ return false;
+ }
+ Matcher matcher = JID_RESERVED_CHARACTERS.matcher(id);
+ return !matcher.find();
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/RosterChangeEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/RosterChangeEvent.java
index 120dd4b24c..c538af093d 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/RosterChangeEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/RosterChangeEvent.java
@@ -19,13 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.event;
-import org.eclipse.ecf.presence.roster.IRosterItem;
+import org.jivesoftware.smack.RosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType;
/**
- * TODO Add Description
+ * Event posted when a roster entry needs to be updated
*
*
*
@@ -45,7 +45,7 @@ public class RosterChangeEvent implements IRosterChangeEvent {
private final RosterChangeType type;
- private final IRosterItem item;
+ private final RosterEntry item;
/**
* Create an instance of this event using the given type and entry.
@@ -55,7 +55,7 @@ public class RosterChangeEvent implements IRosterChangeEvent {
* @param entry
* The changed entry.
*/
- public RosterChangeEvent(RosterChangeType type, IRosterItem item) {
+ public RosterChangeEvent(RosterChangeType type, RosterEntry item) {
this.type = type;
this.item = item;
}
@@ -78,7 +78,7 @@ public class RosterChangeEvent implements IRosterChangeEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent#getEntry()
*/
@Override
- public IRosterItem getItem() {
+ public RosterEntry getItem() {
return item;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserNicknameChangedEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserNicknameChangedEvent.java
index a4bb510747..61dbbc5198 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserNicknameChangedEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserNicknameChangedEvent.java
@@ -19,7 +19,7 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.event;
-import org.eclipse.ecf.core.user.IUser;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
* An event to put on a CollaborationConnection event bus when a users nickname
@@ -42,16 +42,16 @@ import org.eclipse.ecf.core.user.IUser;
public class UserNicknameChangedEvent {
- public final IUser user;
+ public final UserId user;
public final String nickname;
- public UserNicknameChangedEvent(IUser user, String nickname) {
+ public UserNicknameChangedEvent(UserId user, String nickname) {
this.user = user;
this.nickname = nickname;
}
- public IUser getUser() {
+ public UserId getUser() {
return user;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserPresenceChangedEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserPresenceChangedEvent.java
index 9758f8ae48..3fe31df145 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserPresenceChangedEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/UserPresenceChangedEvent.java
@@ -19,10 +19,10 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.event;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
/**
- * Event that is posted when the local uses changes properties of the presence.
+ * Event that is posted when the local user changes properties of the presence.
*
*
*
@@ -40,14 +40,14 @@ import org.eclipse.ecf.presence.IPresence;
public class UserPresenceChangedEvent {
- private final IPresence newPresence;
+ private final Presence newPresence;
- public UserPresenceChangedEvent(IPresence newPresence) {
+ public UserPresenceChangedEvent(Presence newPresence) {
super();
this.newPresence = newPresence;
}
- public IPresence getNewPresence() {
+ public Presence getNewPresence() {
return newPresence;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java
index efbfc9b3c6..8e46034156 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java
@@ -24,7 +24,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
- * TODO Add Description
+ * Event that is posted when a venue invitation is sent
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueParticipantEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueParticipantEvent.java
index 6691707528..0265d9c09a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueParticipantEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueParticipantEvent.java
@@ -19,14 +19,14 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.event;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Event that is posted when a participant's status changes
*
*
*
@@ -48,7 +48,7 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
private final UserId participant;
- private IPresence presence;
+ private Presence presence;
public VenueParticipantEvent(UserId participant,
ParticipantEventType eventType) {
@@ -56,7 +56,7 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
this.eventType = eventType;
}
- public VenueParticipantEvent(UserId participant, IPresence presence,
+ public VenueParticipantEvent(UserId participant, Presence presence,
ParticipantEventType eventType) {
this.participant = participant;
this.eventType = eventType;
@@ -83,7 +83,7 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getPresence()
*/
@Override
- public IPresence getPresence() {
+ public Presence getPresence() {
return presence;
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java
index cf624f06cb..4f33962b73 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java
@@ -22,17 +22,18 @@ package com.raytheon.uf.viz.collaboration.comm.provider.info;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Type;
-import org.eclipse.ecf.presence.Presence;
-import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
+import org.jivesoftware.smack.packet.Presence.Type;
+import org.jivesoftware.smackx.muc.MultiUserChat;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
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.provider.user.IDConverter;
@@ -48,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -57,43 +59,60 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
public class Venue implements IVenue {
- private final IChatRoomContainer container;
+ private final MultiUserChat muc;
- private final IVenueInfo info;
+ private final XMPPConnection conn;
- private Map presenceMap = new HashMap();;
+ private Map presenceMap = new HashMap();
- public Venue(IChatRoomContainer container, IChatRoomInfo info) {
- this.container = container;
- this.info = new VenueInfo(info);
+ public Venue(XMPPConnection conn, MultiUserChat muc) {
+ this.muc = muc;
+ this.conn = conn;
}
@Override
- public IVenueInfo getInfo() {
- return info;
+ public IVenueInfo getInfo() throws CollaborationException {
+ try {
+ return new VenueInfo(MultiUserChat.getRoomInfo(conn, muc.getRoom()));
+ } catch (XMPPException e) {
+ throw new CollaborationException("Unable to get room information",
+ e);
+ }
}
@Override
public Collection getParticipants() {
Set participants = new HashSet();
- ID[] ids = container.getChatRoomParticipants();
- for (ID id : ids) {
- participants.add(IDConverter.convertFrom(id));
+ Iterator iter = muc.getOccupants();
+ while (iter.hasNext()) {
+ String id = iter.next();
+ participants.add(IDConverter.convertFromRoom(muc, id));
}
return participants;
}
@Override
- public IPresence getPresence(IUser user) {
- IPresence presence = presenceMap.get(user.getID().getName());
+ public Presence getPresence(UserId user) {
+ Presence presence = presenceMap.get(user.getNormalizedId());
if (presence == null) {
- presence = new Presence(Type.UNAVAILABLE);
+ presence = new Presence(Type.unavailable);
+ presence.setMode(Mode.away);
}
return presence;
}
- public void handlePresenceUpdated(ID fromID, IPresence presence) {
- presenceMap.put(fromID.getName(), presence);
+ public void handlePresenceUpdated(UserId fromID, Presence presence) {
+ presenceMap.put(fromID.getNormalizedId(), presence);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getId()
+ */
+ @Override
+ public String getName() {
+ return muc.getRoom();
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/VenueInfo.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/VenueInfo.java
index c227a803a0..dfe8c713f2 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/VenueInfo.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/VenueInfo.java
@@ -19,9 +19,10 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.info;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
+import org.jivesoftware.smackx.muc.RoomInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
+import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/**
*
@@ -42,9 +43,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
*/
public class VenueInfo implements IVenueInfo {
- private IChatRoomInfo info;
+ private RoomInfo info;
- public VenueInfo(IChatRoomInfo info) {
+ public VenueInfo(RoomInfo info) {
this.info = info;
}
@@ -55,7 +56,7 @@ public class VenueInfo implements IVenueInfo {
@Override
public String getVenueName() {
- return info.getName();
+ return Tools.parseName(info.getRoom());
}
@Override
@@ -65,12 +66,12 @@ public class VenueInfo implements IVenueInfo {
@Override
public String getVenueID() {
- return info.getRoomID().toExternalForm();
+ return info.getRoom();
}
@Override
public int getParticipantCount() {
- return info.getParticipantsCount();
+ return info.getOccupantsCount();
}
@Override
@@ -85,7 +86,7 @@ public class VenueInfo implements IVenueInfo {
@Override
public boolean requiresPassword() {
- return info.requiresPassword();
+ return info.isPasswordProtected();
}
@Override
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/AccountManager.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/AccountManager.java
index 1f75bd7987..64ffa8308a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/AccountManager.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/AccountManager.java
@@ -22,25 +22,25 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
import java.util.Arrays;
import java.util.Map;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresenceContainerAdapter;
-import org.eclipse.ecf.presence.IPresenceSender;
-import org.eclipse.ecf.presence.Presence;
-import org.eclipse.ecf.presence.roster.IRosterManager;
-import org.eclipse.ecf.presence.roster.IRosterSubscriptionListener;
+import org.jivesoftware.smack.PacketListener;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.filter.PacketTypeFilter;
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.ISubscriptionResponder;
-import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChangedEvent;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Manages account information on server
*
*
* EventBus subscription events.
@@ -55,6 +55,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChanged
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 16, 2012 jkorman Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -64,84 +65,98 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChanged
public class AccountManager implements IAccountManager {
- private IRosterSubscriptionListener autoResponder = new IRosterSubscriptionListener() {
+ private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
+ private PacketListener autoResponder = new PacketListener() {
+
@Override
- public void handleSubscribeRequest(ID fromID) {
+ public void processPacket(Packet packet) {
+ if ( packet instanceof Presence){
+ Presence pres = (Presence) packet;
+ Type type = pres.getType();
+ if (type == null) {
+ return;
+ }
+ UserId fromId = new UserId(pres.getFrom(), sessionManager
+ .getXmppConnection().getHost());
+ switch (type) {
+ case subscribe:
+ handleSubRequest(fromId);
+ break;
+ case subscribed:
+ if (responder != null) {
+ responder.handleSubscribed(fromId);
+ }
+ break;
+ case unsubscribed:
+ if (responder != null) {
+ responder.handleUnsubscribed(fromId);
+ }
+ break;
+ default:
+ // do nothing
+ break;
+ }
+ }
+ }
- IQualifiedID fromId = null;
-
- IPresence.Type subscribedType = IPresence.Type.UNKNOWN;
+ private void handleSubRequest(UserId fromId) {
+ Presence.Type subscribedType;
if (responder != null) {
subscribedType = responder.handleSubscribeRequest(fromId);
} else {
- subscribedType = IPresence.Type.SUBSCRIBED;
+ subscribedType = Presence.Type.subscribed;
}
- IPresence presence = new Presence(subscribedType, null,
- IPresence.Mode.AVAILABLE);
+ Presence presence = new Presence(subscribedType, null, 0,
+ Presence.Mode.available);
try {
- sendPresence(fromID, presence);
+ sendPresence(fromId, presence);
} catch (CollaborationException e) {
- e.printStackTrace();
+ AccountManager.this.log.error("Unable to send presence", e);
}
}
- @Override
- public void handleSubscribed(ID fromID) {
- System.out.println("AccountManager.handleSubscribed " + fromID);
- }
-
- @Override
- public void handleUnsubscribed(ID fromID) {
- System.out.println("AccountManager.handleUnSubscribed " + fromID);
- }
};
- private boolean autoRespond = true;
-
- private IPresenceContainerAdapter presenceAdapter;
-
private ISubscriptionResponder responder;
private CollaborationConnection sessionManager = null;
+ private org.jivesoftware.smack.AccountManager smackManager;
+
/**
*
* @param adapter
*/
- AccountManager(IPresenceContainerAdapter adapter,
+ AccountManager(
CollaborationConnection manager) {
sessionManager = manager;
- presenceAdapter = adapter;
- presenceAdapter.getRosterManager().addRosterSubscriptionListener(
- autoResponder);
+ smackManager = new org.jivesoftware.smack.AccountManager(
+ manager.getXmppConnection());
+ sessionManager.getXmppConnection().addPacketListener(autoResponder,
+ new PacketTypeFilter(Presence.class));
}
- /**
- * Set the auto subscription mode to ON or OFF. If set to off then any
- * currently assigned autoresponder is set to null.
+ /*
+ * (non-Javadoc)
*
- * @param mode
- * The auto subscription mode.
- * @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#setAutoSubscriptionMode(boolean)
+ * @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#
+ * disableAutoSubscribe()
*/
- @Override
- public void setAutoSubscriptionMode(boolean auto) {
- autoRespond = auto;
- if (!auto) {
- responder = null;
- }
+ public void disableAutoSubscribe() {
+ responder = null;
}
- /**
+ /*
+ * (non-Javadoc)
*
- *
- * @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#getAutoSubscriptionMode()
+ * @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#
+ * autoSubscribeEnabled()
*/
@Override
- public boolean getAutoSubscriptionMode() {
- return autoRespond;
+ public boolean autoSubscribeEnabled() {
+ return responder != null;
}
/**
@@ -170,17 +185,14 @@ public class AccountManager implements IAccountManager {
*/
@Override
public void changePassword(char[] password) throws CollaborationException {
- org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
- .getAccountManager();
- if (manager != null) {
- try {
- manager.changePassword(new String(password));
- // all done so clear the password.
- Arrays.fill(password, (char) 0);
- } catch (ECFException e) {
- throw new CollaborationException(
- "Could not change account password");
- }
+ try {
+ smackManager.changePassword(new String(password));
+ } catch (XMPPException e) {
+ throw new CollaborationException(
+ "Could not change account password");
+ } finally {
+ // all done so clear the password.
+ Arrays.fill(password, (char) 0);
}
}
@@ -190,14 +202,10 @@ public class AccountManager implements IAccountManager {
*/
@Override
public void deleteAccount() throws CollaborationException {
- org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
- .getAccountManager();
- if (manager != null) {
- try {
- manager.deleteAccount();
- } catch (ECFException e) {
- throw new CollaborationException("Could not delete account");
- }
+ try {
+ smackManager.deleteAccount();
+ } catch (XMPPException e) {
+ throw new CollaborationException("Could not delete account");
}
}
@@ -209,53 +217,29 @@ public class AccountManager implements IAccountManager {
*/
@Override
public boolean canCreateAccount() throws CollaborationException {
- boolean canCreate = false;
- org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
- .getAccountManager();
- if (manager != null) {
- try {
- canCreate = manager.isAccountCreationSupported();
- } catch (ECFException e) {
- throw new CollaborationException(
- "Error attempting to determine if accounts may be created.");
- }
- }
- return canCreate;
+ return smackManager.supportsAccountCreation();
}
/**
- * TODO : Body of method
+ * Create a new account on the server
*
* @param password
* @param attributes
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#createAccount(java.lang.String,
* char[], java.util.Map)
*/
- @SuppressWarnings("rawtypes")
@Override
public void createAccount(String name, char[] password,
Map attributes) throws CollaborationException {
- if (name != null) {
- if (password != null) {
- // create the account
- org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
- .getAccountManager();
- if (manager != null) {
- Map map = null;
- if (attributes != null) {
- map = (Map) attributes;
- }
-
- try {
- manager.createAccount(name, new String(password), map);
- } catch (ECFException e) {
- throw new CollaborationException(
- "Could not create account ");
- }
- }
- // all done so clear the password.
- Arrays.fill(password, (char) 0);
- }
+ // create the account
+ try {
+ smackManager.createAccount(name, new String(password), attributes);
+ } catch (XMPPException e) {
+ throw new CollaborationException(
+ "Could not create account for user: " + name, e);
+ } finally {
+ // all done so clear the password.
+ Arrays.fill(password, (char) 0);
}
}
@@ -266,25 +250,17 @@ public class AccountManager implements IAccountManager {
* @throws CollaborationException
*/
@Override
- public void sendPresence(IPresence userPresence)
+ public void sendPresence(Presence userPresence)
throws CollaborationException {
- IRosterManager manager = presenceAdapter.getRosterManager();
- IPresenceSender sender = manager.getPresenceSender();
-
- try {
- sender.sendPresenceUpdate(null, userPresence);
- sessionManager.setPresence(userPresence);
- for (ISession session : sessionManager.getSessions()) {
- if (session instanceof IVenueSession) {
- ((IVenueSession) session).sendPresence(userPresence);
- }
+ sessionManager.getXmppConnection().sendPacket(userPresence);
+ sessionManager.setPresence(userPresence);
+ for (ISession session : sessionManager.getSessions()) {
+ if (session instanceof IVenueSession) {
+ ((IVenueSession) session).sendPresence(userPresence);
}
- sessionManager
- .postEvent(new UserPresenceChangedEvent(userPresence));
- } catch (ECFException e) {
- throw new CollaborationException("Could not send presence");
}
+ sessionManager.postEvent(new UserPresenceChangedEvent(userPresence));
}
/**
@@ -293,18 +269,12 @@ public class AccountManager implements IAccountManager {
* @param userPresence
* @throws CollaborationException
*/
- public void sendPresence(ID toId, IPresence userPresence)
+ public void sendPresence(UserId toId, Presence userPresence)
throws CollaborationException {
-
- IRosterManager manager = presenceAdapter.getRosterManager();
- IPresenceSender sender = manager.getPresenceSender();
-
- try {
- sender.sendPresenceUpdate(toId, userPresence);
- sessionManager.setPresence(userPresence);
- } catch (ECFException e) {
- throw new CollaborationException("Could not send presence");
- }
+ userPresence.setFrom(sessionManager.getUser().getFQName());
+ userPresence.setTo(toId.getNormalizedId());
+ sessionManager.setPresence(userPresence);
+ sessionManager.getXmppConnection().sendPacket(userPresence);
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java
index c16eb830ff..4e04bc8bbf 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java
@@ -23,21 +23,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-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.util.ECFException;
-import org.eclipse.ecf.presence.IPresenceContainerAdapter;
-
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Base class for chat and collaboration sessions
*
*
*
@@ -46,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -62,12 +55,6 @@ public abstract class BaseSession implements ISession {
private Map eventSubscribers;
- private IContainer connectionContainer;
-
- private IPresenceContainerAdapter connectionPresence = null;
-
- private Namespace connectionNamespace = null;
-
private CollaborationConnection connection;
/**
@@ -76,9 +63,9 @@ public abstract class BaseSession implements ISession {
* @param externalBus
* @param manager
*/
- protected BaseSession(IContainer container, EventBus externalBus,
+ protected BaseSession(EventBus externalBus,
CollaborationConnection manager) throws CollaborationException {
- this(container, externalBus, manager, UUID.randomUUID().toString());
+ this(externalBus, manager, UUID.randomUUID().toString());
}
/**
@@ -88,30 +75,15 @@ public abstract class BaseSession implements ISession {
* @param manager
* @param sessionId
*/
- protected BaseSession(IContainer container, EventBus externalBus,
+ protected BaseSession(EventBus externalBus,
CollaborationConnection manager, String sessionId)
throws CollaborationException {
// Set the session identifier.
this.sessionId = sessionId;
managerEventBus = externalBus;
eventBus = new EventBus();
- connectionContainer = container;
connection = manager;
eventSubscribers = new HashMap();
- setup();
- }
-
- /**
- *
- * @throws ECFException
- */
- void setup() {
- // Check if the container has been set up previously.
- if (connectionContainer != null) {
- connectionNamespace = connectionContainer.getConnectNamespace();
- connectionPresence = (IPresenceContainerAdapter) connectionContainer
- .getAdapter(IPresenceContainerAdapter.class);
- }
}
/**
@@ -120,7 +92,7 @@ public abstract class BaseSession implements ISession {
* @return The peer to peer chat session instance.
* @throws CollaborationException
*/
- PeerToPeerChat getP2PSession() throws CollaborationException {
+ protected PeerToPeerChat getP2PSession() throws CollaborationException {
return (PeerToPeerChat) connection.getPeerToPeerSession();
}
@@ -128,31 +100,7 @@ public abstract class BaseSession implements ISession {
*
* @return
*/
- IContainer getConnectionContainer() {
- return connectionContainer;
- }
-
- /**
- *
- * @return
- */
- Namespace getConnectionNamespace() {
- return connectionNamespace;
- }
-
- /**
- *
- * @return
- */
- IPresenceContainerAdapter getConnectionPresenceAdapter() {
- return connectionPresence;
- }
-
- /**
- *
- * @return
- */
- EventBus getManagerEventPublisher() {
+ protected EventBus getManagerEventPublisher() {
return managerEventBus;
}
@@ -160,23 +108,10 @@ public abstract class BaseSession implements ISession {
*
* @return
*/
- CollaborationConnection getSessionManager() {
+ protected CollaborationConnection getSessionManager() {
return connection;
}
- /**
- *
- * @param name
- * @return
- */
- public ID createID(String name) throws IDCreateException {
- ID id = null;
- if (connectionNamespace != null) {
- id = IDFactory.getDefault().createID(connectionNamespace, name);
- }
- return id;
- }
-
// *****************
// Implement IEventPublisher methods
// *****************
@@ -195,11 +130,7 @@ public abstract class BaseSession implements ISession {
*/
@Override
public boolean isConnected() {
- boolean connected = false;
- if (connectionContainer != null) {
- connected = (connectionContainer.getConnectedID() != null);
- }
- return connected;
+ return connection.isConnected();
}
/**
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java
index 6d81fb6a42..a21addcb90 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java
@@ -22,33 +22,23 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.ContainerCreateException;
-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;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Mode;
-import org.eclipse.ecf.presence.IPresence.Type;
-import org.eclipse.ecf.presence.IPresenceContainerAdapter;
-import org.eclipse.ecf.presence.IPresenceListener;
-import org.eclipse.ecf.presence.Presence;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInvitationListener;
-import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
-import org.eclipse.ecf.presence.roster.IRoster;
-import org.eclipse.ecf.presence.roster.IRosterEntry;
-import org.eclipse.ecf.presence.roster.IRosterItem;
-import org.eclipse.ecf.presence.roster.IRosterListener;
-import org.eclipse.ecf.presence.roster.IRosterManager;
-import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.filter.PacketTypeFilter;
+import org.jivesoftware.smack.packet.Message;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
+import org.jivesoftware.smack.packet.Presence.Type;
+import org.jivesoftware.smackx.muc.InvitationListener;
+import org.jivesoftware.smackx.muc.MultiUserChat;
+import org.jivesoftware.smackx.muc.RoomInfo;
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -59,8 +49,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
-import com.raytheon.uf.viz.collaboration.comm.identity.MultipleLoginException;
-import com.raytheon.uf.viz.collaboration.comm.identity.UsernamePasswordException;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
@@ -76,6 +64,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.info.VenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserSearch;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
/**
@@ -103,6 +92,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
* Apr 18, 2012 njensen Major cleanup
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -116,35 +106,21 @@ public class CollaborationConnection implements IEventPublisher {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CollaborationConnection.class);
- private static final String PROVIDER = "com.raytheon.uf.viz.collaboration.comm.xmpp";// "ecf.xmpp.smack";
-
private static CollaborationConnection instance = null;
private static Map instanceMap = new HashMap();
private Map sessions;
- private UserId account;
-
- private String password;
-
private UserId user;
- private IPresence userPresence;
-
- private IChatRoomInvitationListener intInvitationListener;
-
- private IPresenceContainerAdapter presenceAdapter;
-
- private Namespace connectionNamespace = null;
+ private Presence userPresence;
private PeerToPeerChat chatInstance = null;
private IAccountManager accountManager = null;
- private IRosterManager rosterManager = null;
-
- private IContainer container = null;
+ private RosterManager rosterManager = null;
private EventBus eventBus;
@@ -152,80 +128,43 @@ public class CollaborationConnection implements IEventPublisher {
private CollaborationConnectionData connectionData;
+ private XMPPConnection connection;
+
private CollaborationConnection(CollaborationConnectionData connectionData)
throws CollaborationException {
this.connectionData = connectionData;
- UserId account = new UserId(connectionData.getUserName(),
- connectionData.getServer());
String password = connectionData.getPassword();
- IPresence initialPresence = new Presence(Type.AVAILABLE,
- connectionData.getMessage(), Mode.fromString(connectionData
- .getStatus().toLowerCase()),
- connectionData.getAttributes());
+ String status = connectionData.getStatus();
+ Mode mode;
+ if (status == null || status.trim().isEmpty()) {
+ mode = Mode.available;
+ } else {
+ mode = Mode.valueOf(status.toLowerCase());
+ }
+ Presence initialPresence = new Presence(Type.available,
+ connectionData.getMessage(), 0, mode);
+ Tools.setProperties(initialPresence, connectionData.getAttributes());
eventBus = new EventBus();
sessions = new HashMap();
+ connection = new XMPPConnection(connectionData.getServer());
+
+ this.user = new UserId(connectionData.getUserName(),
+ connectionData.getServer());
try {
- container = ContainerFactory.getDefault().createContainer(PROVIDER);
-
- if (container != null) {
- // add the listeners before we connect so we don't potentially
- // miss something
- presenceAdapter = Tools.getPresenceContainerAdapter(container,
- IPresenceContainerAdapter.class);
- this.setupInternalConnectionListeners();
- }
-
- } catch (ContainerCreateException cce) {
+ connection.connect();
+ connection.login(user.getName(), password);
+ } catch (XMPPException e) {
closeInternals();
- throw new CollaborationException(String.format(
- "Could not create container for provider [%s]", PROVIDER));
- }
- this.account = account;
- this.password = password;
- try {
- connectToContainer();
- } catch (ContainerConnectException e) {
- closeInternals();
- // ECF does a very good job of wrapping up login exceptions so it is
- // hard to tell why the login failed. This code will attempt to
- // analyze the cause of the failure and in some circumstances
- // produce a helpful error. Since this is relying on string
- // comparison of exception messages it is very likely that if the
- // ECF provider is changed or updated that this will stop producing
- // helpful messages. Unfortunately ECF does not provide any other
- // mechanism for figuring out why login failed.
- for (Throwable t = e; t != null && t != t.getCause(); t = t
- .getCause()) {
- if (t.getMessage().contains("authentication failed")) {
- throw new UsernamePasswordException(
- "Login failed. Invalid username or password", e);
- } else if (t.getMessage().equals("conflict(409)")) {
- throw new MultipleLoginException(
- "Login failed. User already logged in elsewhere",
- e);
- }
- }
- // In cases where we can't produce anything helpful, at least let
- // the user know that it failed and hopeful something in the stack
- // trace will be useful in the DR.
throw new CollaborationException("Login failed.", e);
}
- ID id = container.getConnectedID();
- if (id != null) {
- String name = Tools.parseName(id.getName());
- String host = Tools.parseHost(id.getName());
- String resource = Tools.parseResource(id.getName());
- user = new UserId(name, host, resource);
- user.setId(id);
- }
setupAccountManager();
-
+ setupInternalConnectionListeners();
setupInternalVenueInvitationListener();
- setupP2PComm(presenceAdapter);
+ setupP2PComm();
getPeerToPeerSession();
userPresence = initialPresence;
@@ -258,7 +197,7 @@ public class CollaborationConnection implements IEventPublisher {
*
* @return
*/
- public IPresence getPresence() {
+ public Presence getPresence() {
return userPresence;
}
@@ -266,36 +205,17 @@ public class CollaborationConnection implements IEventPublisher {
*
* @return
*/
- public void setPresence(IPresence presence) {
+ public void setPresence(Presence presence) {
userPresence = presence;
}
- /**
- * @throws CollaborationException
- * @throws ContainerConnectException
- *
- */
- private void connectToContainer() throws CollaborationException,
- ContainerConnectException {
- if (container.getConnectedID() == null) {
- connectionNamespace = container.getConnectNamespace();
-
- // Now connect
- ID targetID = createID(account);
- presenceAdapter = Tools.getPresenceContainerAdapter(container,
- IPresenceContainerAdapter.class);
- container.connect(targetID, ConnectContextFactory
- .createPasswordConnectContext(password));
- }
- }
-
/**
*
*/
private void setupAccountManager() {
if (accountManager == null) {
- if (isConnected() && (presenceAdapter != null)) {
- accountManager = new AccountManager(presenceAdapter, this);
+ if (isConnected()) {
+ accountManager = new AccountManager(this);
}
}
}
@@ -316,22 +236,18 @@ public class CollaborationConnection implements IEventPublisher {
*
*/
private void setupRosterManager() {
- rosterManager = presenceAdapter.getRosterManager();
+ if (rosterManager == null) {
+ if (isConnected()) {
+ rosterManager = new RosterManager(connection);
+ }
+ }
}
/**
*
* @return
*/
- public IPresenceContainerAdapter getPresenceContainerAdapter() {
- return presenceAdapter;
- }
-
- /**
- *
- * @return
- */
- public IRosterManager getRosterManager() {
+ public RosterManager getRosterManager() {
if (rosterManager == null) {
setupRosterManager();
}
@@ -344,17 +260,16 @@ public class CollaborationConnection implements IEventPublisher {
* @return Is this SessionManager currently connected?
*/
public boolean isConnected() {
- return ((container != null) && (container.getConnectedID() != null));
+ return ((connection != null) && (connection.getConnectionID() != null));
}
private void closeInternals() {
- if (container != null) {
+ if (connection != null) {
chatInstance = null;
// Get rid of the account and roster managers
- container.disconnect();
- container.dispose();
- container = null;
+ connection.disconnect();
+ connection = null;
}
instanceMap.remove(connectionData);
if (this == instance) {
@@ -366,7 +281,7 @@ public class CollaborationConnection implements IEventPublisher {
*
*/
public void close() {
- if (container != null) {
+ if (connection != null) {
// Close any created sessions.
Collection toRemove = sessions.values();
sessions.clear();
@@ -390,7 +305,7 @@ public class CollaborationConnection implements IEventPublisher {
*/
public ISession getPeerToPeerSession() throws CollaborationException {
if (chatInstance == null) {
- chatInstance = new PeerToPeerChat(container, eventBus, this);
+ chatInstance = new PeerToPeerChat(eventBus, this);
sessions.put(chatInstance.getSessionId(), chatInstance);
postEvent(chatInstance);
}
@@ -399,23 +314,21 @@ public class CollaborationConnection implements IEventPublisher {
public ISharedDisplaySession joinCollaborationVenue(
IVenueInvitationEvent invitation) throws CollaborationException {
- SharedDisplaySession session = null;
String venueName = invitation.getRoomId().getName();
String sessionId = invitation.getInvite().getSessionId();
- session = new SharedDisplaySession(container, eventBus, this, sessionId);
- if (session != null) {
- session.joinVenue(venueName);
+ SharedDisplaySession session = new SharedDisplaySession(eventBus, this,
+ sessionId);
+ session.configureVenue(venueName);
- if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
- SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
- .getInvite();
- session.setCurrentDataProvider(invite.getDataProvider());
- session.setCurrentSessionLeader(invite.getSessionLeader());
- }
-
- sessions.put(session.getSessionId(), session);
- postEvent(session);
+ if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
+ SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
+ .getInvite();
+ session.setCurrentDataProvider(invite.getDataProvider());
+ session.setCurrentSessionLeader(invite.getSessionLeader());
}
+
+ sessions.put(session.getSessionId(), session);
+ postEvent(session);
return session;
}
@@ -429,7 +342,7 @@ public class CollaborationConnection implements IEventPublisher {
String subject) throws CollaborationException {
SharedDisplaySession session = null;
try {
- session = new SharedDisplaySession(container, eventBus, this);
+ session = new SharedDisplaySession(eventBus, this);
session.createVenue(venueName, subject);
session.setCurrentSessionLeader(user);
@@ -452,19 +365,16 @@ public class CollaborationConnection implements IEventPublisher {
*/
public IVenueSession joinTextOnlyVenue(String venueName)
throws CollaborationException {
- VenueSession session = null;
try {
- session = new VenueSession(container, eventBus, this);
- if (session != null) {
- session.joinVenue(venueName);
- sessions.put(session.getSessionId(), session);
- postEvent(session);
- }
+ VenueSession session = new VenueSession(eventBus, this);
+ session.configureVenue(venueName);
+ sessions.put(session.getSessionId(), session);
+ postEvent(session);
+ return session;
} catch (Exception e) {
throw new CollaborationException(
"Error joining venue " + venueName, e);
}
- return session;
}
/**
@@ -475,18 +385,10 @@ public class CollaborationConnection implements IEventPublisher {
*/
public IVenueSession createTextOnlyVenue(String venueName, String subject)
throws CollaborationException {
- VenueSession session = null;
- try {
- session = new VenueSession(container, eventBus, this);
- if (session != null) {
- session.createVenue(venueName, subject);
- sessions.put(session.getSessionId(), session);
- postEvent(session);
- }
- } catch (Exception e) {
- throw new CollaborationException("Error creating venue "
- + venueName, e);
- }
+ VenueSession session = new VenueSession(eventBus, this);
+ session.createVenue(venueName, subject);
+ sessions.put(session.getSessionId(), session);
+ postEvent(session);
return session;
}
@@ -507,16 +409,17 @@ public class CollaborationConnection implements IEventPublisher {
// Check to see if the container has been connected.
Collection info = new ArrayList();
if (isConnected()) {
- IPresenceContainerAdapter presenceAdapter = Tools
- .getPresenceContainerAdapter(container,
- IPresenceContainerAdapter.class);
- IChatRoomManager venueManager = presenceAdapter
- .getChatRoomManager();
- if (venueManager != null) {
- IChatRoomInfo[] roomInfo = venueManager.getChatRoomInfos();
- for (IChatRoomInfo rInfo : roomInfo) {
- IVenueInfo vi = new VenueInfo(rInfo);
- info.add(vi);
+ Iterator joinedRooms = MultiUserChat.getJoinedRooms(
+ connection, user.getNormalizedId());
+ while (joinedRooms.hasNext()) {
+ String room = joinedRooms.next();
+ RoomInfo roomInfo;
+ try {
+ roomInfo = MultiUserChat.getRoomInfo(connection, room);
+ info.add(new VenueInfo(roomInfo));
+ } catch (XMPPException e) {
+ statusHandler.handle(Priority.PROBLEM,
+ "Unable to get info for room: " + room, e);
}
}
}
@@ -532,62 +435,69 @@ public class CollaborationConnection implements IEventPublisher {
*
*/
private void setupInternalConnectionListeners() {
-
- presenceAdapter.getRosterManager().addPresenceListener(
- new IPresenceListener() {
-
- @Override
- public void handlePresence(ID fromId,
- org.eclipse.ecf.presence.IPresence presence) {
-
- if (rosterManager != null) {
- if (contactsMgr != null) {
- IUser u = contactsMgr.getUser(fromId);
- if (u != null) {
- IRosterEntry entry = contactsMgr
- .getRosterEntry(u);
- eventBus.post(entry);
- }
- }
- }
- }
- });
-
- presenceAdapter.getRosterManager().addRosterListener(
- new IRosterListener() {
-
- @Override
- public void handleRosterEntryAdd(IRosterEntry entry) {
+ final Roster roster = connection.getRoster();
+ roster.addRosterListener(new RosterListener() {
+
+ @Override
+ public void presenceChanged(Presence presence) {
+ String fromId = presence.getFrom();
+ if (contactsMgr != null) {
+ UserId u = IDConverter.convertFrom(fromId);
+ if (u != null) {
+ RosterEntry entry = contactsMgr
+ .getRosterEntry(u);
+ eventBus.post(entry);
IRosterChangeEvent event = new RosterChangeEvent(
- RosterChangeType.ADD, entry);
+ RosterChangeType.MODIFY, entry);
eventBus.post(event);
}
+ }
+ }
+
+ @Override
+ public void entriesUpdated(Collection addresses) {
+ send(addresses, RosterChangeType.MODIFY);
+ }
+
+ @Override
+ public void entriesDeleted(Collection addresses) {
+ send(addresses, RosterChangeType.DELETE);
+ }
+
+ @Override
+ public void entriesAdded(Collection addresses) {
+ send(addresses, RosterChangeType.ADD);
+ }
- @Override
- public void handleRosterUpdate(IRoster roster,
- IRosterItem item) {
- IRosterChangeEvent event = new RosterChangeEvent(
- RosterChangeType.MODIFY, item);
+ /**
+ * Send event bus notification for roster
+ *
+ * @param addresses
+ * @param type
+ */
+ private void send(Collection addresses,
+ RosterChangeType type) {
+ for (String addy : addresses) {
+ RosterEntry entry = roster.getEntry(addy);
+ if (entry != null) {
+ IRosterChangeEvent event = new RosterChangeEvent(type,
+ entry);
eventBus.post(event);
}
-
- @Override
- public void handleRosterEntryRemove(IRosterEntry entry) {
- IRosterChangeEvent event = new RosterChangeEvent(
- RosterChangeType.DELETE, entry);
- eventBus.post(event);
- }
- });
+ }
+ }
+ });
}
public ISession getSession(String sessionId) {
return sessions.get(sessionId);
}
- private void setupP2PComm(IPresenceContainerAdapter presenceAdapter) {
- if (isConnected() && (presenceAdapter != null)) {
+ private void setupP2PComm() {
+ if (isConnected()) {
PeerToPeerCommHelper helper = new PeerToPeerCommHelper(this);
- presenceAdapter.getChatManager().addMessageListener(helper);
+ connection.addPacketListener(helper, new PacketTypeFilter(
+ Message.class));
}
}
@@ -599,48 +509,38 @@ public class CollaborationConnection implements IEventPublisher {
*
*/
private void setupInternalVenueInvitationListener() {
- if (isConnected() && (presenceAdapter != null)) {
- IChatRoomManager venueManager = presenceAdapter
- .getChatRoomManager();
- if (venueManager != null) {
- intInvitationListener = new IChatRoomInvitationListener() {
- @Override
- public void handleInvitationReceived(ID roomID, ID from,
- String subject, String body) {
+ if (isConnected()) {
+ MultiUserChat.addInvitationListener(connection,
+ new InvitationListener() {
- IQualifiedID venueId = null;
- if (roomID instanceof XMPPRoomID) {
- XMPPRoomID room = (XMPPRoomID) roomID;
- venueId = new VenueId();
- venueId.setName(room.getLongName());
+ @Override
+ public void invitationReceived(Connection conn,
+ String room, String inviter, String reason,
+ String password, Message message) {
+ IQualifiedID venueId = new VenueId();
+ venueId.setName(Tools.parseName(room));
- }
- if (venueId != null) {
- IQualifiedID id = IDConverter.convertFrom(from);
-
- UserId invitor = new UserId(id.getName(),
- id.getHost(), id.getResource());
+ UserId invitor = IDConverter.convertFrom(inviter);
VenueInvite received;
try {
received = (VenueInvite) Tools
- .unMarshallData(body);
-
- if (subject == null) {
+ .unMarshallData(reason);
+ // TODO handle invite from generic client
+ String subject = message.getSubject();
+ if (received != null && subject == null) {
subject = received.getSubject();
if (subject == null) {
- subject = presenceAdapter
- .getChatRoomManager()
- .getChatRoomInfo(
- roomID.getName())
- .getSubject();
+ RoomInfo roomInfo = MultiUserChat
+ .getRoomInfo(conn, room);
+ subject = roomInfo.getSubject();
}
- }
- IVenueInvitationEvent invite = new VenueInvitationEvent(
- venueId, invitor, subject, received);
- eventBus.post(invite);
- } catch (CollaborationException e) {
+ IVenueInvitationEvent invite = new VenueInvitationEvent(
+ venueId, invitor, subject, received);
+ eventBus.post(invite);
+ }
+ } catch (Exception e) {
statusHandler
.handle(Priority.PROBLEM,
"Error handling received invite message",
@@ -648,10 +548,7 @@ public class CollaborationConnection implements IEventPublisher {
}
}
- }
- };
- venueManager.addInvitationListener(intInvitationListener);
- }
+ });
}
}
@@ -684,24 +581,6 @@ public class CollaborationConnection implements IEventPublisher {
return contactsMgr;
}
- /**
- *
- * @param name
- * @return
- */
- public ID createID(UserId name) throws CollaborationException {
- ID id = null;
- try {
- if (connectionNamespace != null) {
- id = IDFactory.getDefault().createID(connectionNamespace,
- name.getFQName());
- }
- } catch (IDCreateException idce) {
- throw new CollaborationException("Could not create id");
- }
- return id;
- }
-
public Collection getSessions() {
return sessions.values();
}
@@ -733,4 +612,12 @@ public class CollaborationConnection implements IEventPublisher {
}
}
+ protected XMPPConnection getXmppConnection() {
+ return connection;
+ }
+
+ public UserSearch createSearch() {
+ return new UserSearch(connection);
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java
index b7fec62a7f..df7bbb235a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java
@@ -19,15 +19,12 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.presence.im.IChatMessage;
-import org.eclipse.ecf.presence.im.IChatMessageSender;
+import org.jivesoftware.smack.Chat;
+import org.jivesoftware.smack.MessageListener;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Message;
+import org.jivesoftware.smack.packet.Message.Type;
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.Activator;
@@ -51,6 +48,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
* ------------ ---------- ----------- --------------------------
* Mar 21, 2012 jkorman Initial creation
* Apr 18, 2012 njensen Cleanup
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -60,19 +58,15 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
- private IChatMessageSender chatSender = null;
-
/**
*
* @param container
* @param externalBus
* @param manager
*/
- PeerToPeerChat(IContainer container, EventBus externalBus,
+ PeerToPeerChat(EventBus externalBus,
CollaborationConnection manager) throws CollaborationException {
- super(container, externalBus, manager);
- chatSender = getConnectionPresenceAdapter().getChatManager()
- .getChatMessageSender();
+ super(externalBus, manager);
}
/**
@@ -81,30 +75,33 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
*/
@Override
public void sendPeerToPeer(IMessage message) throws CollaborationException {
- if (chatSender != null) {
- ID toID = createID(message.getTo().getFQName());
- String subject = message.getSubject();
- String body = message.getBody();
- Collection properties = message.getProperties();
- Map props = null;
- if ((properties != null) && (properties.size() > 0)) {
- props = new HashMap();
- for (Property p : properties) {
- props.put(p.getKey(), p.getValue());
- }
- }
+ CollaborationConnection manager = getConnection();
+ XMPPConnection conn = manager.getXmppConnection();
+ IQualifiedID to = message.getTo();
+ String toId = to.getFQName();
+ Message xmppMessage = new Message(toId, Type.chat);
+ xmppMessage.setBody(message.getBody());
+ for (Property p : message.getProperties()) {
+ xmppMessage.setProperty(p.getKey(), p.getValue());
+ }
+ xmppMessage.setSubject(message.getSubject());
+ synchronized (this) {
+ Activator.getDefault().getNetworkStats()
+ .log(Activator.PEER_TO_PEER, message.getBody().length(), 0);
+ // TODO this is how ECF sent messages, we should look into the
+ // side-effects of creating an empty message listener every time we
+ // send a message. Alternative would be to redesign around keeping
+ // track of the created chat
+ Chat chat = conn.getChatManager().createChat(toId,
+ new MessageListener() {
+ public void processMessage(Chat chat, Message message) {
+ }
+ });
try {
- Activator
- .getDefault()
- .getNetworkStats()
- .log(Activator.PEER_TO_PEER,
- message.getBody().length(), 0);
- chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT,
- subject, body, props);
- } catch (ECFException e) {
- throw new CollaborationException(
- "Error sending message to peer "
- + message.getTo().getName(), e);
+ chat.sendMessage(xmppMessage);
+ } catch (XMPPException e) {
+ throw new CollaborationException("Unable to send message to: "
+ + toId, e);
}
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java
index fbded13749..fb455d2f1e 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java
@@ -19,12 +19,9 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
-import java.util.Map;
-
-import org.eclipse.ecf.presence.IIMMessageEvent;
-import org.eclipse.ecf.presence.IIMMessageListener;
-import org.eclipse.ecf.presence.im.IChatMessage;
-import org.eclipse.ecf.presence.im.IChatMessageEvent;
+import org.jivesoftware.smack.PacketListener;
+import org.jivesoftware.smack.packet.Message;
+import org.jivesoftware.smack.packet.Packet;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -52,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 28, 2012 jkorman Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -59,7 +57,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
* @version 1.0
*/
-public class PeerToPeerCommHelper implements IIMMessageListener {
+public class PeerToPeerCommHelper implements PacketListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PeerToPeerCommHelper.class);
@@ -97,15 +95,21 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
this.manager = manager;
}
- /**
+ /*
+ * (non-Javadoc)
*
+ * @see
+ * org.jivesoftware.smack.PacketListener#processPacket(org.jivesoftware.
+ * smack.packet.Packet)
*/
@Override
- public void handleMessageEvent(IIMMessageEvent messageEvent) {
- if (messageEvent instanceof IChatMessageEvent) {
- IChatMessageEvent event = (IChatMessageEvent) messageEvent;
-
- IChatMessage msg = event.getChatMessage();
+ public void processPacket(Packet packet) {
+ if (packet instanceof Message) {
+ Message msg = (Message) packet;
+ if (IDConverter.isFromRoom(msg.getFrom())) {
+ // venues will have their own listeners
+ return;
+ }
String body = msg.getBody();
Activator.getDefault().getNetworkStats()
.log(Activator.PEER_TO_PEER, 0, body.length());
@@ -120,13 +124,14 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
}
}
}
+
}
/**
*
* @param message
*/
- private void routeData(IChatMessage message) {
+ private void routeData(Message message) {
Object object = null;
try {
object = Tools.unMarshallData(message.getBody());
@@ -135,8 +140,8 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
"Error unmarshalling PeerToPeer data", e);
}
if (object != null) {
- String sessionId = (String) message.getProperties().get(
- Tools.PROP_SESSION_ID);
+ String sessionId = (String) message
+ .getProperty(Tools.PROP_SESSION_ID);
if (sessionId == null) {
manager.postEvent(object);
} else {
@@ -156,27 +161,21 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
*
* @param message
*/
- private void routeMessage(IChatMessage message) {
- IQualifiedID fromId = IDConverter.convertFrom(message.getFromID());
- fromId.setResource(Tools.parseResource(message.getFromID().getName()));
+ private void routeMessage(Message message) {
+ IQualifiedID fromId = IDConverter.convertFrom(message.getFrom());
TextMessage textMsg = new TextMessage(fromId, message.getBody());
textMsg.setFrom(fromId);
textMsg.setBody(message.getBody());
textMsg.setSubject(message.getSubject());
- @SuppressWarnings("unchecked")
- Map props = message.getProperties();
- for (Object o : props.keySet()) {
- if (o instanceof String) {
- String key = (String) o;
- Object v = props.get(key);
- if (v instanceof String) {
- textMsg.setProperty(key, (String) v);
- }
+ for (String key : message.getPropertyNames()) {
+ Object v = message.getProperty(key);
+ if (v instanceof String) {
+ textMsg.setProperty(key, (String) v);
}
}
ITextMessageEvent chatEvent = new ChatMessageEvent(textMsg);
- String sessionId = (String) message.getProperties().get(
+ String sessionId = (String) message.getProperty(
Tools.PROP_SESSION_ID);
// Now find out who gets the message. If the message doesn't contain
// a session id then assume its a straight text chat message.
@@ -256,4 +255,5 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
null);
manager.postEvent(configurationEvent);
}
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/RosterManager.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/RosterManager.java
new file mode 100644
index 0000000000..4a968ca240
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/RosterManager.java
@@ -0,0 +1,78 @@
+/**
+ * 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.session;
+
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.XMPPConnection;
+
+/**
+ * Manages roster from server
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 25, 2013 2561 bclement Initial creation
+ *
+ *
+ *
+ * @author bclement
+ * @version 1.0
+ */
+public class RosterManager {
+
+ private final XMPPConnection connection;
+
+ /**
+ * @param connection
+ */
+ public RosterManager(XMPPConnection connection) {
+ this.connection = connection;
+ }
+
+ /**
+ * @return roster from server connection
+ */
+ public Roster getRoster() {
+ return connection.getRoster();
+ }
+
+ /**
+ * Add listener for roster events
+ *
+ * @param listener
+ */
+ public void addRosterListener(RosterListener listener) {
+ getRoster().addRosterListener(listener);
+ }
+
+ /**
+ * Remove listener for roster events
+ *
+ * @param listener
+ */
+ public void removeRosterListener(RosterListener listener) {
+ getRoster().removeRosterListener(listener);
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java
index 3663d84eec..352769147e 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java
@@ -19,8 +19,6 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
-import org.eclipse.ecf.core.IContainer;
-
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
@@ -30,7 +28,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
- * TODO Add Description
+ * Chat room with shared display
*
*
*
@@ -53,15 +51,15 @@ public class SharedDisplaySession extends VenueSession implements
private UserId dataProvider = null;
- public SharedDisplaySession(IContainer container, EventBus externalBus,
+ public SharedDisplaySession(EventBus externalBus,
CollaborationConnection manager) throws CollaborationException {
- super(container, externalBus, manager);
+ super(externalBus, manager);
}
- public SharedDisplaySession(IContainer container, EventBus externalBus,
+ public SharedDisplaySession(EventBus externalBus,
CollaborationConnection manager, String sessionId)
throws CollaborationException {
- super(container, externalBus, manager, sessionId);
+ super(externalBus, manager, sessionId);
}
@Override
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
index 906c9faa47..eb018271e9 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
@@ -19,28 +19,17 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.ContainerCreateException;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.identity.IDFactory;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.presence.IIMMessageEvent;
-import org.eclipse.ecf.presence.IIMMessageListener;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
-import org.eclipse.ecf.presence.chatroom.IChatRoomInvitationSender;
-import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
-import org.eclipse.ecf.presence.chatroom.IChatRoomMessage;
-import org.eclipse.ecf.presence.chatroom.IChatRoomMessageEvent;
-import org.eclipse.ecf.presence.chatroom.IChatRoomMessageSender;
-import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
+import org.jivesoftware.smack.PacketListener;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Message;
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smackx.Form;
+import org.jivesoftware.smackx.muc.MultiUserChat;
+import org.jivesoftware.smackx.muc.ParticipantStatusListener;
import com.google.common.eventbus.EventBus;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -52,6 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
+import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
@@ -84,6 +74,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
* Apr 17, 2012 njensen Major refactor
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -105,13 +96,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
public static final String SEND_HISTORY = "[[HISTORY]]";
- private IChatRoomInfo venueInfo = null;
+ private MultiUserChat muc = null;
- private IChatRoomContainer venueContainer = null;
+ private PacketListener intListener = null;
- private IIMMessageListener intListener = null;
-
- private IChatRoomParticipantListener participantListener = null;
+ private PacketListener participantListener = null;
private Venue venue;
@@ -120,10 +109,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param container
* @param eventBus
*/
- protected VenueSession(IContainer container, EventBus externalBus,
+ protected VenueSession(EventBus externalBus,
CollaborationConnection manager, String sessionId)
throws CollaborationException {
- super(container, externalBus, manager, sessionId);
+ super(externalBus, manager, sessionId);
}
/**
@@ -131,9 +120,9 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param container
* @param eventBus
*/
- protected VenueSession(IContainer container, EventBus externalBus,
+ protected VenueSession(EventBus externalBus,
CollaborationConnection manager) throws CollaborationException {
- super(container, externalBus, manager);
+ super(externalBus, manager);
}
/**
@@ -144,22 +133,19 @@ public class VenueSession extends BaseSession implements IVenueSession {
*/
@Override
public void close() {
-
+ if (muc == null) {
+ return;
+ }
if (intListener != null) {
- venueContainer.removeMessageListener(intListener);
+ muc.removeMessageListener(intListener);
intListener = null;
}
if (participantListener != null) {
- venueContainer
- .removeChatRoomParticipantListener(participantListener);
+ muc.removeParticipantListener(participantListener);
participantListener = null;
}
- if (venueContainer != null) {
- venueContainer.disconnect();
- venueContainer = null;
- }
-
- venueInfo = null;
+ muc.leave();
+ muc = null;
super.close();
}
@@ -193,21 +179,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
@Override
public void sendInvitation(UserId id, VenueInvite invite)
throws CollaborationException {
- IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
- .getChatRoomManager().getInvitationSender();
- if (sender != null) {
- String msgBody = Tools.marshallData(invite);
- ID roomId = venueInfo.getConnectedID();
- ID userId = IDFactory.getDefault().createID(
- getConnectionNamespace(), id.getFQName());
-
- try {
- sender.sendInvitation(roomId, userId, invite.getSubject(),
- msgBody);
- } catch (ECFException e) {
- throw new CollaborationException("Error sending invitation", e);
- }
- }
+ String msgBody = Tools.marshallData(invite);
+ muc.invite(id.getNormalizedId(), msgBody);
}
/**
@@ -242,42 +215,53 @@ public class VenueSession extends BaseSession implements IVenueSession {
protected void sendMessageToVenue(String message)
throws CollaborationException {
// Assume success
- if ((venueContainer != null) && (message != null)) {
+ if ((muc != null) && (message != null)) {
Activator.getDefault().getNetworkStats()
.log(Activator.VENUE, message.length(), 0);
- IChatRoomMessageSender sender = venueContainer
- .getChatRoomMessageSender();
try {
if (message.startsWith(SEND_CMD)) {
- sender.sendMessage(message);
+ muc.sendMessage(message);
} else {
- sender.sendMessage(SEND_TXT + message);
+ muc.sendMessage(SEND_TXT + message);
}
- } catch (ECFException e) {
+ } catch (XMPPException e) {
throw new CollaborationException("Error sending messge", e);
}
}
}
- protected IChatRoomInfo joinVenue(String venueName)
+ /**
+ * Set up venue configuration and listeners. Must call
+ * {@link VenueSession#connectToRoom()} to actually join room
+ *
+ * @param venueName
+ * @return
+ * @throws CollaborationException
+ */
+ protected IVenueInfo configureVenue(String venueName)
throws CollaborationException {
- // Create chat room container from manager
- IChatRoomManager venueManager = getConnectionPresenceAdapter()
- .getChatRoomManager();
- if (venueManager != null) {
- venueInfo = venueManager.getChatRoomInfo(venueName);
- if (venueInfo == null) {
- throw new CollaborationException("Unable to join venue "
- + venueName + ". Venue may have been closed already.");
- }
- completeVenueConnection(venueInfo);
- }
- return venueInfo;
+ CollaborationConnection manager = getSessionManager();
+ XMPPConnection conn = manager.getXmppConnection();
+ String roomId = getRoomId(conn.getHost(), venueName);
+ this.muc = new MultiUserChat(conn, roomId);
+ this.venue = new Venue(conn, muc);
+ createListeners();
+ return this.venue.getInfo();
}
/**
- * This does NOT connect to the room, it only creates the venue and returns
- * the info. To connect, connectToRoom must be called.
+ * Construct room id from name and host
+ *
+ * @param host
+ * @param roomName
+ * @return
+ */
+ private String getRoomId(String host, String roomName){
+ return roomName + "@conference." + host;
+ }
+
+ /**
+ * Create room and connect to it
*
* @param venueName
* @throws CollaborationException
@@ -285,117 +269,177 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String,
* java.lang.String)
*/
- protected IChatRoomInfo createVenue(String venueName, String subject)
+ protected IVenueInfo createVenue(String venueName, String subject)
throws CollaborationException {
try {
- // Create chat room container from manager
- IChatRoomManager venueManager = getConnectionPresenceAdapter()
- .getChatRoomManager();
- if (venueManager != null) {
- venueInfo = venueManager.getChatRoomInfo(venueName);
- if (venueInfo == null) {
- Map props = null;
- if (subject != null) {
- props = new HashMap();
- props.put(Tools.VENUE_SUBJECT_PROP, subject);
- }
- venueInfo = venueManager.createChatRoom(venueName, props);
- completeVenueConnection(venueInfo);
- }
- }
- } catch (Exception e) {
+ CollaborationConnection manager = getSessionManager();
+ XMPPConnection conn = manager.getXmppConnection();
+ String roomId = getRoomId(conn.getHost(), venueName);
+ this.muc = new MultiUserChat(conn, roomId);
+ createListeners();
+ UserId user = manager.getUser();
+ // TODO check if room already exists
+ muc.create(user.getName());
+ muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
+ muc.changeSubject(subject);
+ this.venue = new Venue(conn, muc);
+ sendPresence(CollaborationConnection.getConnection().getPresence());
+ return this.venue.getInfo();
+ } catch (XMPPException e) {
throw new CollaborationException("Error creating venue "
+ venueName, e);
}
- return venueInfo;
}
/**
- *
- * @return
- * @throws CollaborationException
+ * register chat room listeners with muc
*/
- private void completeVenueConnection(IChatRoomInfo venueInfo)
- throws CollaborationException {
- if (venueInfo != null) {
- try {
- venueContainer = venueInfo.createChatRoomContainer();
- this.venue = new Venue(venueContainer, venueInfo);
- } catch (ContainerCreateException e) {
- throw new CollaborationException(
- "Error completing connection to venue", e);
+ private void createListeners() {
+ muc.addParticipantStatusListener(new ParticipantStatusListener() {
+
+ @Override
+ public void voiceRevoked(String participant) {
+ // TODO Auto-generated method stub
+
}
- }
+
+ @Override
+ public void voiceGranted(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void ownershipRevoked(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void ownershipGranted(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void nicknameChanged(String participant, String newNickname) {
+ // TODO how do we pass along new nickname?
+ UserId user = IDConverter.convertFromRoom(muc, participant);
+ postEvent(new VenueParticipantEvent(user,
+ ParticipantEventType.UPDATED));
+ }
+
+ @Override
+ public void moderatorRevoked(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void moderatorGranted(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void membershipRevoked(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void membershipGranted(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void left(String participant) {
+ UserId user = IDConverter.convertFromRoom(muc, participant);
+ postEvent(new VenueParticipantEvent(user,
+ ParticipantEventType.DEPARTED));
+
+ }
+
+ @Override
+ public void kicked(String participant, String actor, String reason) {
+ this.left(participant);
+ }
+
+ @Override
+ public void joined(String participant) {
+ UserId user = IDConverter.convertFromRoom(muc, participant);
+ postEvent(new VenueParticipantEvent(user,
+ ParticipantEventType.ARRIVED));
+ }
+
+ @Override
+ public void banned(String participant, String actor, String reason) {
+ this.left(participant);
+ }
+
+ @Override
+ public void adminRevoked(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void adminGranted(String participant) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+ // presence listener
+ muc.addParticipantListener(new PacketListener() {
+
+ @Override
+ public void processPacket(Packet packet) {
+ if (packet instanceof Presence) {
+ Presence p = (Presence) packet;
+ String fromID = p.getFrom();
+ UserId user = IDConverter.convertFromRoom(muc, fromID);
+ venue.handlePresenceUpdated(user, p);
+ postEvent(new VenueParticipantEvent(user, p,
+ ParticipantEventType.PRESENCE_UPDATED));
+ }
+ }
+ });
+ // message listener
+ this.muc.addMessageListener(new PacketListener() {
+
+ @Override
+ public void processPacket(Packet packet) {
+ if (packet instanceof Message) {
+ Message m = (Message) packet;
+ Activator.getDefault().getNetworkStats()
+ .log(Activator.VENUE, 0, m.getBody().length());
+ if (accept(m)) {
+ distributeMessage(convertMessage(m));
+ }
+ }
+
+ }
+ });
}
/**
* Allows users to connect after the fact so that they do not miss any
* messages coming from the room (after the dialog/view has been
- * instanstiated)
+ * instantiated)
*/
public void connectToRoom() {
+ if (this.muc.isJoined()) {
+ return;
+ }
try {
- IChatRoomParticipantListener pListener = new IChatRoomParticipantListener() {
- @Override
- public void handleArrived(IUser participant) {
- UserId user = IDConverter.convertFrom(participant);
- postEvent(new VenueParticipantEvent(user,
- ParticipantEventType.ARRIVED));
- }
-
- @Override
- public void handleUpdated(IUser participant) {
- UserId user = IDConverter.convertFrom(participant);
- postEvent(new VenueParticipantEvent(user,
- ParticipantEventType.UPDATED));
- }
-
- @Override
- public void handleDeparted(IUser participant) {
- UserId user = IDConverter.convertFrom(participant);
- postEvent(new VenueParticipantEvent(user,
- ParticipantEventType.DEPARTED));
- }
-
- @Override
- public void handlePresenceUpdated(ID fromID,
- org.eclipse.ecf.presence.IPresence presence) {
- venue.handlePresenceUpdated(fromID, presence);
- UserId user = IDConverter.convertFrom(fromID);
- postEvent(new VenueParticipantEvent(user, presence,
- ParticipantEventType.PRESENCE_UPDATED));
-
- }
- };
- venueContainer.addChatRoomParticipantListener(pListener);
-
- venueContainer.connect(venueInfo.getRoomID(), null);
- if (venueContainer.getConnectedID() != null) {
-
- intListener = new IIMMessageListener() {
- public void handleMessageEvent(IIMMessageEvent messageEvent) {
- if (messageEvent instanceof IChatRoomMessageEvent) {
- IChatRoomMessage m = ((IChatRoomMessageEvent) messageEvent)
- .getChatRoomMessage();
- Activator
- .getDefault()
- .getNetworkStats()
- .log(Activator.VENUE, 0,
- m.getMessage().length());
- if (accept(m)) {
- distributeMessage(convertMessage(m));
- }
- }
- }
- };
- venueContainer.addMessageListener(intListener);
-
- sendPresence(CollaborationConnection.getConnection()
- .getPresence());
- }
+ UserId user = getSessionManager().getUser();
+ this.muc.join(user.getName());
+ sendPresence(CollaborationConnection.getConnection().getPresence());
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
- } catch (ContainerConnectException e) {
+ } catch (XMPPException e) {
statusHandler.handle(Priority.ERROR,
"Unable to connect to container", e);
}
@@ -409,23 +453,32 @@ public class VenueSession extends BaseSession implements IVenueSession {
* A message to accept.
* @return Should the message be accepted.
*/
- private boolean accept(IChatRoomMessage message) {
- boolean acceptMessage = true;
-
- String body = message.getMessage();
- // Command data only
- if (body.startsWith(SEND_CMD)) {
- ID from = message.getFromID();
-
- String name = Tools.parseName(from.getName());
-
- UserId account = getSessionManager().getUser();
- String aName = account.getFQName();
- if (aName.equals(name)) {
- acceptMessage = false;
- }
+ private boolean accept(Message message) {
+ if (this.muc == null) {
+ // we don't seem to be in a room
+ return false;
}
- return acceptMessage;
+
+ String from = message.getFrom();
+ String roomName = Tools.parseName(from);
+ String thisRoom = Tools.parseName(this.muc.getRoom());
+ if (!thisRoom.equals(roomName)) {
+ // this message is for another room, they should have a listener to
+ // pick it up
+ return false;
+ }
+
+ UserId account = getSessionManager().getUser();
+ UserId fromUser = IDConverter.convertFromRoom(muc, from);
+
+ String body = message.getBody();
+
+ if (!body.startsWith(SEND_HISTORY) && fromUser.isSameUser(account)) {
+ // ignore from ourselves except for history
+ return false;
+ }
+
+ return true;
}
/**
@@ -447,7 +500,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
} catch (CollaborationException ce) {
statusHandler.error(
"Error deserializing received message on venue "
- + venueInfo.getName(), ce);
+ + muc.getRoom(), ce);
}
} else if (body.startsWith(SEND_TXT)) {
body = body.substring(SEND_TXT.length());
@@ -503,25 +556,22 @@ public class VenueSession extends BaseSession implements IVenueSession {
* The ECF chat room message to convert.
* @return The converted message.
*/
- private IMessage convertMessage(IChatRoomMessage msg) {
+ private IMessage convertMessage(Message msg) {
IMessage message = null;
- String body = msg.getMessage();
+ String body = msg.getBody();
if (body != null) {
- message = new CollaborationMessage(null, msg.getMessage());
- message.setFrom(IDConverter.convertFrom(msg.getFromID()));
+ message = new CollaborationMessage(null, body);
+ message.setFrom(IDConverter.convertFromRoom(muc, msg.getFrom()));
}
return message;
}
@Override
- public void sendPresence(IPresence presence) throws CollaborationException {
- try {
- CollaborationConnection.getConnection().getRosterManager()
- .getPresenceSender()
- .sendPresenceUpdate(venueInfo.getRoomID(), presence);
- } catch (ECFException e) {
- throw new CollaborationException(e);
- }
+ public void sendPresence(Presence presence) throws CollaborationException {
+ presence.setTo(venue.getInfo().getVenueID());
+ XMPPConnection conn = getConnection().getXmppConnection();
+ conn.sendPacket(presence);
}
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/ContactsManager.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/ContactsManager.java
index e57119b1a0..7ce070aafa 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/ContactsManager.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/ContactsManager.java
@@ -33,24 +33,12 @@ import javax.xml.bind.JAXB;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.core.user.User;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Type;
-import org.eclipse.ecf.presence.Presence;
-import org.eclipse.ecf.presence.roster.IRoster;
-import org.eclipse.ecf.presence.roster.IRosterEntry;
-import org.eclipse.ecf.presence.roster.IRosterGroup;
-import org.eclipse.ecf.presence.roster.IRosterItem;
-import org.eclipse.ecf.presence.roster.IRosterListener;
-import org.eclipse.ecf.presence.search.ICriteria;
-import org.eclipse.ecf.presence.search.ICriterion;
-import org.eclipse.ecf.presence.search.IResult;
-import org.eclipse.ecf.presence.search.ISearch;
-import org.eclipse.ecf.presence.search.IUserSearchManager;
-import org.eclipse.ecf.presence.search.UserSearchException;
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@@ -62,14 +50,15 @@ import com.raytheon.uf.common.localization.exception.LocalizationOpFailedExcepti
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.session.RosterManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
/**
- *
- * TODO Add Description
+ * Manage contacts from local groups and roster on server
*
*
*
@@ -78,6 +67,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGro
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 29, 2012 bsteffen Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -118,6 +108,8 @@ public class ContactsManager {
private final CollaborationConnection connection;
+ private final UserSearch search;
+
private List localGroups;
private Map localAliases;
@@ -126,57 +118,41 @@ public class ContactsManager {
public ContactsManager(CollaborationConnection connection) {
this.connection = connection;
+ this.search = connection.createSearch();
localAliases = UserIdWrapper.readAliasMap();
- applyLocalAliases(getRoster());
initLocalGroups();
- connection.getRosterManager().addRosterListener(new IRosterListener() {
+ final RosterManager rosterManager = connection.getRosterManager();
+ final Roster roster = rosterManager.getRoster();
+ // currently don't need to listen to roster since we only allow one
+ // client
+ rosterManager.addRosterListener(new RosterListener() {
@Override
- public void handleRosterUpdate(IRoster roster,
- IRosterItem changedValue) {
+ public void entriesAdded(Collection addresses) {
+ // TODO handle roster additions from other clients
+ }
+
+ @Override
+ public void entriesUpdated(Collection addresses) {
+ // TODO Auto-generated method stub
}
@Override
- public void handleRosterEntryRemove(IRosterEntry entry) {
+ public void entriesDeleted(Collection addresses) {
+ // TODO Auto-generated method stub
}
@Override
- public void handleRosterEntryAdd(IRosterEntry entry) {
- applyLocalAliases(entry);
+ public void presenceChanged(
+ org.jivesoftware.smack.packet.Presence presence) {
+ // TODO Auto-generated method stub
}
});
}
- private void applyLocalAliases(IRosterItem item) {
- if (item instanceof IRosterEntry) {
- IRosterEntry entry = (IRosterEntry) item;
- IUser user = entry.getUser();
- String alias = localAliases.get(getUserId(user));
- if (alias != null && user instanceof User) {
- ((User) user).setNickname(alias);
- }
- } else if (item instanceof IRosterGroup) {
- Collection> entries = ((IRosterGroup) item).getEntries();
- synchronized (entries) {
- entries = new ArrayList(entries);
- }
- for (Object o : entries) {
- applyLocalAliases((IRosterItem) o);
- }
- } else if (item instanceof IRoster) {
- Collection> entries = ((IRoster) item).getItems();
- synchronized (entries) {
- entries = new ArrayList(entries);
- }
- for (Object o : entries) {
- applyLocalAliases((IRosterItem) o);
- }
- }
- }
-
private void initLocalGroups() {
storeLocalGroupsJob.setSystem(true);
IPathManager pm = PathManagerFactory.getPathManager();
@@ -204,31 +180,28 @@ public class ContactsManager {
}
}
- public void addToLocalGroup(String groupName, IUser user) {
+ public void addToLocalGroup(String groupName, UserId user) {
synchronized (this.localGroups) {
LocalGroup group = createLocalGroup(groupName);
- String userId = getUserId(user);
+ String userId = user.getNormalizedId();
List userNames = group.getUserNames();
if (!userNames.contains(userId)) {
- List users = group.getUsers();
+ List users = group.getUsers();
group.getUserNames().add(userId);
users.add(user);
}
- IRosterEntry entry = getRosterEntry(user);
+ RosterEntry entry = getRosterEntry(user);
if (entry == null || entry.getGroups().isEmpty()) {
// In order to get presence for a user they must be in the
// roster, we can add them to the roster by either subscribing
// to them using presence or adding them to the roster,
- // subscribing to the presence will not set the name coreectly
+ // subscribing to the presence will not set the name correctly
// so we use the roster add method.
try {
- // IPresence presence = new Presence(Type.SUBSCRIBE);
- // connection.getRosterManager().getPresenceSender()
- // .sendPresenceUpdate(user.getID(), presence);
-
- connection.getRosterManager().getRosterSubscriptionSender()
- .sendRosterAdd(userId, user.getName(), null);
- } catch (ECFException e) {
+ RosterManager rosterManager = connection.getRosterManager();
+ Roster roster = rosterManager.getRoster();
+ roster.createEntry(userId, user.getAlias(), new String[0]);
+ } catch (XMPPException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
@@ -240,14 +213,14 @@ public class ContactsManager {
storeLocalGroupsJob.schedule();
}
- public void deleteFromLocalGroup(String groupName, IUser user) {
+ public void deleteFromLocalGroup(String groupName, UserId user) {
synchronized (localGroups) {
Iterator it = localGroups.iterator();
while (it.hasNext()) {
LocalGroup group = it.next();
if (group.getName().equals(groupName)) {
group.getUsers().remove(user);
- group.getUserNames().remove(getUserId(user));
+ group.getUserNames().remove(user.getNormalizedId());
for (LocalGroupListener listener : getSafeGroupListeners()) {
listener.userDeleted(group, user);
}
@@ -257,13 +230,13 @@ public class ContactsManager {
if (getLocalGroups(user).isEmpty()) {
// if the user is in no local groups and no roster groups remove
// them from our roster.
- IRosterEntry entry = getRosterEntry(user);
+ RosterEntry entry = getRosterEntry(user);
if (entry != null && entry.getGroups().isEmpty()) {
- IPresence presence = new Presence(Type.UNSUBSCRIBE);
+ Presence presence = new Presence(Type.unsubscribe);
+ presence.setTo(user.getNormalizedId());
try {
- connection.getRosterManager().getPresenceSender()
- .sendPresenceUpdate(user.getID(), presence);
- } catch (ECFException e) {
+ connection.getAccountManager().sendPresence(presence);
+ } catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
@@ -297,9 +270,9 @@ public class ContactsManager {
while (it.hasNext()) {
LocalGroup group = it.next();
if (groupName.equals(group.getName())) {
- ArrayList users = new ArrayList(
+ List users = new ArrayList(
group.getUsers());
- for (IUser user : users) {
+ for (UserId user : users) {
deleteFromLocalGroup(groupName, user);
}
it.remove();
@@ -330,12 +303,12 @@ public class ContactsManager {
storeLocalGroupsJob.schedule();
}
- public List getLocalGroups(IUser user) {
+ public List getLocalGroups(UserId user) {
List results = new ArrayList();
synchronized (localGroups) {
for (LocalGroup group : localGroups) {
for (String userName : group.getUserNames()) {
- if (getUserId(user).equals(userName)) {
+ if (user.getNormalizedId().equals(userName)) {
results.add(group);
break;
}
@@ -345,17 +318,16 @@ public class ContactsManager {
return results;
}
- public void setNickname(IUser user, String nickname) {
+ public void setNickname(UserId user, String nickname) {
synchronized (localAliases) {
- localAliases.put(getUserId(user), nickname);
+ localAliases.put(user.getNormalizedId(), nickname);
try {
UserIdWrapper.saveAliasMap(localAliases);
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
- applyLocalAliases(getRoster());
connection.postEvent(new UserNicknameChangedEvent(user, nickname));
}
}
@@ -369,23 +341,20 @@ public class ContactsManager {
* @param user
* @return
*/
- public String getDisplayName(IUser user) {
- String alias = localAliases.get(getUserId(user));
+ public String getDisplayName(UserId user) {
+ String alias = localAliases.get(user.getNormalizedId());
if (alias == null) {
// at this point try to get the user from roster;
- IUser rosterUser = null;
- if (user.getID() != null) {
- rosterUser = getUser(user.getID());
+ UserId rosterUser = null;
+ if (user.getNormalizedId() != null) {
+ rosterUser = getUser(user.getNormalizedId());
}
if (rosterUser != null) {
user = rosterUser;
}
- alias = user.getNickname();
+ alias = user.getAlias();
if (alias == null) {
alias = user.getName();
- if (alias == null) {
- alias = user.getID().getName();
- }
}
if (alias.contains("@")) {
alias = Tools.parseName(alias);
@@ -394,29 +363,29 @@ public class ContactsManager {
return alias;
}
- public IUser getUser(ID id) {
- return getUser(getUserId(id));
- }
-
- public IUser getUser(String userId) {
- userId = normalizeId(userId);
- IRosterEntry entry = searchRoster(getRoster(), userId);
+ public UserId getUser(String userId) {
+ RosterEntry entry = searchRoster(getRoster(), userId);
if (entry == null) {
return null;
}
- return entry.getUser();
+ return IDConverter.convertFrom(entry);
}
- public IRosterEntry getRosterEntry(IUser user) {
+ public RosterEntry getRosterEntry(UserId user) {
return searchRoster(user);
}
- public IPresence getPresence(IUser user) {
- IRosterEntry entry = searchRoster(user);
- if (entry == null) {
- return new Presence(Type.UNKNOWN);
+ public Presence getPresence(UserId user) {
+ UserId self = connection.getUser();
+ if (self.isSameUser(user)) {
+ return getSelfPresence();
}
- return entry.getPresence();
+ Roster roster = getRoster();
+ return roster.getPresence(user.getNormalizedId());
+ }
+
+ public Presence getSelfPresence() {
+ return connection.getPresence();
}
/**
@@ -426,23 +395,23 @@ public class ContactsManager {
* @param name
* @return
*/
- protected IUser findAndAddUser(String name) {
- name = normalizeId(name);
- IUser user = null;
- IRosterEntry entry = searchRoster(getRoster(), name);
+ protected UserId findAndAddUser(String id) {
+ UserId user = null;
+ RosterEntry entry = searchRoster(getRoster(), id);
if (entry != null) {
- user = entry.getUser();
+ user = IDConverter.convertFrom(entry);
}
if (user == null) {
- user = findUser(name);
+ user = findUser(id);
if (user != null) {
try {
- connection
- .getRosterManager()
- .getRosterSubscriptionSender()
- .sendRosterAdd(getUserId(user), user.getName(),
- null);
- } catch (ECFException e) {
+ Roster roster = connection.getRosterManager().getRoster();
+ String alias = user.getAlias();
+ if (alias == null || alias.trim().isEmpty()) {
+ alias = user.getName();
+ }
+ roster.createEntry(user.getFQName(), alias, new String[0]);
+ } catch (XMPPException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
@@ -452,103 +421,38 @@ public class ContactsManager {
}
- private IUser findUser(String name) {
- IUserSearchManager searchManager = connection
- .getPresenceContainerAdapter().getUserSearchManager();
- ICriterion criterion = searchManager.createRestriction().eq("Username",
- Tools.parseName(name));
- ICriteria criteria = searchManager.createCriteria();
- criteria.add(criterion);
- try {
- ISearch search = searchManager.search(criteria);
- for (Object result : search.getResultList().getResults()) {
- if (result instanceof IResult) {
- IUser user = ((IResult) result).getUser();
- String alias = localAliases.get(getUserId(user));
- if (alias != null && user instanceof User) {
- ((User) user).setNickname(alias);
- }
- return user;
- }
- }
- } catch (UserSearchException e) {
- statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
- }
- return null;
- }
-
- private IRoster getRoster() {
+ /**
+ * @return
+ */
+ private Roster getRoster() {
return connection.getRosterManager().getRoster();
}
- /**
- * given a user return username@host.
- *
- * @param user
- * @return
- */
- private String getUserId(IUser user) {
- if (user.getID() == null) {
- return normalizeId(user.toString());
+ private UserId findUser(String idString) {
+ List results;
+ try {
+ results = search.byId(idString);
+ } catch (XMPPException e) {
+ statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+ return null;
}
- return getUserId(user.getID());
- }
-
- /**
- * given a user ID return username@host.
- *
- * @param id
- * @return
- */
- private String getUserId(ID id) {
- return normalizeId(id.getName());
- }
-
- private String normalizeId(String userId) {
- String name = Tools.parseName(userId);
- String hostname = Tools.parseHost(userId);
- hostname = IDConverter.normalizeHostname(hostname);
- return name + "@" + hostname;
- }
-
- private IRosterEntry searchRoster(IUser user) {
- String userId = getUserId(user);
- return searchRoster(getRoster(), userId);
- }
-
- private IRosterEntry searchRoster(IRosterItem item, String userName) {
- if (item instanceof IRosterEntry) {
- IRosterEntry entry = (IRosterEntry) item;
- if (userName.equals(getUserId(entry.getUser()))) {
- return entry;
+ for (UserId id : results) {
+ String alias = localAliases.get(id.getNormalizedId());
+ if (alias != null) {
+ id.setAlias(alias);
}
- } else if (item instanceof IRosterGroup) {
- Collection> entries = ((IRosterGroup) item).getEntries();
- synchronized (entries) {
- entries = new ArrayList(entries);
- }
- for (Object o : entries) {
- IRosterEntry entry = searchRoster((IRosterItem) o, userName);
- if (entry != null) {
- return entry;
- }
- }
- } else if (item instanceof IRoster) {
- Collection> entries = ((IRoster) item).getItems();
- synchronized (entries) {
- entries = new ArrayList(entries);
- }
- for (Object o : entries) {
- IRosterEntry entry = searchRoster((IRosterItem) o, userName);
- if (entry != null) {
- return entry;
- }
- }
- } else {
- throw new IllegalStateException("Unexpected Roster entry: "
- + item.getClass().getSimpleName());
}
- return null;
+ // since we are searching by ID, there should be 0 or 1 result
+ return results.isEmpty() ? null : results.iterator().next();
+ }
+
+ private RosterEntry searchRoster(UserId user) {
+ String userId = user.getNormalizedId();
+ return searchRoster(connection.getRosterManager().getRoster(), userId);
+ }
+
+ private RosterEntry searchRoster(Roster roster, String userId) {
+ return roster.getEntry(userId);
}
public void addLocalGroupListener(LocalGroupListener listener) {
@@ -577,9 +481,9 @@ public class ContactsManager {
public void groupDeleted(LocalGroup group);
- public void userAdded(LocalGroup group, IUser user);
+ public void userAdded(LocalGroup group, UserId user);
- public void userDeleted(LocalGroup group, IUser user);
+ public void userDeleted(LocalGroup group, UserId user);
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java
index c29d5b63e3..4ba7ea94ab 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java
@@ -19,10 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
-import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.util.StringUtils;
+import org.jivesoftware.smackx.muc.MultiUserChat;
+import org.jivesoftware.smackx.muc.Occupant;
/**
- * TODO Add Description
+ * Utility to parse id strings
*
*
*
@@ -31,6 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 28, 2012 jkorman Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -42,42 +46,39 @@ public class IDConverter {
private static final String CONF_ID = "conference.";
- /**
- *
- * @param user
- * @return
- */
- public static UserId convertFrom(org.eclipse.ecf.core.identity.ID id) {
- String name = Tools.parseName(id.getName());
- String host = Tools.parseHost(id.getName());
- String rsc = Tools.parseResource(id.getName());
-
+ public static UserId convertFrom(String id) {
+ String name = StringUtils.parseName(id);
+ String host = StringUtils.parseServer(id);
+ String rsc = StringUtils.parseResource(id);
UserId uid = new UserId(name, host, rsc);
- uid.setId(id);
return uid;
}
- /**
- *
- * @param user
- * @return
- */
- public static UserId convertFrom(org.eclipse.ecf.core.user.IUser user) {
- UserId retVal = null;
- if (user instanceof UserId) {
- retVal = (UserId) user;
- } else {
- String name = Tools.parseName(user.getID().getName());
- String host = Tools.parseHost(user.getID().getName());
- retVal = new UserId(name, host);
- retVal.setId(user.getID());
- if (user.getNickname() != null) {
- retVal.setAlias(user.getNickname());
- } else {
- retVal.setAlias(user.getName());
- }
+ public static UserId convertFrom(RosterEntry entry) {
+ UserId rval = convertFrom(entry.getUser());
+ rval.setAlias(entry.getName());
+ return rval;
+ }
+
+ public static UserId convertFromRoom(MultiUserChat room, String id) {
+ String nickname = StringUtils.parseResource(id);
+ if (nickname == null || nickname.trim().isEmpty()) {
+ // this message is from the room itself
+ return convertFrom(id);
}
- return retVal;
+ String host = StringUtils.parseServer(id);
+
+ String name;
+ Occupant occupant;
+ if (room != null && (occupant = room.getOccupant(id)) != null) {
+ // get actual user name
+ name = StringUtils.parseName(occupant.getJid());
+ } else {
+ // fallback to using room nickname
+ name = nickname;
+ }
+
+ return new UserId(name, host);
}
public static String normalizeHostname(String hostname) {
@@ -87,4 +88,9 @@ public class IDConverter {
return hostname;
}
+ public static boolean isFromRoom(String id) {
+ String host = StringUtils.parseServer(id);
+ return host.startsWith(CONF_ID);
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/LocalGroups.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/LocalGroups.java
index e8efeb159b..cae232048d 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/LocalGroups.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/LocalGroups.java
@@ -29,10 +29,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
-import org.eclipse.ecf.core.user.IUser;
-
/**
- * TODO Add Description
+ * Group information not stored on chat server
*
*
*
@@ -82,7 +80,7 @@ public class LocalGroups {
private ContactsManager manager;
@XmlTransient
- private List users;
+ private List users;
public LocalGroup() {
}
@@ -111,11 +109,11 @@ public class LocalGroups {
this.userNames = userNames;
}
- public synchronized List getUsers() {
+ public synchronized List getUsers() {
if (users == null) {
- users = new ArrayList();
+ users = new ArrayList();
for (String userName : userNames) {
- IUser user = manager.findAndAddUser(userName);
+ UserId user = manager.findAndAddUser(userName);
if (user != null) {
users.add(user);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ISubscriptionResponseEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/RosterItem.java
similarity index 54%
rename from cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ISubscriptionResponseEvent.java
rename to cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/RosterItem.java
index 8ea8de9a0b..ae0da2b0af 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/ISubscriptionResponseEvent.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/RosterItem.java
@@ -17,12 +17,12 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
-package com.raytheon.uf.viz.collaboration.comm.identity.event;
+package com.raytheon.uf.viz.collaboration.comm.provider.user;
-import org.eclipse.ecf.presence.IPresence;
+import org.jivesoftware.smack.packet.Presence;
/**
- * TODO Add Description
+ * Entry from local roster
*
*
*
@@ -30,28 +30,50 @@ import org.eclipse.ecf.presence.IPresence;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Mar 16, 2012 jkorman Initial creation
+ * Nov 22, 2013 bclement Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
- * @author jkorman
+ * @author bclement
* @version 1.0
*/
-public interface ISubscriptionResponseEvent {
+public class RosterItem {
+
+ private final UserId id;
+
+ private Presence presence;
/**
- * How was the subscription responded to.
- *
- * @return The response type.
+ * @param id
+ * @param presence
*/
- IPresence.Type getResponse();
+ public RosterItem(UserId id, Presence presence) {
+ this.id = id;
+ this.presence = presence;
+ }
/**
- * Was this response due to an auto responder.
- *
- * @return Was this response due to an auto responder.
+ * @return the presence
*/
- boolean isAutoResponder();
+ public Presence getPresence() {
+ return presence;
+ }
+
+ /**
+ * @param presence
+ * the presence to set
+ */
+ public void setPresence(Presence presence) {
+ this.presence = presence;
+ }
+
+ /**
+ * @return the id
+ */
+ public UserId getId() {
+ return id;
+ }
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java
index 1b135258a9..70d41d7695 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java
@@ -19,20 +19,15 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
-import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.user.IUser;
-
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/**
- * TODO Add Description
+ * Parsed user id string
*
*
*
@@ -42,6 +37,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
* Apr 18, 2012 njensen Major refactor
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -50,7 +46,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
*/
@DynamicSerialize
@XmlRootElement(name = "userId")
-public class UserId implements IQualifiedID, IUser {
+public class UserId implements IQualifiedID {
@DynamicSerializeElement
protected String name;
@@ -64,8 +60,6 @@ public class UserId implements IQualifiedID, IUser {
@DynamicSerializeElement
protected String alias;
- private ID id;
-
public UserId() {
}
@@ -93,7 +87,11 @@ public class UserId implements IQualifiedID, IUser {
String alias) {
this.name = userName;
setHost(hostName);
- this.resource = resource;
+ if (resource != null && resource.trim().isEmpty()) {
+ resource = null;
+ } else {
+ this.resource = resource;
+ }
this.alias = alias;
}
@@ -108,7 +106,7 @@ public class UserId implements IQualifiedID, IUser {
/**
* @return The user name associated with this id.
- * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getUserName()
+ * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getUsers()
*/
@Override
public String getName() {
@@ -176,6 +174,13 @@ public class UserId implements IQualifiedID, IUser {
return sb.toString();
}
+ /**
+ * @return username@host.
+ */
+ public String getNormalizedId() {
+ return name + "@" + host;
+ }
+
public String getAlias() {
if (alias == null || alias.isEmpty()) {
return name;
@@ -198,6 +203,8 @@ public class UserId implements IQualifiedID, IUser {
int result = 1;
result = prime * result + ((host == null) ? 0 : host.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
+ // TODO should resource be part of this since it is the same user at a
+ // different location?
result = prime * result
+ ((resource == null) ? 0 : resource.hashCode());
return result;
@@ -223,6 +230,8 @@ public class UserId implements IQualifiedID, IUser {
} else if (!name.equals(other.name))
return false;
if (resource == null) {
+ // TODO should resource be part of this since it is the same user at
+ // a different location?
if (other.resource != null)
return false;
} else if (!resource.equals(other.resource))
@@ -230,34 +239,6 @@ public class UserId implements IQualifiedID, IUser {
return true;
}
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getNickname() {
- return alias;
- }
-
- @Override
- public Map getProperties() {
- return null;
- }
-
- @Override
- public ID getID() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(ID id) {
- this.id = id;
- }
-
/**
* Checks if it is the same user. Does not check the resource.
*
@@ -266,9 +247,17 @@ public class UserId implements IQualifiedID, IUser {
* @return if it is the same user
*/
public boolean isSameUser(String id) {
- boolean result = false;
String name = Tools.parseName(id);
String host = Tools.parseHost(id);
+ return isSameUser(name, host);
+ }
+
+ public boolean isSameUser(UserId other) {
+ return isSameUser(other.getName(), other.getHost());
+ }
+
+ public boolean isSameUser(String name, String host) {
+ boolean result = false;
if (name != null && host != null) {
if (this.name.equals(name) && this.host.equals(host)) {
result = true;
@@ -276,4 +265,5 @@ public class UserId implements IQualifiedID, IUser {
}
return result;
}
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserIdWrapper.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserIdWrapper.java
index da59577cb8..6e6f9d1146 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserIdWrapper.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserIdWrapper.java
@@ -40,7 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
/**
- * TODO Add Description
+ * provides access to alias information stored in localization
*
*
*
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserSearch.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserSearch.java
new file mode 100644
index 0000000000..e903084e6c
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserSearch.java
@@ -0,0 +1,167 @@
+/**
+ * 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.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smackx.Form;
+import org.jivesoftware.smackx.FormField;
+import org.jivesoftware.smackx.ReportedData;
+import org.jivesoftware.smackx.ReportedData.Row;
+import org.jivesoftware.smackx.search.UserSearchManager;
+
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+
+/**
+ * Search utility for XMPP connections
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 22, 2013 2561 bclement Initial creation
+ *
+ *
+ *
+ * @author bclement
+ * @version 1.0
+ */
+public class UserSearch {
+
+ private final XMPPConnection connection;
+
+ private final UserSearchManager searchManager;
+
+ private static final String SEARCH_SERVICE_PREFIX = "search.";
+
+ private static final String SEARCH_ACTION = "search";
+
+ public static final String USERID_FIELD = "Username";
+
+ public static final String JABBER_ID_COLUMN = "jid";
+
+ public static final String NAME_COLUMN = "name";
+
+ private static final String FORM_TYPE = "FORM_TYPE";
+
+ private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
+
+ /**
+ * @param conn
+ */
+ public UserSearch(XMPPConnection conn) {
+ this.connection = conn;
+ this.searchManager = new UserSearchManager(conn);
+ }
+
+ /**
+ * Search by username
+ *
+ * @param name
+ * @return list of user ids that match that name
+ * @throws XMPPException
+ */
+ public List byId(String id) throws XMPPException {
+ return byCriteria(USERID_FIELD, id);
+ }
+
+ /**
+ * Search for users by single criteria
+ *
+ * @param field
+ * @param value
+ * @return list of user ids that match that criteria
+ * @throws XMPPException
+ */
+ public List byCriteria(String field, String value)
+ throws XMPPException {
+ String serviceName = getSearchServiceName();
+ Form searchForm = searchManager.getSearchForm(serviceName);
+ Form answerForm = searchForm.createAnswerForm();
+ answerForm.setAnswer(field, true);
+ answerForm.setAnswer(SEARCH_ACTION, value);
+ ReportedData results = searchManager.getSearchResults(answerForm,
+ serviceName);
+ return unwrap(results);
+ }
+
+ /**
+ * Extract user ids from search results
+ *
+ * @param results
+ * @return
+ */
+ protected List unwrap(ReportedData results) {
+ List rval = new ArrayList();
+ Iterator rows = results.getRows();
+ while (rows.hasNext()) {
+ Row row = (Row) rows.next();
+ Iterator> jids = row.getValues(JABBER_ID_COLUMN);
+ Iterator> names = row.getValues(NAME_COLUMN);
+ while (jids.hasNext() && names.hasNext()) {
+ String jid = (String) jids.next();
+ UserId id = IDConverter.convertFrom(jid);
+ id.setAlias((String) names.next());
+ rval.add(id);
+ }
+ if (jids.hasNext() || names.hasNext()) {
+ log.warn("Search results had unmatched number of names and ids");
+ }
+ }
+ return rval;
+ }
+
+ /**
+ * @return fully qualified service name
+ */
+ private String getSearchServiceName() {
+ return SEARCH_SERVICE_PREFIX + connection.getServiceName();
+ }
+
+ /**
+ * @return fields for user search
+ * @throws XMPPException
+ */
+ public String[] getUserPropertiesFields() throws XMPPException {
+ String serviceName = getSearchServiceName();
+ Form searchForm = searchManager.getSearchForm(serviceName);
+
+ Set fields = new HashSet();
+ Iterator userProperties = searchForm.getFields();
+ while (userProperties.hasNext()) {
+ FormField field = (FormField) userProperties.next();
+ String variable = field.getVariable();
+ // ignore these fields
+ if (!variable.equalsIgnoreCase(FORM_TYPE)
+ && !variable.equalsIgnoreCase(SEARCH_ACTION))
+ fields.add(variable);
+ }
+ return (String[]) fields.toArray(new String[0]);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java
index cdfcff26b5..ce6c54b569 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java
+++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java
@@ -19,10 +19,10 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
-import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueId;
+import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
- * TODO Add Description
+ * Qualified id for a venue
*
*
*
@@ -38,14 +38,12 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueId;
* @version 1.0
*/
-public class VenueId implements IVenueId {
+public class VenueId implements IQualifiedID {
private String host;
private String resource;
- private String venueName;
-
private String name;
/**
@@ -84,9 +82,8 @@ public class VenueId implements IVenueId {
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.ID#setName(java.lang.String)
*/
@Override
- public void setName(String userName) {
- name = userName;
- venueName = name;
+ public void setName(String venueName) {
+ name = venueName;
}
/**
@@ -102,15 +99,8 @@ public class VenueId implements IVenueId {
*/
@Override
public String getFQName() {
+ // FIXME
return null;
}
- /**
- * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueId#getVenueName()
- */
- @Override
- public String getVenueName() {
- return venueName;
- }
-
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration.display/META-INF/MANIFEST.MF
index 1e0291e541..dfa42bf837 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.collaboration.display/META-INF/MANIFEST.MF
@@ -12,7 +12,6 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core,
com.raytheon.viz.ui,
org.eclipse.ui,
- org.eclipse.ecf,
com.raytheon.uf.viz.collaboration.comm,
com.raytheon.uf.common.colormap,
com.raytheon.uf.viz.remote.graphics,
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/ParticipantEventController.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/ParticipantEventController.java
index 849bf891d9..d61fdf6894 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/ParticipantEventController.java
+++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/ParticipantEventController.java
@@ -21,7 +21,12 @@ package com.raytheon.uf.viz.collaboration.display.roles;
import org.eclipse.ui.PartInitException;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
+import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditorInput;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.viz.ui.VizWorkbenchManager;
@@ -46,6 +51,9 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
public class ParticipantEventController extends
AbstractRoleEventController {
+ private final IUFStatusHandler statusHandler = UFStatus.getHandler(this
+ .getClass());
+
public ParticipantEventController(ISharedDisplaySession session) {
super(session);
}
@@ -59,9 +67,17 @@ public class ParticipantEventController extends
*/
@Override
protected ICollaborationEditor createDisplayContainer() {
+ String desc;
+ try {
+ IVenueInfo info = session.getVenue().getInfo();
+ desc = info.getVenueDescription();
+ } catch (CollaborationException e1) {
+ statusHandler
+ .handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
+ desc = session.getVenue().getName();
+ }
CollaborationEditorInput input = new CollaborationEditorInput(
- session.getSessionId(), session.getVenue().getInfo()
- .getVenueDescription());
+ session.getSessionId(), desc);
try {
return (ICollaborationEditor) VizWorkbenchManager.getInstance()
.getCurrentWindow().getActivePage()
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java
index ca4bcdc6d9..161c240253 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java
+++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java
@@ -36,9 +36,12 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import com.google.common.eventbus.Subscribe;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
+import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
@@ -90,6 +93,8 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
public class SharedEditorsManager implements IRemoteDisplayContainer {
+ private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
+
public class RemoteDisplayEventHandler {
@Subscribe
public void remoteDisplayRequested(RemoteDisplayRequested event) {
@@ -443,8 +448,15 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
private SharedEditorsManager(ISharedDisplaySession session) {
this.session = session;
session.registerEventHandler(eventHandler);
- editorTitleSuffix = " ("
- + session.getVenue().getInfo().getVenueDescription() + ")";
+ String title;
+ try {
+ IVenueInfo info = session.getVenue().getInfo();
+ title = info.getVenueDescription();
+ } catch (CollaborationException e) {
+ log.error("Unable to get venue information", e);
+ title = session.getVenue().getName();
+ }
+ editorTitleSuffix = " (" + title + ")";
}
public int getDisplayId(IRenderableDisplay display) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/rsc/DataProviderRsc.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/rsc/DataProviderRsc.java
index 138b856611..082c32ba8e 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/rsc/DataProviderRsc.java
+++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/rsc/DataProviderRsc.java
@@ -85,9 +85,16 @@ public class DataProviderRsc extends
if (container != null) {
session = container.getSession();
colorManager = container.getColorManager();
- IVenueInfo info = session.getVenue().getInfo();
- roomName = info.getVenueDescription();
- subject = info.getVenueSubject();
+ IVenueInfo info;
+ try {
+ info = session.getVenue().getInfo();
+ roomName = info.getVenueDescription();
+ subject = info.getVenueSubject();
+ } catch (CollaborationException e) {
+ statusHandler.error(e.getLocalizedMessage(), e);
+ roomName = session.getVenue().getName();
+ }
+
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java
index d51c57a9bc..1e180b2ecf 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java
+++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java
@@ -287,6 +287,7 @@ public class CollaborationDrawingResource extends
event.setType(lockingDrawing ? CollaborationEventType.LOCK_USERS
: CollaborationEventType.UNLOCK_USERS);
sendEvent(event);
+ handleDrawEvent(event);
}
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingToolLayer.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingToolLayer.java
index da2a48347e..75a399efe7 100644
--- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingToolLayer.java
+++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingToolLayer.java
@@ -153,6 +153,7 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
event.setCoordinates(new ArrayList(coordinates));
resource.sendEvent(event);
coordinates.clear();
+ resource.handleDrawEvent(event);
}
private void sendSimpleEvent(CollaborationEventType type) {
@@ -161,6 +162,7 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
event.setType(type);
event.setUserName(resource.getMyUser());
resource.sendEvent(event);
+ resource.handleDrawEvent(event);
}
public Stack> getUndoStack() {
diff --git a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml
index 36e33b2ec2..c16fe0ed5c 100644
--- a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml
+++ b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml
@@ -31,62 +31,6 @@
version="0.0.0"
unpack="false"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ unpack="true"/>
*
@@ -381,43 +382,15 @@ public class CollaborationGroupView extends CaveFloatingView implements
manager.add(new ShowVenueAction((IVenueSession) o));
manager.add(new ArchiveViewerAction((IVenueSession) o));
return;
+ } else if (o instanceof RosterEntry) {
+ RosterEntry entry = (RosterEntry) o;
+ UserId user = IDConverter.convertFrom(entry);
+ fillContextMenu(manager, selection, user);
} else if (o instanceof UserId) {
- createMenu(manager);
- return;
- }
-
- // the user, both the logged in user as well as his buddies
- if (o instanceof IUser) {
- IUser user = (IUser) o;
- IPresence presence = CollaborationConnection.getConnection()
- .getContactsManager().getPresence(user);
- if (presence != null && presence.getType() == Type.AVAILABLE) {
- Action inviteAction = new InviteAction(user);
- if (inviteAction.isEnabled()) {
- manager.add(inviteAction);
- }
- Action p2pAction = new PeerToPeerChatAction(user);
- if (p2pAction.isEnabled()) {
- manager.add(p2pAction);
- }
- manager.add(new Separator());
- manager.add(createSessionAction);
- }
- String name = CollaborationConnection.getConnection()
- .getContactsManager().getDisplayName(user);
- aliasAction.setId(name);
- aliasAction.setText("Alias");
- manager.add(aliasAction);
- manager.add(new ArchiveViewerAction(user));
- manager.add(new AddToGroupAction(getSelectedUsers()));
- String groupName = null;
- Object group = selection.getPaths()[0].getFirstSegment();
- if (group instanceof LocalGroup) {
- groupName = ((LocalGroup) group).getName();
- manager.add(new RemoveFromGroupAction(groupName,
- getSelectedUsers()));
- }
- } else if (o instanceof IRosterGroup || o instanceof LocalGroup) {
+ // the user, both the logged in user as well as his buddies
+ UserId user = (UserId) o;
+ fillContextMenu(manager, selection, user);
+ } else if (o instanceof RosterGroup || o instanceof LocalGroup) {
manager.add(createSessionAction);
if (o instanceof LocalGroup) {
LocalGroup group = (LocalGroup) o;
@@ -428,6 +401,45 @@ public class CollaborationGroupView extends CaveFloatingView implements
}
}
}
+
+ private void fillContextMenu(IMenuManager manager, TreeSelection selection,
+ UserId user) {
+ CollaborationConnection connection = CollaborationConnection
+ .getConnection();
+ UserId me = connection.getUser();
+ if (me.isSameUser(user)) {
+ createMenu(manager);
+ return;
+ }
+
+ Presence presence = CollaborationConnection.getConnection()
+ .getContactsManager().getPresence(user);
+ if (presence != null && presence.getType() == Type.available) {
+ Action inviteAction = new InviteAction(user);
+ if (inviteAction.isEnabled()) {
+ manager.add(inviteAction);
+ }
+ Action p2pAction = new PeerToPeerChatAction(user);
+ if (p2pAction.isEnabled()) {
+ manager.add(p2pAction);
+ }
+ manager.add(new Separator());
+ manager.add(createSessionAction);
+ }
+ String name = CollaborationConnection.getConnection()
+ .getContactsManager().getDisplayName(user);
+ aliasAction.setId(name);
+ aliasAction.setText("Alias");
+ manager.add(aliasAction);
+ manager.add(new ArchiveViewerAction(user));
+ manager.add(new AddToGroupAction(getSelectedUsers()));
+ String groupName = null;
+ Object group = selection.getPaths()[0].getFirstSegment();
+ if (group instanceof LocalGroup) {
+ groupName = ((LocalGroup) group).getName();
+ manager.add(new RemoveFromGroupAction(groupName, getSelectedUsers()));
+ }
+ }
private void addDoubleClickListeners() {
usersTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
@@ -436,8 +448,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
TreeSelection selection = (TreeSelection) usersTreeViewer
.getSelection();
Object o = selection.getFirstElement();
- if (o instanceof IUser) {
- new PeerToPeerChatAction((IUser) o).run();
+ if (o instanceof UserId) {
+ new PeerToPeerChatAction((UserId) o).run();
} else if (o instanceof IVenueSession) {
new ShowVenueAction((IVenueSession) o).run();
}
@@ -523,10 +535,9 @@ public class CollaborationGroupView extends CaveFloatingView implements
}
protected void changeText(Object selectedObj, String newText) {
- if (selectedObj instanceof IUser) {
- IUser user = (IUser) selectedObj;
- UserId id = IDConverter.convertFrom(user);
- id.setAlias(treeEditor.getItem().getText());
+ if (selectedObj instanceof UserId) {
+ UserId user = (UserId) selectedObj;
+ user.setAlias(newText);
CollaborationConnection.getConnection().getContactsManager()
.setNickname(user, newText);
CollaborationConnection.getConnection().postEvent(user);
@@ -719,31 +730,31 @@ public class CollaborationGroupView extends CaveFloatingView implements
*
* @return
*/
- public IUser[] getSelectedUsers() {
- Set selectedUsers = new HashSet();
+ public UserId[] getSelectedUsers() {
+ Set selectedUsers = new HashSet();
IStructuredSelection selection = (IStructuredSelection) usersTreeViewer
.getSelection();
Object[] nodes = selection.toArray();
for (Object node : nodes) {
- if (node instanceof IUser) {
- IUser user = (IUser) node;
+ if (node instanceof UserId) {
+ UserId user = (UserId) node;
selectedUsers.add(user);
- } else if (node instanceof IRosterGroup) {
- selectedUsers.addAll(getSelectedUsers((IRosterGroup) node));
+ } else if (node instanceof RosterGroup) {
+ selectedUsers.addAll(getSelectedUsers((RosterGroup) node));
} else if (node instanceof LocalGroup) {
- for (IUser user : ((LocalGroup) node).getUsers()) {
- IPresence presence = CollaborationConnection
+ for (UserId user : ((LocalGroup) node).getUsers()) {
+ Presence presence = CollaborationConnection
.getConnection().getContactsManager()
.getPresence(user);
- if (presence.getType() == IPresence.Type.AVAILABLE) {
+ if (presence.getType() == Presence.Type.available) {
selectedUsers.add(user);
}
}
}
}
- return selectedUsers.toArray(new IUser[selectedUsers.size()]);
+ return selectedUsers.toArray(new UserId[selectedUsers.size()]);
}
/**
@@ -753,16 +764,15 @@ public class CollaborationGroupView extends CaveFloatingView implements
* @param groupNode
* @return users
*/
- private Set getSelectedUsers(IRosterGroup groupNode) {
- Set selectedUsers = new HashSet();
- for (Object node : groupNode.getEntries()) {
- if (node instanceof IRosterEntry) {
- IRosterEntry user = (IRosterEntry) node;
- if (user.getPresence().getType() == Type.AVAILABLE) {
- selectedUsers.add(((IRosterEntry) node).getUser());
- }
- } else if (node instanceof IRosterGroup) {
- selectedUsers.addAll(getSelectedUsers((IRosterGroup) node));
+ private Set getSelectedUsers(RosterGroup groupNode) {
+ Set selectedUsers = new HashSet();
+ ContactsManager contacts = CollaborationConnection.getConnection()
+ .getContactsManager();
+ for (RosterEntry node : groupNode.getEntries()) {
+ UserId user = IDConverter.convertFrom(node);
+ Presence presence = contacts.getPresence(user);
+ if (presence.getType() == Type.available) {
+ selectedUsers.add(user);
}
}
return selectedUsers;
@@ -853,12 +863,12 @@ public class CollaborationGroupView extends CaveFloatingView implements
}
@Override
- public void userAdded(LocalGroup group, IUser user) {
+ public void userAdded(LocalGroup group, UserId user) {
refreshUsersTreeViewerAsync(group);
}
@Override
- public void userDeleted(LocalGroup group, IUser user) {
+ public void userDeleted(LocalGroup group, UserId user) {
refreshUsersTreeViewerAsync(group);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationUtils.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationUtils.java
index c1980a9db9..b9a84024d4 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationUtils.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationUtils.java
@@ -25,8 +25,9 @@ import java.util.List;
import javax.xml.bind.JAXB;
-import org.eclipse.ecf.presence.IPresence.Mode;
import org.eclipse.swt.graphics.Image;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@@ -66,10 +67,8 @@ public class CollaborationUtils {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CollaborationUtils.class);
- public static final org.eclipse.ecf.presence.IPresence.Mode[] statusModes = {
- Mode.AVAILABLE, Mode.DND, Mode.AWAY };
-
- private static final String PREFIX_CONFERENCE = "conference.";
+ public static final Presence.Mode[] statusModes = { Mode.available,
+ Mode.dnd, Mode.away };
/**
* Get an image associated with the node.
@@ -103,19 +102,23 @@ public class CollaborationUtils {
}
public static String formatMode(Mode mode) {
- String name = mode.toString();
-
- StringBuilder result = new StringBuilder(name.length());
- String[] words = name.split("\\s");
- for (int i = 0, l = words.length; i < l; ++i) {
- if (i > 0)
- result.append(" ");
- result.append(Character.toUpperCase(words[i].charAt(0))).append(
- words[i].substring(1));
-
+ if (mode == null) {
+ mode = Mode.available;
+ }
+ switch (mode) {
+ case available:
+ return "Available";
+ case away:
+ return "Away";
+ case chat:
+ return "Chat";
+ case dnd:
+ return "Do Not Disturb";
+ case xa:
+ return "Extended Away";
+ default:
+ return mode.toString();
}
-
- return result.toString();
}
public static List getAlertWords() {
@@ -178,4 +181,5 @@ public class CollaborationUtils {
"Unable to save alert words to localization", e);
}
}
+
}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java
index 1f85a878a6..a1093405d1 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java
@@ -19,7 +19,6 @@
**/
package com.raytheon.uf.viz.collaboration.ui;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -44,6 +43,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
@@ -232,9 +232,9 @@ public class ConnectionSubscriber {
public void run() {
IQualifiedID peer = message.getFrom();
- IUser user = null;
- if (peer instanceof IUser) {
- user = (IUser) peer;
+ UserId user = null;
+ if (peer instanceof UserId) {
+ user = (UserId) peer;
} else {
user = CollaborationConnection.getConnection()
.getContactsManager().getUser(peer.getFQName());
@@ -259,7 +259,7 @@ public class ConnectionSubscriber {
.getBoolean(
CollabPrefConstants.HttpCollaborationConfiguration.P_SESSION_CONFIGURED);
boolean configured = false;
- if ((configurationEvent.getHttpdCollaborationURL() == null) == false) {
+ if (configurationEvent.getHttpdCollaborationURL() != null) {
// Add the httpd collaboration url to the CAVE configuration.
Activator
.getDefault()
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java
index bb6f66cb34..43208fcf33 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java
@@ -55,6 +55,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
+import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.ISharedEditorsManagerListener;
@@ -475,8 +476,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
String err = null;
if (name.length() <= 0) {
err = "Must have session name.";
- } else if (false) {
- // TODO Above else make it a test for invalid characters.
+ } else if (!Tools.isValidId(name)) {
err = "Name contains invalid characters.";
} else {
Collection info = CollaborationConnection
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/IUserSelector.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/IUserSelector.java
index b6a153993c..3fbc82f578 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/IUserSelector.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/IUserSelector.java
@@ -19,7 +19,7 @@
**/
package com.raytheon.uf.viz.collaboration.ui;
-import org.eclipse.ecf.core.user.IUser;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/**
* Defines method for retrieving selected users.
@@ -40,6 +40,6 @@ import org.eclipse.ecf.core.user.IUser;
public interface IUserSelector {
- public IUser[] getSelectedUsers();
+ public UserId[] getSelectedUsers();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UserSearchDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UserSearchDialog.java
index 9958aa92eb..c1e10eb941 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UserSearchDialog.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UserSearchDialog.java
@@ -24,14 +24,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.presence.search.ICriteria;
-import org.eclipse.ecf.presence.search.ICriterion;
-import org.eclipse.ecf.presence.search.IResult;
-import org.eclipse.ecf.presence.search.ISearch;
-import org.eclipse.ecf.presence.search.IUserSearchManager;
-import org.eclipse.ecf.presence.search.UserSearchException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -57,11 +49,14 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+import org.jivesoftware.smack.XMPPException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserSearch;
import com.raytheon.uf.viz.collaboration.ui.actions.AddToGroupAction;
import com.raytheon.uf.viz.collaboration.ui.actions.CreateSessionAction;
import com.raytheon.uf.viz.collaboration.ui.actions.InviteAction;
@@ -78,6 +73,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 27, 2012 bsteffen Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -129,16 +125,16 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
});
- IUserSearchManager manager = CollaborationConnection.getConnection()
- .getPresenceContainerAdapter().getUserSearchManager();
+ UserSearch search = CollaborationConnection.getConnection()
+ .createSearch();
fieldCombo = new Combo(entryComp, SWT.DROP_DOWN | SWT.READ_ONLY);
fieldCombo.add("All");
try {
- for (String field : manager.getUserPropertiesFields()) {
+ for (String field : search.getUserPropertiesFields()) {
fieldCombo.add(field);
}
fieldCombo.select(0);
- } catch (ECFException e1) {
+ } catch (XMPPException e1) {
statusHandler
.handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
}
@@ -216,9 +212,9 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
if (selection == null || selection.length == 0) {
return;
}
- IUser[] users = new IUser[selection.length];
+ UserId[] users = new UserId[selection.length];
for (int i = 0; i < users.length; i += 1) {
- users[i] = (IUser) selection[i].getData();
+ users[i] = (UserId) selection[i].getData();
}
if (users.length == 1) {
Action p2pAction = new PeerToPeerChatAction(users[0]);
@@ -239,7 +235,7 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
}
private void search() {
- List results = new ArrayList();
+ List results = new ArrayList();
List keys = new ArrayList();
if (fieldCombo.getText().equals("All")) {
for (String string : fieldCombo.getItems()) {
@@ -251,22 +247,13 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
keys.add(fieldCombo.getText());
}
for (String key : keys) {
- IUserSearchManager manager = CollaborationConnection
- .getConnection().getPresenceContainerAdapter()
- .getUserSearchManager();
- ICriterion criterion = manager.createRestriction().eq(key,
- searchText.getText(), true);
- ICriteria criteria = manager.createCriteria();
- criteria.add(criterion);
+ UserSearch search = CollaborationConnection.getConnection()
+ .createSearch();
try {
- ISearch search = manager.search(criteria);
- for (Object result : search.getResultList().getResults()) {
- if (result instanceof IResult) {
- IUser user = ((IResult) result).getUser();
- results.add(user);
- }
- }
- } catch (UserSearchException e) {
+ List users = search.byCriteria(key,
+ searchText.getText());
+ results.addAll(users);
+ } catch (XMPPException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
@@ -274,11 +261,15 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
Set uniqueIds = new HashSet();
resultTable.removeAll();
if (results.size() > 0) {
- for (IUser user : results) {
- String id = user.getID().getName();
+ for (UserId user : results) {
+ String id = user.getNormalizedId();
if (!uniqueIds.contains(id)) {
TableItem ti = new TableItem(resultTable, SWT.NONE);
- ti.setText(0, user.getName());
+ String fullName = user.getAlias();
+ if (fullName == null || fullName.isEmpty()) {
+ fullName = user.getName();
+ }
+ ti.setText(0, fullName);
ti.setText(1, id);
ti.setData(user);
uniqueIds.add(id);
@@ -293,18 +284,18 @@ public class UserSearchDialog extends CaveSWTDialog implements IUserSelector {
}
@Override
- public IUser[] getSelectedUsers() {
- Set selectedUsers = new HashSet();
+ public UserId[] getSelectedUsers() {
+ Set selectedUsers = new HashSet();
TableItem[] selection = resultTable.getSelection();
if (selection != null && selection.length > 0) {
- IUser[] users = new IUser[selection.length];
+ UserId[] users = new UserId[selection.length];
for (int i = 0; i < users.length; i += 1) {
- IUser user = (IUser) selection[i].getData();
+ UserId user = (UserId) selection[i].getData();
selectedUsers.add(user);
}
}
- return selectedUsers.toArray(new IUser[selectedUsers.size()]);
+ return selectedUsers.toArray(new UserId[selectedUsers.size()]);
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeContentProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeContentProvider.java
index 4e62d7810f..f332528f0a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeContentProvider.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeContentProvider.java
@@ -24,15 +24,15 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.roster.IRosterEntry;
-import org.eclipse.ecf.presence.roster.IRosterGroup;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationGroupContainer;
@@ -48,6 +48,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -115,31 +116,29 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
if (parentElement instanceof SessionGroupContainer) {
SessionGroupContainer cont = (SessionGroupContainer) parentElement;
return cont.getObjects().toArray();
- } else if (parentElement instanceof IRosterGroup) {
- IRosterGroup group = (IRosterGroup) parentElement;
- List result = new ArrayList();
+ } else if (parentElement instanceof RosterGroup) {
+ RosterGroup group = (RosterGroup) parentElement;
+ List result = new ArrayList();
UserId localUser = CollaborationConnection.getConnection()
.getUser();
- Collection> entries = group.getEntries();
+ Collection entries = group.getEntries();
synchronized (entries) {
- entries = new ArrayList(entries);
+ entries = new ArrayList(entries);
}
- for (Object obj : entries) {
- if (obj instanceof IRosterEntry) {
- IUser user = ((IRosterEntry) obj).getUser();
- if (!localUser.isSameUser(user.getID().getName())) {
- result.add(user);
- }
+ for (RosterEntry entry : entries) {
+ String user = entry.getUser();
+ if (!localUser.isSameUser(user)) {
+ result.add(IDConverter.convertFrom(entry));
}
}
return result.toArray();
} else if (parentElement instanceof LocalGroup) {
- List result = new ArrayList();
+ List result = new ArrayList();
LocalGroup group = (LocalGroup) parentElement;
UserId localUser = CollaborationConnection.getConnection()
.getUser();
- for (IUser user : group.getUsers()) {
- if (!localUser.isSameUser(user.getID().getName())) {
+ for (UserId user : group.getUsers()) {
+ if (!localUser.isSameUser(user.getNormalizedId())) {
result.add(user);
}
}
@@ -171,21 +170,19 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
@Override
public boolean hasChildren(Object element) {
boolean hasChildren = false;
- if (element instanceof IRosterGroup) {
- IRosterGroup group = (IRosterGroup) element;
+ if (element instanceof RosterGroup) {
+ RosterGroup group = (RosterGroup) element;
UserId localUser = CollaborationConnection.getConnection()
.getUser();
- Collection> entries = group.getEntries();
+ Collection entries = group.getEntries();
synchronized (entries) {
- entries = new ArrayList(entries);
+ entries = new ArrayList(entries);
}
- for (Object obj : entries) {
- if (obj instanceof IRosterEntry) {
- IUser user = ((IRosterEntry) obj).getUser();
- if (!localUser.isSameUser(user.getID().getName())) {
- hasChildren = true;
- break;
- }
+ for (RosterEntry entry : entries) {
+ String user = entry.getUser();
+ if (!localUser.isSameUser(user)) {
+ hasChildren = true;
+ break;
}
}
} else if (element instanceof SessionGroupContainer) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeFilter.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeFilter.java
index c5e6e180eb..0242305950 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeFilter.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeFilter.java
@@ -19,7 +19,6 @@
**/
package com.raytheon.uf.viz.collaboration.ui;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
@@ -64,7 +63,7 @@ public class UsersTreeFilter extends ViewerFilter {
if (labelText.equals(currentText)) {
viewer.setSelection(new StructuredSelection(element));
}
- if (element instanceof IUser && !(element instanceof UserId)) {
+ if (element instanceof UserId) {
String[] words = getWords(currentText);
for (String word : words) {
if (!labelText.toUpperCase().contains(word.toUpperCase())) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java
index 65b40dc5c9..65a3964d55 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java
@@ -25,9 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.roster.IRosterGroup;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.SWT;
@@ -35,10 +32,15 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterGroup;
+import org.jivesoftware.smack.packet.Presence;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
-import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
@@ -54,6 +56,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -62,18 +65,17 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
*/
public class UsersTreeLabelProvider extends ColumnLabelProvider {
+ private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
+
private AbstractUserLabelProvider userLabelProvider = new AbstractUserLabelProvider() {
@Override
- protected IPresence getPresence(IUser user) {
+ protected Presence getPresence(UserId user) {
CollaborationConnection connection = CollaborationConnection
.getConnection();
if (connection == null) {
return null;
}
- if (user instanceof UserId) {
- return connection.getPresence();
- }
return connection.getContactsManager().getPresence(user);
}
};
@@ -95,9 +97,9 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
return null;
}
String key = "";
- if (element instanceof IUser) {
+ if (element instanceof UserId) {
return userLabelProvider.getImage(element);
- } else if (element instanceof IRosterGroup) {
+ } else if (element instanceof RosterGroup) {
key = "group";
} else if (element instanceof IVenueSession) {
// key = "session_group";
@@ -115,46 +117,45 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
@Override
public String getText(Object element) {
- if (element instanceof IRosterGroup) {
- return ((IRosterGroup) element).getName();
+ if (element instanceof RosterGroup) {
+ return ((RosterGroup) element).getName();
+ } else if (element instanceof RosterEntry) {
+ return ((RosterEntry) element).getName();
} else if (element instanceof SessionGroupContainer) {
return "Active Sessions";
} else if (element instanceof UserId) {
UserId user = (UserId) element;
- IPresence presence = userLabelProvider.getPresence(user);
- String fullName = user.getName();
- if (presence != null) {
- if (presence.getProperties() != null) {
- Object site = presence.getProperties().get(
- SiteConfigInformation.SITE_NAME);
- if (site != null && !site.toString().isEmpty()) {
- fullName += " - " + site;
- }
- Object role = presence.getProperties().get(
- SiteConfigInformation.ROLE_NAME);
- if (role != null && !role.toString().isEmpty()) {
- fullName += " - " + role;
- }
- }
+ String fullname = userLabelProvider.getText(element);
+ CollaborationConnection conn = CollaborationConnection
+ .getConnection();
+ UserId me = conn.getUser();
+ if (me.isSameUser(user)) {
+ // hostname for self
+ fullname += " - " + user.getHost();
}
- return fullName + " - " + user.getHost();
+ return fullname;
} else if (element instanceof IVenueSession) {
- if (((IVenueSession) element).getVenue() == null) {
+ IVenueSession venue = (IVenueSession) element;
+ if (venue.getVenue() == null) {
return null;
}
- return ((IVenueSession) element).getVenue().getInfo()
- .getVenueDescription();
+ IVenueInfo info;
+ try {
+ info = venue.getVenue().getInfo();
+ } catch (CollaborationException e) {
+ log.error("Unable to get session information", e);
+ return null;
+ }
+ return info.getVenueDescription();
} else if (element instanceof LocalGroup) {
return ((LocalGroup) element).getName();
- } else if (element instanceof IUser) {
- return userLabelProvider.getText(element);
}
return null;
}
@Override
public Font getFont(Object element) {
- if (element instanceof IRosterGroup
+ if (element instanceof RosterGroup
|| element instanceof SessionGroupContainer
|| element instanceof LocalGroup) {
// for this case do nothing, as it is not the top level of
@@ -175,14 +176,20 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
@Override
public String getToolTipText(Object element) {
StringBuilder builder = new StringBuilder();
- if (element instanceof IUser) {
+ if (element instanceof UserId) {
return userLabelProvider.getToolTipText(element);
}
// builds the tooltip text for the session group
// portion of the view
else if (element instanceof IVenueSession) {
IVenueSession sessGroup = (IVenueSession) element;
- IVenueInfo info = sessGroup.getVenue().getInfo();
+ IVenueInfo info;
+ try {
+ info = sessGroup.getVenue().getInfo();
+ } catch (CollaborationException e) {
+ log.error("Unable to get session tool tip text", e);
+ return "";
+ }
builder.append("ID: ").append(info.getVenueID());
builder.append("\nName: ").append(info.getVenueDescription())
.append("\n");
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeViewerSorter.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeViewerSorter.java
index 00a2733f6f..dde5f3cde6 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeViewerSorter.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeViewerSorter.java
@@ -20,11 +20,10 @@ package com.raytheon.uf.viz.collaboration.ui;
* further licensing information.
**/
-import org.eclipse.ecf.presence.roster.IRosterEntry;
-import org.eclipse.ecf.presence.roster.IRosterGroup;
-import org.eclipse.ecf.presence.roster.IRosterItem;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
@@ -41,6 +40,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -74,35 +74,34 @@ public class UsersTreeViewerSorter extends ViewerSorter {
}
// Groups before users.
- if (e1 instanceof IRosterGroup) {
- if (!(e2 instanceof IRosterGroup)) {
+ if (e1 instanceof RosterGroup) {
+ if (!(e2 instanceof RosterGroup)) {
return -1;
}
- } else if (e1 instanceof IRosterGroup) {
+ } else if (e1 instanceof RosterGroup) {
return 1;
}
- if (e1 instanceof IRosterItem && e2 instanceof IRosterItem) {
+ if (e1 instanceof RosterEntry && e2 instanceof RosterEntry) {
// Either both are groups or both are users.
- if (e1 instanceof IRosterGroup && e2 instanceof IRosterGroup) {
- return ((IRosterGroup) e1).getName().compareTo(
- ((IRosterGroup) e2).getName());
- } else if (e1 instanceof IRosterEntry && e2 instanceof IRosterEntry) {
+ if (e1 instanceof RosterGroup && e2 instanceof RosterGroup) {
+ return ((RosterGroup) e1).getName().compareTo(
+ ((RosterGroup) e2).getName());
+ } else if (e1 instanceof RosterEntry && e2 instanceof RosterEntry) {
String name;
String otherName;
- IRosterEntry entry = (IRosterEntry) e1;
- IRosterEntry otherEntry = (IRosterEntry) e2;
- if (entry.getUser().getName() != null
- && !entry.getUser().getName().isEmpty()) {
- name = entry.getUser().getName();
- } else {
+ RosterEntry entry = (RosterEntry) e1;
+ RosterEntry otherEntry = (RosterEntry) e2;
+ if (entry.getName() != null && !entry.getName().isEmpty()) {
name = entry.getName();
+ } else {
+ name = entry.getUser();
}
- if (otherEntry.getUser().getName() != null
- && !otherEntry.getUser().getName().isEmpty()) {
- otherName = otherEntry.getUser().getName();
- } else {
+ if (otherEntry.getName() != null
+ && !otherEntry.getName().isEmpty()) {
otherName = otherEntry.getName();
+ } else {
+ otherName = otherEntry.getUser();
}
return name.compareTo(otherName);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/AddToGroupAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/AddToGroupAction.java
index 5926dbe13a..0830ad4fa1 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/AddToGroupAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/AddToGroupAction.java
@@ -22,7 +22,6 @@ package com.raytheon.uf.viz.collaboration.ui.actions;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
@@ -34,6 +33,7 @@ import org.eclipse.swt.widgets.Menu;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.CreateGroupDialog;
import com.raytheon.uf.viz.core.icon.IconUtil;
@@ -59,14 +59,14 @@ public class AddToGroupAction extends Action {
private final String group;
- private final IUser[] users;
+ private final UserId[] users;
/**
* This action will create a menu of groups to which the users will be added
*
* @param users
*/
- public AddToGroupAction(IUser... users) {
+ public AddToGroupAction(UserId... users) {
super("Add To Group...", IconUtil.getImageDescriptor(Activator
.getDefault().getBundle(), "add_group.gif"));
this.users = users;
@@ -74,7 +74,7 @@ public class AddToGroupAction extends Action {
this.setMenuCreator(new MenuCreator());
}
- public AddToGroupAction(String group, IUser... users) {
+ public AddToGroupAction(String group, UserId... users) {
super(group, IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), "local_group.gif"));
this.group = group;
@@ -93,7 +93,7 @@ public class AddToGroupAction extends Action {
return;
}
}
- for (IUser user : users) {
+ for (UserId user : users) {
CollaborationConnection.getConnection().getContactsManager()
.addToLocalGroup(group, user);
}
@@ -127,7 +127,7 @@ public class AddToGroupAction extends Action {
.getConnection().getContactsManager();
List groups = contactsMgr.getLocalGroups();
List usedGroups = new ArrayList(groups);
- for (IUser user : users) {
+ for (UserId user : users) {
usedGroups.retainAll(contactsMgr.getLocalGroups(user));
}
groups.removeAll(usedGroups);
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ArchiveViewerAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ArchiveViewerAction.java
index 6b31f2a7a7..93f2062bd0 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ArchiveViewerAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ArchiveViewerAction.java
@@ -19,7 +19,6 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
@@ -28,7 +27,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
-import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
@@ -67,16 +65,16 @@ public class ArchiveViewerAction extends Action {
setEnabled(CollaborationConnection.getConnection() != null);
}
- public ArchiveViewerAction(IUser user) {
+ public ArchiveViewerAction(UserId user) {
super("View Log...", IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), "log.gif"));
- sessionName = Tools.parseName(user.getID().getName());
+ sessionName = user.getName();
}
public ArchiveViewerAction(IVenueSession session) {
super("View Log...", IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), "log.gif"));
- sessionName = session.getVenue().getInfo().getVenueDescription();
+ sessionName = session.getVenue().getName();
}
@Override
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeRoleAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeRoleAction.java
index 60faac007d..0a69144cb1 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeRoleAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeRoleAction.java
@@ -19,15 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import java.util.Map;
-
-import org.eclipse.ecf.presence.IPresence;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -72,10 +70,10 @@ public class ChangeRoleAction extends Action {
public ChangeRoleAction(String role) {
super(role, Action.AS_RADIO_BUTTON);
this.role = role;
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getPresence();
- String currentRole = (String) presence.getProperties().get(
- SiteConfigInformation.ROLE_NAME);
+ String currentRole = (String) presence
+ .getProperty(SiteConfigInformation.ROLE_NAME);
if (role.equals(currentRole)) {
setChecked(true);
}
@@ -89,10 +87,8 @@ public class ChangeRoleAction extends Action {
CollaborationConnection connection = CollaborationConnection
.getConnection();
- IPresence presence = connection.getPresence();
- @SuppressWarnings("unchecked")
- Map props = presence.getProperties();
- props.put(SiteConfigInformation.ROLE_NAME, role);
+ Presence presence = connection.getPresence();
+ presence.setProperty(SiteConfigInformation.ROLE_NAME, role);
try {
connection.getAccountManager().sendPresence(presence);
@@ -128,10 +124,10 @@ public class ChangeRoleAction extends Action {
private void fill() {
SiteConfigInformation siteInfo = SiteConfigurationManager
.getSiteConfigInformation();
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getPresence();
- String currentSite = (String) presence.getProperties().get(
- SiteConfigInformation.SITE_NAME);
+ String currentSite = (String) presence
+ .getProperty(SiteConfigInformation.SITE_NAME);
for (SiteConfig config : siteInfo.getConfig()) {
if (config.getSite().equals(currentSite)) {
for (String role : config.getRoles()) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeSiteAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeSiteAction.java
index 639b92c552..9f1d341798 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeSiteAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeSiteAction.java
@@ -19,15 +19,13 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import java.util.Map;
-
-import org.eclipse.ecf.presence.IPresence;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -73,9 +71,10 @@ public class ChangeSiteAction extends Action {
public ChangeSiteAction(String site) {
super(site, Action.AS_RADIO_BUTTON);
this.site = site;
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getPresence();
- String currentSite = (String) presence.getProperties().get(
+ String currentSite = (String) presence
+ .getProperty(
SiteConfigInformation.SITE_NAME);
if (site.equals(currentSite)) {
setChecked(true);
@@ -90,10 +89,8 @@ public class ChangeSiteAction extends Action {
CollaborationConnection connection = CollaborationConnection
.getConnection();
- IPresence presence = connection.getPresence();
- @SuppressWarnings("unchecked")
- Map props = presence.getProperties();
- props.put(SiteConfigInformation.SITE_NAME, site);
+ Presence presence = connection.getPresence();
+ presence.setProperty(SiteConfigInformation.SITE_NAME, site);
// now need to send the new subscribe list out to those who are
// listening for it
SubscribeList list = new SubscribeList();
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusAction.java
index 93cc01f0bd..b5ca4e548a 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusAction.java
@@ -19,20 +19,20 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Mode;
-import org.eclipse.ecf.presence.Presence;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
+import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
@@ -76,7 +76,7 @@ public class ChangeStatusAction extends Action {
+ ".gif";
setImageDescriptor(IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), iconName));
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getPresence();
if (mode.equals(presence.getMode())) {
setChecked(true);
@@ -91,12 +91,12 @@ public class ChangeStatusAction extends Action {
CollaborationConnection connection = CollaborationConnection
.getConnection();
- IPresence presence = connection.getPresence();
- presence = new Presence(presence.getType(), presence.getStatus(), mode,
- presence.getProperties());
-
+ Presence presence = connection.getPresence();
+ Presence newPresence = new Presence(presence.getType(),
+ presence.getStatus(), presence.getPriority(), mode);
+ Tools.copyProperties(presence, newPresence);
try {
- connection.getAccountManager().sendPresence(presence);
+ connection.getAccountManager().sendPresence(newPresence);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, "Error sending presence", e);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusMessageAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusMessageAction.java
index c597fc0c50..f6d49ed67e 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusMessageAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ChangeStatusMessageAction.java
@@ -19,15 +19,15 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.Presence;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.widgets.Display;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
+import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.login.ChangeStatusDialog;
@@ -71,12 +71,13 @@ public class ChangeStatusMessageAction extends Action {
CollaborationConnection connection = CollaborationConnection
.getConnection();
- IPresence presence = connection.getPresence();
- presence = new Presence(presence.getType(), msg, presence.getMode(),
- presence.getProperties());
+ Presence presence = connection.getPresence();
+ Presence newPresence = new Presence(presence.getType(), msg,
+ presence.getPriority(), presence.getMode());
+ Tools.copyProperties(presence, newPresence);
try {
- connection.getAccountManager().sendPresence(presence);
+ connection.getAccountManager().sendPresence(newPresence);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, "Error sending presence", e);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateGroupAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateGroupAction.java
index bcbe35b6dc..8b1a893578 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateGroupAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateGroupAction.java
@@ -19,11 +19,11 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.CreateGroupDialog;
import com.raytheon.uf.viz.core.icon.IconUtil;
@@ -48,16 +48,16 @@ import com.raytheon.uf.viz.core.icon.IconUtil;
public class CreateGroupAction extends Action {
- private final IUser[] users;
+ private final UserId[] users;
public CreateGroupAction() {
super("Create Group", IconUtil.getImageDescriptor(Activator
.getDefault().getBundle(), "add_group.gif"));
- this.users = new IUser[0];
+ this.users = new UserId[0];
setEnabled(CollaborationConnection.getConnection() != null);
}
- public CreateGroupAction(IUser... users) {
+ public CreateGroupAction(UserId... users) {
super("New Group...", IconUtil.getImageDescriptor(Activator
.getDefault().getBundle(), "add_group.gif"));
this.users = users;
@@ -72,7 +72,7 @@ public class CreateGroupAction extends Action {
if (group == null) {
return;
}
- for (IUser user : users) {
+ for (UserId user : users) {
CollaborationConnection.getConnection().getContactsManager()
.addToLocalGroup(group, user);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateSessionAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateSessionAction.java
index d76fa8dc9b..9d32d653c9 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateSessionAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/CreateSessionAction.java
@@ -19,7 +19,6 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Display;
@@ -30,7 +29,9 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
+import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.CreateSessionData;
import com.raytheon.uf.viz.collaboration.ui.CreateSessionDialog;
@@ -114,13 +115,14 @@ public class CreateSessionAction extends Action {
try {
if (result.isInviteUsers() && userSelection != null) {
- IUser[] users = userSelection.getSelectedUsers();
+ UserId[] users = userSelection.getSelectedUsers();
if (users.length > 0) {
- InviteAction invite = new InviteAction(
- (IVenueSession) CollaborationConnection
- .getConnection().getSession(sessionId),
- users);
+ IVenueSession session = (IVenueSession) CollaborationConnection
+ .getConnection().getSession(sessionId);
+ IVenueInfo info = session.getVenue().getInfo();
+ InviteAction invite = new InviteAction(session,
+ info.getVenueDescription(), users);
invite.setInviteMessage(result.getInviteMessage());
invite.run();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java
index 283887e690..0fcf2830b0 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java
@@ -92,8 +92,8 @@ public class DisplayFeedAction extends Action {
String sessionId = null;
for (ISession session : connection.getSessions()) {
if (session instanceof IVenueSession) {
- if (((IVenueSession) session).getVenue().getInfo()
- .getVenueName().startsWith(FEED_VENUE)) {
+ if (((IVenueSession) session).getVenue().getName()
+ .startsWith(FEED_VENUE)) {
sessionId = session.getSessionId();
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/InviteAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/InviteAction.java
index 0c40a914a3..11706757d2 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/InviteAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/InviteAction.java
@@ -24,15 +24,14 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Type;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -45,7 +44,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
@@ -59,6 +57,7 @@ import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2012 bsteffen Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -71,13 +70,13 @@ public class InviteAction extends Action {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(InviteAction.class);
- private final IUser[] users;
+ private final UserId[] users;
private final IVenueSession session;
private String inviteMessage;
- public InviteAction(IUser... users) {
+ public InviteAction(UserId... users) {
super("Invite...");
this.users = users;
this.session = null;
@@ -87,8 +86,9 @@ public class InviteAction extends Action {
setMenuCreator(new MenuCreator());
}
- public InviteAction(IVenueSession session, IUser... users) {
- super(session.getVenue().getInfo().getVenueDescription());
+ public InviteAction(IVenueSession session, String description,
+ UserId... users) {
+ super(description);
this.users = users;
this.session = session;
this.setToolTipText("Invite selected user(s) to join a session.");
@@ -117,12 +117,11 @@ public class InviteAction extends Action {
invite.setSubject(session.getVenue().getInfo().getVenueSubject());
List inviteList = new ArrayList();
UserId inviter = CollaborationConnection.getConnection().getUser();
- for (IUser user : users) {
- UserId userId = IDConverter.convertFrom(user);
+ for (UserId user : users) {
// don't invite the user sending the invite
- if (!inviter.equals(userId)) {
- inviteList.add(userId);
+ if (!inviter.equals(user)) {
+ inviteList.add(user);
}
}
session.sendInvitation(inviteList, invite);
@@ -148,7 +147,7 @@ public class InviteAction extends Action {
private List getNewSessions() {
List result = new ArrayList();
- for (IUser user : users) {
+ for (UserId user : users) {
for (IVenueSession session : getNewSessions(user)) {
if (!result.contains(session)) {
result.add(session);
@@ -158,10 +157,10 @@ public class InviteAction extends Action {
return result;
}
- private List getNewSessions(IUser user) {
- IPresence presence = CollaborationConnection.getConnection()
+ private List getNewSessions(UserId user) {
+ Presence presence = CollaborationConnection.getConnection()
.getContactsManager().getPresence(user);
- if (presence.getType() == Type.UNAVAILABLE) {
+ if (presence.getType() == Type.unavailable) {
return Collections.emptyList();
}
List result = new ArrayList();
@@ -169,19 +168,16 @@ public class InviteAction extends Action {
.getSessions();
for (ISession session : sessions) {
if (session != null && session instanceof IVenueSession) {
- final IVenueInfo info = ((IVenueSession) session).getVenue()
- .getInfo();
Collection participants = ((IVenueSession) session)
.getVenue().getParticipants();
boolean notInRoom = true;
- String id = user.getID().getName();
for (UserId pa : participants) {
- if (pa.isSameUser(id)) {
+ if (pa.isSameUser(user)) {
notInRoom = false;
break;
}
}
- if (info != null && notInRoom) {
+ if (notInRoom) {
result.add((IVenueSession) session);
}
}
@@ -214,7 +210,16 @@ public class InviteAction extends Action {
private void fill() {
for (IVenueSession session : getNewSessions()) {
- Action action = new InviteAction(session, users);
+ String desc;
+ try {
+ IVenueInfo info = session.getVenue().getInfo();
+ desc = info.getVenueDescription();
+ } catch (CollaborationException e) {
+ statusHandler.handle(Priority.PROBLEM,
+ e.getLocalizedMessage(), e);
+ desc = session.getVenue().getName();
+ }
+ Action action = new InviteAction(session, desc, users);
IContributionItem contrib = new ActionContributionItem(action);
contrib.fill(menu, -1);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/PeerToPeerChatAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/PeerToPeerChatAction.java
index 4f0ae4ffbe..c454c389d9 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/PeerToPeerChatAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/PeerToPeerChatAction.java
@@ -19,18 +19,16 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.IPresence.Type;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
@@ -59,9 +57,9 @@ public class PeerToPeerChatAction extends Action {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PeerToPeerChatAction.class);
- private final IUser user;
+ private final UserId user;
- public PeerToPeerChatAction(IUser user) {
+ public PeerToPeerChatAction(UserId user) {
super("Chat", IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), "chats.gif"));
this.user = user;
@@ -70,9 +68,9 @@ public class PeerToPeerChatAction extends Action {
@Override
public void run() {
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getContactsManager().getPresence(user);
- if (presence.getType() != Type.UNAVAILABLE) {
+ if (presence.getType() != Type.unavailable) {
UserId loginUserId = CollaborationConnection.getConnection()
.getUser();
if (!loginUserId.equals(user)) {
@@ -87,12 +85,12 @@ public class PeerToPeerChatAction extends Action {
*/
public void updateEnabled() {
boolean enabled = false;
- IPresence presence = CollaborationConnection.getConnection()
+ Presence presence = CollaborationConnection.getConnection()
.getContactsManager().getPresence(user);
- if (presence.getType() != Type.UNAVAILABLE) {
+ if (presence.getType() != Type.unavailable) {
UserId loginUserId = CollaborationConnection.getConnection()
.getUser();
- if (!loginUserId.getID().getName().equals(user.getID().getName())) {
+ if (!loginUserId.getName().equals(user.getName())) {
enabled = true;
}
}
@@ -110,12 +108,12 @@ public class PeerToPeerChatAction extends Action {
*/
public PeerToPeerView createP2PChat(Integer viewMode) {
try {
- String name = user.getID().getName();
+ String name = user.getName();
PeerToPeerView p2pView = (PeerToPeerView) CaveWorkbenchPageManager
.getActiveInstance().showView(PeerToPeerView.ID, name,
viewMode);
if (p2pView.getPeer() == null) {
- p2pView.setPeer(IDConverter.convertFrom(user));
+ p2pView.setPeer(user);
}
return p2pView;
} catch (PartInitException e) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/RemoveFromGroupAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/RemoveFromGroupAction.java
index 04579a715e..6cf777c344 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/RemoveFromGroupAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/RemoveFromGroupAction.java
@@ -19,11 +19,11 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.icon.IconUtil;
@@ -46,11 +46,11 @@ import com.raytheon.uf.viz.core.icon.IconUtil;
public class RemoveFromGroupAction extends Action {
- private final IUser[] users;
+ private final UserId[] users;
private final String group;
- public RemoveFromGroupAction(String group, IUser... users) {
+ public RemoveFromGroupAction(String group, UserId... users) {
super("Remove From " + group, IconUtil.getImageDescriptor(Activator
.getDefault().getBundle(), "remove_group.gif"));
this.users = users;
@@ -61,7 +61,7 @@ public class RemoveFromGroupAction extends Action {
public void run() {
ContactsManager manager = CollaborationConnection.getConnection()
.getContactsManager();
- for (IUser user : users) {
+ for (UserId user : users) {
manager.deleteFromLocalGroup(group, user);
}
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ShareEditorAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ShareEditorAction.java
index 01a1f3b88d..8db342c3db 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ShareEditorAction.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/ShareEditorAction.java
@@ -142,9 +142,16 @@ public class ShareEditorAction extends ContributedEditorMenuAction implements
if (editor != null) {
List sessions = getSessions();
for (final ISharedDisplaySession session : sessions) {
- IVenueInfo sessionInfo = session.getVenue().getInfo();
+ String sessionName;
+ try {
+ IVenueInfo sessionInfo = session.getVenue().getInfo();
+ sessionName = sessionInfo.getVenueDescription();
+ } catch (CollaborationException e1) {
+ Activator.statusHandler.error(e1.getLocalizedMessage(), e1);
+ sessionName = session.getVenue().getName();
+ }
ActionContributionItem aci = new ActionContributionItem(
- new Action(sessionInfo.getVenueDescription()) {
+ new Action(sessionName) {
@Override
public void run() {
try {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/CollaborationGroupContainer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/CollaborationGroupContainer.java
index e8d1caad89..a6e7304cb1 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/CollaborationGroupContainer.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/CollaborationGroupContainer.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.eclipse.ecf.presence.roster.IRosterGroup;
+import org.jivesoftware.smack.RosterGroup;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
@@ -61,10 +61,9 @@ public class CollaborationGroupContainer {
List result = new ArrayList();
result.add(connection.getUser());
result.add(sessionGroup);
- for (Object obj : connection.getRosterManager().getRoster().getItems()) {
- if (obj instanceof IRosterGroup) {
- result.add(obj);
- }
+ for (RosterGroup obj : connection.getRosterManager().getRoster()
+ .getGroups()) {
+ result.add(obj);
}
for (LocalGroup group : connection.getContactsManager()
.getLocalGroups()) {
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/SessionGroupContainer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/SessionGroupContainer.java
index 05897fbcb4..0d5deded09 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/SessionGroupContainer.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/data/SessionGroupContainer.java
@@ -24,8 +24,12 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
+import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
/**
@@ -47,6 +51,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
public class SessionGroupContainer {
+ private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
+
public List getObjects() {
CollaborationConnection connection = CollaborationConnection
.getConnection();
@@ -57,12 +63,20 @@ public class SessionGroupContainer {
List result = new ArrayList();
for (ISession session : sessions) {
if (session instanceof IVenueSession) {
- if (((IVenueSession) session).getVenue().getInfo()
- .isPersistent() == false) {
+ IVenueSession vs = (IVenueSession) session;
+ IVenueInfo info;
+ try {
+ info = vs.getVenue().getInfo();
+ } catch (CollaborationException e) {
+ log.error("Unable to get venue info", e);
+ continue;
+ }
+ if (info.isPersistent() == false) {
result.add(session);
}
}
}
return result;
}
+
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java
index 625a1a4389..80703f689b 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/login/LoginDialog.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.ecf.presence.IPresence;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -41,6 +40,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.jivesoftware.smack.packet.Presence;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
@@ -193,7 +193,7 @@ public class LoginDialog extends Dialog {
statusCombo = new Combo(body, SWT.DEFAULT);
// TODO get possible status options from config file?
- for (IPresence.Mode mode : CollaborationUtils.statusModes) {
+ for (Presence.Mode mode : CollaborationUtils.statusModes) {
statusCombo.add(CollaborationUtils.formatMode(mode));
}
String status = loginData.getStatus();
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java
index 26f62bc3f2..c936e34245 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java
@@ -20,8 +20,8 @@
package com.raytheon.uf.viz.collaboration.ui.prefs;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.ecf.presence.IPresence.Mode;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.jivesoftware.smack.packet.Presence.Mode;
import com.raytheon.uf.viz.collaboration.ui.Activator;
@@ -62,7 +62,7 @@ public class CollabPrefInitializer extends AbstractPreferenceInitializer {
System.getProperty("user.name"));
store.setDefault(CollabPrefConstants.P_STATUS,
- Mode.AVAILABLE.toString());
+ Mode.available.toString());
store.setDefault(CollabPrefConstants.P_MESSAGE, "");
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java
index 283056971a..7b1f5a8c78 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java
@@ -24,7 +24,6 @@ import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.eclipse.ecf.core.user.IUser;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ControlContribution;
@@ -57,7 +56,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.ColorPopulator;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.IRemoteDisplayChangedListener;
@@ -208,11 +206,11 @@ public class CollaborationSessionView extends SessionView implements
if (rgb != null) {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
- IUser entry = (IUser) selection.getFirstElement();
- ColorChangeEvent event = new ColorChangeEvent(
- IDConverter.convertFrom(entry), rgb);
+ UserId entry = (UserId) selection.getFirstElement();
+ ColorChangeEvent event = new ColorChangeEvent(entry, rgb);
try {
session.sendObjectToVenue(event);
+ CollaborationSessionView.this.modifyColors(event);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to send color change to venue", e);
@@ -562,9 +560,14 @@ public class CollaborationSessionView extends SessionView implements
Label label = new Label(comp, SWT.NONE);
StringBuilder labelInfo = new StringBuilder();
if (session != null) {
- IVenueInfo info = ((IVenueSession) session).getVenue().getInfo();
- labelInfo.append(info.getVenueSubject());
- label.setToolTipText(info.getVenueSubject());
+ IVenueInfo info;
+ try {
+ info = ((IVenueSession) session).getVenue().getInfo();
+ labelInfo.append(info.getVenueSubject());
+ label.setToolTipText(info.getVenueSubject());
+ } catch (CollaborationException e) {
+ statusHandler.error(e.getLocalizedMessage(), e);
+ }
}
label.setText(labelInfo.toString());
}
@@ -725,6 +728,8 @@ public class CollaborationSessionView extends SessionView implements
case ERASE:
layer.doneErasing();
break;
+ default:
+ // not drawing
}
layer.setDrawMode(DrawMode.NONE);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java
index d501ab28a9..0cff8b5074 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java
@@ -23,20 +23,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
+import org.jivesoftware.smack.packet.Presence;
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.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
@@ -51,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 mnash Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -104,10 +103,10 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
@Override
public Font getFont(Object element) {
- if (!(element instanceof IUser)) {
+ if (!(element instanceof UserId)) {
return null;
}
- IUser user = (IUser) element;
+ UserId user = (UserId) element;
boolean leader = isSessionLeader(user);
boolean provider = isDataProvider(user);
if (leader && provider) {
@@ -140,12 +139,11 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
@Override
public Color getForeground(Object element) {
- if (!(element instanceof IUser)) {
+ if (!(element instanceof UserId)) {
return null;
}
- IUser user = ((IUser) element);
- UserId userId = IDConverter.convertFrom(user);
- RGB rgb = manager.getColorFromUser(userId);
+ UserId user = ((UserId) element);
+ RGB rgb = manager.getColorFromUser(user);
if (rgb == null) {
rgb = new RGB(0, 0, 0);
}
@@ -174,24 +172,22 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
return connection.getSession(sessionId);
}
- protected boolean isSessionLeader(IUser user) {
+ protected boolean isSessionLeader(UserId user) {
ISession session = getSession();
if (session instanceof SharedDisplaySession) {
- UserId id = IDConverter.convertFrom(user);
UserId leader = ((SharedDisplaySession) session)
.getCurrentSessionLeader();
- return id.equals(leader);
+ return user.equals(leader);
}
return false;
}
- protected boolean isDataProvider(IUser user) {
+ protected boolean isDataProvider(UserId user) {
ISession session = getSession();
if (session instanceof SharedDisplaySession) {
- UserId id = IDConverter.convertFrom(user);
UserId provider = ((SharedDisplaySession) session)
.getCurrentDataProvider();
- return id.equals(provider);
+ return user.equals(provider);
}
return false;
}
@@ -203,23 +199,23 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
return null;
}
StringBuilder builder = new StringBuilder(toolTip);
- IUser user = (IUser) element;
- IPresence presence = getPresence(user);
+ UserId user = (UserId) element;
+ Presence presence = getPresence(user);
if (presence != null) {
- String site = String.valueOf(presence.getProperties().get(
- SiteConfigInformation.SITE_NAME));
+ String site = String.valueOf(presence
+ .getProperty(SiteConfigInformation.SITE_NAME));
if (enabledSites != null && enabledSites.contains(site)) {
builder.append("\n").append("Subscribed");
}
}
ISession session = getSession();
if (session instanceof SharedDisplaySession) {
- UserId id = IDConverter.convertFrom(user);
- boolean isSessionLeader = id
+ boolean isSessionLeader = user
.equals(((SharedDisplaySession) session)
.getCurrentSessionLeader());
- boolean isDataProvider = id.equals(((SharedDisplaySession) session)
- .getCurrentDataProvider());
+ boolean isDataProvider = user
+ .equals(((SharedDisplaySession) session)
+ .getCurrentDataProvider());
if (isSessionLeader || isDataProvider) {
// TODO if transferring control is ever desired and implemented
// we need to distinguish these. Until then, Leader works fine.
@@ -248,7 +244,7 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider {
}
@Override
- protected IPresence getPresence(IUser user) {
+ protected Presence getPresence(UserId user) {
IVenueSession session = (IVenueSession) getSession();
return session.getVenue().getPresence(user);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java
index 537f89014d..256acb90bb 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java
@@ -24,9 +24,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence.Type;
-import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
@@ -36,6 +33,7 @@ import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.jivesoftware.smack.packet.Presence.Type;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -45,7 +43,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
+import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterItem;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
@@ -219,9 +217,9 @@ public class PeerToPeerView extends AbstractSessionView implements
protected String getSessionName() {
if (peer == null) {
return getViewSite().getSecondaryId();
- } else if (peer instanceof IUser) {
+ } else if (peer instanceof UserId) {
return CollaborationConnection.getConnection().getContactsManager()
- .getDisplayName((IUser) peer);
+ .getDisplayName((UserId) peer);
} else {
return peer.getFQName();
}
@@ -250,10 +248,10 @@ public class PeerToPeerView extends AbstractSessionView implements
}
@Subscribe
- public void handleModifiedPresence(IRosterEntry entry) {
- UserId id = IDConverter.convertFrom(entry.getUser());
+ public void handleModifiedPresence(RosterItem entry) {
+ UserId id = entry.getId();
if (id.equals(peer)) {
- if (entry.getPresence().getType() == Type.UNAVAILABLE) {
+ if (entry.getPresence().getType() == Type.unavailable) {
online = false;
} else {
online = true;
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java
index 315ec47e6b..2f5ef5e8e7 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java
@@ -22,8 +22,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -36,13 +34,13 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.jivesoftware.smack.packet.Presence;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation;
import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation.SiteConfig;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
-import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation;
@@ -60,6 +58,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2012 mnash Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -91,8 +90,8 @@ public class SessionFeedView extends SessionView {
public SessionFeedView() {
super();
String actingSite = CollaborationConnection.getConnection()
- .getPresence().getProperties()
- .get(SiteConfigInformation.SITE_NAME).toString();
+ .getPresence().getProperty(SiteConfigInformation.SITE_NAME)
+ .toString();
enabledSites = SiteConfigurationManager.getSubscribeList(actingSite);
userEnabledSites = SiteConfigurationManager.getUserSubscribeList();
}
@@ -109,7 +108,7 @@ public class SessionFeedView extends SessionView {
super.initComponents(parent);
colors = SiteConfigurationManager.getSiteColors();
if (colors != null) {
- for (IUser user : session.getVenue().getParticipants()) {
+ for (UserId user : session.getVenue().getParticipants()) {
setColorForSite(user);
}
} else {
@@ -147,7 +146,7 @@ public class SessionFeedView extends SessionView {
// loop through all the entries in the list so we can set the
// color for all sites corresponding to "selectedSite"
if (site != null) {
- for (IUser user : session.getVenue().getParticipants()) {
+ for (UserId user : session.getVenue().getParticipants()) {
setColorForSite(user);
}
}
@@ -254,11 +253,10 @@ public class SessionFeedView extends SessionView {
Object site = null;
if (isHistory) {
site = msg.getSubject();
- } else if (msg.getFrom() instanceof IUser) {
- IPresence presence = session.getVenue().getPresence(
- (IUser) msg.getFrom());
- site = presence.getProperties()
- .get(SiteConfigInformation.SITE_NAME);
+ } else if (msg.getFrom() instanceof UserId) {
+ Presence presence = session.getVenue().getPresence(
+ (UserId) msg.getFrom());
+ site = presence.getProperty(SiteConfigInformation.SITE_NAME);
}
// should we append?
@@ -286,11 +284,11 @@ public class SessionFeedView extends SessionView {
private String getSelectedSite() {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
- IUser selectedEntry = (IUser) selection.getFirstElement();
- IPresence pres = session.getVenue().getPresence(selectedEntry);
- Object selectedSite = pres.getProperties().get(
+ UserId selectedEntry = (UserId) selection.getFirstElement();
+ Presence pres = session.getVenue().getPresence(selectedEntry);
+ Object selectedSite = pres.getProperty(
SiteConfigInformation.SITE_NAME);
- return selectedSite.toString();
+ return selectedSite == null ? "" : selectedSite.toString();
}
/**
@@ -300,10 +298,9 @@ public class SessionFeedView extends SessionView {
*
* @param user
*/
- private void setColorForSite(IUser user) {
- UserId id = IDConverter.convertFrom(user);
- IPresence presence = session.getVenue().getPresence(user);
- setColorForSite(id, presence);
+ private void setColorForSite(UserId user) {
+ Presence presence = session.getVenue().getPresence(user);
+ setColorForSite(user, presence);
}
/**
@@ -312,11 +309,11 @@ public class SessionFeedView extends SessionView {
* @param id
* @param presence
*/
- private void setColorForSite(UserId id, IPresence presence) {
+ private void setColorForSite(UserId id, Presence presence) {
if (presence == null) {
return;
}
- Object site = presence.getProperties().get(
+ Object site = presence.getProperty(
SiteConfigInformation.SITE_NAME);
if (site != null) {
setColorForSite(id, site.toString());
@@ -369,7 +366,7 @@ public class SessionFeedView extends SessionView {
setColorForSite(participant);
if (session != null && session.getVenue() != null) {
Object siteOb = session.getVenue().getPresence(participant)
- .getProperties().get(SiteConfigInformation.SITE_NAME);
+ .getProperty(SiteConfigInformation.SITE_NAME);
String site = "";
if (siteOb != null) {
site = siteOb.toString();
@@ -394,11 +391,11 @@ public class SessionFeedView extends SessionView {
*/
@Override
protected void participantDeparted(UserId participant) {
- String site = session.getVenue().getPresence(participant)
- .getProperties().get(SiteConfigInformation.SITE_NAME)
- .toString();
+ Presence presence = session.getVenue().getPresence(participant);
+ Object siteObj = presence.getProperty(SiteConfigInformation.SITE_NAME);
+ String siteName = siteObj == null ? "" : siteObj.toString();
// only show sites you care about
- if (enabledSites.contains(site) || userEnabledSites.contains(site)) {
+ if (enabledSites.contains(siteName) || userEnabledSites.contains(siteName)) {
super.participantDeparted(participant);
} else {
usersTable.setInput(session.getVenue().getParticipants());
@@ -408,7 +405,7 @@ public class SessionFeedView extends SessionView {
@Override
protected void participantPresenceUpdated(UserId participant,
- IPresence presence) {
+ Presence presence) {
setColorForSite(participant, presence);
super.participantPresenceUpdated(participant, presence);
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java
index 15e61562f9..d2438f37f7 100644
--- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java
+++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java
@@ -22,13 +22,11 @@ package com.raytheon.uf.viz.collaboration.ui.session;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresence;
-import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
@@ -37,6 +35,9 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
@@ -62,6 +63,7 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.jivesoftware.smack.packet.Presence;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -79,6 +81,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
+import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
@@ -94,6 +97,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
+ * Dec 6, 2013 2561 bclement removed ECF
*
*
*
@@ -235,11 +239,17 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
@Subscribe
public void updateUserAlias(UserId id) {
- List entries = (List) usersTable.getInput();
- for (IRosterEntry entry : entries) {
- UserId uid = (UserId) entry.getUser();
+ Collection> entries = (Collection>) usersTable.getInput();
+ for (Object obj : entries) {
+ if (!(obj instanceof UserId)) {
+ statusHandler.error("Unexpected user table input type: "
+ + obj.getClass());
+ return;
+ }
+ UserId uid = (UserId) obj;
if (uid.getFQName().equals(id.getFQName())) {
- ((UserId) entry.getUser()).setName(id.getAlias());
+ // TODO update on roster?
+ uid.setAlias(id.getAlias());
break;
}
}
@@ -348,14 +358,27 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
usersTable.setSorter(new ViewerSorter() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- IUser c1 = (IUser) e1;
- IUser c2 = (IUser) e1;
+ UserId c1 = (UserId) e1;
+ UserId c2 = (UserId) e1;
- return c1.getID().getName().compareTo(c2.getID().getName());
+ return c1.getName().compareTo(c2.getName());
}
});
ColumnViewerToolTipSupport.enableFor(usersTable, ToolTip.RECREATE);
+ usersTable.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ StructuredSelection selection = (StructuredSelection) usersTable
+ .getSelection();
+
+ Object o = selection.getFirstElement();
+ if (o instanceof UserId) {
+ new PeerToPeerChatAction((UserId) o).run();
+ }
+ }
+ });
+
if (session != null) {
usersTable.setInput(session.getVenue().getParticipants());
} else {
@@ -560,9 +583,14 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
label.setLayoutData(data);
StringBuilder labelInfo = new StringBuilder();
if (session != null) {
- IVenueInfo info = session.getVenue().getInfo();
- labelInfo.append(info.getVenueSubject());
- label.setToolTipText(info.getVenueSubject());
+ IVenueInfo info;
+ try {
+ info = session.getVenue().getInfo();
+ labelInfo.append(info.getVenueSubject());
+ label.setToolTipText(info.getVenueSubject());
+ } catch (CollaborationException e) {
+ statusHandler.error(e.getLocalizedMessage(), e);
+ }
}
label.setText(labelInfo.toString());
}
@@ -598,7 +626,14 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
if (session == null) {
return sessionId;
}
- return session.getVenue().getInfo().getVenueDescription();
+ try {
+ IVenueInfo info = session.getVenue().getInfo();
+ return info.getVenueDescription();
+ } catch (CollaborationException e) {
+ statusHandler.error("Unable to get venue info", e);
+ return session.getVenue().getName();
+ }
+
}
@Subscribe
@@ -606,7 +641,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
throws Exception {
final ParticipantEventType type = event.getEventType();
- final IPresence presence = event.getPresence();
+ final Presence presence = event.getPresence();
final UserId participant = event.getParticipant();
VizApp.runAsync(new Runnable() {
@@ -672,7 +707,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
* @param presence
*/
protected void participantPresenceUpdated(UserId participant,
- IPresence presence) {
+ Presence presence) {
usersTable.refresh();
}
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.classpath b/cots/org.jivesoftware.smack/.classpath
similarity index 70%
rename from cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.classpath
rename to cots/org.jivesoftware.smack/.classpath
index ad32c83a78..dcda08472d 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.classpath
+++ b/cots/org.jivesoftware.smack/.classpath
@@ -1,6 +1,8 @@
-
+
+
+
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.project b/cots/org.jivesoftware.smack/.project
similarity index 91%
rename from cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.project
rename to cots/org.jivesoftware.smack/.project
index a964c41ac0..247d8cc4e7 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.project
+++ b/cots/org.jivesoftware.smack/.project
@@ -1,6 +1,6 @@
- com.raytheon.uf.viz.collaboration.comm.xmpp
+ org.jivesoftware.smack
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.settings/org.eclipse.jdt.core.prefs b/cots/org.jivesoftware.smack/.settings/org.eclipse.jdt.core.prefs
similarity index 55%
rename from cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.settings/org.eclipse.jdt.core.prefs
rename to cots/org.jivesoftware.smack/.settings/org.eclipse.jdt.core.prefs
index cee65c0334..f42de363af 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/.settings/org.eclipse.jdt.core.prefs
+++ b/cots/org.jivesoftware.smack/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,7 @@
-#Fri Jul 20 17:19:32 CDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/cots/org.jivesoftware.smack/META-INF/MANIFEST.MF b/cots/org.jivesoftware.smack/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..cfe7bfdae6
--- /dev/null
+++ b/cots/org.jivesoftware.smack/META-INF/MANIFEST.MF
@@ -0,0 +1,61 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Smack
+Bundle-SymbolicName: org.jivesoftware.smack
+Bundle-Version: 3.3.1
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ClassPath: smack.jar,
+ .,
+ smackx.jar
+Export-Package: org.jivesoftware.smack,
+ org.jivesoftware.smack.compression,
+ org.jivesoftware.smack.debugger,
+ org.jivesoftware.smack.filter,
+ org.jivesoftware.smack.keepalive,
+ org.jivesoftware.smack.packet,
+ org.jivesoftware.smack.parsing,
+ org.jivesoftware.smack.ping,
+ org.jivesoftware.smack.ping.packet,
+ org.jivesoftware.smack.ping.provider,
+ org.jivesoftware.smack.provider,
+ org.jivesoftware.smack.proxy,
+ org.jivesoftware.smack.sasl,
+ org.jivesoftware.smack.util,
+ org.jivesoftware.smack.util.collections,
+ org.jivesoftware.smack.util.dns,
+ org.jivesoftware.smackx,
+ org.jivesoftware.smackx.bookmark,
+ org.jivesoftware.smackx.bytestreams,
+ org.jivesoftware.smackx.bytestreams.ibb,
+ org.jivesoftware.smackx.bytestreams.ibb.packet,
+ org.jivesoftware.smackx.bytestreams.ibb.provider,
+ org.jivesoftware.smackx.bytestreams.socks5,
+ org.jivesoftware.smackx.bytestreams.socks5.packet,
+ org.jivesoftware.smackx.bytestreams.socks5.provider,
+ org.jivesoftware.smackx.commands,
+ org.jivesoftware.smackx.entitycaps,
+ org.jivesoftware.smackx.entitycaps.cache,
+ org.jivesoftware.smackx.entitycaps.packet,
+ org.jivesoftware.smackx.entitycaps.provider,
+ org.jivesoftware.smackx.filetransfer,
+ org.jivesoftware.smackx.muc,
+ org.jivesoftware.smackx.packet,
+ org.jivesoftware.smackx.ping,
+ org.jivesoftware.smackx.provider,
+ org.jivesoftware.smackx.pubsub,
+ org.jivesoftware.smackx.pubsub.listener,
+ org.jivesoftware.smackx.pubsub.packet,
+ org.jivesoftware.smackx.pubsub.provider,
+ org.jivesoftware.smackx.pubsub.util,
+ org.jivesoftware.smackx.receipts,
+ org.jivesoftware.smackx.search,
+ org.jivesoftware.smackx.workgroup,
+ org.jivesoftware.smackx.workgroup.agent,
+ org.jivesoftware.smackx.workgroup.ext.forms,
+ org.jivesoftware.smackx.workgroup.ext.history,
+ org.jivesoftware.smackx.workgroup.ext.macros,
+ org.jivesoftware.smackx.workgroup.ext.notes,
+ org.jivesoftware.smackx.workgroup.packet,
+ org.jivesoftware.smackx.workgroup.settings,
+ org.jivesoftware.smackx.workgroup.user,
+ org.jivesoftware.smackx.workgroup.util
diff --git a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/build.properties b/cots/org.jivesoftware.smack/build.properties
similarity index 59%
rename from cave/com.raytheon.uf.viz.collaboration.comm.xmpp/build.properties
rename to cots/org.jivesoftware.smack/build.properties
index e9863e281e..8616534916 100644
--- a/cave/com.raytheon.uf.viz.collaboration.comm.xmpp/build.properties
+++ b/cots/org.jivesoftware.smack/build.properties
@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ smack.jar,\
+ smackx.jar
diff --git a/cots/org.jivesoftware.smack/smack.jar b/cots/org.jivesoftware.smack/smack.jar
new file mode 100644
index 0000000000..d7e3df6207
Binary files /dev/null and b/cots/org.jivesoftware.smack/smack.jar differ
diff --git a/cots/org.jivesoftware.smack/smackx.jar b/cots/org.jivesoftware.smack/smackx.jar
new file mode 100644
index 0000000000..d5e1586ca0
Binary files /dev/null and b/cots/org.jivesoftware.smack/smackx.jar differ