Issue #2561 removed ECF from collaboration
added smack 3.3.1 to cots collaboration now uses smack directly for XMPP moderate code cleanup on collaboration.comm added double click to start chat in participant list Former-commit-id:d0d14ec091
[formerly5d1d44b60d
] [formerly8ece30944a
] [formerlyd0d14ec091
[formerly5d1d44b60d
] [formerly8ece30944a
] [formerlye6c4b39aca
[formerly8ece30944a
[formerly 6fc85f79c126283eb4dbddfa94943523d9ff0a6d]]]] Former-commit-id:e6c4b39aca
Former-commit-id:4d04f6edbf
[formerly5a7fca6352
] [formerly ea97705eee929964d9b775519d5de735e490a0d4 [formerlyb8df043202
]] Former-commit-id: ebcbc592123de417dee62c72e2708e136768fd8e [formerly0cf7b822ce
] Former-commit-id:d7ddaa295d
This commit is contained in:
parent
e324a43104
commit
1197d89ded
112 changed files with 1995 additions and 3713 deletions
|
@ -1,17 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Xmpp
|
||||
Bundle-SymbolicName: com.raytheon.uf.viz.collaboration.comm.xmpp;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.collaboration.comm.xmpp.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ecf;bundle-version="3.1.300",
|
||||
org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0",
|
||||
org.eclipse.ecf.provider;bundle-version="4.2.100",
|
||||
org.eclipse.ecf.presence;bundle-version="2.0.0",
|
||||
org.eclipse.ecf.sharedobject;bundle-version="2.2.100",
|
||||
org.jivesoftware.smack;bundle-version="3.1.100"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.collaboration.comm.xmpp
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.ecf.containerFactory">
|
||||
<containerFactory
|
||||
class="com.raytheon.uf.viz.collaboration.comm.xmpp.internal.XMPPContainerInstantiator"
|
||||
description="AWIPS XMPP (Jabber)"
|
||||
name="com.raytheon.uf.viz.collaboration.comm.xmpp">
|
||||
</containerFactory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -1,30 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.xmpp;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private static BundleContext context;
|
||||
|
||||
static BundleContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = bundleContext;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,356 +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;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.ecf.core.ContainerConnectException;
|
||||
import org.eclipse.ecf.core.events.ContainerConnectedEvent;
|
||||
import org.eclipse.ecf.core.events.ContainerConnectingEvent;
|
||||
import org.eclipse.ecf.core.identity.ID;
|
||||
import org.eclipse.ecf.core.security.IConnectContext;
|
||||
import org.eclipse.ecf.core.sharedobject.SharedObjectAddException;
|
||||
import org.eclipse.ecf.core.user.User;
|
||||
import org.eclipse.ecf.core.util.ECFException;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.Messages;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.XmppPlugin;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnectionObjectPacketEvent;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
|
||||
import org.eclipse.ecf.presence.im.IChatManager;
|
||||
import org.eclipse.ecf.presence.roster.IRosterManager;
|
||||
import org.eclipse.ecf.provider.comm.AsynchEvent;
|
||||
import org.eclipse.ecf.provider.comm.ConnectionCreateException;
|
||||
import org.eclipse.ecf.provider.comm.ISynchAsynchConnection;
|
||||
import org.eclipse.ecf.provider.generic.ContainerMessage;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.XMPPChatRoomContainer;
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.XMPPChatRoomManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.XMPPContainerPresenceHelper;
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.smack.ECFConnection;
|
||||
|
||||
/**
|
||||
* Extends the ECF XMPPContainer but overrides any methods which use the
|
||||
* chatRoomManager or containerPresenceHelper to use viz specific instances.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 20, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPContainer extends org.eclipse.ecf.provider.xmpp.XMPPContainer {
|
||||
|
||||
/**
|
||||
* custom chat room manager.
|
||||
*/
|
||||
XMPPChatRoomManager chatRoomManager = null;
|
||||
|
||||
XMPPContainerPresenceHelper presenceHelper = null;
|
||||
|
||||
public XMPPContainer() throws Exception {
|
||||
this(DEFAULT_KEEPALIVE);
|
||||
}
|
||||
|
||||
public XMPPContainer(int ka) throws Exception {
|
||||
super(ka);
|
||||
chatRoomManager = new XMPPChatRoomManager(getID());
|
||||
presenceHelper = new XMPPContainerPresenceHelper(this);
|
||||
}
|
||||
|
||||
public XMPPContainer(String userhost, int ka) throws Exception {
|
||||
super(userhost, ka);
|
||||
chatRoomManager = new XMPPChatRoomManager(getID());
|
||||
presenceHelper = new XMPPContainerPresenceHelper(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to return custom chatRoomManager
|
||||
*/
|
||||
@Override
|
||||
public IChatRoomManager getChatRoomManager() {
|
||||
return chatRoomManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use rosterManager from custom presenceHelper
|
||||
*/
|
||||
@Override
|
||||
public IRosterManager getRosterManager() {
|
||||
return presenceHelper.getRosterManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use chatManager from custom presenceHelper
|
||||
*/
|
||||
@Override
|
||||
public IChatManager getChatManager() {
|
||||
return presenceHelper.getChatManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to disconnect custom presenceHelper and connect our own
|
||||
* instead. Also takes the functionality from the connect method in
|
||||
* ClientSOContainer so that we can complete all the necessary functionality
|
||||
* of the super's super method in our own method. The super method
|
||||
* originally called super with a different presence helper id and that
|
||||
* would break part of our functionality
|
||||
*/
|
||||
@Override
|
||||
public void connect(ID remote, IConnectContext joinContext)
|
||||
throws ContainerConnectException {
|
||||
try {
|
||||
getSharedObjectManager().addSharedObject(presenceHelperID,
|
||||
presenceHelper, null);
|
||||
|
||||
// following taken from
|
||||
// ClientSOContainer.connect(ID,IConnectContext);
|
||||
try {
|
||||
if (isClosing)
|
||||
throw new IllegalStateException("Container closing"); //$NON-NLS-1$
|
||||
if (remote == null)
|
||||
throw new ContainerConnectException(
|
||||
"targetID cannot be null"); //$NON-NLS-1$
|
||||
Object response = null;
|
||||
synchronized (getConnectLock()) {
|
||||
// Throw if already connected
|
||||
if (isConnected())
|
||||
throw new IllegalStateException(
|
||||
"Container already connected connectedID=" + getConnectedID()); //$NON-NLS-1$
|
||||
// Throw if connecting
|
||||
if (isConnecting())
|
||||
throw new IllegalStateException("Container connecting"); //$NON-NLS-1$
|
||||
// else we're entering connecting state
|
||||
// first notify synchonously
|
||||
final ISynchAsynchConnection aConnection = createConnection(
|
||||
remote, joinContext);
|
||||
setStateConnecting(aConnection);
|
||||
|
||||
fireContainerEvent(new ContainerConnectingEvent(
|
||||
this.getID(), remote, joinContext));
|
||||
|
||||
final Object connectData = getConnectData(remote,
|
||||
joinContext);
|
||||
final int connectTimeout = getConnectTimeout();
|
||||
|
||||
synchronized (aConnection) {
|
||||
|
||||
try {
|
||||
// Make connect call
|
||||
response = aConnection.connect(remote, connectData,
|
||||
connectTimeout);
|
||||
} catch (final ECFException e) {
|
||||
if (getConnection() != aConnection)
|
||||
disconnect(aConnection);
|
||||
else
|
||||
setStateDisconnected(aConnection);
|
||||
throw e;
|
||||
}
|
||||
// If not in correct state, disconnect and return
|
||||
if (getConnection() != aConnection) {
|
||||
disconnect(aConnection);
|
||||
throw new IllegalStateException(
|
||||
"Container connect failed because not in correct state"); //$NON-NLS-1$
|
||||
}
|
||||
ID serverID = null;
|
||||
try {
|
||||
serverID = handleConnectResponse(remote, response);
|
||||
} catch (final Exception e) {
|
||||
setStateDisconnected(aConnection);
|
||||
throw e;
|
||||
}
|
||||
setStateConnected(serverID, aConnection);
|
||||
// notify listeners
|
||||
fireContainerEvent(new ContainerConnectedEvent(
|
||||
this.getID(), remoteServerID));
|
||||
aConnection.start();
|
||||
}
|
||||
}
|
||||
} catch (XMPPException e) {
|
||||
throw new ContainerConnectException(e.getMessage(), e);
|
||||
} catch (final ECFException e) {
|
||||
final IStatus s = e.getStatus();
|
||||
throw new ContainerConnectException(s.getMessage(),
|
||||
s.getException());
|
||||
} catch (final Exception e) {
|
||||
throw new ContainerConnectException(e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
XmppPlugin.getDefault().registerService(this);
|
||||
} catch (final ContainerConnectException e) {
|
||||
disconnect();
|
||||
throw e;
|
||||
} catch (final SharedObjectAddException e1) {
|
||||
disconnect();
|
||||
throw new ContainerConnectException(NLS.bind(
|
||||
Messages.XMPPContainer_EXCEPTION_ADDING_SHARED_OBJECT,
|
||||
presenceHelperID), e1);
|
||||
}
|
||||
// end ClientSOContainer code
|
||||
|
||||
getSharedObjectManager().removeSharedObject(presenceHelperID);
|
||||
try {
|
||||
getSharedObjectManager().addSharedObject(presenceHelperID,
|
||||
presenceHelper, null);
|
||||
} catch (SharedObjectAddException e) {
|
||||
disconnect();
|
||||
throw new ContainerConnectException(NLS.bind(
|
||||
Messages.XMPPContainer_EXCEPTION_ADDING_SHARED_OBJECT,
|
||||
presenceHelperID), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Need to override this method from ClientSOContainer so that our connect
|
||||
* method can set the connection and the connectionState and the
|
||||
* remoteServerID
|
||||
*
|
||||
* Taken from ECF.
|
||||
*
|
||||
* @param serverID
|
||||
* @param conn
|
||||
*/
|
||||
private void setStateConnected(ID serverID, ISynchAsynchConnection conn) {
|
||||
connectionState = CONNECTED;
|
||||
connection = conn;
|
||||
remoteServerID = serverID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Need to override this method out of ClientSOContainer so that our connect
|
||||
* method can set the connectionState and disconnect the connection
|
||||
*
|
||||
* Taken from ECF
|
||||
*
|
||||
*/
|
||||
private void setStateDisconnected(ISynchAsynchConnection conn) {
|
||||
disconnect(conn);
|
||||
connectionState = DISCONNECTED;
|
||||
connection = null;
|
||||
remoteServerID = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Need to override this method out of ClientSOContainer so that our connect
|
||||
* method can set the connectionState and the connection
|
||||
*
|
||||
* Taken from ECF
|
||||
*
|
||||
* @param conn
|
||||
*/
|
||||
private void setStateConnecting(ISynchAsynchConnection conn) {
|
||||
connectionState = CONNECTING;
|
||||
connection = conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to disconnect custom chatRoomManager and custom presenceHelper
|
||||
*/
|
||||
@Override
|
||||
public void disconnect() {
|
||||
super.disconnect();
|
||||
chatRoomManager.setConnection(null, null, null);
|
||||
presenceHelper.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to return custom chatRoomManager
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
chatRoomManager.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to set connection in custom chatRoomManager and to set user in
|
||||
* custom presenceHelper
|
||||
*/
|
||||
@Override
|
||||
protected ID handleConnectResponse(ID originalTarget, Object serverData)
|
||||
throws Exception {
|
||||
ID result = super.handleConnectResponse(originalTarget, serverData);
|
||||
chatRoomManager.setConnection(getConnectNamespace(), originalTarget,
|
||||
getECFConnection());
|
||||
presenceHelper.setUser(new User(originalTarget));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to cast ECFConnection to viz implementation
|
||||
*/
|
||||
public ECFConnection getECFConnection() {
|
||||
return (ECFConnection) super.getConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to create viz ECFConnection
|
||||
*/
|
||||
@Override
|
||||
protected ISynchAsynchConnection createConnection(ID remoteSpace,
|
||||
Object data) throws ConnectionCreateException {
|
||||
final boolean google = isGoogle(remoteSpace);
|
||||
return new ECFConnection(google, getConnectNamespace(), receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapted from super.processAsynch to use custom chatRoomManager for chat
|
||||
* events.
|
||||
*/
|
||||
@Override
|
||||
protected void processAsynch(AsynchEvent e) {
|
||||
try {
|
||||
if (e instanceof ECFConnectionObjectPacketEvent) {
|
||||
// It's an ECF object message
|
||||
final ECFConnectionObjectPacketEvent evt = (ECFConnectionObjectPacketEvent) e;
|
||||
final Object obj = evt.getObjectValue();
|
||||
// this should be a ContainerMessage
|
||||
final Object cm = deserializeContainerMessage((byte[]) obj);
|
||||
if (cm == null)
|
||||
super.processAsynch(e);
|
||||
final ContainerMessage contMessage = (ContainerMessage) cm;
|
||||
final IChatRoomContainer chat = chatRoomManager
|
||||
.findReceiverChatRoom(contMessage.getToContainerID());
|
||||
if (chat != null && chat instanceof XMPPChatRoomContainer) {
|
||||
final XMPPChatRoomContainer cont = (XMPPChatRoomContainer) chat;
|
||||
cont.handleContainerMessage(contMessage);
|
||||
return;
|
||||
}
|
||||
super.processAsynch(e);
|
||||
}
|
||||
} catch (final IOException except) {
|
||||
log(NLS.bind(Messages.XMPPContainer_EXCEPTION_HANDLING_ASYCH_EVENT,
|
||||
e), except);
|
||||
}
|
||||
super.processAsynch(e);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,235 +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;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.ecf.core.ContainerConnectException;
|
||||
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.IConnectContext;
|
||||
import org.eclipse.ecf.core.sharedobject.SharedObjectAddException;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.ChatMembershipEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.IQEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.MessageEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.PresenceEvent;
|
||||
import org.eclipse.ecf.presence.IIMMessageListener;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
|
||||
import org.eclipse.ecf.provider.generic.SOWrapper;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.XMPPContainer;
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.smack.ECFConnection;
|
||||
|
||||
/**
|
||||
* Override the ECF XMPPChatRoomContainer but provide a custom viz
|
||||
* XMPPChatRoomContainerHelper
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 20, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPChatRoomContainer extends
|
||||
org.eclipse.ecf.internal.provider.xmpp.XMPPChatRoomContainer {
|
||||
|
||||
private static final String CONTAINER_HELPER_ID = XMPPContainer.class
|
||||
.getName() + ".xmppgroupchathandler"; //$NON-NLS-1$
|
||||
|
||||
private ID containerHelperID;
|
||||
|
||||
/**
|
||||
* Use viz version of chatRoomContainerHelper.
|
||||
*/
|
||||
private XMPPChatRoomContainerHelper containerHelper;
|
||||
|
||||
public XMPPChatRoomContainer(ECFConnection conn, Namespace usernamespace)
|
||||
throws IDCreateException {
|
||||
super(conn, usernamespace);
|
||||
this.containerHelperID = IDFactory.getDefault().createStringID(
|
||||
CONTAINER_HELPER_ID);
|
||||
this.containerHelper = new XMPPChatRoomContainerHelper(usernamespace,
|
||||
getXMPPConnection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void addChatRoomParticipantListener(
|
||||
IChatRoomParticipantListener participantListener) {
|
||||
if (containerHelper != null) {
|
||||
containerHelper.addChatParticipantListener(participantListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void addMessageListener(IIMMessageListener listener) {
|
||||
containerHelper.addChatRoomMessageListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
protected void addSharedObjectToContainer(ID remote)
|
||||
throws SharedObjectAddException {
|
||||
getSharedObjectManager().addSharedObject(containerHelperID,
|
||||
containerHelper, new HashMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to clean up custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
protected void cleanUpConnectFail() {
|
||||
super.cleanUpConnectFail();
|
||||
if (containerHelper != null) {
|
||||
getSharedObjectManager().removeSharedObject(containerHelperID);
|
||||
containerHelper = null;
|
||||
containerHelperID = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to connect custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void connect(ID remote, IConnectContext connectContext)
|
||||
throws ContainerConnectException {
|
||||
super.connect(remote, connectContext);
|
||||
containerHelper.setRoomID(remoteServerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to disconnect custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void disconnect() {
|
||||
super.disconnect();
|
||||
if (containerHelper != null)
|
||||
containerHelper.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to dispose custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (containerHelperID != null) {
|
||||
getSharedObjectManager().removeSharedObject(containerHelperID);
|
||||
containerHelperID = null;
|
||||
}
|
||||
super.dispose();
|
||||
if (containerHelper != null)
|
||||
containerHelper.dispose(getID());
|
||||
containerHelper = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public ID[] getChatRoomParticipants() {
|
||||
return containerHelper.getChatRoomParticipants();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void removeChatRoomParticipantListener(
|
||||
IChatRoomParticipantListener participantListener) {
|
||||
if (containerHelper != null) {
|
||||
containerHelper.removeChatParticipantListener(participantListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelper.
|
||||
*/
|
||||
@Override
|
||||
public void removeMessageListener(IIMMessageListener listener) {
|
||||
containerHelper.removeChatRoomMessageListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelperID.
|
||||
*/
|
||||
@Override
|
||||
protected void handleChatMessage(Message mess) throws IOException {
|
||||
final SOWrapper wrap = getSharedObjectWrapper(containerHelperID);
|
||||
if (wrap != null) {
|
||||
wrap.deliverEvent(new MessageEvent(mess));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelperID.
|
||||
*/
|
||||
@Override
|
||||
protected void handleIQMessage(IQ mess) throws IOException {
|
||||
final SOWrapper wrap = getSharedObjectWrapper(containerHelperID);
|
||||
if (wrap != null) {
|
||||
wrap.deliverEvent(new IQEvent(mess));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelperID.
|
||||
*/
|
||||
@Override
|
||||
protected void handlePresenceMessage(Presence mess) throws IOException {
|
||||
final SOWrapper wrap = getSharedObjectWrapper(containerHelperID);
|
||||
if (wrap != null) {
|
||||
wrap.deliverEvent(new PresenceEvent(mess));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to use custom containerHelperID.
|
||||
*/
|
||||
@Override
|
||||
protected void handleChatMembershipEvent(String from, boolean add) {
|
||||
final SOWrapper wrap = getSharedObjectWrapper(containerHelperID);
|
||||
if (wrap != null) {
|
||||
wrap.deliverEvent(new ChatMembershipEvent(from, add));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,178 +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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ecf.core.identity.ID;
|
||||
import org.eclipse.ecf.core.identity.Namespace;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.ChatMembershipEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.PresenceEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.smack.ECFConnection;
|
||||
import org.eclipse.ecf.presence.IIMMessageListener;
|
||||
import org.eclipse.ecf.presence.IPresence;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
/**
|
||||
* Extend the ECF XMPPChatRoomContainerHelper with three changes (1) add
|
||||
* properties to presence events in a room. (2) expose methods needed by the Viz
|
||||
* version of XMPPChatRoomContainer. (3) disable the default chatMembership
|
||||
* events and instead fire ChatMembershipEvents when the presence changes.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 20, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPChatRoomContainerHelper extends
|
||||
org.eclipse.ecf.internal.provider.xmpp.XMPPChatRoomContainerHelper {
|
||||
|
||||
/**
|
||||
* Need our own list to track who is in the room.
|
||||
*/
|
||||
private final List<ID> chatRoomContainerParticipants = Collections
|
||||
.synchronizedList(new ArrayList<ID>());
|
||||
|
||||
public XMPPChatRoomContainerHelper(Namespace usernamespace,
|
||||
XMPPConnection conn) {
|
||||
super(usernamespace, conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected void setRoomID(ID roomID) {
|
||||
super.setRoomID(roomID);
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected void disconnect() {
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected void addChatParticipantListener(
|
||||
IChatRoomParticipantListener listener) {
|
||||
super.addChatParticipantListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected void removeChatParticipantListener(
|
||||
IChatRoomParticipantListener listener) {
|
||||
super.removeChatParticipantListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected void addChatRoomMessageListener(IIMMessageListener msgListener) {
|
||||
super.addChatRoomMessageListener(msgListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* exposed method to this package.
|
||||
*/
|
||||
@Override
|
||||
protected ID createUserIDFromName(String name) {
|
||||
return super.createUserIDFromName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* adapted from super.createIPresence, but modified to add properties from
|
||||
* the packet.
|
||||
*/
|
||||
@Override
|
||||
protected IPresence createIPresence(Presence xmppPresence) {
|
||||
final String status = xmppPresence.getStatus();
|
||||
final IPresence newPresence = new org.eclipse.ecf.presence.Presence(
|
||||
createIPresenceType(xmppPresence), status,
|
||||
createIPresenceMode(xmppPresence),
|
||||
ECFConnection.getPropertiesFromPacket(xmppPresence));
|
||||
return newPresence;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to also fire ChatMembershipEvent, see
|
||||
* handleChatMembershipEvent for more information on why this is done.
|
||||
*/
|
||||
@Override
|
||||
protected void handlePresenceEvent(PresenceEvent evt) {
|
||||
super.handlePresenceEvent(evt);
|
||||
final Presence xmppPresence = evt.getPresence();
|
||||
final String from = canonicalizeRoomFrom(xmppPresence.getFrom());
|
||||
final ID fromID = createUserIDFromName(from);
|
||||
if (xmppPresence.getType().equals(Presence.Type.available)) {
|
||||
if (!chatRoomContainerParticipants.contains(fromID)) {
|
||||
chatRoomContainerParticipants.add(fromID);
|
||||
super.handleChatMembershipEvent(new ChatMembershipEvent(
|
||||
xmppPresence.getFrom(), true));
|
||||
}
|
||||
} else {
|
||||
chatRoomContainerParticipants.remove(fromID);
|
||||
super.handleChatMembershipEvent(new ChatMembershipEvent(
|
||||
xmppPresence.getFrom(), false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The ECF version of this class will not always correctly fire these events
|
||||
* for the user that created this room. The reason is because
|
||||
* XMPPChatRoomManager.createChatRoom creates a temporary MultiUserChat to
|
||||
* create the room but this MultiUserChat registers with the
|
||||
* RoomListenerMultiplexor and it does not deregister until finalize. When
|
||||
* we connect to the room it will create a second MultiUserChat and it is
|
||||
* possible they are both registered. When the temporary chat is garbage
|
||||
* collected it removes the room from the RoomListenerMultiplexor and events
|
||||
* for that room are ignored. Most events do not come from the
|
||||
* RoomListenerMultiplexor so there is no problems but the
|
||||
* ChatMembershipEvent comes from that and breaks sometimes so we disable it
|
||||
* and instead fire these events from handlePresenceEvent since that event
|
||||
* is fired separately from the RoomListenerMultiplexor.
|
||||
*/
|
||||
@Override
|
||||
protected void handleChatMembershipEvent(ChatMembershipEvent evt) {
|
||||
; // disabled
|
||||
}
|
||||
|
||||
}
|
|
@ -1,276 +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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.ecf.core.ContainerCreateException;
|
||||
import org.eclipse.ecf.core.identity.ID;
|
||||
import org.eclipse.ecf.core.identity.IDCreateException;
|
||||
import org.eclipse.ecf.core.identity.Namespace;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.Messages;
|
||||
import org.eclipse.ecf.presence.chatroom.ChatRoomCreateException;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
|
||||
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
|
||||
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.Form;
|
||||
import org.jivesoftware.smackx.muc.MultiUserChat;
|
||||
import org.jivesoftware.smackx.muc.RoomInfo;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.internal.smack.ECFConnection;
|
||||
|
||||
/**
|
||||
* Extend the ECF XMPPChatRoomManager but add the ability to use a custom viz
|
||||
* chat room container.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 20, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPChatRoomManager extends
|
||||
org.eclipse.ecf.internal.provider.xmpp.XMPPChatRoomManager {
|
||||
|
||||
private static final String PROP_XMPP_SUBJECT = "subject";
|
||||
|
||||
/**
|
||||
* Super has ecfConnection but it is private and we need it.
|
||||
*/
|
||||
private ECFConnection ecfConnection = null;
|
||||
|
||||
/**
|
||||
* Super has connectNamespace but it is private and we need it.
|
||||
*/
|
||||
private Namespace connectNamespace = null;
|
||||
|
||||
public XMPPChatRoomManager(ID containerID) {
|
||||
super(containerID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to so we can grab the ecfConnection and namespace
|
||||
*/
|
||||
public void setConnection(Namespace connectNamespace, ID connectedID,
|
||||
ECFConnection connection) {
|
||||
super.setConnection(connectNamespace, connectedID, connection);
|
||||
this.connectNamespace = connectNamespace;
|
||||
this.ecfConnection = connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to wrap the roomInfo in a custom roomInfo.
|
||||
*/
|
||||
@Override
|
||||
protected IChatRoomInfo getChatRoomInfo(ID roomID) {
|
||||
IChatRoomInfo result = super.getChatRoomInfo(roomID);
|
||||
if (result != null) {
|
||||
result = new ECFRoomInfo(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to wrap the roomInfo in a custom roomInfo.
|
||||
*/
|
||||
@Override
|
||||
public IChatRoomInfo getChatRoomInfo(String roomname) {
|
||||
IChatRoomInfo result = super.getChatRoomInfo(roomname);
|
||||
if (result != null) {
|
||||
result = new ECFRoomInfo(result);
|
||||
} else if (ecfConnection != null) {
|
||||
// If the result is null then it is possible that ecf silently
|
||||
// disgarded an exception from xmpp, we would like some way to be
|
||||
// able to capture that exception so this code will
|
||||
// attempt to find the room itself and log errors.
|
||||
Exception exception = null;
|
||||
String mucName = null;
|
||||
try {
|
||||
XMPPConnection conn = ecfConnection.getXMPPConnection();
|
||||
XMPPRoomID roomID = new XMPPRoomID(connectNamespace, conn,
|
||||
roomname);
|
||||
mucName = roomID.getMucString();
|
||||
RoomInfo info = MultiUserChat.getRoomInfo(conn, mucName);
|
||||
if (info != null) {
|
||||
// Theoretically this will never hit but if it does there is
|
||||
// no way of getting a super.ECFRoomInfo even
|
||||
// though we know the room exists, so just log it.
|
||||
System.err
|
||||
.println("XMPPChatRoomManager cannot find info for room "
|
||||
+ roomname + " but it exists.");
|
||||
}
|
||||
} catch (XMPPException e) {
|
||||
if (e.getXMPPError().getCode() != 404) {
|
||||
// 404 is considered normal, everything else is bad
|
||||
exception = e;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
exception = e;
|
||||
}
|
||||
if (exception != null) {
|
||||
System.err
|
||||
.println("XMPPChatRoomManager cannot find info for room "
|
||||
+ roomname
|
||||
+ " when looking for "
|
||||
+ String.valueOf(mucName));
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden to use the same nickname that is used when joining.
|
||||
*/
|
||||
@Override
|
||||
public IChatRoomInfo createChatRoom(String roomname, Map properties)
|
||||
throws ChatRoomCreateException {
|
||||
if (roomname == null)
|
||||
throw new ChatRoomCreateException(roomname,
|
||||
Messages.XMPPChatRoomManager_EXCEPTION_ROOM_CANNOT_BE_NULL);
|
||||
try {
|
||||
String nickname = ecfConnection.getXMPPConnection().getUser();
|
||||
final String server = ecfConnection.getXMPPConnection().getHost();
|
||||
final String domain = (properties == null) ? XMPPRoomID.DOMAIN_DEFAULT
|
||||
: (String) properties.get(PROP_XMPP_CONFERENCE);
|
||||
final String conference = XMPPRoomID.fixConferenceDomain(domain,
|
||||
server);
|
||||
final String roomID = roomname + XMPPRoomID.AT_SIGN + conference;
|
||||
// create proxy to the room
|
||||
final MultiUserChat muc = new MultiUserChat(
|
||||
ecfConnection.getXMPPConnection(), roomID);
|
||||
|
||||
if (!checkRoom(conference, roomID)) {
|
||||
// otherwise create a new one
|
||||
|
||||
/**
|
||||
* This is the reason we override super.createChatRoom, when we
|
||||
* join it only uses the username, not then host so we must do
|
||||
* the same here or a user departed event is triggered for
|
||||
* user@host when user arrives.
|
||||
*/
|
||||
if (nickname.contains("@")) {
|
||||
nickname = nickname.split("@")[0];
|
||||
}
|
||||
muc.create(nickname);
|
||||
muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
|
||||
final String subject = (properties == null) ? null
|
||||
: (String) properties.get(PROP_XMPP_SUBJECT);
|
||||
if (subject != null)
|
||||
muc.changeSubject(subject);
|
||||
}
|
||||
|
||||
} catch (final XMPPException e) {
|
||||
throw new ChatRoomCreateException(roomname, e.getMessage(), e);
|
||||
}
|
||||
return getChatRoomInfo(roomname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom roomInfo that wraps another roomInfo and overrides
|
||||
* createChatRoomContainer to return viz container.
|
||||
*/
|
||||
class ECFRoomInfo implements IChatRoomInfo {
|
||||
|
||||
IChatRoomInfo realInfo;
|
||||
|
||||
public ECFRoomInfo(IChatRoomInfo realInfo) {
|
||||
this.realInfo = realInfo;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return realInfo.getDescription();
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return realInfo.getSubject();
|
||||
}
|
||||
|
||||
public ID getRoomID() {
|
||||
return realInfo.getRoomID();
|
||||
}
|
||||
|
||||
public int getParticipantsCount() {
|
||||
return realInfo.getParticipantsCount();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return realInfo.getName();
|
||||
}
|
||||
|
||||
public boolean isPersistent() {
|
||||
return realInfo.isPersistent();
|
||||
}
|
||||
|
||||
public boolean requiresPassword() {
|
||||
return realInfo.requiresPassword();
|
||||
}
|
||||
|
||||
public boolean isModerated() {
|
||||
return realInfo.isModerated();
|
||||
}
|
||||
|
||||
public ID getConnectedID() {
|
||||
return realInfo.getConnectedID();
|
||||
}
|
||||
|
||||
public Object getAdapter(Class adapter) {
|
||||
return realInfo.getAdapter(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapted from the ECF version of ECFRoomInfo but changed to return our
|
||||
* custom container.
|
||||
*/
|
||||
public IChatRoomContainer createChatRoomContainer()
|
||||
throws ContainerCreateException {
|
||||
XMPPChatRoomContainer chatContainer = null;
|
||||
if (ecfConnection == null)
|
||||
throw new ContainerCreateException(
|
||||
Messages.XMPPChatRoomManager_EXCEPTION_CONTAINER_DISCONNECTED);
|
||||
try {
|
||||
chatContainer = new XMPPChatRoomContainer(ecfConnection,
|
||||
connectNamespace);
|
||||
addChat(chatContainer);
|
||||
return chatContainer;
|
||||
} catch (final IDCreateException e) {
|
||||
throw new ContainerCreateException(
|
||||
Messages.XMPPChatRoomManager_EXCEPTION_CREATING_CHAT_CONTAINER,
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return realInfo.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,85 +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;
|
||||
|
||||
import org.eclipse.ecf.core.ContainerCreateException;
|
||||
import org.eclipse.ecf.core.ContainerTypeDescription;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.xmpp.XMPPContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* Extends the ECF XMPPContainerInstantiator to create a Viz specific container
|
||||
* with fixes needed for Viz.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPContainerInstantiator extends
|
||||
org.eclipse.ecf.internal.provider.xmpp.XMPPContainerInstantiator {
|
||||
|
||||
/**
|
||||
* Adapted from super.createInstance, only change is that it returns the Viz
|
||||
* XMPPContainer instead of the ECF XMPPContainer
|
||||
*/
|
||||
@Override
|
||||
public XMPPContainer createInstance(ContainerTypeDescription description,
|
||||
Object[] args) throws ContainerCreateException {
|
||||
try {
|
||||
Integer ka = new Integer(XMPPContainer.DEFAULT_KEEPALIVE);
|
||||
String name = null;
|
||||
if (args != null) {
|
||||
if (args.length > 0) {
|
||||
name = (String) args[0];
|
||||
if (args.length > 1) {
|
||||
ka = getIntegerFromArg(args[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (name == null) {
|
||||
if (ka == null) {
|
||||
return new XMPPContainer();
|
||||
} else {
|
||||
return new XMPPContainer(ka.intValue());
|
||||
}
|
||||
} else {
|
||||
if (ka == null) {
|
||||
ka = new Integer(XMPPContainer.DEFAULT_KEEPALIVE);
|
||||
}
|
||||
return new XMPPContainer(name, ka.intValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ContainerCreateException(
|
||||
"Exception creating generic container", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,494 +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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
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.internal.provider.xmpp.events.IQEvent;
|
||||
import org.eclipse.ecf.internal.provider.xmpp.events.PresenceEvent;
|
||||
import org.eclipse.ecf.presence.IPresence;
|
||||
import org.eclipse.ecf.presence.IPresenceListener;
|
||||
import org.eclipse.ecf.presence.IPresenceSender;
|
||||
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.roster.IRosterManager;
|
||||
import org.eclipse.ecf.presence.roster.IRosterSubscriptionListener;
|
||||
import org.eclipse.ecf.presence.roster.IRosterSubscriptionSender;
|
||||
import org.eclipse.ecf.provider.xmpp.XMPPContainer;
|
||||
import org.eclipse.ecf.provider.xmpp.identity.XMPPID;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.RosterPacket;
|
||||
|
||||
/**
|
||||
* Viz specific implementation of the XMPPContainerPresenceHelper which fixes a
|
||||
* bug that causes users to disappear from rosters when they log out when they
|
||||
* are in multiple groups. This class no handles all presence events when a user
|
||||
* becomes unavaialble, all other events are handled by the ECF version.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 25, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class XMPPContainerPresenceHelper extends
|
||||
org.eclipse.ecf.internal.provider.xmpp.XMPPContainerPresenceHelper {
|
||||
|
||||
/**
|
||||
* Have our own roster manager to track listeners.
|
||||
*/
|
||||
private VizRosterManager rosterManager;
|
||||
|
||||
public XMPPContainerPresenceHelper(XMPPContainer container) {
|
||||
super(container);
|
||||
rosterManager = new VizRosterManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is overriden because when a roster packet is delivered with a new
|
||||
* name then the ecf implementation does not change the name, this will
|
||||
* change it before letting the ecf connection handle the event normally.
|
||||
*/
|
||||
@Override
|
||||
protected void handleIQEvent(IQEvent evt) {
|
||||
final IQ iq = evt.getIQ();
|
||||
if (iq instanceof RosterPacket) {
|
||||
final RosterPacket rosterPacket = (RosterPacket) iq;
|
||||
if (rosterPacket.getType() == IQ.Type.SET) {
|
||||
for (RosterPacket.Item item : rosterPacket.getRosterItems()) {
|
||||
final RosterPacket.ItemType itemType = item.getItemType();
|
||||
if (itemType == RosterPacket.ItemType.to
|
||||
|| itemType == RosterPacket.ItemType.both) {
|
||||
XMPPID newID = createIDFromName(item.getUser());
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> items = roster.getItems();
|
||||
synchronized (items) {
|
||||
updateRosterName(items, newID, item.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
super.handleIQEvent(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to recursively find roster entries that match the user id provided
|
||||
* and change the name of the user in the roster entry.
|
||||
*
|
||||
* @param rosterItems
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
private void updateRosterName(Collection<Object> rosterItems, XMPPID id,
|
||||
String name) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Object obj : rosterItems) {
|
||||
if (obj instanceof IRosterGroup) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> items = ((IRosterGroup) obj).getEntries();
|
||||
synchronized (items) {
|
||||
updateRosterName(items, id, name);
|
||||
}
|
||||
} else if (obj instanceof IRosterEntry) {
|
||||
IRosterEntry entry = (IRosterEntry) obj;
|
||||
if (entry.getUser().getID().equals(id)) {
|
||||
((User) entry.getUser()).setName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it can call a custom version of updatePresence when the presence
|
||||
* type is unavaialble.
|
||||
*/
|
||||
@Override
|
||||
protected void handlePresenceEvent(PresenceEvent evt) {
|
||||
if (evt.getPresence().getType() == Presence.Type.unavailable) {
|
||||
final Presence xmppPresence = evt.getPresence();
|
||||
final String from = xmppPresence.getFrom();
|
||||
final IPresence newPresence = createIPresence(xmppPresence);
|
||||
final XMPPID fromID = createIDFromName(from);
|
||||
updatePresence(fromID, newPresence);
|
||||
rosterManager.notifyPresenceListeners(fromID, newPresence);
|
||||
} else {
|
||||
super.handlePresenceEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it can call a custom version of updatePresenceInGroup and
|
||||
* updatePresenceForMatchingEntry, it also only handles cases of removal.
|
||||
*/
|
||||
private void updatePresence(XMPPID fromID, IPresence newPresence) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Collection<Object> rosterItems = roster.getItems();
|
||||
List<IRosterEntry> newEntrys = new ArrayList<IRosterEntry>();
|
||||
synchronized (rosterItems) {
|
||||
for (final Iterator<Object> i = rosterItems.iterator(); i.hasNext();) {
|
||||
final IRosterItem item = (IRosterItem) i.next();
|
||||
if (item instanceof IRosterGroup) {
|
||||
IRosterEntry[] es = updatePresenceInGroup(
|
||||
(IRosterGroup) item, fromID, newPresence);
|
||||
for (int j = 0; j < es.length; j++) {
|
||||
newEntrys.add(es[j]);
|
||||
}
|
||||
} else if (item instanceof org.eclipse.ecf.presence.roster.RosterEntry) {
|
||||
IRosterEntry entry = updatePresenceForMatchingEntry(
|
||||
(org.eclipse.ecf.presence.roster.RosterEntry) item,
|
||||
fromID, newPresence);
|
||||
if (entry != null)
|
||||
newEntrys.add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IRosterEntry[] entrys = newEntrys.toArray(new IRosterEntry[] {});
|
||||
if (entrys.length > 0) {
|
||||
for (int i = 0; i < entrys.length; i++) {
|
||||
removeItemFromRoster(rosterItems, fromID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it can call a custom version of updatePresenceForMatchingEntry
|
||||
*/
|
||||
private IRosterEntry[] updatePresenceInGroup(IRosterGroup group,
|
||||
XMPPID fromID, IPresence newPresence) {
|
||||
List<IRosterEntry> results = new ArrayList<IRosterEntry>();
|
||||
@SuppressWarnings("unchecked")
|
||||
final Collection<Object> groupEntries = group.getEntries();
|
||||
synchronized (groupEntries) {
|
||||
for (final Iterator<Object> i = groupEntries.iterator(); i
|
||||
.hasNext();) {
|
||||
IRosterEntry newEntry = updatePresenceForMatchingEntry(
|
||||
(org.eclipse.ecf.presence.roster.RosterEntry) i.next(),
|
||||
fromID, newPresence);
|
||||
if (newEntry != null)
|
||||
results.add(newEntry);
|
||||
}
|
||||
}
|
||||
return results.toArray(new IRosterEntry[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it can call a custom version of removeEntryFromRoster, it has also
|
||||
* been simplified to handle only cases of removal when the presence type is
|
||||
* unavaialble.
|
||||
*/
|
||||
private IRosterEntry updatePresenceForMatchingEntry(
|
||||
org.eclipse.ecf.presence.roster.RosterEntry entry, XMPPID fromID,
|
||||
IPresence newPresence) {
|
||||
final IUser user = entry.getUser();
|
||||
XMPPID oldID = (XMPPID) user.getID();
|
||||
// If the username/host part matches that means we either have to update
|
||||
// the resource, or create a new client
|
||||
if (oldID.equals(fromID)) {
|
||||
return removeEntryFromRoster(oldID, entry, newPresence, user);
|
||||
} else if (oldID.getUsernameAtHost().equals(fromID.getUsernameAtHost())) {
|
||||
return entry;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it can call a custom version of countClientsInRoster, it also uses
|
||||
* the results of this method differently
|
||||
*/
|
||||
private IRosterEntry removeEntryFromRoster(XMPPID oldID,
|
||||
org.eclipse.ecf.presence.roster.RosterEntry entry,
|
||||
IPresence newPresence, IUser user) {
|
||||
if (countClientsInRoster(oldID) > 0) {
|
||||
// remove this client from roster
|
||||
return entry;
|
||||
} else {
|
||||
// Last one, so we set resource to null and set presence to
|
||||
// unavailable
|
||||
oldID.setResourceName(null);
|
||||
entry.setPresence(newPresence);
|
||||
rosterManager.notifyRosterUpdate(entry);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it will return the number of entries that have the same name/hose
|
||||
* but a different resource. Returning the number of users with same
|
||||
* name/host even if they have the same resource is what causes the ECF
|
||||
* version to delete users that are in multiple groups. For a user that is
|
||||
* not logged in more than once this will always return 0.
|
||||
*/
|
||||
private int countClientsInRosterGroup(
|
||||
org.eclipse.ecf.presence.roster.RosterGroup group, XMPPID oldID) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> groupItems = group.getEntries();
|
||||
int count = 0;
|
||||
for (final Iterator<Object> i = groupItems.iterator(); i.hasNext();) {
|
||||
final IRosterItem item = (IRosterItem) i.next();
|
||||
if (item instanceof org.eclipse.ecf.presence.roster.RosterEntry) {
|
||||
org.eclipse.ecf.presence.roster.RosterEntry entry = (org.eclipse.ecf.presence.roster.RosterEntry) item;
|
||||
XMPPID entryID = (XMPPID) entry.getUser().getID();
|
||||
if (!entryID.equals(oldID)
|
||||
&& entryID.getUsernameAtHost().equals(
|
||||
oldID.getUsernameAtHost()))
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been adapted from the ECF XMPPContainerPresenceHelper so
|
||||
* that it will return the number of entries that have the same name/hose
|
||||
* but a different resource. Returning the number of users with same
|
||||
* name/host even if they have the same resource is what causes the ECF
|
||||
* version to delete users that are in multiple groups. For a user that is
|
||||
* not logged in more than once this will always return 0.
|
||||
*/
|
||||
private int countClientsInRoster(XMPPID oldID) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> rosterItems = roster.getItems();
|
||||
int count = 0;
|
||||
synchronized (rosterItems) {
|
||||
for (final Iterator<Object> i = rosterItems.iterator(); i.hasNext();) {
|
||||
final IRosterItem item = (IRosterItem) i.next();
|
||||
if (item instanceof org.eclipse.ecf.presence.roster.RosterGroup) {
|
||||
final org.eclipse.ecf.presence.roster.RosterGroup group = (org.eclipse.ecf.presence.roster.RosterGroup) item;
|
||||
count += countClientsInRosterGroup(group, oldID);
|
||||
} else if (item instanceof org.eclipse.ecf.presence.roster.RosterEntry) {
|
||||
org.eclipse.ecf.presence.roster.RosterEntry entry = (org.eclipse.ecf.presence.roster.RosterEntry) item;
|
||||
XMPPID entryID = (XMPPID) entry.getUser().getID();
|
||||
if (!entryID.equals(oldID)
|
||||
&& entryID.getUsernameAtHost().equals(
|
||||
oldID.getUsernameAtHost())) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void removeItemFromRoster(Collection<Object> rosterItems,
|
||||
XMPPID itemIDToRemove) {
|
||||
boolean removed = false;
|
||||
synchronized (rosterItems) {
|
||||
for (final Iterator<Object> i = rosterItems.iterator(); i.hasNext();) {
|
||||
final IRosterItem item = (IRosterItem) i.next();
|
||||
if (item instanceof org.eclipse.ecf.presence.roster.RosterGroup) {
|
||||
final org.eclipse.ecf.presence.roster.RosterGroup group = (org.eclipse.ecf.presence.roster.RosterGroup) item;
|
||||
removed = removeItemFromRosterGroup(group, itemIDToRemove);
|
||||
// If group is empty, remove it too
|
||||
if (group.getEntries().size() == 0)
|
||||
i.remove();
|
||||
} else if (item instanceof org.eclipse.ecf.presence.roster.RosterEntry) {
|
||||
if (((org.eclipse.ecf.presence.roster.RosterEntry) item)
|
||||
.getUser().getID().equals(itemIDToRemove)) {
|
||||
i.remove();
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (removed)
|
||||
rosterManager.notifyRosterUpdate(roster);
|
||||
|
||||
}
|
||||
|
||||
private boolean removeItemFromRosterGroup(
|
||||
org.eclipse.ecf.presence.roster.RosterGroup group,
|
||||
XMPPID itemIDToRemove) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Collection<Object> groupEntries = group.getEntries();
|
||||
synchronized (groupEntries) {
|
||||
for (final Iterator<Object> i = groupEntries.iterator(); i
|
||||
.hasNext();) {
|
||||
final org.eclipse.ecf.presence.roster.RosterEntry entry = (org.eclipse.ecf.presence.roster.RosterEntry) i
|
||||
.next();
|
||||
if (entry.getUser().getID().equals(itemIDToRemove)) {
|
||||
i.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* provide the VizRosterManager access to the super rosterManager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected IRosterManager getSuperRosterManager() {
|
||||
return super.getRosterManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the viz roster manager instead of super, most calls are just
|
||||
* forwarded through.
|
||||
*/
|
||||
@Override
|
||||
public IRosterManager getRosterManager() {
|
||||
return rosterManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* The entire purpose of this class is to intercept the various listeners so
|
||||
* that they can be notified when presence changes in the viz
|
||||
* XMPPCOntainerPresenceHelper since it does not have access to the super
|
||||
* class roster manager listeners.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 26, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
private class VizRosterManager implements IRosterManager {
|
||||
|
||||
private final List<IRosterListener> rosterUpdateListeners = new ArrayList<IRosterListener>();
|
||||
|
||||
private final List<IPresenceListener> presenceListeners = new ArrayList<IPresenceListener>();
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return getSuperRosterManager().getAdapter(adapter);
|
||||
}
|
||||
|
||||
public void notifyRosterUpdate(IRosterItem entry) {
|
||||
List<IRosterListener> toNotify = null;
|
||||
synchronized (rosterUpdateListeners) {
|
||||
toNotify = new ArrayList<IRosterListener>(rosterUpdateListeners);
|
||||
}
|
||||
for (IRosterListener l : toNotify) {
|
||||
l.handleRosterUpdate(entry.getRoster(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyPresenceListeners(ID fromID, IPresence presence) {
|
||||
List<IPresenceListener> toNotify = null;
|
||||
synchronized (presenceListeners) {
|
||||
toNotify = new ArrayList<IPresenceListener>(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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 20, 2012 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.osgi.framework.BundleContext;
|
|||
import com.raytheon.uf.common.comm.NetworkStatistics;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Activator for Collaboration Communication
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Exception class for collaboration component
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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<String, String> 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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 19, 2012 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface ICollaborationMessage extends IMessage {
|
||||
|
||||
}
|
|
@ -23,20 +23,20 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
|||
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Collaboration message wrapper interface
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 24, 2012 jkorman Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,24 +22,28 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
|
|||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Property interface for collaboration messages
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 27, 2012 jkorman Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @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<Property> getProperties();
|
||||
public Collection<Property> getProperties();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 19, 2012 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IVenueMessage extends IMessage {
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* User authentication specific collaboration exception
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -20,28 +20,28 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity.event;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Event fired when the configuration has changed
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 11, 2012 bkowal Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 27, 2012 jkorman Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface ITextMessageEvent {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @return the message
|
||||
*/
|
||||
TextMessage getMessage();
|
||||
public TextMessage getMessage();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity.event;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Type of event for participant updates
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 20, 2012 jkorman Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public enum ParticipantEventType {
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity.event;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Type of event for roster changes
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 11, 2012 jkorman Initial creation
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public enum RosterChangeType {
|
||||
|
|
|
@ -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<UserId> 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();
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity.info;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Information on a venue. Information may become outdated.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Persisted site configuration information
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,7 +51,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|||
@DynamicSerialize
|
||||
public class ColorPopulator {
|
||||
@DynamicSerializeElement
|
||||
private List<UserId> userName;
|
||||
private List<UserId> users;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<Integer> red;
|
||||
|
@ -61,44 +62,55 @@ public class ColorPopulator {
|
|||
@DynamicSerializeElement
|
||||
private List<Integer> blue;
|
||||
|
||||
/**
|
||||
* For serialization only, use {@link ColorPopulator#ColorPopulator(Map)}
|
||||
*/
|
||||
@Deprecated
|
||||
public ColorPopulator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rgbs
|
||||
* Map of user ids to color information
|
||||
*/
|
||||
public ColorPopulator(Map<UserId, RGB> rgbs) {
|
||||
userName = new ArrayList<UserId>();
|
||||
users = new ArrayList<UserId>();
|
||||
red = new ArrayList<Integer>();
|
||||
green = new ArrayList<Integer>();
|
||||
blue = new ArrayList<Integer>();
|
||||
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<UserId, RGB> getColors() {
|
||||
Map<UserId, RGB> colors = new HashMap<UserId, RGB>();
|
||||
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<UserId> getUserName() {
|
||||
return userName;
|
||||
public List<UserId> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userName
|
||||
* the userName to set
|
||||
* @param users
|
||||
* the users to set
|
||||
*/
|
||||
public void setUserName(List<UserId> userName) {
|
||||
this.userName = userName;
|
||||
public void setUsers(List<UserId> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 29, 2012 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IVenueId extends IQualifiedID {
|
||||
|
||||
String getVenueName();
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -102,18 +108,8 @@ public abstract class Tools {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
* @param container
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getPresenceContainerAdapter(IContainer container,
|
||||
Class<T> 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<String, String> props) {
|
||||
for (Entry<String, String> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, IPresence> presenceMap = new HashMap<String, IPresence>();;
|
||||
private Map<String, Presence> presenceMap = new HashMap<String, Presence>();
|
||||
|
||||
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<UserId> getParticipants() {
|
||||
Set<UserId> participants = new HashSet<UserId>();
|
||||
ID[] ids = container.getChatRoomParticipants();
|
||||
for (ID id : ids) {
|
||||
participants.add(IDConverter.convertFrom(id));
|
||||
Iterator<String> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <ul>
|
||||
* 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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,12 +55,6 @@ public abstract class BaseSession implements ISession {
|
|||
|
||||
private Map<Object, Object> 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<Object, Object>();
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<CollaborationConnectionData, CollaborationConnection> instanceMap = new HashMap<CollaborationConnectionData, CollaborationConnection>();
|
||||
|
||||
private Map<String, ISession> 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<String, ISession>();
|
||||
|
||||
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<ISession> 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<IVenueInfo> info = new ArrayList<IVenueInfo>();
|
||||
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<String> 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<String> addresses) {
|
||||
send(addresses, RosterChangeType.MODIFY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entriesDeleted(Collection<String> addresses) {
|
||||
send(addresses, RosterChangeType.DELETE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entriesAdded(Collection<String> 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<String> 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<ISession> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<Property> properties = message.getProperties();
|
||||
Map<String, String> props = null;
|
||||
if ((properties != null) && (properties.size() > 0)) {
|
||||
props = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<Object, Object> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 25, 2013 2561 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, String> props = null;
|
||||
if (subject != null) {
|
||||
props = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -118,6 +108,8 @@ public class ContactsManager {
|
|||
|
||||
private final CollaborationConnection connection;
|
||||
|
||||
private final UserSearch search;
|
||||
|
||||
private List<LocalGroup> localGroups;
|
||||
|
||||
private Map<String, String> 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<String> addresses) {
|
||||
// TODO handle roster additions from other clients
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entriesUpdated(Collection<String> addresses) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRosterEntryRemove(IRosterEntry entry) {
|
||||
public void entriesDeleted(Collection<String> 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<Object>(entries);
|
||||
}
|
||||
for (Object o : entries) {
|
||||
applyLocalAliases((IRosterItem) o);
|
||||
}
|
||||
} else if (item instanceof IRoster) {
|
||||
Collection<?> entries = ((IRoster) item).getItems();
|
||||
synchronized (entries) {
|
||||
entries = new ArrayList<Object>(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<String> userNames = group.getUserNames();
|
||||
if (!userNames.contains(userId)) {
|
||||
List<IUser> users = group.getUsers();
|
||||
List<UserId> 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<LocalGroup> 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<IUser> users = new ArrayList<IUser>(
|
||||
List<UserId> users = new ArrayList<UserId>(
|
||||
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<LocalGroup> getLocalGroups(IUser user) {
|
||||
public List<LocalGroup> getLocalGroups(UserId user) {
|
||||
List<LocalGroup> results = new ArrayList<LocalGroup>();
|
||||
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<UserId> 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<Object>(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<Object>(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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -82,7 +80,7 @@ public class LocalGroups {
|
|||
private ContactsManager manager;
|
||||
|
||||
@XmlTransient
|
||||
private List<IUser> users;
|
||||
private List<UserId> users;
|
||||
|
||||
public LocalGroup() {
|
||||
}
|
||||
|
@ -111,11 +109,11 @@ public class LocalGroups {
|
|||
this.userNames = userNames;
|
||||
}
|
||||
|
||||
public synchronized List<IUser> getUsers() {
|
||||
public synchronized List<UserId> getUsers() {
|
||||
if (users == null) {
|
||||
users = new ArrayList<IUser>();
|
||||
users = new ArrayList<UserId>();
|
||||
for (String userName : userNames) {
|
||||
IUser user = manager.findAndAddUser(userName);
|
||||
UserId user = manager.findAndAddUser(userName);
|
||||
if (user != null) {
|
||||
users.add(user);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 22, 2013 2561 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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<UserId> 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<UserId> 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<UserId> unwrap(ReportedData results) {
|
||||
List<UserId> rval = new ArrayList<UserId>();
|
||||
Iterator<Row> 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<String> fields = new HashSet<String>();
|
||||
Iterator<FormField> 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]);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<ICollaborationEditor> {
|
||||
|
||||
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()
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,6 +287,7 @@ public class CollaborationDrawingResource extends
|
|||
event.setType(lockingDrawing ? CollaborationEventType.LOCK_USERS
|
||||
: CollaborationEventType.UNLOCK_USERS);
|
||||
sendEvent(event);
|
||||
handleDrawEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
|
|||
event.setCoordinates(new ArrayList<Coordinate>(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<Collection<Geometry>> getUndoStack() {
|
||||
|
|
|
@ -31,62 +31,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.presence"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.provider.xmpp"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.filetransfer"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.identity"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.provider.filetransfer"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.provider"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.ecf.sharedobject"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.viz.collaboration.ui"
|
||||
download-size="0"
|
||||
|
@ -134,14 +78,7 @@
|
|||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.viz.collaboration.comm.xmpp"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
unpack="true"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.equinox.concurrent"
|
||||
|
|
|
@ -11,13 +11,12 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.viz.collaboration.comm;bundle-version="1.0.0",
|
||||
org.eclipse.swt;bundle-version="3.6.1",
|
||||
org.eclipse.ecf;bundle-version="3.1.0",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.collaboration.display;bundle-version="1.0.0",
|
||||
org.eclipse.ecf.presence;bundle-version="2.0.0",
|
||||
com.raytheon.viz.ui;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.drawing;bundle-version="1.0.0",
|
||||
com.raytheon.viz.core;bundle-version="1.12.1174"
|
||||
com.raytheon.viz.core;bundle-version="1.12.1174",
|
||||
org.jivesoftware.smack;bundle-version="3.3.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.raytheon.uf.viz.core.maps.display
|
||||
|
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
|
@ -22,16 +22,17 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.ecf.core.user.IUser;
|
||||
import org.eclipse.ecf.presence.IPresence;
|
||||
import org.eclipse.ecf.presence.IPresence.Type;
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Presence.Mode;
|
||||
import org.jivesoftware.smack.packet.Presence.Type;
|
||||
|
||||
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.UserId;
|
||||
|
||||
/**
|
||||
* Common code that is used whenever providing labels for users in a tree.
|
||||
|
@ -56,21 +57,21 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (!(element instanceof IUser)) {
|
||||
if (!(element instanceof UserId)) {
|
||||
return null;
|
||||
}
|
||||
IUser user = (IUser) element;
|
||||
UserId user = (UserId) element;
|
||||
StringBuilder name = new StringBuilder();
|
||||
name.append(getDisplayName(user));
|
||||
IPresence presence = getPresence(user);
|
||||
Presence presence = getPresence(user);
|
||||
if (presence != null) {
|
||||
Object site = presence.getProperties().get(
|
||||
Object site = presence.getProperty(
|
||||
SiteConfigInformation.SITE_NAME);
|
||||
if (site != null) {
|
||||
name.append(" - ");
|
||||
name.append(site);
|
||||
}
|
||||
Object role = presence.getProperties().get(
|
||||
Object role = presence.getProperty(
|
||||
SiteConfigInformation.ROLE_NAME);
|
||||
if (role != null) {
|
||||
name.append(" - ");
|
||||
|
@ -82,14 +83,18 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
if (!(element instanceof IUser)) {
|
||||
if (!(element instanceof UserId)) {
|
||||
return null;
|
||||
}
|
||||
IUser user = (IUser) element;
|
||||
IPresence presence = getPresence(user);
|
||||
UserId user = (UserId) element;
|
||||
Presence presence = getPresence(user);
|
||||
String key = "";
|
||||
if (presence != null && presence.getType() == Type.AVAILABLE) {
|
||||
key = presence.getMode().toString().replaceAll("\\s+", "_");
|
||||
if (presence != null && presence.getType() == Type.available) {
|
||||
Mode mode = presence.getMode();
|
||||
if (mode == null) {
|
||||
mode = Mode.available;
|
||||
}
|
||||
key = mode.toString().replaceAll("\\s+", "_");
|
||||
} else {
|
||||
key = "contact_disabled";
|
||||
}
|
||||
|
@ -101,15 +106,15 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
@Override
|
||||
public String getToolTipText(Object element) {
|
||||
if (!(element instanceof IUser)) {
|
||||
if (!(element instanceof UserId)) {
|
||||
return null;
|
||||
}
|
||||
IUser user = (IUser) element;
|
||||
IPresence presence = getPresence(user);
|
||||
UserId user = (UserId) element;
|
||||
Presence presence = getPresence(user);
|
||||
StringBuilder text = new StringBuilder();
|
||||
text.append("Name: ").append(getDisplayName(user)).append("\n");
|
||||
text.append("Status: ");
|
||||
if (presence == null || presence.getType() != Type.AVAILABLE) {
|
||||
if (presence == null || presence.getType() != Type.available) {
|
||||
text.append("Offline\n");
|
||||
} else {
|
||||
text.append(CollaborationUtils.formatMode(presence.getMode()))
|
||||
|
@ -118,8 +123,8 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
text.append("Message : \"").append(presence.getStatus())
|
||||
.append("\"\n");
|
||||
}
|
||||
for (Object key : presence.getProperties().keySet()) {
|
||||
Object value = presence.getProperties().get(key);
|
||||
for (String key : presence.getPropertyNames()) {
|
||||
Object value = presence.getProperty(key);
|
||||
if (value != null && key != null) {
|
||||
text.append(key).append(" : ").append(value).append("\n");
|
||||
}
|
||||
|
@ -148,11 +153,11 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
imageMap.clear();
|
||||
}
|
||||
|
||||
protected String getDisplayName(IUser user) {
|
||||
protected String getDisplayName(UserId user) {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
if (connection == null) {
|
||||
String name = user.getNickname();
|
||||
String name = user.getAlias();
|
||||
if (name == null) {
|
||||
name = user.getName();
|
||||
}
|
||||
|
@ -162,6 +167,6 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract IPresence getPresence(IUser user);
|
||||
protected abstract Presence getPresence(UserId user);
|
||||
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class Activator extends AbstractUIPlugin {
|
|||
@Override
|
||||
public IPersistentPreferenceStore getPreferenceStore() {
|
||||
if (prefs == null) {
|
||||
prefs = new ScopedPreferenceStore(new InstanceScope(), PLUGIN_ID);
|
||||
prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, PLUGIN_ID);
|
||||
}
|
||||
|
||||
return prefs;
|
||||
|
|
|
@ -24,11 +24,6 @@ import java.util.Arrays;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
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.roster.IRosterEntry;
|
||||
import org.eclipse.ecf.presence.roster.IRosterGroup;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
@ -79,6 +74,10 @@ import org.eclipse.ui.IViewReference;
|
|||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.internal.WorkbenchMessages;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.jivesoftware.smack.RosterEntry;
|
||||
import org.jivesoftware.smack.RosterGroup;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.Presence.Type;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
@ -87,6 +86,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserPresenceChangedEvent;
|
||||
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.ContactsManager.LocalGroupListener;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.LocalGroups.LocalGroup;
|
||||
|
@ -131,6 +131,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
* Oct 22, 2013 #2483 lvenable Fixed image memory leak.
|
||||
* Dec 6, 2013 2561 bclement removed ECF
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<IUser> selectedUsers = new HashSet<IUser>();
|
||||
public UserId[] getSelectedUsers() {
|
||||
Set<UserId> selectedUsers = new HashSet<UserId>();
|
||||
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<IUser> getSelectedUsers(IRosterGroup groupNode) {
|
||||
Set<IUser> selectedUsers = new HashSet<IUser>();
|
||||
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<UserId> getSelectedUsers(RosterGroup groupNode) {
|
||||
Set<UserId> selectedUsers = new HashSet<UserId>();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<AlertWord> getAlertWords() {
|
||||
|
@ -178,4 +181,5 @@ public class CollaborationUtils {
|
|||
"Unable to save alert words to localization", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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<IVenueInfo> info = CollaborationConnection
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<IUser> results = new ArrayList<IUser>();
|
||||
List<UserId> results = new ArrayList<UserId>();
|
||||
List<String> keys = new ArrayList<String>();
|
||||
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<UserId> 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<String> uniqueIds = new HashSet<String>();
|
||||
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<IUser> selectedUsers = new HashSet<IUser>();
|
||||
public UserId[] getSelectedUsers() {
|
||||
Set<UserId> selectedUsers = new HashSet<UserId>();
|
||||
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()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<IUser> result = new ArrayList<IUser>();
|
||||
} else if (parentElement instanceof RosterGroup) {
|
||||
RosterGroup group = (RosterGroup) parentElement;
|
||||
List<UserId> result = new ArrayList<UserId>();
|
||||
UserId localUser = CollaborationConnection.getConnection()
|
||||
.getUser();
|
||||
Collection<?> entries = group.getEntries();
|
||||
Collection<RosterEntry> entries = group.getEntries();
|
||||
synchronized (entries) {
|
||||
entries = new ArrayList<Object>(entries);
|
||||
entries = new ArrayList<RosterEntry>(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<IUser> result = new ArrayList<IUser>();
|
||||
List<UserId> result = new ArrayList<UserId>();
|
||||
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<RosterEntry> entries = group.getEntries();
|
||||
synchronized (entries) {
|
||||
entries = new ArrayList<Object>(entries);
|
||||
entries = new ArrayList<RosterEntry>(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) {
|
||||
|
|
|
@ -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())) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<LocalGroup> groups = contactsMgr.getLocalGroups();
|
||||
List<LocalGroup> usedGroups = new ArrayList<LocalGroup>(groups);
|
||||
for (IUser user : users) {
|
||||
for (UserId user : users) {
|
||||
usedGroups.retainAll(contactsMgr.getLocalGroups(user));
|
||||
}
|
||||
groups.removeAll(usedGroups);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Object, Object> 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()) {
|
||||
|
|
|
@ -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<Object, Object> 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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<UserId> inviteList = new ArrayList<UserId>();
|
||||
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<IVenueSession> getNewSessions() {
|
||||
List<IVenueSession> result = new ArrayList<IVenueSession>();
|
||||
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<IVenueSession> getNewSessions(IUser user) {
|
||||
IPresence presence = CollaborationConnection.getConnection()
|
||||
private List<IVenueSession> getNewSessions(UserId user) {
|
||||
Presence presence = CollaborationConnection.getConnection()
|
||||
.getContactsManager().getPresence(user);
|
||||
if (presence.getType() == Type.UNAVAILABLE) {
|
||||
if (presence.getType() == Type.unavailable) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<IVenueSession> result = new ArrayList<IVenueSession>();
|
||||
|
@ -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<UserId> 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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,9 +142,16 @@ public class ShareEditorAction extends ContributedEditorMenuAction implements
|
|||
if (editor != null) {
|
||||
List<ISharedDisplaySession> 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 {
|
||||
|
|
|
@ -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<Object> result = new ArrayList<Object>();
|
||||
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()) {
|
||||
|
|
|
@ -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<Object> getObjects() {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
|
@ -57,12 +63,20 @@ public class SessionGroupContainer {
|
|||
List<Object> result = new ArrayList<Object>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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, "");
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue