Issue #232 - Added message routing/corrected roster creation
Former-commit-id:6149d30b13
[formerlyb45ea1e0a7
[formerly b7040976e3c8fd029a0d821511f977cfd4b4888e]] Former-commit-id:b45ea1e0a7
Former-commit-id:8dde3a0798
This commit is contained in:
parent
5999d295f4
commit
08704e35ea
36 changed files with 1361 additions and 1080 deletions
|
@ -1,30 +1,63 @@
|
||||||
|
/**
|
||||||
|
* 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;
|
package com.raytheon.uf.viz.collaboration;
|
||||||
|
|
||||||
import org.osgi.framework.BundleActivator;
|
import org.osgi.framework.BundleActivator;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Add Description
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Feb 27, 2012 jkorman Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author jkorman
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class Activator implements BundleActivator {
|
public class Activator implements BundleActivator {
|
||||||
|
|
||||||
private static BundleContext context;
|
private static BundleContext context;
|
||||||
|
|
||||||
static BundleContext getContext() {
|
static BundleContext getContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* (non-Javadoc)
|
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
*/
|
||||||
*/
|
public void start(BundleContext bundleContext) throws Exception {
|
||||||
public void start(BundleContext bundleContext) throws Exception {
|
Activator.context = bundleContext;
|
||||||
Activator.context = bundleContext;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* (non-Javadoc)
|
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
*/
|
||||||
*/
|
public void stop(BundleContext bundleContext) throws Exception {
|
||||||
public void stop(BundleContext bundleContext) throws Exception {
|
Activator.context = null;
|
||||||
Activator.context = null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.comm.identity;
|
package com.raytheon.uf.viz.collaboration.comm.identity;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,26 +46,28 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Implementations of ISession do not support polling for messages but instead
|
* Implementations of ISession do not support polling for messages but instead
|
||||||
* make exclusive use of listener based callbacks to make incoming data available.
|
* make exclusive use of listener based callbacks to make incoming data
|
||||||
|
* available.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 24, 2012 jkorman Initial creation
|
* Feb 24, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface ISession {
|
public interface ISession extends IEventPublisher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close and clean up this session. After a close, isConnected must return false.
|
* Close and clean up this session. After a close, isConnected must return
|
||||||
|
* false.
|
||||||
*/
|
*/
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
@ -73,16 +76,33 @@ public interface ISession {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IQualifiedID getUserID();
|
IQualifiedID getUserID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the connection status of the session.
|
* Gets the connection status of the session.
|
||||||
|
*
|
||||||
* @return The connection status.
|
* @return The connection status.
|
||||||
*/
|
*/
|
||||||
boolean isConnected();
|
boolean isConnected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the session identifier.
|
* Get the session identifier.
|
||||||
* @return The session identifier.
|
*
|
||||||
|
* @return The session identifier.
|
||||||
*/
|
*/
|
||||||
String getSessionId();
|
String getSessionId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the session identifier of a remote session this session is following.
|
||||||
|
*
|
||||||
|
* @return The remote session id.
|
||||||
|
*/
|
||||||
|
String getFollowingSessionId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the session identifier of a remote session this session is following.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* The remote session identifier.
|
||||||
|
*/
|
||||||
|
void setFollowingSessionId(String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public interface IVenueInvitationEvent {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IChatID getInvitor();
|
IQualifiedID getInvitor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -62,7 +62,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
private final long timeStamp;
|
private final long timeStamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param to
|
* @param to
|
||||||
|
@ -74,7 +74,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
initProperties();
|
initProperties();
|
||||||
timeStamp = setTimeStamp();
|
timeStamp = setTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the to
|
* @return the to
|
||||||
*/
|
*/
|
||||||
|
@ -162,7 +162,7 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
public String getProperty(String key, String defaultValue) {
|
public String getProperty(String key, String defaultValue) {
|
||||||
String retValue = defaultValue;
|
String retValue = defaultValue;
|
||||||
if (properties != null) {
|
if (properties != null) {
|
||||||
if(properties.containsKey(key)) {
|
if (properties.containsKey(key)) {
|
||||||
retValue = properties.get(key);
|
retValue = properties.get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,16 +170,17 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the message properties as a collection of key, value
|
* Gets the message properties as a collection of key, value pairs. Always
|
||||||
* pairs. Always returns a not-null value.
|
* returns a not-null value.
|
||||||
|
*
|
||||||
* @return A Collection of properties associated with this message.
|
* @return A Collection of properties associated with this message.
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperties()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperties()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Collection<Property> getProperties() {
|
public Collection<Property> getProperties() {
|
||||||
Collection<Property> p = new ArrayList<Property>();
|
Collection<Property> p = new ArrayList<Property>();
|
||||||
for(String s : properties.keySet()) {
|
for (String s : properties.keySet()) {
|
||||||
p.add(new Property(s,properties.get(s)));
|
p.add(new Property(s, properties.get(s)));
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -221,12 +222,11 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the receipt time for this message in milliseconds from
|
* Get the receipt time for this message in milliseconds from Jan 1, 1970.
|
||||||
* Jan 1, 1970.
|
*
|
||||||
* @return The receipt time stamp.
|
* @return The receipt time stamp.
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getTimeStamp()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getTimeStamp()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -243,5 +243,5 @@ public abstract class BaseMessage implements Serializable, IMessage {
|
||||||
properties.put(TIMESTAMP, Long.toHexString(timestamp));
|
properties.put(TIMESTAMP, Long.toHexString(timestamp));
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,21 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 24, 2012 jkorman Initial creation
|
* Feb 24, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CollaborationMessage extends BaseMessage {
|
public class CollaborationMessage extends BaseMessage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public class CollaborationMessage extends BaseMessage {
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public CollaborationMessage(IQualifiedID to, String body) {
|
public CollaborationMessage(IQualifiedID to, String body) {
|
||||||
super(to,body);
|
super(to, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,5 +67,5 @@ public class CollaborationMessage extends BaseMessage {
|
||||||
@Override
|
@Override
|
||||||
public void getBodyAsBinary(byte[] body) {
|
public void getBodyAsBinary(byte[] body) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,17 +23,17 @@ package com.raytheon.uf.viz.collaboration.comm.provider;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 8, 2012 jkorman Initial creation
|
* Mar 8, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class Errors {
|
public abstract class Errors {
|
||||||
|
@ -43,15 +43,16 @@ public abstract class Errors {
|
||||||
public static final int CANNOT_CONNECT = -50;
|
public static final int CANNOT_CONNECT = -50;
|
||||||
|
|
||||||
public static final int ALREADY_CONNECTED = -51;
|
public static final int ALREADY_CONNECTED = -51;
|
||||||
|
|
||||||
public static final int BAD_NAME = -52;
|
public static final int BAD_NAME = -52;
|
||||||
|
|
||||||
// Error - An attempt to use a Venue that has been disposed.
|
// Error - An attempt to use a Venue that has been disposed.
|
||||||
public static final int VENUE_DISPOSED = -100;
|
public static final int VENUE_DISPOSED = -100;
|
||||||
|
|
||||||
// Error - Venue exists when attempting to create a new venue.
|
// Error - Venue exists when attempting to create a new venue.
|
||||||
public static final int VENUE_EXISTS = -101;
|
public static final int VENUE_EXISTS = -101;
|
||||||
|
|
||||||
// Error - Venue not found when attempting to join an existing venue.
|
// Error - Venue not found when attempting to join an existing venue.
|
||||||
public static final int VENUE_NOT_FOUND = -102;
|
public static final int VENUE_NOT_FOUND = -102;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,51 +29,65 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 27, 2012 jkorman Initial creation
|
* Feb 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Presence implements IPresence {
|
public class Presence implements IPresence {
|
||||||
|
|
||||||
private static Map<org.eclipse.ecf.presence.IPresence.Type,IPresence.Type> TYPE_MAP = new HashMap<org.eclipse.ecf.presence.IPresence.Type,IPresence.Type>();
|
private static Map<org.eclipse.ecf.presence.IPresence.Type, IPresence.Type> TYPE_MAP = new HashMap<org.eclipse.ecf.presence.IPresence.Type, IPresence.Type>();
|
||||||
static {
|
static {
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.AVAILABLE, IPresence.Type.AVAILABLE);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.AVAILABLE,
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.ERROR, IPresence.Type.ERROR);
|
IPresence.Type.AVAILABLE);
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBE, IPresence.Type.SUBSCRIBE);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.ERROR,
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBED, IPresence.Type.SUBSCRIBED);
|
IPresence.Type.ERROR);
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNAVAILABLE, IPresence.Type.UNAVAILABLE);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBE,
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBE, IPresence.Type.UNSUBSCRIBE);
|
IPresence.Type.SUBSCRIBE);
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBED, IPresence.Type.UNSUBSCRIBED);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBED,
|
||||||
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNKNOWN, IPresence.Type.UNKNOWN);
|
IPresence.Type.SUBSCRIBED);
|
||||||
}
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNAVAILABLE,
|
||||||
|
IPresence.Type.UNAVAILABLE);
|
||||||
private static Map<org.eclipse.ecf.presence.IPresence.Mode,IPresence.Mode> MODE_MAP = new HashMap<org.eclipse.ecf.presence.IPresence.Mode,IPresence.Mode>();
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBE,
|
||||||
static {
|
IPresence.Type.UNSUBSCRIBE);
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.AVAILABLE, IPresence.Mode.AVAILABLE);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBED,
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.AWAY, IPresence.Mode.AWAY);
|
IPresence.Type.UNSUBSCRIBED);
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.CHAT, IPresence.Mode.CHAT);
|
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNKNOWN,
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.DND, IPresence.Mode.DND);
|
IPresence.Type.UNKNOWN);
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.EXTENDED_AWAY, IPresence.Mode.EXTENDED_AWAY);
|
|
||||||
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.INVISIBLE, IPresence.Mode.INVISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String,Property> properties = null;
|
private static Map<org.eclipse.ecf.presence.IPresence.Mode, IPresence.Mode> MODE_MAP = new HashMap<org.eclipse.ecf.presence.IPresence.Mode, IPresence.Mode>();
|
||||||
|
static {
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.AVAILABLE,
|
||||||
|
IPresence.Mode.AVAILABLE);
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.AWAY,
|
||||||
|
IPresence.Mode.AWAY);
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.CHAT,
|
||||||
|
IPresence.Mode.CHAT);
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.DND,
|
||||||
|
IPresence.Mode.DND);
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.EXTENDED_AWAY,
|
||||||
|
IPresence.Mode.EXTENDED_AWAY);
|
||||||
|
MODE_MAP.put(org.eclipse.ecf.presence.IPresence.Mode.INVISIBLE,
|
||||||
|
IPresence.Mode.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Property> properties = null;
|
||||||
|
|
||||||
private Mode mode;
|
private Mode mode;
|
||||||
|
|
||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
private String statusMessage;
|
private String statusMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -116,45 +130,49 @@ public class Presence implements IPresence {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the status message for this presence.
|
* Get the status message for this presence.
|
||||||
|
*
|
||||||
* @return The status message.
|
* @return The status message.
|
||||||
*/
|
*/
|
||||||
public String getStatusMessage() {
|
public String getStatusMessage() {
|
||||||
return statusMessage;
|
return statusMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the status message for this presence.
|
* Set the status message for this presence.
|
||||||
* @param statusMessage The status message.
|
*
|
||||||
|
* @param statusMessage
|
||||||
|
* The status message.
|
||||||
*/
|
*/
|
||||||
public void setStatusMessage(String statusMessage) {
|
public void setStatusMessage(String statusMessage) {
|
||||||
this.statusMessage = statusMessage;
|
this.statusMessage = statusMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ensureProperties() {
|
private void ensureProperties() {
|
||||||
if(properties == null) {
|
if (properties == null) {
|
||||||
properties = new HashMap<String,Property>();
|
properties = new HashMap<String, Property>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setProperty(java.lang.String, java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setProperty(java.lang.String,
|
||||||
|
* java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setProperty(String key, String value) {
|
public void setProperty(String key, String value) {
|
||||||
ensureProperties();
|
ensureProperties();
|
||||||
properties.put(key, new Property(key,value));
|
properties.put(key, new Property(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperty(java.lang.String, java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperty(java.lang.String,
|
||||||
|
* java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getProperty(String key, String defaultValue) {
|
public String getProperty(String key, String defaultValue) {
|
||||||
String retValue = defaultValue;
|
String retValue = defaultValue;
|
||||||
if(properties != null) {
|
if (properties != null) {
|
||||||
Property property = properties.get(key);
|
Property property = properties.get(key);
|
||||||
retValue = (property != null) ? property.getValue() : defaultValue;
|
retValue = (property != null) ? property.getValue() : defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -168,24 +186,27 @@ public class Presence implements IPresence {
|
||||||
public Collection<Property> getProperties() {
|
public Collection<Property> getProperties() {
|
||||||
return properties.values();
|
return properties.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert from an ECF presence to this presence.
|
* Convert from an ECF presence to this presence.
|
||||||
* @param presence The ECF presnce to convert from.
|
*
|
||||||
|
* @param presence
|
||||||
|
* The ECF presnce to convert from.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IPresence convertPresence(org.eclipse.ecf.presence.IPresence presence) {
|
public static IPresence convertPresence(
|
||||||
|
org.eclipse.ecf.presence.IPresence presence) {
|
||||||
IPresence newPresence = null;
|
IPresence newPresence = null;
|
||||||
if(presence != null) {
|
if (presence != null) {
|
||||||
newPresence = new Presence();
|
newPresence = new Presence();
|
||||||
newPresence.setType(TYPE_MAP.get(presence.getType()));
|
newPresence.setType(TYPE_MAP.get(presence.getType()));
|
||||||
newPresence.setMode(MODE_MAP.get(presence.getMode()));
|
newPresence.setMode(MODE_MAP.get(presence.getMode()));
|
||||||
newPresence.setStatusMessage(presence.getStatus());
|
newPresence.setStatusMessage(presence.getStatus());
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, String> properties = (Map<String, String>) presence.getProperties();
|
Map<String, String> properties = (Map<String, String>) presence
|
||||||
if(properties != null) {
|
.getProperties();
|
||||||
for(String key : properties.keySet()) {
|
if (properties != null) {
|
||||||
|
for (String key : properties.keySet()) {
|
||||||
newPresence.setProperty(key, properties.get(key));
|
newPresence.setProperty(key, properties.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,36 +214,26 @@ public class Presence implements IPresence {
|
||||||
return newPresence;
|
return newPresence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param presence
|
* @param presence
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static org.eclipse.ecf.presence.IPresence convertPresence(IPresence presence) {
|
public static org.eclipse.ecf.presence.IPresence convertPresence(
|
||||||
|
IPresence presence) {
|
||||||
org.eclipse.ecf.presence.IPresence newPresence = null;
|
org.eclipse.ecf.presence.IPresence newPresence = null;
|
||||||
if(presence != null) {
|
if (presence != null) {
|
||||||
newPresence = new org.eclipse.ecf.presence.Presence();
|
newPresence = new org.eclipse.ecf.presence.Presence();
|
||||||
|
|
||||||
// Map<String, String> properties = presence.getProperties();
|
// Map<String, String> properties = presence.getProperties();
|
||||||
// if(properties != null) {
|
// if(properties != null) {
|
||||||
// for(String key : properties.keySet()) {
|
// for(String key : properties.keySet()) {
|
||||||
// newPresence.setProperty(key, properties.get(key));
|
// newPresence.setProperty(key, properties.get(key));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return newPresence;
|
return newPresence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,33 +24,32 @@ import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 23, 2012 jkorman Initial creation
|
* Mar 23, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum SerializationMode {
|
public enum SerializationMode {
|
||||||
THRIFT, JAXB, JAVA, STRING, NONE, ISNULL;
|
THRIFT, JAXB, JAVA, STRING, NONE, ISNULL;
|
||||||
|
|
||||||
public static SerializationMode getMode(Object object) {
|
public static SerializationMode getMode(Object object) {
|
||||||
SerializationMode mode = ISNULL;
|
SerializationMode mode = ISNULL;
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
if(object instanceof String) {
|
if (object instanceof String) {
|
||||||
mode = STRING;
|
mode = STRING;
|
||||||
} else if (object instanceof Serializable) {
|
} else if (object instanceof Serializable) {
|
||||||
mode = JAVA;
|
mode = JAVA;
|
||||||
|
|
|
@ -25,30 +25,30 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 24, 2012 jkorman Initial creation
|
* Feb 24, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TextMessage extends BaseMessage {
|
public class TextMessage extends BaseMessage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param to
|
* @param to
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public TextMessage(IQualifiedID to, String body) {
|
public TextMessage(IQualifiedID to, String body) {
|
||||||
super(to,body);
|
super(to, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,19 +48,25 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
|
|
||||||
public abstract class Tools {
|
public abstract class Tools {
|
||||||
|
|
||||||
private static final String ENV_THRIFT = "[[COMMAND#"
|
public static final String TAG_INVITE_ID = "[[INVITEID#%s]]%s";
|
||||||
|
|
||||||
|
public static final String PROP_SESSION_ID = "sessionId";
|
||||||
|
|
||||||
|
public static final String CMD_PREAMBLE = "[[COMMAND#";
|
||||||
|
|
||||||
|
private static final String ENV_THRIFT = CMD_PREAMBLE
|
||||||
+ SerializationMode.THRIFT.name() + "]]";
|
+ SerializationMode.THRIFT.name() + "]]";
|
||||||
|
|
||||||
private static final String ENV_JAXB = "[[COMMAND#"
|
private static final String ENV_JAXB = CMD_PREAMBLE
|
||||||
+ SerializationMode.JAXB.name() + "]]";
|
+ SerializationMode.JAXB.name() + "]]";
|
||||||
|
|
||||||
private static final String ENV_STRING = "[[COMMAND#"
|
private static final String ENV_STRING = CMD_PREAMBLE
|
||||||
+ SerializationMode.STRING.name() + "]]";
|
+ SerializationMode.STRING.name() + "]]";
|
||||||
|
|
||||||
private static final String ENV_JAVA = "[[COMMAND#"
|
private static final String ENV_JAVA = CMD_PREAMBLE
|
||||||
+ SerializationMode.JAVA.name() + "]]";
|
+ SerializationMode.JAVA.name() + "]]";
|
||||||
|
|
||||||
private static final String ENV_NONE = "[[COMMAND#"
|
private static final String ENV_NONE = CMD_PREAMBLE
|
||||||
+ SerializationMode.NONE.name() + "]]";
|
+ SerializationMode.NONE.name() + "]]";
|
||||||
|
|
||||||
public static final String VENUE_SUBJECT_PROP = "subject";
|
public static final String VENUE_SUBJECT_PROP = "subject";
|
||||||
|
|
|
@ -26,23 +26,23 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 27, 2012 jkorman Initial creation
|
* Mar 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ChatMessageEvent implements ITextMessageEvent {
|
public class ChatMessageEvent implements ITextMessageEvent {
|
||||||
|
|
||||||
private final TextMessage message;
|
private final TextMessage message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param msg
|
* @param msg
|
||||||
|
@ -51,13 +51,12 @@ public class ChatMessageEvent implements ITextMessageEvent {
|
||||||
message = msg;
|
message = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TextMessage getMessage() {
|
public TextMessage getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,34 +20,33 @@
|
||||||
package com.raytheon.uf.viz.collaboration.comm.provider.event;
|
package com.raytheon.uf.viz.collaboration.comm.provider.event;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 27, 2012 jkorman Initial creation
|
* Mar 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VenueInvitationEvent implements IVenueInvitationEvent {
|
public class VenueInvitationEvent implements IVenueInvitationEvent {
|
||||||
|
|
||||||
private IQualifiedID venueId;
|
private IQualifiedID venueId;
|
||||||
|
|
||||||
private IChatID invitor;
|
private IQualifiedID invitor;
|
||||||
|
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
private String body;
|
private String body;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,16 +56,17 @@ public class VenueInvitationEvent implements IVenueInvitationEvent {
|
||||||
* @param subject
|
* @param subject
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public VenueInvitationEvent(IQualifiedID venueId, IChatID invitor, String subject, String body) {
|
public VenueInvitationEvent(IQualifiedID venueId, IQualifiedID invitor,
|
||||||
|
String subject, String body) {
|
||||||
this.venueId = venueId;
|
this.venueId = venueId;
|
||||||
this.invitor = invitor;
|
this.invitor = invitor;
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the room identifier
|
* Get the room identifier
|
||||||
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getRoomId()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getRoomId()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +78,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent {
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getInvitor()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getInvitor()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IChatID getInvitor() {
|
public IQualifiedID getInvitor() {
|
||||||
return invitor;
|
return invitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,38 +28,40 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 20, 2012 jkorman Initial creation
|
* Mar 20, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VenueParticipantEvent implements IVenueParticipantEvent {
|
public class VenueParticipantEvent implements IVenueParticipantEvent {
|
||||||
|
|
||||||
private final ParticipantEventType eventType;
|
private final ParticipantEventType eventType;
|
||||||
|
|
||||||
private final IVenueParticipant participant;
|
private final IVenueParticipant participant;
|
||||||
|
|
||||||
private IPresence presence;
|
private IPresence presence;
|
||||||
|
|
||||||
public VenueParticipantEvent(IVenueParticipant participant, ParticipantEventType eventType) {
|
public VenueParticipantEvent(IVenueParticipant participant,
|
||||||
|
ParticipantEventType eventType) {
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VenueParticipantEvent(IVenueParticipant participant, IPresence presence, ParticipantEventType eventType) {
|
public VenueParticipantEvent(IVenueParticipant participant,
|
||||||
|
IPresence presence, ParticipantEventType eventType) {
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
this.presence = presence;
|
this.presence = presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getEventType()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent#getEventType()
|
||||||
*/
|
*/
|
||||||
|
@ -83,6 +85,5 @@ public class VenueParticipantEvent implements IVenueParticipantEvent {
|
||||||
public IPresence getPresence() {
|
public IPresence getPresence() {
|
||||||
return presence;
|
return presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,17 +27,17 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 jkorman Initial creation
|
* Mar 1, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class InfoAdapter {
|
public class InfoAdapter {
|
||||||
|
@ -45,44 +45,44 @@ public class InfoAdapter {
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 jkorman Initial creation
|
* Mar 1, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 jkorman Initial creation
|
* Mar 1, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
private static class MutableVenueInfo implements IVenueInfo {
|
private static class MutableVenueInfo implements IVenueInfo {
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private int participantCount;
|
private int participantCount;
|
||||||
|
|
||||||
private boolean isModerated = false;
|
private boolean isModerated = false;
|
||||||
|
@ -90,7 +90,7 @@ public class InfoAdapter {
|
||||||
private boolean isPersistent = false;
|
private boolean isPersistent = false;
|
||||||
|
|
||||||
private boolean requiresPassword = false;
|
private boolean requiresPassword = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param description
|
* @param description
|
||||||
|
@ -98,7 +98,7 @@ public class InfoAdapter {
|
||||||
public void setVenueDescription(String description) {
|
public void setVenueDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -106,7 +106,7 @@ public class InfoAdapter {
|
||||||
public void setVenueName(String name) {
|
public void setVenueName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param subject
|
* @param subject
|
||||||
|
@ -122,7 +122,7 @@ public class InfoAdapter {
|
||||||
public void setVenueID(String id) {
|
public void setVenueID(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param count
|
* @param count
|
||||||
|
@ -130,7 +130,7 @@ public class InfoAdapter {
|
||||||
public void setParticipantCount(int count) {
|
public void setParticipantCount(int count) {
|
||||||
participantCount = count;
|
participantCount = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param moderated
|
* @param moderated
|
||||||
|
@ -138,6 +138,7 @@ public class InfoAdapter {
|
||||||
public void setModerated(boolean moderated) {
|
public void setModerated(boolean moderated) {
|
||||||
isModerated = moderated;
|
isModerated = moderated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param persistent
|
* @param persistent
|
||||||
|
@ -145,6 +146,7 @@ public class InfoAdapter {
|
||||||
public void setPersistent(boolean persistent) {
|
public void setPersistent(boolean persistent) {
|
||||||
isPersistent = persistent;
|
isPersistent = persistent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiresPassword(boolean requiresPassword) {
|
public void setRequiresPassword(boolean requiresPassword) {
|
||||||
this.requiresPassword = requiresPassword;
|
this.requiresPassword = requiresPassword;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +217,7 @@ public class InfoAdapter {
|
||||||
public boolean requiresPassword() {
|
public boolean requiresPassword() {
|
||||||
return requiresPassword;
|
return requiresPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -223,10 +225,11 @@ public class InfoAdapter {
|
||||||
sb.append(String.format("[%s]:", id));
|
sb.append(String.format("[%s]:", id));
|
||||||
sb.append(String.format("mod[%s]:", (isModerated) ? "T" : "F"));
|
sb.append(String.format("mod[%s]:", (isModerated) ? "T" : "F"));
|
||||||
sb.append(String.format("pers[%s]:", (isPersistent) ? "T" : "F"));
|
sb.append(String.format("pers[%s]:", (isPersistent) ? "T" : "F"));
|
||||||
sb.append(String.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
|
sb.append(String
|
||||||
|
.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
|
||||||
sb.append(String.format("\n subject : %s", subject));
|
sb.append(String.format("\n subject : %s", subject));
|
||||||
sb.append(String.format("\n description : %s", description));
|
sb.append(String.format("\n description : %s", description));
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,20 +237,21 @@ public class InfoAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert ECF room into to a VenueInfo instance.
|
* Convert ECF room into to a VenueInfo instance.
|
||||||
|
*
|
||||||
* @param info
|
* @param info
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IVenueInfo createVenueInfo(IChatRoomInfo info) {
|
public static IVenueInfo createVenueInfo(IChatRoomInfo info) {
|
||||||
MutableVenueInfo venue = null;
|
MutableVenueInfo venue = null;
|
||||||
if(info != null) {
|
if (info != null) {
|
||||||
|
|
||||||
venue = new MutableVenueInfo();
|
venue = new MutableVenueInfo();
|
||||||
venue.setVenueDescription(info.getDescription());
|
venue.setVenueDescription(info.getDescription());
|
||||||
venue.setVenueName(info.getName());
|
venue.setVenueName(info.getName());
|
||||||
venue.setVenueSubject(info.getSubject());
|
venue.setVenueSubject(info.getSubject());
|
||||||
venue.setVenueID(info.getRoomID().toExternalForm());
|
venue.setVenueID(info.getRoomID().toExternalForm());
|
||||||
venue.setParticipantCount(info.getParticipantsCount());
|
venue.setParticipantCount(info.getParticipantsCount());
|
||||||
|
|
||||||
venue.setModerated(info.isModerated());
|
venue.setModerated(info.isModerated());
|
||||||
venue.setPersistent(info.isPersistent());
|
venue.setPersistent(info.isPersistent());
|
||||||
venue.setRequiresPassword(info.requiresPassword());
|
venue.setRequiresPassword(info.requiresPassword());
|
||||||
|
|
|
@ -31,32 +31,32 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 jkorman Initial creation
|
* Mar 1, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Venue implements IVenue {
|
public class Venue implements IVenue {
|
||||||
|
|
||||||
private IVenueInfo info;
|
private IVenueInfo info;
|
||||||
|
|
||||||
private Map<String, IVenueParticipant> participants;
|
private Map<String, IVenueParticipant> participants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Venue() {
|
public Venue() {
|
||||||
participants = new HashMap<String, IVenueParticipant>();
|
participants = new HashMap<String, IVenueParticipant>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getInfo()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getInfo()
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +73,7 @@ public class Venue implements IVenue {
|
||||||
public void setInfo(IVenueInfo info) {
|
public void setInfo(IVenueInfo info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,15 +41,15 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||||
public class VenueInfo implements IVenueInfo {
|
public class VenueInfo implements IVenueInfo {
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private int participantCount;
|
private int participantCount;
|
||||||
|
|
||||||
private boolean isModerated = false;
|
private boolean isModerated = false;
|
||||||
|
|
||||||
private boolean isPersistent = false;
|
private boolean isPersistent = false;
|
||||||
|
@ -96,7 +96,7 @@ public class VenueInfo implements IVenueInfo {
|
||||||
public int getParticipantCount() {
|
public int getParticipantCount() {
|
||||||
return participantCount;
|
return participantCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isModerated()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isModerated()
|
||||||
|
@ -134,7 +134,7 @@ public class VenueInfo implements IVenueInfo {
|
||||||
sb.append(String.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
|
sb.append(String.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
|
||||||
sb.append(String.format("\n subject : %s", subject));
|
sb.append(String.format("\n subject : %s", subject));
|
||||||
sb.append(String.format("\n description : %s", description));
|
sb.append(String.format("\n description : %s", description));
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,21 +26,21 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 27, 2012 jkorman Initial creation
|
* Feb 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface IMutableRosterEntry extends IRosterEntry {
|
interface IMutableRosterEntry extends IRosterEntry {
|
||||||
|
|
||||||
void setPresence(IPresence presence);
|
void setPresence(IPresence presence);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.ID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -232,7 +232,12 @@ public class Roster extends RosterItem implements IRoster {
|
||||||
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
|
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
|
||||||
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
|
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
|
||||||
|
|
||||||
IChatID id = VenueUserId.convertFrom(entry.getUser());
|
IChatID id = IDConverter.convertFrom(entry.getUser());
|
||||||
|
System.out.println(" "
|
||||||
|
+ entry.getUser().getID().getName());
|
||||||
|
System.out.println("Group:" + group.getName() + " id:"
|
||||||
|
+ id.getFQName());
|
||||||
|
|
||||||
RosterEntry re = new RosterEntry(id);
|
RosterEntry re = new RosterEntry(id);
|
||||||
// Check to see if we already have an entry
|
// Check to see if we already have an entry
|
||||||
IRosterEntry reCurrent = getRosterEntry(re);
|
IRosterEntry reCurrent = getRosterEntry(re);
|
||||||
|
@ -242,7 +247,12 @@ public class Roster extends RosterItem implements IRoster {
|
||||||
}
|
}
|
||||||
IPresence p = Presence.convertPresence(entry.getPresence());
|
IPresence p = Presence.convertPresence(entry.getPresence());
|
||||||
re.setPresence(p);
|
re.setPresence(p);
|
||||||
|
System.out.println(" entry:" + re.getName() + " presence:"
|
||||||
|
+ re.getPresence().getMode()
|
||||||
|
+ re.getPresence().getType());
|
||||||
|
|
||||||
re.addGroup(group);
|
re.addGroup(group);
|
||||||
|
group.addEntry(re);
|
||||||
internalEntries.put(re.getUser(), re);
|
internalEntries.put(re.getUser(), re);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,23 +33,24 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 27, 2012 jkorman Initial creation
|
* Feb 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRosterEntry {
|
public class RosterEntry extends RosterItem implements IRosterEntry,
|
||||||
|
IMutableRosterEntry {
|
||||||
|
|
||||||
private IChatID userId = null;
|
private IChatID userId = null;
|
||||||
|
|
||||||
private IPresence presence = null;
|
private IPresence presence = null;
|
||||||
|
|
||||||
private Map<IRosterGroup, IRosterGroup> groups = null;
|
private Map<IRosterGroup, IRosterGroup> groups = null;
|
||||||
|
@ -60,6 +61,7 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
*/
|
*/
|
||||||
public RosterEntry(IChatID id) {
|
public RosterEntry(IChatID id) {
|
||||||
userId = id;
|
userId = id;
|
||||||
|
setName(id.getFQName());
|
||||||
groups = new HashMap<IRosterGroup, IRosterGroup>();
|
groups = new HashMap<IRosterGroup, IRosterGroup>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,15 +71,15 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
@Override
|
@Override
|
||||||
public IChatID getUser() {
|
public IChatID getUser() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param group
|
* @param group
|
||||||
*/
|
*/
|
||||||
public void addGroup(IRosterGroup group) {
|
public void addGroup(IRosterGroup group) {
|
||||||
if(group != null) {
|
if (group != null) {
|
||||||
if(!groups.containsKey(group)) {
|
if (!groups.containsKey(group)) {
|
||||||
groups.put(group, group);
|
groups.put(group, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,10 +100,10 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
public void setPresence(IPresence presence) {
|
public void setPresence(IPresence presence) {
|
||||||
this.presence = presence;
|
this.presence = presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPresence getPresence() {
|
public IPresence getPresence() {
|
||||||
|
@ -141,19 +143,18 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final void main(String[] args) {
|
||||||
|
|
||||||
public static final void main(String [] args) {
|
|
||||||
|
|
||||||
IChatID id = new IChatID() {
|
IChatID id = new IChatID() {
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
private String nickName = null;
|
private String nickName = null;
|
||||||
|
|
||||||
private String host = null;
|
private String host = null;
|
||||||
|
|
||||||
private String resource = null;
|
private String resource = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setName(String userName) {
|
public void setName(String userName) {
|
||||||
name = userName;
|
name = userName;
|
||||||
|
@ -172,9 +173,9 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
@Override
|
@Override
|
||||||
public String getNickname() {
|
public String getNickname() {
|
||||||
return nickName;
|
return nickName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHost(String hostName) {
|
public void setHost(String hostName) {
|
||||||
host = hostName;
|
host = hostName;
|
||||||
|
@ -184,44 +185,42 @@ public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRos
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getResource() {
|
public String getResource() {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setResource(String resource) {
|
public void setResource(String resource) {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFQName() {
|
public String getFQName() {
|
||||||
StringBuilder sb = new StringBuilder(name);
|
StringBuilder sb = new StringBuilder(name);
|
||||||
sb.append("@");
|
sb.append("@");
|
||||||
sb.append(host);
|
sb.append(host);
|
||||||
if(resource != null) {
|
if (resource != null) {
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
sb.append(resource);
|
sb.append(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
id.setName("fred");
|
id.setName("fred");
|
||||||
id.setHost("awipscm.omaha.us.ray.com");
|
id.setHost("awipscm.omaha.us.ray.com");
|
||||||
id.setResource("smack");
|
id.setResource("smack");
|
||||||
|
|
||||||
IMutableRosterEntry entry = new RosterEntry(id);
|
IMutableRosterEntry entry = new RosterEntry(id);
|
||||||
entry.setPresence(new Presence());
|
entry.setPresence(new Presence());
|
||||||
|
|
||||||
IRosterEntry en = entry;
|
IRosterEntry en = entry;
|
||||||
|
|
||||||
System.out.println(id.getFQName());
|
System.out.println(id.getFQName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,36 +31,36 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 27, 2012 jkorman Initial creation
|
* Feb 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RosterGroup extends RosterItem implements IRosterGroup {
|
public class RosterGroup extends RosterItem implements IRosterGroup {
|
||||||
|
|
||||||
private Collection<IRosterEntry> entries = null;
|
private Collection<IRosterEntry> entries = null;
|
||||||
|
|
||||||
private Collection<IRosterGroup> groups = null;
|
private Collection<IRosterGroup> groups = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public RosterGroup(String name, IRosterItem parent, IRoster roster) {
|
public RosterGroup(String name, IRosterItem parent, IRoster roster) {
|
||||||
super(name, parent, roster);
|
super(name, parent, roster);
|
||||||
entries = new ArrayList<IRosterEntry>();
|
entries = new ArrayList<IRosterEntry>();
|
||||||
if(roster.supportsNestedGroups()) {
|
if (roster.supportsNestedGroups()) {
|
||||||
groups = new ArrayList<IRosterGroup>();
|
groups = new ArrayList<IRosterGroup>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param entry
|
* @param entry
|
||||||
|
@ -68,7 +68,7 @@ public class RosterGroup extends RosterItem implements IRosterGroup {
|
||||||
public void addEntry(IRosterEntry entry) {
|
public void addEntry(IRosterEntry entry) {
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup#getEntries()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup#getEntries()
|
||||||
|
|
|
@ -43,26 +43,26 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 29, 2012 jkorman Initial creation
|
* Feb 29, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class RosterItem implements IRosterItem {
|
public class RosterItem implements IRosterItem {
|
||||||
|
|
||||||
//
|
//
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
//
|
//
|
||||||
private IRosterItem parent = null;
|
private IRosterItem parent = null;
|
||||||
|
|
||||||
//
|
//
|
||||||
private IRoster roster = null;
|
private IRoster roster = null;
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ public class RosterItem implements IRosterItem {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public RosterItem() {
|
public RosterItem() {
|
||||||
this(null,null,null);
|
this(null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -101,7 +101,7 @@ public class RosterItem implements IRosterItem {
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getName()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getName()
|
||||||
|
@ -118,7 +118,7 @@ public class RosterItem implements IRosterItem {
|
||||||
public void setParent(IRosterItem item) {
|
public void setParent(IRosterItem item) {
|
||||||
parent = item;
|
parent = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getParent()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getParent()
|
||||||
*/
|
*/
|
||||||
|
@ -134,7 +134,7 @@ public class RosterItem implements IRosterItem {
|
||||||
public void setRoster(IRoster roster) {
|
public void setRoster(IRoster roster) {
|
||||||
this.roster = roster;
|
this.roster = roster;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getRoster()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getRoster()
|
||||||
|
@ -176,5 +176,5 @@ public class RosterItem implements IRosterItem {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,11 @@ import java.util.Collection;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
|
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -118,7 +117,7 @@ public class RosterManager implements IRosterManager {
|
||||||
Roster newRoster = null;
|
Roster newRoster = null;
|
||||||
|
|
||||||
if (roster != null) {
|
if (roster != null) {
|
||||||
IChatID id = VenueUserId.convertFrom(roster.getUser());
|
IChatID id = IDConverter.convertFrom(roster.getUser());
|
||||||
newRoster = new Roster(id);
|
newRoster = new Roster(id);
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
@ -127,12 +126,22 @@ public class RosterManager implements IRosterManager {
|
||||||
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
|
if (o instanceof org.eclipse.ecf.presence.roster.IRosterEntry) {
|
||||||
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
|
org.eclipse.ecf.presence.roster.IRosterEntry entry = (org.eclipse.ecf.presence.roster.IRosterEntry) o;
|
||||||
|
|
||||||
|
System.out.println("RosterEntry ");
|
||||||
|
System.out.println(" -- " + entry.getUser().getName());
|
||||||
|
System.out.println(" "
|
||||||
|
+ entry.getUser().getID().getName());
|
||||||
|
|
||||||
id = RosterId.convertFrom(entry.getUser());
|
id = RosterId.convertFrom(entry.getUser());
|
||||||
RosterEntry re = new RosterEntry(id);
|
RosterEntry re = new RosterEntry(id);
|
||||||
if (!newRoster.getEntries().contains(re)) {
|
if (!newRoster.getEntries().contains(re)) {
|
||||||
IPresence p = Presence.convertPresence(entry
|
IPresence p = Presence.convertPresence(entry
|
||||||
.getPresence());
|
.getPresence());
|
||||||
re.setPresence(p);
|
re.setPresence(p);
|
||||||
|
|
||||||
|
System.out.println(" entry:" + re.getName()
|
||||||
|
+ " presence:" + re.getPresence().getMode()
|
||||||
|
+ re.getPresence().getType());
|
||||||
|
|
||||||
newRoster.addRosterEntry(re);
|
newRoster.addRosterEntry(re);
|
||||||
}
|
}
|
||||||
} else if (o instanceof org.eclipse.ecf.presence.roster.IRosterGroup) {
|
} else if (o instanceof org.eclipse.ecf.presence.roster.IRosterGroup) {
|
||||||
|
|
|
@ -41,21 +41,22 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* EventBus subscription events.
|
* EventBus subscription events.
|
||||||
* <li>ISubscriptionResponseEvent : This event is posted when a subscription request has
|
* <li>ISubscriptionResponseEvent : This event is posted when a subscription
|
||||||
* been responded to.</li>
|
* request has been responded to.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 16, 2012 jkorman Initial creation
|
* Mar 16, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AccountManager implements IAccountManager {
|
public class AccountManager implements IAccountManager {
|
||||||
|
@ -64,21 +65,24 @@ public class AccountManager implements IAccountManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleSubscribeRequest(ID fromID) {
|
public void handleSubscribeRequest(ID fromID) {
|
||||||
|
|
||||||
IQualifiedID fromId = null;
|
IQualifiedID fromId = null;
|
||||||
|
|
||||||
IPresence.Type subscribedType = IPresence.Type.UNKNOWN;
|
IPresence.Type subscribedType = IPresence.Type.UNKNOWN;
|
||||||
if(responder != null) {
|
if (responder != null) {
|
||||||
subscribedType = responder.handleSubscribeRequest(fromId);
|
subscribedType = responder.handleSubscribeRequest(fromId);
|
||||||
} else {
|
} else {
|
||||||
subscribedType = IPresence.Type.SUBSCRIBED;
|
subscribedType = IPresence.Type.SUBSCRIBED;
|
||||||
}
|
}
|
||||||
org.eclipse.ecf.presence.Presence.Type sType = Tools.convertPresenceType(subscribedType);
|
org.eclipse.ecf.presence.Presence.Type sType = Tools
|
||||||
|
.convertPresenceType(subscribedType);
|
||||||
|
|
||||||
|
org.eclipse.ecf.presence.IPresence presence = new org.eclipse.ecf.presence.Presence(
|
||||||
|
sType);
|
||||||
|
|
||||||
org.eclipse.ecf.presence.IPresence presence = new org.eclipse.ecf.presence.Presence(sType);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
presenceAdapter.getRosterManager().getPresenceSender().sendPresenceUpdate(fromID, presence);
|
presenceAdapter.getRosterManager().getPresenceSender()
|
||||||
|
.sendPresenceUpdate(fromID, presence);
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
// Will have to do something with this sooner or later.
|
// Will have to do something with this sooner or later.
|
||||||
}
|
}
|
||||||
|
@ -92,32 +96,35 @@ public class AccountManager implements IAccountManager {
|
||||||
public void handleUnsubscribed(ID fromID) {
|
public void handleUnsubscribed(ID fromID) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean autoRespond = true;
|
private boolean autoRespond = true;
|
||||||
|
|
||||||
private IPresenceContainerAdapter presenceAdapter;
|
private IPresenceContainerAdapter presenceAdapter;
|
||||||
|
|
||||||
private ISubscriptionResponder responder;
|
private ISubscriptionResponder responder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param adapter
|
* @param adapter
|
||||||
*/
|
*/
|
||||||
AccountManager(IPresenceContainerAdapter adapter) {
|
AccountManager(IPresenceContainerAdapter adapter) {
|
||||||
presenceAdapter = adapter;
|
presenceAdapter = adapter;
|
||||||
presenceAdapter.getRosterManager().addRosterSubscriptionListener(autoResponder);
|
presenceAdapter.getRosterManager().addRosterSubscriptionListener(
|
||||||
|
autoResponder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the auto subscription mode to ON or OFF. If set to off then any currently assigned
|
* Set the auto subscription mode to ON or OFF. If set to off then any
|
||||||
* autoresponder is set to null.
|
* currently assigned autoresponder is set to null.
|
||||||
* @param mode The auto subscription mode.
|
*
|
||||||
|
* @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#setAutoSubscriptionMode(boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setAutoSubscriptionMode(boolean auto) {
|
public void setAutoSubscriptionMode(boolean auto) {
|
||||||
autoRespond = auto;
|
autoRespond = auto;
|
||||||
if(!auto) {
|
if (!auto) {
|
||||||
responder = null;
|
responder = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,20 +158,23 @@ public class AccountManager implements IAccountManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param password The new password. For security the password is a character array that will
|
* @param password
|
||||||
* be zero'd after use.
|
* The new password. For security the password is a character
|
||||||
|
* array that will be zero'd after use.
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#changePassword(char[])
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#changePassword(char[])
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void changePassword(char[] password) throws CollaborationException {
|
public void changePassword(char[] password) throws CollaborationException {
|
||||||
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter.getAccountManager();
|
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
|
||||||
if(manager != null) {
|
.getAccountManager();
|
||||||
|
if (manager != null) {
|
||||||
try {
|
try {
|
||||||
manager.changePassword(new String(password));
|
manager.changePassword(new String(password));
|
||||||
// all done so clear the password.
|
// all done so clear the password.
|
||||||
Arrays.fill(password, (char) 0);
|
Arrays.fill(password, (char) 0);
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
throw new CollaborationException("Could not change account password");
|
throw new CollaborationException(
|
||||||
|
"Could not change account password");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,8 +185,9 @@ public class AccountManager implements IAccountManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteAccount() throws CollaborationException {
|
public void deleteAccount() throws CollaborationException {
|
||||||
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter.getAccountManager();
|
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
|
||||||
if(manager != null) {
|
.getAccountManager();
|
||||||
|
if (manager != null) {
|
||||||
try {
|
try {
|
||||||
manager.deleteAccount();
|
manager.deleteAccount();
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
|
@ -187,18 +198,21 @@ public class AccountManager implements IAccountManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the server allows new accounts to be created by the user.
|
* Determines if the server allows new accounts to be created by the user.
|
||||||
* @throws CollaborationException
|
*
|
||||||
|
* @throws CollaborationException
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#canCreateAccount()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#canCreateAccount()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canCreateAccount() throws CollaborationException {
|
public boolean canCreateAccount() throws CollaborationException {
|
||||||
boolean canCreate = false;
|
boolean canCreate = false;
|
||||||
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter.getAccountManager();
|
org.eclipse.ecf.presence.IAccountManager manager = presenceAdapter
|
||||||
if(manager != null) {
|
.getAccountManager();
|
||||||
|
if (manager != null) {
|
||||||
try {
|
try {
|
||||||
canCreate = manager.isAccountCreationSupported();
|
canCreate = manager.isAccountCreationSupported();
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
throw new CollaborationException("Error attempting to determine if accounts may be created.");
|
throw new CollaborationException(
|
||||||
|
"Error attempting to determine if accounts may be created.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return canCreate;
|
return canCreate;
|
||||||
|
@ -208,16 +222,16 @@ public class AccountManager implements IAccountManager {
|
||||||
* TODO : Body of method
|
* TODO : Body of method
|
||||||
*
|
*
|
||||||
* @param password
|
* @param password
|
||||||
* @param attributes
|
* @param attributes
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#createAccount(java.lang.String, char[], java.util.Map)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager#createAccount(java.lang.String,
|
||||||
|
* char[], java.util.Map)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void createAccount(String name, char[] password, Map<String, String> attributes)
|
public void createAccount(String name, char[] password,
|
||||||
throws CollaborationException {
|
Map<String, String> attributes) throws CollaborationException {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
if (password != null) {
|
if (password != null) {
|
||||||
|
|
||||||
|
|
||||||
// all done so clear the password.
|
// all done so clear the password.
|
||||||
Arrays.fill(password, (char) 0);
|
Arrays.fill(password, (char) 0);
|
||||||
}
|
}
|
||||||
|
@ -231,14 +245,16 @@ public class AccountManager implements IAccountManager {
|
||||||
* @throws CollaborationException
|
* @throws CollaborationException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendPresence(IPresence userPresence) throws CollaborationException {
|
public void sendPresence(IPresence userPresence)
|
||||||
IPresenceSender sender = presenceAdapter.getRosterManager().getPresenceSender();
|
throws CollaborationException {
|
||||||
|
IPresenceSender sender = presenceAdapter.getRosterManager()
|
||||||
|
.getPresenceSender();
|
||||||
try {
|
try {
|
||||||
sender.sendPresenceUpdate(null, Presence.convertPresence(userPresence));
|
sender.sendPresenceUpdate(null,
|
||||||
|
Presence.convertPresence(userPresence));
|
||||||
} catch (ECFException e) {
|
} catch (ECFException e) {
|
||||||
// TODO : Exception handing....
|
// TODO : Exception handing....
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -29,51 +28,46 @@ import org.eclipse.ecf.core.identity.ID;
|
||||||
import org.eclipse.ecf.core.identity.IDCreateException;
|
import org.eclipse.ecf.core.identity.IDCreateException;
|
||||||
import org.eclipse.ecf.core.identity.IDFactory;
|
import org.eclipse.ecf.core.identity.IDFactory;
|
||||||
import org.eclipse.ecf.core.identity.Namespace;
|
import org.eclipse.ecf.core.identity.Namespace;
|
||||||
import org.eclipse.ecf.core.util.Base64;
|
|
||||||
import org.eclipse.ecf.core.util.ECFException;
|
import org.eclipse.ecf.core.util.ECFException;
|
||||||
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
|
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 21, 2012 jkorman Initial creation
|
* Mar 21, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
public abstract class BaseSession implements ISession {
|
||||||
public abstract class BaseSession implements ISession, IEventPublisher {
|
|
||||||
|
|
||||||
protected final String sessionId;
|
protected final String sessionId;
|
||||||
|
|
||||||
|
private String followingId;
|
||||||
|
|
||||||
private EventBus managerEventBus;
|
private EventBus managerEventBus;
|
||||||
|
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
private Map<Object, Object> eventSubscribers;
|
private Map<Object, Object> eventSubscribers;
|
||||||
|
|
||||||
private IContainer connectionContainer;
|
private IContainer connectionContainer;
|
||||||
|
|
||||||
private IPresenceContainerAdapter connectionPresence = null;
|
private IPresenceContainerAdapter connectionPresence = null;
|
||||||
|
|
||||||
private Namespace connectionNamespace = null;
|
private Namespace connectionNamespace = null;
|
||||||
|
|
||||||
// The session manager that created this session.
|
// The session manager that created this session.
|
||||||
|
@ -85,42 +79,41 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
* @param externalBus
|
* @param externalBus
|
||||||
* @param manager
|
* @param manager
|
||||||
*/
|
*/
|
||||||
protected BaseSession(IContainer container, EventBus externalBus, SessionManager manager) {
|
protected BaseSession(IContainer container, EventBus externalBus,
|
||||||
|
SessionManager manager) throws CollaborationException {
|
||||||
// Set the session identifier.
|
// Set the session identifier.
|
||||||
sessionId = UUID.randomUUID().toString();
|
sessionId = UUID.randomUUID().toString();
|
||||||
managerEventBus = externalBus;
|
managerEventBus = externalBus;
|
||||||
eventBus = new EventBus();
|
eventBus = new EventBus();
|
||||||
connectionContainer = container;
|
connectionContainer = container;
|
||||||
sessionManager = manager;
|
sessionManager = manager;
|
||||||
eventSubscribers = new HashMap<Object,Object>();
|
eventSubscribers = new HashMap<Object, Object>();
|
||||||
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @throws ECFException
|
* @throws ECFException
|
||||||
*/
|
*/
|
||||||
void setup() throws ECFException {
|
void setup() {
|
||||||
// Check if the container has been set up previously.
|
// Check if the container has been set up previously.
|
||||||
if (connectionContainer != null) {
|
if (connectionContainer != null) {
|
||||||
|
|
||||||
connectionNamespace = connectionContainer.getConnectNamespace();
|
connectionNamespace = connectionContainer.getConnectNamespace();
|
||||||
connectionPresence = (IPresenceContainerAdapter) connectionContainer
|
connectionPresence = (IPresenceContainerAdapter) connectionContainer
|
||||||
.getAdapter(IPresenceContainerAdapter.class);
|
.getAdapter(IPresenceContainerAdapter.class);
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get access to the peer to peer session instance.
|
* Get access to the peer to peer session instance.
|
||||||
|
*
|
||||||
* @return The peer to peer chat session instance.
|
* @return The peer to peer chat session instance.
|
||||||
* @throws CollaborationException
|
* @throws CollaborationException
|
||||||
*/
|
*/
|
||||||
PeerToPeerChat getP2PSession() throws CollaborationException {
|
PeerToPeerChat getP2PSession() throws CollaborationException {
|
||||||
return (PeerToPeerChat) sessionManager.getPeerToPeerSession();
|
return (PeerToPeerChat) sessionManager.getPeerToPeerSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
@ -145,7 +138,6 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
return connectionPresence;
|
return connectionPresence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
|
||||||
*/
|
*/
|
||||||
|
@ -161,7 +153,7 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
@Override
|
@Override
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
boolean connected = false;
|
boolean connected = false;
|
||||||
if(connectionContainer != null) {
|
if (connectionContainer != null) {
|
||||||
connected = (connectionContainer.getConnectedID() != null);
|
connected = (connectionContainer.getConnectedID() != null);
|
||||||
}
|
}
|
||||||
return connected;
|
return connected;
|
||||||
|
@ -174,13 +166,16 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
// Unregister any handlers added using this session
|
// Unregister any handlers added using this session
|
||||||
// for(Object o : eventSubscribers.values()) {
|
// for(Object o : eventSubscribers.values()) {
|
||||||
// managerEventBus.unregister(o);
|
// managerEventBus.unregister(o);
|
||||||
// }
|
// }
|
||||||
sessionManager.removeSession(this);
|
sessionManager.removeSession(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the session identifier.
|
||||||
|
*
|
||||||
|
* @return The session id for this session.
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getSessionId()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getSessionId()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,9 +183,31 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************
|
/**
|
||||||
|
* Get the session identifier of a remote session this session is following.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* The remote session identifier.
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getFollowingSessionId()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getFollowingSessionId() {
|
||||||
|
return followingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the session identifier of a remote session this session is following.
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#setFollowingSessionId(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setFollowingSessionId(String id) {
|
||||||
|
followingId = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// *****************
|
||||||
// Implement IEventPublisher methods
|
// Implement IEventPublisher methods
|
||||||
//*****************
|
// *****************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -199,12 +216,12 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerEventHandler(Object handler) {
|
public void registerEventHandler(Object handler) {
|
||||||
if(!eventSubscribers.containsKey(handler)) {
|
if (!eventSubscribers.containsKey(handler)) {
|
||||||
eventBus.register(handler);
|
eventBus.register(handler);
|
||||||
eventSubscribers.put(handler, handler);
|
eventSubscribers.put(handler, handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param handler
|
* @param handler
|
||||||
|
@ -223,11 +240,11 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
public EventBus getEventPublisher() {
|
public EventBus getEventPublisher() {
|
||||||
return eventBus;
|
return eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus getManagerEventPublisher() {
|
EventBus getManagerEventPublisher() {
|
||||||
return managerEventBus;
|
return managerEventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -235,8 +252,8 @@ public abstract class BaseSession implements ISession, IEventPublisher {
|
||||||
*/
|
*/
|
||||||
public ID createID(String name) throws IDCreateException {
|
public ID createID(String name) throws IDCreateException {
|
||||||
ID id = null;
|
ID id = null;
|
||||||
if(connectionNamespace != null) {
|
if (connectionNamespace != null) {
|
||||||
id = IDFactory.getDefault().createID(connectionNamespace, name);
|
id = IDFactory.getDefault().createID(connectionNamespace, name);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,34 +22,42 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 27, 2012 jkorman Initial creation
|
* Mar 27, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DataHandler {
|
public class DataHandler {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handle(IInitData initdata) {
|
public void handle(IInitData initdata) {
|
||||||
System.out.println("Handling IInitData " + initdata);
|
System.out.println("DataHandler---------------------------------");
|
||||||
|
System.out.println(" Handling IInitData " + initdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handle(IDisplayEvent event) {
|
public void handle(IDisplayEvent event) {
|
||||||
|
System.out.println("DataHandler---------------------------------");
|
||||||
System.out.println("Handling IDisplayEvent " + event);
|
System.out.println("Handling IDisplayEvent " + event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void handle(IVenueInvitationEvent event) {
|
||||||
|
System.out.println("DataHandler---------------------------------");
|
||||||
|
System.out.println("Received invitation " + event.getBody());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,7 @@ import java.util.Map;
|
||||||
import org.eclipse.ecf.core.IContainer;
|
import org.eclipse.ecf.core.IContainer;
|
||||||
import org.eclipse.ecf.core.identity.ID;
|
import org.eclipse.ecf.core.identity.ID;
|
||||||
import org.eclipse.ecf.core.util.ECFException;
|
import org.eclipse.ecf.core.util.ECFException;
|
||||||
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.IChatMessage;
|
||||||
import org.eclipse.ecf.presence.im.IChatMessageEvent;
|
|
||||||
import org.eclipse.ecf.presence.im.IChatMessageSender;
|
import org.eclipse.ecf.presence.im.IChatMessageSender;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
@ -37,11 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Errors;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Errors;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.ChatMessageEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -73,9 +66,8 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
|
||||||
* @param manager
|
* @param manager
|
||||||
*/
|
*/
|
||||||
PeerToPeerChat(IContainer container, EventBus externalBus,
|
PeerToPeerChat(IContainer container, EventBus externalBus,
|
||||||
SessionManager manager) {
|
SessionManager manager) throws CollaborationException {
|
||||||
super(container, externalBus, manager);
|
super(container, externalBus, manager);
|
||||||
setup();
|
|
||||||
chatSender = getConnectionPresenceAdapter().getChatManager()
|
chatSender = getConnectionPresenceAdapter().getChatManager()
|
||||||
.getChatMessageSender();
|
.getChatMessageSender();
|
||||||
}
|
}
|
||||||
|
@ -132,49 +124,14 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
/**
|
||||||
try {
|
*
|
||||||
super.setup();
|
* @return
|
||||||
|
*/
|
||||||
getConnectionPresenceAdapter().getChatManager().addMessageListener(
|
@Override
|
||||||
new IIMMessageListener() {
|
public EventBus getEventPublisher() {
|
||||||
|
return getManagerEventPublisher();
|
||||||
@Override
|
|
||||||
public void handleMessageEvent(
|
|
||||||
IIMMessageEvent messageEvent) {
|
|
||||||
if (messageEvent instanceof IChatMessageEvent) {
|
|
||||||
IChatMessageEvent event = (IChatMessageEvent) messageEvent;
|
|
||||||
|
|
||||||
IChatMessage msg = event.getChatMessage();
|
|
||||||
String body = msg.getBody();
|
|
||||||
if (body != null) {
|
|
||||||
if (body.startsWith("[[COMMAND#")) {
|
|
||||||
Object object = null;
|
|
||||||
try {
|
|
||||||
object = Tools.unMarshallData(body);
|
|
||||||
} catch (CollaborationException e) {
|
|
||||||
System.out
|
|
||||||
.println("Error unmarshalling PeerToPeer data");
|
|
||||||
}
|
|
||||||
if (object != null) {
|
|
||||||
getEventPublisher().post(object);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// anything else pass to the normal text
|
|
||||||
TextMessage textMsg = null;
|
|
||||||
|
|
||||||
ITextMessageEvent chatEvent = new ChatMessageEvent(
|
|
||||||
textMsg);
|
|
||||||
|
|
||||||
getEventPublisher().post(chatEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (ECFException ecfe) {
|
|
||||||
System.out.println("Error setting up PeerToPeer chat listeners");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
/**
|
||||||
|
* 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 java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.ecf.presence.IIMMessageEvent;
|
||||||
|
import org.eclipse.ecf.presence.IIMMessageListener;
|
||||||
|
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
|
||||||
|
import org.eclipse.ecf.presence.im.IChatMessage;
|
||||||
|
import org.eclipse.ecf.presence.im.IChatMessageEvent;
|
||||||
|
|
||||||
|
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.event.ITextMessageEvent;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.event.ChatMessageEvent;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Add Description
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Mar 28, 2012 jkorman Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author jkorman
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PeerToPeerCommHelper implements IIMMessageListener {
|
||||||
|
|
||||||
|
private SessionManager manager;
|
||||||
|
|
||||||
|
private IPresenceContainerAdapter presenceAdapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param manager
|
||||||
|
* @param presenceAdapter
|
||||||
|
*/
|
||||||
|
PeerToPeerCommHelper(SessionManager manager,
|
||||||
|
IPresenceContainerAdapter presenceAdapter) {
|
||||||
|
this.presenceAdapter = presenceAdapter;
|
||||||
|
this.manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void handleMessageEvent(IIMMessageEvent messageEvent) {
|
||||||
|
|
||||||
|
System.out.println("Handling event "
|
||||||
|
+ messageEvent.getClass().getName());
|
||||||
|
|
||||||
|
if (messageEvent instanceof IChatMessageEvent) {
|
||||||
|
IChatMessageEvent event = (IChatMessageEvent) messageEvent;
|
||||||
|
System.out.println(" message event.body "
|
||||||
|
+ event.getChatMessage().getBody());
|
||||||
|
|
||||||
|
IChatMessage msg = event.getChatMessage();
|
||||||
|
String body = msg.getBody();
|
||||||
|
if (body != null) {
|
||||||
|
if (body.startsWith(Tools.CMD_PREAMBLE)) {
|
||||||
|
routeData(msg);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// anything else pass to the normal text
|
||||||
|
routeMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void routeData(IChatMessage message) {
|
||||||
|
Object object = null;
|
||||||
|
try {
|
||||||
|
object = Tools.unMarshallData(message.getBody());
|
||||||
|
} catch (CollaborationException e) {
|
||||||
|
System.out.println("Error unmarshalling PeerToPeer data");
|
||||||
|
}
|
||||||
|
if (object != null) {
|
||||||
|
String sessionId = (String) message.getProperties().get(
|
||||||
|
Tools.PROP_SESSION_ID);
|
||||||
|
if (sessionId == null) {
|
||||||
|
manager.getEventPublisher().post(object);
|
||||||
|
} else {
|
||||||
|
// Ok, we have a session id.
|
||||||
|
ISession session = manager.getSession(sessionId);
|
||||||
|
if (session != null) {
|
||||||
|
session.getEventPublisher().post(object);
|
||||||
|
} else {
|
||||||
|
System.out.println("ERROR: Unknown sessionid [" + sessionId
|
||||||
|
+ "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manager.getEventPublisher().post(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void routeMessage(IChatMessage message) {
|
||||||
|
String from = message.getFromID().getName();
|
||||||
|
IQualifiedID fromId = new UserId(Tools.parseName(from),
|
||||||
|
Tools.parseHost(from));
|
||||||
|
fromId.setResource(Tools.parseResource(message.getFromID().getName()));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ITextMessageEvent chatEvent = new ChatMessageEvent(textMsg);
|
||||||
|
|
||||||
|
String sessionId = (String) message.getProperties().get(
|
||||||
|
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.
|
||||||
|
if (sessionId == null) {
|
||||||
|
manager.getEventPublisher().post(chatEvent);
|
||||||
|
} else {
|
||||||
|
// Ok, we have a session id.
|
||||||
|
ISession session = manager.getSession(sessionId);
|
||||||
|
if (session != null) {
|
||||||
|
session.getEventPublisher().post(chatEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,9 +22,7 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.ecf.core.ContainerConnectException;
|
import org.eclipse.ecf.core.ContainerConnectException;
|
||||||
import org.eclipse.ecf.core.ContainerCreateException;
|
import org.eclipse.ecf.core.ContainerCreateException;
|
||||||
|
@ -48,17 +46,20 @@ 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.IAccountManager;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
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.IVenueSession;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IVenueInvitationListener;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueInvitationEvent;
|
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueInvitationEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
|
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager;
|
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -87,13 +88,17 @@ import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager;
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SessionManager {
|
public class SessionManager implements IEventPublisher {
|
||||||
|
|
||||||
private enum SessionType { SESSION_P2P, SESSION_CHAT_ONLY, SESSION_COLLABORATION; }
|
private enum SessionType {
|
||||||
|
SESSION_P2P, SESSION_CHAT_ONLY, SESSION_COLLABORATION;
|
||||||
|
}
|
||||||
|
|
||||||
private static final String PROVIDER = "ecf.xmpp.smack";
|
private static final String PROVIDER = "ecf.xmpp.smack";
|
||||||
|
|
||||||
private Map<String, ISession> sessions = null;
|
private Map<String, ISession> sessions;
|
||||||
|
|
||||||
|
private Map<String, ISession> following;
|
||||||
|
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
|
@ -101,10 +106,10 @@ public class SessionManager {
|
||||||
|
|
||||||
private IChatRoomInvitationListener intInvitationListener;
|
private IChatRoomInvitationListener intInvitationListener;
|
||||||
|
|
||||||
private IVenueInvitationListener invitationListener;
|
private IPresenceContainerAdapter presenceAdapter;
|
||||||
|
|
||||||
private PeerToPeerChat chatInstance = null;
|
private PeerToPeerChat chatInstance = null;
|
||||||
|
|
||||||
private IAccountManager accountManager = null;
|
private IAccountManager accountManager = null;
|
||||||
|
|
||||||
private IRosterManager rosterManager = null;
|
private IRosterManager rosterManager = null;
|
||||||
|
@ -118,7 +123,7 @@ public class SessionManager {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public SessionManager(String account, String password) throws Exception {
|
public SessionManager(String account, String password) throws Exception {
|
||||||
// XMPPConnection.DEBUG_ENABLED = true;
|
XMPPConnection.DEBUG_ENABLED = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
container = ContainerFactory.getDefault().createContainer(PROVIDER);
|
container = ContainerFactory.getDefault().createContainer(PROVIDER);
|
||||||
|
@ -131,29 +136,36 @@ public class SessionManager {
|
||||||
try {
|
try {
|
||||||
connectToContainer();
|
connectToContainer();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
throw new Exception("Error creating SessionManager", e);
|
||||||
}
|
}
|
||||||
setupAccountManager();
|
setupAccountManager();
|
||||||
|
|
||||||
eventBus = new EventBus();
|
eventBus = new EventBus();
|
||||||
|
|
||||||
sessions = new HashMap<String, ISession>();
|
sessions = new HashMap<String, ISession>();
|
||||||
|
following = new HashMap<String, ISession>();
|
||||||
|
|
||||||
setupInternalConnectionListeners();
|
setupInternalConnectionListeners();
|
||||||
setupInternalVenueInvitationListener();
|
setupInternalVenueInvitationListener();
|
||||||
|
setupP2PComm(presenceAdapter);
|
||||||
|
getPeerToPeerSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param account The account name to connect to.
|
* @param account
|
||||||
* @param password The password to use for connection.
|
* The account name to connect to.
|
||||||
* @param initialPresence The initial presence for the account name.
|
* @param password
|
||||||
|
* The password to use for connection.
|
||||||
|
* @param initialPresence
|
||||||
|
* The initial presence for the account name.
|
||||||
* @throws ContainerCreateException
|
* @throws ContainerCreateException
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public SessionManager(String account, String password, IPresence initialPresence) throws Exception {
|
public SessionManager(String account, String password,
|
||||||
|
IPresence initialPresence) throws Exception {
|
||||||
this(account, password);
|
this(account, password);
|
||||||
if(accountManager != null) {
|
if (accountManager != null) {
|
||||||
accountManager.sendPresence(initialPresence);
|
accountManager.sendPresence(initialPresence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,6 +182,9 @@ public class SessionManager {
|
||||||
try {
|
try {
|
||||||
container.connect(targetID, ConnectContextFactory
|
container.connect(targetID, ConnectContextFactory
|
||||||
.createPasswordConnectContext(password));
|
.createPasswordConnectContext(password));
|
||||||
|
|
||||||
|
presenceAdapter = Tools.getPresenceContainerAdapter(container,
|
||||||
|
IPresenceContainerAdapter.class);
|
||||||
} catch (ContainerConnectException e) {
|
} catch (ContainerConnectException e) {
|
||||||
System.out.println("Error attempting to connect");
|
System.out.println("Error attempting to connect");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -182,13 +197,8 @@ public class SessionManager {
|
||||||
*/
|
*/
|
||||||
private void setupAccountManager() {
|
private void setupAccountManager() {
|
||||||
if (accountManager == null) {
|
if (accountManager == null) {
|
||||||
if (isConnected()) {
|
if (isConnected() && (presenceAdapter != null)) {
|
||||||
IPresenceContainerAdapter presenceAdapter = Tools
|
accountManager = new AccountManager(presenceAdapter);
|
||||||
.getPresenceContainerAdapter(container,
|
|
||||||
IPresenceContainerAdapter.class);
|
|
||||||
if (presenceAdapter != null) {
|
|
||||||
accountManager = new AccountManager(presenceAdapter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,8 +220,9 @@ public class SessionManager {
|
||||||
*/
|
*/
|
||||||
private void setupRosterManager() {
|
private void setupRosterManager() {
|
||||||
IRoster roster = null;
|
IRoster roster = null;
|
||||||
IPresenceContainerAdapter presenceAdapter = Tools.getPresenceContainerAdapter(
|
IPresenceContainerAdapter presenceAdapter = Tools
|
||||||
container, IPresenceContainerAdapter.class);
|
.getPresenceContainerAdapter(container,
|
||||||
|
IPresenceContainerAdapter.class);
|
||||||
if (presenceAdapter != null) {
|
if (presenceAdapter != null) {
|
||||||
roster = presenceAdapter.getRosterManager().getRoster();
|
roster = presenceAdapter.getRosterManager().getRoster();
|
||||||
if (roster != null) {
|
if (roster != null) {
|
||||||
|
@ -245,7 +256,6 @@ public class SessionManager {
|
||||||
*/
|
*/
|
||||||
public void closeManager() {
|
public void closeManager() {
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
removeVenueInvitationListener();
|
|
||||||
|
|
||||||
// Close any created sessions.
|
// Close any created sessions.
|
||||||
for (ISession session : sessions.values()) {
|
for (ISession session : sessions.values()) {
|
||||||
|
@ -260,11 +270,13 @@ public class SessionManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PeerToPeerChat session instance.
|
* Get the PeerToPeerChat session instance.
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ISession getPeerToPeerSession() throws CollaborationException {
|
public ISession getPeerToPeerSession() throws CollaborationException {
|
||||||
if(chatInstance == null) {
|
if (chatInstance == null) {
|
||||||
chatInstance = new PeerToPeerChat(container, eventBus, this);
|
chatInstance = new PeerToPeerChat(container, eventBus, this);
|
||||||
|
sessions.put(chatInstance.getSessionId(), chatInstance);
|
||||||
}
|
}
|
||||||
return chatInstance;
|
return chatInstance;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +294,7 @@ public class SessionManager {
|
||||||
session = new VenueSession(container, eventBus, this);
|
session = new VenueSession(container, eventBus, this);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.joinVenue(venueName);
|
session.joinVenue(venueName);
|
||||||
|
sessions.put(session.getSessionId(), session);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -303,14 +316,14 @@ public class SessionManager {
|
||||||
session = new VenueSession(container, eventBus, this);
|
session = new VenueSession(container, eventBus, this);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.createVenue(venueName, subject);
|
session.createVenue(venueName, subject);
|
||||||
|
|
||||||
IPresence presence = new Presence();
|
IPresence presence = new Presence();
|
||||||
presence.setMode(IPresence.Mode.AVAILABLE);
|
presence.setMode(IPresence.Mode.AVAILABLE);
|
||||||
presence.setType(IPresence.Type.AVAILABLE);
|
presence.setType(IPresence.Type.AVAILABLE);
|
||||||
presence.setProperty("DATA_PROVIDER", "");
|
presence.setProperty("DATA_PROVIDER", "");
|
||||||
presence.setProperty("SESSION_LEADER", "");
|
presence.setProperty("SESSION_LEADER", "");
|
||||||
|
|
||||||
|
sessions.put(session.getSessionId(), session);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
@ -330,6 +343,7 @@ public class SessionManager {
|
||||||
session = new VenueSession(container, eventBus, this);
|
session = new VenueSession(container, eventBus, this);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.joinVenue(venueName);
|
session.joinVenue(venueName);
|
||||||
|
sessions.put(session.getSessionId(), session);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -351,6 +365,7 @@ public class SessionManager {
|
||||||
session = new VenueSession(container, eventBus, this);
|
session = new VenueSession(container, eventBus, this);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.createVenue(venueName, subject);
|
session.createVenue(venueName, subject);
|
||||||
|
sessions.put(session.getSessionId(), session);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -358,7 +373,7 @@ public class SessionManager {
|
||||||
}
|
}
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param session
|
* @param session
|
||||||
|
@ -378,7 +393,8 @@ public class SessionManager {
|
||||||
IPresenceContainerAdapter presenceAdapter = Tools
|
IPresenceContainerAdapter presenceAdapter = Tools
|
||||||
.getPresenceContainerAdapter(container,
|
.getPresenceContainerAdapter(container,
|
||||||
IPresenceContainerAdapter.class);
|
IPresenceContainerAdapter.class);
|
||||||
IChatRoomManager venueManager = presenceAdapter.getChatRoomManager();
|
IChatRoomManager venueManager = presenceAdapter
|
||||||
|
.getChatRoomManager();
|
||||||
if (venueManager != null) {
|
if (venueManager != null) {
|
||||||
IChatRoomInfo[] roomInfo = venueManager.getChatRoomInfos();
|
IChatRoomInfo[] roomInfo = venueManager.getChatRoomInfos();
|
||||||
for (IChatRoomInfo rInfo : roomInfo) {
|
for (IChatRoomInfo rInfo : roomInfo) {
|
||||||
|
@ -398,22 +414,41 @@ public class SessionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************
|
// ***************************
|
||||||
// Venue invitation listener management
|
// Connection listener
|
||||||
// ***************************
|
// ***************************
|
||||||
|
|
||||||
private void setupInternalConnectionListeners() {
|
private void setupInternalConnectionListeners() {
|
||||||
|
|
||||||
if(container != null) {
|
if (container != null) {
|
||||||
container.addListener(new IContainerListener() {
|
container.addListener(new IContainerListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(IContainerEvent event) {
|
public void handleEvent(IContainerEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************
|
||||||
|
// Peer to Peer communications
|
||||||
|
// ***************************
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ISession getSession(String sessionId) {
|
||||||
|
return sessions.get(sessionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupP2PComm(IPresenceContainerAdapter presenceAdapter) {
|
||||||
|
if (isConnected() && (presenceAdapter != null)) {
|
||||||
|
PeerToPeerCommHelper helper = new PeerToPeerCommHelper(this,
|
||||||
|
presenceAdapter);
|
||||||
|
presenceAdapter.getChatManager().addMessageListener(helper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************
|
// ***************************
|
||||||
// Venue invitation listener management
|
// Venue invitation listener management
|
||||||
// ***************************
|
// ***************************
|
||||||
|
@ -422,51 +457,57 @@ public class SessionManager {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void setupInternalVenueInvitationListener() {
|
private void setupInternalVenueInvitationListener() {
|
||||||
if (isConnected()) {
|
if (isConnected() && (presenceAdapter != null)) {
|
||||||
IPresenceContainerAdapter presenceAdapter = Tools
|
IChatRoomManager venueManager = presenceAdapter
|
||||||
.getPresenceContainerAdapter(container,
|
.getChatRoomManager();
|
||||||
IPresenceContainerAdapter.class);
|
if (venueManager != null) {
|
||||||
if (presenceAdapter != null) {
|
intInvitationListener = new IChatRoomInvitationListener() {
|
||||||
IChatRoomManager venueManager = presenceAdapter.getChatRoomManager();
|
@Override
|
||||||
if (venueManager != null) {
|
public void handleInvitationReceived(ID roomID, ID from,
|
||||||
intInvitationListener = new IChatRoomInvitationListener() {
|
String subject, String body) {
|
||||||
@Override
|
|
||||||
public void handleInvitationReceived(ID roomID,
|
IQualifiedID venueId = IDConverter.convertFrom(roomID);
|
||||||
ID from, String subject, String body) {
|
IQualifiedID id = IDConverter.convertFrom(from);
|
||||||
if (invitationListener != null) {
|
|
||||||
invitationListener.handleInvitation(null, null,
|
IChatID invitor = new VenueUserId(id.getName(),
|
||||||
subject, body);
|
id.getHost(), id.getResource());
|
||||||
}
|
|
||||||
|
IVenueInvitationEvent invite = new VenueInvitationEvent(
|
||||||
|
venueId, invitor, subject, body);
|
||||||
// IVenueInvitationEvent invite = new VenueInvitationEvent(roomID, from, subject, body);
|
System.out.println("Posting invitation using eventBus:"
|
||||||
|
+ eventBus.hashCode());
|
||||||
|
eventBus.post(invite);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
venueManager.addInvitationListener(intInvitationListener);
|
||||||
};
|
|
||||||
venueManager.addInvitationListener(intInvitationListener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register an event handler with this
|
||||||
*
|
*
|
||||||
* @param listener
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher#registerEventHandler(java.lang.Object)
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public IVenueInvitationListener setVenueInvitationListener(
|
@Override
|
||||||
IVenueInvitationListener listener) {
|
public void registerEventHandler(Object handler) {
|
||||||
invitationListener = listener;
|
eventBus.register(handler);
|
||||||
return listener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher#unRegisterEventHandler(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void removeVenueInvitationListener() {
|
@Override
|
||||||
invitationListener = null;
|
public void unRegisterEventHandler(Object handler) {
|
||||||
|
eventBus.unregister(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher#getEventPublisher()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EventBus getEventPublisher() {
|
||||||
|
return eventBus;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ public class TestJAXBObject implements IRenderable, ISerializableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param item_1 the item_1 to set
|
* @param item_1
|
||||||
|
* the item_1 to set
|
||||||
*/
|
*/
|
||||||
public void setItem_1(String item_1) {
|
public void setItem_1(String item_1) {
|
||||||
this.item_1 = item_1;
|
this.item_1 = item_1;
|
||||||
|
@ -62,7 +63,8 @@ public class TestJAXBObject implements IRenderable, ISerializableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param value the value to set
|
* @param value
|
||||||
|
* the value to set
|
||||||
*/
|
*/
|
||||||
public void setValue(Integer value) {
|
public void setValue(Integer value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|
|
@ -27,30 +27,30 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 23, 2012 jkorman Initial creation
|
* Mar 23, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public class TestObject implements IRenderable {
|
public class TestObject implements IRenderable {
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private int value = 0;
|
private int value = 0;
|
||||||
|
|
||||||
public TestObject() {
|
public TestObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestObject(String name) {
|
public TestObject(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,8 @@ public class TestObject implements IRenderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name the name to set
|
* @param name
|
||||||
|
* the name to set
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -77,7 +78,8 @@ public class TestObject implements IRenderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param value the value to set
|
* @param value
|
||||||
|
* the value to set
|
||||||
*/
|
*/
|
||||||
public void setValue(int value) {
|
public void setValue(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -44,7 +42,7 @@ import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
|
||||||
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
|
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import com.google.common.eventbus.Subscribe;
|
// import com.google.common.eventbus.Subscribe;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
|
@ -57,9 +55,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEv
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IInvitation;
|
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IInvitation;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageFilter;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageListener;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IPresenceListener;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||||
|
@ -110,79 +105,6 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
|
||||||
public class VenueSession extends BaseSession implements IVenueSession,
|
public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
ISharedDisplaySession {
|
ISharedDisplaySession {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Feb 27, 2012 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
private static class InternalListener {
|
|
||||||
|
|
||||||
private IMessageListener messageListener;
|
|
||||||
|
|
||||||
private IPresenceListener presenceListener;
|
|
||||||
|
|
||||||
private IMessageFilter filter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* @param filter
|
|
||||||
*/
|
|
||||||
public InternalListener(IMessageListener listener, IMessageFilter filter) {
|
|
||||||
messageListener = listener;
|
|
||||||
this.filter = filter;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param listener
|
|
||||||
* @param filter
|
|
||||||
*/
|
|
||||||
public InternalListener(IPresenceListener listener,
|
|
||||||
IMessageFilter filter) {
|
|
||||||
presenceListener = listener;
|
|
||||||
this.filter = filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
public void processMessage(IMessage message) {
|
|
||||||
messageListener.processMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param presence
|
|
||||||
*/
|
|
||||||
public void processPresence(IPresence presence) {
|
|
||||||
presenceListener.notifyPresence(presence);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean filter(IMessage message) {
|
|
||||||
return filter.filter(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String SEND_CMD = "[[COMMAND";
|
private static final String SEND_CMD = "[[COMMAND";
|
||||||
|
|
||||||
private static final String SEND_TXT = "[[TEXT]]";
|
private static final String SEND_TXT = "[[TEXT]]";
|
||||||
|
@ -193,10 +115,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
|
|
||||||
private IChatRoomContainer venueContainer = null;
|
private IChatRoomContainer venueContainer = null;
|
||||||
|
|
||||||
private List<InternalListener> collaborationListeners = null;
|
|
||||||
|
|
||||||
private List<InternalListener> presenceListeners = null;
|
|
||||||
|
|
||||||
private IIMMessageListener intListener = null;
|
private IIMMessageListener intListener = null;
|
||||||
|
|
||||||
private IChatRoomParticipantListener participantListener = null;
|
private IChatRoomParticipantListener participantListener = null;
|
||||||
|
@ -218,84 +136,79 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
VenueSession(IContainer container, EventBus externalBus,
|
VenueSession(IContainer container, EventBus externalBus,
|
||||||
SessionManager manager) {
|
SessionManager manager) throws CollaborationException {
|
||||||
super(container, externalBus, manager);
|
super(container, externalBus, manager);
|
||||||
try {
|
|
||||||
setup();
|
|
||||||
} catch (ECFException e) {
|
|
||||||
|
|
||||||
} finally {
|
// Runnable r = new Runnable() {
|
||||||
initListeners();
|
// @Override
|
||||||
}
|
// public void run() {
|
||||||
|
// try {
|
||||||
// Runnable r = new Runnable() {
|
// Thread.sleep(30000);
|
||||||
// @Override
|
//
|
||||||
// public void run() {
|
// TestJAXBObject j = new TestJAXBObject();
|
||||||
// try {
|
// j.setItem_1("This is an object");
|
||||||
// Thread.sleep(20000);
|
// j.setValue(5);
|
||||||
//
|
// sendRenderableObject(j);
|
||||||
// TestJAXBObject j = new TestJAXBObject();
|
//
|
||||||
// j.setItem_1("This is an object");
|
// VenueParticipant id = new VenueParticipant("jkorman",
|
||||||
// j.setValue(5);
|
// "paul", "awipscm.omaha.us.ray.com");
|
||||||
// sendRenderableObject(j);
|
// id.setResource("cave");
|
||||||
//
|
// IInitData d = new InitData();
|
||||||
// VenueParticipant id = new VenueParticipant("jkorman", "paul", "awipscm.omaha.us.ray.com");
|
// ((InitData) d).setName("This is a test init data object");
|
||||||
// id.setResource("cave");
|
//
|
||||||
// IInitData d = new InitData();
|
// IDisplayEvent e = new DisplayEvent();
|
||||||
// ((InitData) d).setName("This is a test init data object");
|
// ((DisplayEvent) e).setName("This is a test display event");
|
||||||
//
|
//
|
||||||
// IDisplayEvent e = new DisplayEvent();
|
// sendInitData(id, d);
|
||||||
// ((DisplayEvent) e).setName("This is a test display event");
|
// sendEvent(id, e);
|
||||||
//
|
//
|
||||||
// sendInitData(id, d);
|
// Thread.sleep(10000);
|
||||||
// sendEvent(id,e);
|
// System.out.println("Sending invitation");
|
||||||
// } catch (Exception e) {
|
//
|
||||||
// System.out.println("Error sending RenderableObject");
|
// sendInvitation("tester5@conference.awipscm.omaha.us.ray.com",
|
||||||
// }
|
// "jkorman", "Test Room", "Join the test");
|
||||||
// }
|
//
|
||||||
// };
|
// } catch (Exception e) {
|
||||||
// Thread t = new Thread(r);
|
// System.out.println("Error sending RenderableObject");
|
||||||
// t.start();
|
// }
|
||||||
// registerEventHandler(this);
|
//
|
||||||
// try {
|
// }
|
||||||
// DataHandler h = new DataHandler();
|
// };
|
||||||
// subscribeToInitData(h);
|
// Thread t = new Thread(r);
|
||||||
// } catch (CollaborationException ce) {
|
// t.start();
|
||||||
// ce.printStackTrace();
|
// registerEventHandler(this);
|
||||||
// }
|
// try {
|
||||||
|
// DataHandler h = new DataHandler();
|
||||||
|
// subscribeToInitData(h);
|
||||||
|
// } catch (CollaborationException ce) {
|
||||||
|
// ce.printStackTrace();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Subscribe
|
// @Subscribe
|
||||||
// public void handle(IRenderable renderable) {
|
// public void handle(IRenderable renderable) {
|
||||||
// System.out.println("Renderable found");
|
// System.out.println("Renderable found");
|
||||||
// if (renderable instanceof TestJAXBObject) {
|
// if (renderable instanceof TestJAXBObject) {
|
||||||
// TestJAXBObject j = (TestJAXBObject) renderable;
|
// TestJAXBObject j = (TestJAXBObject) renderable;
|
||||||
// if (j.getValue() < 100) {
|
// if (j.getValue() < 100) {
|
||||||
// System.out.println(String.format("%s %d Renderable",
|
// System.out.println(String.format("%s %d Renderable",
|
||||||
// j.getItem_1(), j.getValue()));
|
// j.getItem_1(), j.getValue()));
|
||||||
// j.setValue(j.getValue() + 200);
|
// j.setValue(j.getValue() + 200);
|
||||||
// j.setItem_1("Now for the return trip");
|
// j.setItem_1("Now for the return trip");
|
||||||
// try {
|
// try {
|
||||||
// sendRenderableObject(j);
|
// sendRenderableObject(j);
|
||||||
// } catch (CollaborationException ce) {
|
// } catch (CollaborationException ce) {
|
||||||
// System.out.println("Error sending RenderableObject");
|
// System.out.println("Error sending RenderableObject");
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// System.out.println(String.format("%s %d Renderable",
|
// System.out.println(String.format("%s %d Renderable",
|
||||||
// j.getItem_1(), j.getValue()));
|
// j.getItem_1(), j.getValue()));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws ECFException
|
|
||||||
*/
|
|
||||||
void setup() throws ECFException {
|
|
||||||
super.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the identification of the owner of this session.
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
|
||||||
*/
|
*/
|
||||||
|
@ -310,6 +223,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ISharedDisplaySession spawnSharedDisplaySession() {
|
public ISharedDisplaySession spawnSharedDisplaySession() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -325,20 +239,17 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
|
|
||||||
if (intListener != null) {
|
if (intListener != null) {
|
||||||
venueContainer.removeMessageListener(intListener);
|
venueContainer.removeMessageListener(intListener);
|
||||||
|
intListener = null;
|
||||||
}
|
}
|
||||||
if (participantListener != null) {
|
if (participantListener != null) {
|
||||||
venueContainer
|
venueContainer
|
||||||
.removeChatRoomParticipantListener(participantListener);
|
.removeChatRoomParticipantListener(participantListener);
|
||||||
|
participantListener = null;
|
||||||
|
}
|
||||||
|
if (venueContainer != null) {
|
||||||
|
venueContainer.disconnect();
|
||||||
|
venueContainer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
collaborationListeners.clear();
|
|
||||||
collaborationListeners = null;
|
|
||||||
|
|
||||||
presenceListeners.clear();
|
|
||||||
presenceListeners = null;
|
|
||||||
|
|
||||||
venueContainer.disconnect();
|
|
||||||
venueContainer = null;
|
|
||||||
|
|
||||||
venueManager = null;
|
venueManager = null;
|
||||||
venueInfo = null;
|
venueInfo = null;
|
||||||
|
@ -346,11 +257,335 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about this venue.
|
||||||
|
*
|
||||||
|
* @return The information about this venue. May return a null reference if
|
||||||
|
* the venue is not connected.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IVenue getVenue() {
|
||||||
|
IVenue venue = null;
|
||||||
|
if (isConnected() && (venueContainer != null)) {
|
||||||
|
venue = new Venue();
|
||||||
|
ID[] ids = venueContainer.getChatRoomParticipants();
|
||||||
|
for (ID id : ids) {
|
||||||
|
|
||||||
|
IVenueParticipant vp = new VenueParticipant();
|
||||||
|
String fullName = id.getName();
|
||||||
|
vp.setName(Tools.parseName(fullName));
|
||||||
|
vp.setHost(Tools.parseHost(fullName));
|
||||||
|
vp.setResource(Tools.parseResource(fullName));
|
||||||
|
venue.addParticipant(vp);
|
||||||
|
}
|
||||||
|
venue.setInfo(InfoAdapter.createVenueInfo(venueInfo));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
return venue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an invitation from this venue to another user.
|
||||||
|
*
|
||||||
|
* @param invitation
|
||||||
|
* An invitation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int sendInvitation(IInvitation invitation) {
|
||||||
|
int status = Errors.NO_ERROR;
|
||||||
|
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
||||||
|
.getChatRoomManager().getInvitationSender();
|
||||||
|
if (sender != null) {
|
||||||
|
ID roomId = getConnectionPresenceAdapter().getChatRoomManager()
|
||||||
|
.getChatRoomInfo(invitation.getRoomId()).getConnectedID();
|
||||||
|
|
||||||
|
// *******************
|
||||||
|
// ** TODO : The host part of this need to defined
|
||||||
|
ID userId = IDFactory.getDefault().createID(
|
||||||
|
getConnectionNamespace(),
|
||||||
|
invitation.getFrom() + "@awipscm.omaha.us.ray.com");
|
||||||
|
// *******************
|
||||||
|
|
||||||
|
try {
|
||||||
|
String body = insertSessionId(invitation.getBody());
|
||||||
|
|
||||||
|
sender.sendInvitation(roomId, userId, invitation.getSubject(),
|
||||||
|
body);
|
||||||
|
} catch (ECFException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an invitation from this venue to another user.
|
||||||
|
*
|
||||||
|
* @param room
|
||||||
|
* The target venue for this invitation.
|
||||||
|
* @param id
|
||||||
|
* The target user for this invitation.
|
||||||
|
* @param subject
|
||||||
|
* The intended subject of the venue conversation.
|
||||||
|
* @param body
|
||||||
|
* Any text that the user may wish to include.
|
||||||
|
* @return
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
|
||||||
|
* java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int sendInvitation(String room, String id, String subject,
|
||||||
|
String body) {
|
||||||
|
// Assume success
|
||||||
|
int status = Errors.NO_ERROR;
|
||||||
|
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
||||||
|
.getChatRoomManager().getInvitationSender();
|
||||||
|
if (sender != null) {
|
||||||
|
body = insertSessionId(body);
|
||||||
|
|
||||||
|
ID roomId = getConnectionPresenceAdapter().getChatRoomManager()
|
||||||
|
.getChatRoomInfo(room).getConnectedID();
|
||||||
|
ID userId = IDFactory.getDefault().createID(
|
||||||
|
getConnectionNamespace(), id + "@awipscm.omaha.us.ray.com");
|
||||||
|
|
||||||
|
try {
|
||||||
|
sender.sendInvitation(roomId, userId, subject, body);
|
||||||
|
} catch (ECFException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an invitation from this venue to another user.
|
||||||
|
*
|
||||||
|
* @param room
|
||||||
|
* The target venue for this invitation.
|
||||||
|
* @param id
|
||||||
|
* The target user for this invitation.
|
||||||
|
* @param subject
|
||||||
|
* The intended subject of the venue conversation.
|
||||||
|
* @param body
|
||||||
|
* Any text that the user may wish to include.
|
||||||
|
* @return
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
|
||||||
|
* java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int sendInvitation(String room, List<String> ids, String subject,
|
||||||
|
String body) {
|
||||||
|
// Assume success
|
||||||
|
int status = Errors.NO_ERROR;
|
||||||
|
if (ids != null) {
|
||||||
|
for (String id : ids) {
|
||||||
|
sendInvitation(room, id, subject, body);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
status = -1;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String insertSessionId(String body) {
|
||||||
|
return String.format(Tools.TAG_INVITE_ID, sessionId,
|
||||||
|
(body != null) ? body : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getSessionId()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getSessionId() {
|
||||||
|
return sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************
|
||||||
|
// ISharedDisplaySession
|
||||||
|
// ***************************
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param participant
|
||||||
|
* @param initData
|
||||||
|
* @throws CollaborationException
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendInitData(com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID,
|
||||||
|
* com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sendInitData(
|
||||||
|
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
|
||||||
|
IInitData initData) throws CollaborationException {
|
||||||
|
|
||||||
|
PeerToPeerChat session = null;
|
||||||
|
session = getP2PSession();
|
||||||
|
if (session != null) {
|
||||||
|
String message = Tools.marshallData(initData);
|
||||||
|
if (message != null) {
|
||||||
|
session.sendPeerToPeer(participant.getFQName(), message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to peer to peer data events.
|
||||||
|
*
|
||||||
|
* @param An
|
||||||
|
* object that subscribes to peer to peer events.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void subscribeToInitData(Object subscriber)
|
||||||
|
throws CollaborationException {
|
||||||
|
if (!initSubscribers.containsKey(subscriber)) {
|
||||||
|
initSubscribers.put(subscriber, subscriber);
|
||||||
|
}
|
||||||
|
EventBus bus = getP2PSession().getEventPublisher();
|
||||||
|
System.out.println("Subscribe EventBus instance :" + bus.hashCode());
|
||||||
|
bus.register(subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UnSubscribe to peer to peer data events.
|
||||||
|
*
|
||||||
|
* @param An
|
||||||
|
* object that will be unsubscribed for peer to peer events.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void unSubscribeToInitData(Object subscriber)
|
||||||
|
throws CollaborationException {
|
||||||
|
if (initSubscribers.containsKey(subscriber)) {
|
||||||
|
initSubscribers.remove(subscriber);
|
||||||
|
getP2PSession().getEventPublisher().unregister(subscriber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param participant
|
||||||
|
* @param event
|
||||||
|
* @throws CollaborationException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sendEvent(
|
||||||
|
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
|
||||||
|
IDisplayEvent event) throws CollaborationException {
|
||||||
|
|
||||||
|
PeerToPeerChat session = null;
|
||||||
|
session = getP2PSession();
|
||||||
|
if (session != null) {
|
||||||
|
String message = Tools.marshallData(event);
|
||||||
|
if (message != null) {
|
||||||
|
session.sendPeerToPeer(participant.getFQName(), message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @throws CollaborationException
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendEvent(com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sendEvent(IDisplayEvent event) throws CollaborationException {
|
||||||
|
if (event != null) {
|
||||||
|
String message = Tools.marshallData(event);
|
||||||
|
if (message != null) {
|
||||||
|
sendTextMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param renderable
|
||||||
|
* @throws CollaborationException
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendRenderableObject(com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sendRenderableObject(IRenderable renderable)
|
||||||
|
throws CollaborationException {
|
||||||
|
if (renderable != null) {
|
||||||
|
String message = Tools.marshallData(renderable);
|
||||||
|
if (message != null) {
|
||||||
|
sendTextMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the identification of the user who is the DataProvider.
|
||||||
|
*
|
||||||
|
* @return The DataProvider user identification.
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentDataProvider()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IChatID getCurrentDataProvider() {
|
||||||
|
return sessionDataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the identification of the user who is the Session Leader.
|
||||||
|
*
|
||||||
|
* @return The Session Leader user identification.
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentSessionLeader()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IChatID getCurrentSessionLeader() {
|
||||||
|
return sessionLeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#hasRole(com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean hasRole(ParticipantRole role) {
|
||||||
|
return roles.contains(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************
|
||||||
|
// ISharedDisplaySession
|
||||||
|
// ***************************
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
* A message to send.
|
||||||
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendTextMessage(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void sendTextMessage(String message) throws CollaborationException {
|
||||||
|
// Assume success
|
||||||
|
if ((venueContainer != null) && (message != null)) {
|
||||||
|
IChatRoomMessageSender sender = venueContainer
|
||||||
|
.getChatRoomMessageSender();
|
||||||
|
try {
|
||||||
|
if (message.startsWith(SEND_CMD)) {
|
||||||
|
sender.sendMessage(message);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(SEND_TXT + message);
|
||||||
|
}
|
||||||
|
} catch (ECFException e) {
|
||||||
|
throw new CollaborationException("Error sending text messge");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************
|
||||||
|
// Internal methods
|
||||||
|
// ***************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#joinVenue(java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#joinVenue(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public int joinVenue(String venueName) {
|
int joinVenue(String venueName) {
|
||||||
int errorStatus = -1;
|
int errorStatus = -1;
|
||||||
try {
|
try {
|
||||||
// Create chat room container from manager
|
// Create chat room container from manager
|
||||||
|
@ -382,7 +617,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String,
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String,
|
||||||
* java.lang.String)
|
* java.lang.String)
|
||||||
*/
|
*/
|
||||||
public int createVenue(String venueName, String subject) {
|
int createVenue(String venueName, String subject) {
|
||||||
int errorStatus = -1;
|
int errorStatus = -1;
|
||||||
try {
|
try {
|
||||||
// Create chat room container from manager
|
// Create chat room container from manager
|
||||||
|
@ -517,317 +752,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
return errorStatus;
|
return errorStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return The information about this venue. May return a null reference if
|
|
||||||
* the venue is not connected.
|
|
||||||
*/
|
|
||||||
public IVenue getVenue() {
|
|
||||||
IVenue venue = null;
|
|
||||||
if (isConnected() && (venueContainer != null)) {
|
|
||||||
venue = new Venue();
|
|
||||||
ID[] ids = venueContainer.getChatRoomParticipants();
|
|
||||||
for (ID id : ids) {
|
|
||||||
IVenueParticipant participant = new VenueParticipant();
|
|
||||||
participant.setName(id.getName());
|
|
||||||
venue.addParticipant(participant);
|
|
||||||
}
|
|
||||||
venue.setInfo(InfoAdapter.createVenueInfo(venueInfo));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
return venue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send an invitation from this venue to another user.
|
|
||||||
*
|
|
||||||
* @param invitation
|
|
||||||
* An invitation
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int sendInvitation(IInvitation invitation) {
|
|
||||||
int status = Errors.NO_ERROR;
|
|
||||||
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
|
||||||
.getChatRoomManager().getInvitationSender();
|
|
||||||
if (sender != null) {
|
|
||||||
ID roomId = getConnectionPresenceAdapter().getChatRoomManager()
|
|
||||||
.getChatRoomInfo(invitation.getRoomId()).getConnectedID();
|
|
||||||
|
|
||||||
// *******************
|
|
||||||
// ** TODO : The host part of this need to defined
|
|
||||||
ID userId = IDFactory.getDefault().createID(
|
|
||||||
getConnectionNamespace(),
|
|
||||||
invitation.getFrom() + "@awipscm.omaha.us.ray.com");
|
|
||||||
// *******************
|
|
||||||
|
|
||||||
try {
|
|
||||||
sender.sendInvitation(roomId, userId, invitation.getSubject(),
|
|
||||||
invitation.getBody());
|
|
||||||
} catch (ECFException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send an invitation from this venue to another user.
|
|
||||||
*
|
|
||||||
* @param room
|
|
||||||
* The target venue for this invitation.
|
|
||||||
* @param id
|
|
||||||
* The target user for this invitation.
|
|
||||||
* @param subject
|
|
||||||
* The intended subject of the venue conversation.
|
|
||||||
* @param body
|
|
||||||
* Any text that the user may wish to include.
|
|
||||||
* @return
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
|
|
||||||
* java.lang.String, java.lang.String, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int sendInvitation(String room, String id, String subject,
|
|
||||||
String body) {
|
|
||||||
// Assume success
|
|
||||||
int status = Errors.NO_ERROR;
|
|
||||||
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
|
||||||
.getChatRoomManager().getInvitationSender();
|
|
||||||
if (sender != null) {
|
|
||||||
|
|
||||||
ID roomId = getConnectionPresenceAdapter().getChatRoomManager()
|
|
||||||
.getChatRoomInfo(room).getConnectedID();
|
|
||||||
ID userId = IDFactory.getDefault().createID(
|
|
||||||
getConnectionNamespace(), id + "@awipscm.omaha.us.ray.com");
|
|
||||||
|
|
||||||
try {
|
|
||||||
sender.sendInvitation(roomId, userId, subject, body);
|
|
||||||
} catch (ECFException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send an invitation from this venue to another user.
|
|
||||||
*
|
|
||||||
* @param room
|
|
||||||
* The target venue for this invitation.
|
|
||||||
* @param id
|
|
||||||
* The target user for this invitation.
|
|
||||||
* @param subject
|
|
||||||
* The intended subject of the venue conversation.
|
|
||||||
* @param body
|
|
||||||
* Any text that the user may wish to include.
|
|
||||||
* @return
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendInvitation(java.lang.String,
|
|
||||||
* java.lang.String, java.lang.String, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int sendInvitation(String room, List<String> ids, String subject,
|
|
||||||
String body) {
|
|
||||||
// Assume success
|
|
||||||
int status = Errors.NO_ERROR;
|
|
||||||
if (ids != null) {
|
|
||||||
for (String id : ids) {
|
|
||||||
sendInvitation(room, id, subject, body);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
status = -1;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getSessionId()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getSessionId() {
|
|
||||||
return sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************
|
|
||||||
// ISharedDisplaySession
|
|
||||||
// ***************************
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param participant
|
|
||||||
* @param initData
|
|
||||||
* @throws CollaborationException
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendInitData(com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID,
|
|
||||||
* com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void sendInitData(
|
|
||||||
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
|
|
||||||
IInitData initData) throws CollaborationException {
|
|
||||||
|
|
||||||
PeerToPeerChat session = null;
|
|
||||||
session = getP2PSession();
|
|
||||||
if (session != null) {
|
|
||||||
String message = Tools.marshallData(initData);
|
|
||||||
if (message != null) {
|
|
||||||
session.sendPeerToPeer(participant.getFQName(), message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subscribe to peer to peer data events.
|
|
||||||
*
|
|
||||||
* @param An
|
|
||||||
* object that subscribes to peer to peer events.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void subscribeToInitData(Object subscriber)
|
|
||||||
throws CollaborationException {
|
|
||||||
if (!initSubscribers.containsKey(subscriber)) {
|
|
||||||
initSubscribers.put(subscriber, subscriber);
|
|
||||||
}
|
|
||||||
PeerToPeerChat session = getP2PSession();
|
|
||||||
session.getEventPublisher().register(subscriber);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UnSubscribe to peer to peer data events.
|
|
||||||
*
|
|
||||||
* @param An
|
|
||||||
* object that will be unsubscribed for peer to peer events.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void unSubscribeToInitData(Object subscriber)
|
|
||||||
throws CollaborationException {
|
|
||||||
if (initSubscribers.containsKey(subscriber)) {
|
|
||||||
initSubscribers.remove(subscriber);
|
|
||||||
PeerToPeerChat session = getP2PSession();
|
|
||||||
session.getEventPublisher().unregister(subscriber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param participant
|
|
||||||
* @param event
|
|
||||||
* @throws CollaborationException
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void sendEvent(
|
|
||||||
com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID participant,
|
|
||||||
IDisplayEvent event) throws CollaborationException {
|
|
||||||
|
|
||||||
PeerToPeerChat session = null;
|
|
||||||
session = getP2PSession();
|
|
||||||
if (session != null) {
|
|
||||||
String message = Tools.marshallData(event);
|
|
||||||
if (message != null) {
|
|
||||||
session.sendPeerToPeer(participant.getFQName(), message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @throws CollaborationException
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendEvent(com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void sendEvent(IDisplayEvent event) throws CollaborationException {
|
|
||||||
if (event != null) {
|
|
||||||
String message = Tools.marshallData(event);
|
|
||||||
if (message != null) {
|
|
||||||
sendTextMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param renderable
|
|
||||||
* @throws CollaborationException
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendRenderableObject(com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void sendRenderableObject(IRenderable renderable)
|
|
||||||
throws CollaborationException {
|
|
||||||
if (renderable != null) {
|
|
||||||
String message = Tools.marshallData(renderable);
|
|
||||||
if (message != null) {
|
|
||||||
sendTextMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the identification of the user who is the DataProvider.
|
|
||||||
*
|
|
||||||
* @return The DataProvider user identification.
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentDataProvider()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IChatID getCurrentDataProvider() {
|
|
||||||
return sessionDataProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the identification of the user who is the Session Leader.
|
|
||||||
*
|
|
||||||
* @return The Session Leader user identification.
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#getCurrentSessionLeader()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IChatID getCurrentSessionLeader() {
|
|
||||||
return sessionLeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#hasRole(com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasRole(ParticipantRole role) {
|
|
||||||
return roles.contains(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************
|
|
||||||
// ISharedDisplaySession
|
|
||||||
// ***************************
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param message
|
|
||||||
* A message to send.
|
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendTextMessage(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void sendTextMessage(String message) throws CollaborationException {
|
|
||||||
// Assume success
|
|
||||||
if ((venueContainer != null) && (message != null)) {
|
|
||||||
IChatRoomMessageSender sender = venueContainer
|
|
||||||
.getChatRoomMessageSender();
|
|
||||||
try {
|
|
||||||
if (message.startsWith(SEND_CMD)) {
|
|
||||||
sender.sendMessage(message);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(SEND_TXT + message);
|
|
||||||
}
|
|
||||||
} catch (ECFException e) {
|
|
||||||
throw new CollaborationException("Error sending text messge");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up the various message listener lists. Ensures that all listener
|
|
||||||
* collections are not null prior to use.
|
|
||||||
*/
|
|
||||||
private void initListeners() {
|
|
||||||
presenceListeners = Collections
|
|
||||||
.synchronizedList(new ArrayList<InternalListener>());
|
|
||||||
collaborationListeners = Collections
|
|
||||||
.synchronizedList(new ArrayList<InternalListener>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
|
@ -862,23 +786,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
private void firePresenceListeners(IMessage message) {
|
|
||||||
synchronized (presenceListeners) {
|
|
||||||
if (message instanceof IPresence) {
|
|
||||||
IPresence presence = (IPresence) message;
|
|
||||||
for (InternalListener listener : presenceListeners) {
|
|
||||||
if (listener.filter(message)) {
|
|
||||||
listener.processPresence(presence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert from an ECF chat room message to an IMessage instance.
|
* Convert from an ECF chat room message to an IMessage instance.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.collaboration.comm.provider.user;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Add Description
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Mar 28, 2012 jkorman Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author jkorman
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class IDConverter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static IQualifiedID 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());
|
||||||
|
return new UserId(name, host, rsc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) {
|
||||||
|
String name = Tools.parseName(user.getID().getName());
|
||||||
|
String host = Tools.parseHost(user.getID().getName());
|
||||||
|
return new VenueUserId(name, user.getNickname(), host);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,17 +26,17 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 21, 2012 jkorman Initial creation
|
* Mar 21, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RosterId extends UserId implements IChatID {
|
public class RosterId extends UserId implements IChatID {
|
||||||
|
@ -50,11 +50,12 @@ public class RosterId extends UserId implements IChatID {
|
||||||
* @param nickName
|
* @param nickName
|
||||||
* @param resource
|
* @param resource
|
||||||
*/
|
*/
|
||||||
public RosterId(String userName, String hostName, String resource, String nickName) {
|
public RosterId(String userName, String hostName, String resource,
|
||||||
|
String nickName) {
|
||||||
super(userName, hostName, resource);
|
super(userName, hostName, resource);
|
||||||
nickname = nickName;
|
nickname = nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#setNickname(java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#setNickname(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -71,7 +72,9 @@ public class RosterId extends UserId implements IChatID {
|
||||||
return nickname;
|
return nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see java.lang.Object#hashCode()
|
* @see java.lang.Object#hashCode()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,7 +86,9 @@ public class RosterId extends UserId implements IChatID {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,15 +107,15 @@ public class RosterId extends UserId implements IChatID {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) {
|
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) {
|
||||||
String name = Tools.parseName(user.getName());
|
String name = Tools.parseName(user.getID().getName());
|
||||||
String host = Tools.parseHost(user.getName());
|
String host = Tools.parseHost(user.getID().getName());
|
||||||
return new RosterId(name, host, user.getNickname(), null);
|
return new RosterId(name, host, user.getNickname(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,24 +25,24 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 24, 2012 jkorman Initial creation
|
* Feb 24, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class UserId implements IQualifiedID {
|
public class UserId implements IQualifiedID {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
private String resource;
|
private String resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ public class UserId implements IQualifiedID {
|
||||||
this.host = hostName;
|
this.host = hostName;
|
||||||
resource = null;
|
resource = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param userName
|
* @param userName
|
||||||
|
@ -108,7 +108,8 @@ public class UserId implements IQualifiedID {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param resourceName The resource associated with this id.
|
* @param resourceName
|
||||||
|
* The resource associated with this id.
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResourceName(java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResourceName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,14 +136,16 @@ public class UserId implements IQualifiedID {
|
||||||
StringBuilder sb = new StringBuilder(name);
|
StringBuilder sb = new StringBuilder(name);
|
||||||
sb.append("@");
|
sb.append("@");
|
||||||
sb.append(host);
|
sb.append(host);
|
||||||
if(resource != null) {
|
if (resource != null) {
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
sb.append(resource);
|
sb.append(resource);
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see java.lang.Object#hashCode()
|
* @see java.lang.Object#hashCode()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -156,7 +159,9 @@ public class UserId implements IQualifiedID {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,21 +29,21 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 jkorman Initial creation
|
* Mar 1, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VenueParticipant implements IVenueParticipant {
|
public class VenueParticipant implements IVenueParticipant {
|
||||||
|
|
||||||
private Map<String, String> properties;
|
private Map<String, String> properties;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -53,7 +53,7 @@ public class VenueParticipant implements IVenueParticipant {
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
private String resource;
|
private String resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +79,8 @@ public class VenueParticipant implements IVenueParticipant {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#setProperty(java.lang.String, java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#setProperty(java.lang.String,
|
||||||
|
* java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setProperty(String key, String value) {
|
public void setProperty(String key, String value) {
|
||||||
|
@ -87,12 +88,13 @@ public class VenueParticipant implements IVenueParticipant {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperty(java.lang.String, java.lang.String)
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperty(java.lang.String,
|
||||||
|
* java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getProperty(String key, String defaultValue) {
|
public String getProperty(String key, String defaultValue) {
|
||||||
String value = properties.get(key);
|
String value = properties.get(key);
|
||||||
if(value == null) {
|
if (value == null) {
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -178,7 +180,7 @@ public class VenueParticipant implements IVenueParticipant {
|
||||||
StringBuilder sb = new StringBuilder(name);
|
StringBuilder sb = new StringBuilder(name);
|
||||||
sb.append("@");
|
sb.append("@");
|
||||||
sb.append(host);
|
sb.append(host);
|
||||||
if(resource != null) {
|
if (resource != null) {
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
sb.append(resource);
|
sb.append(resource);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,29 +20,28 @@
|
||||||
package com.raytheon.uf.viz.collaboration.comm.provider.user;
|
package com.raytheon.uf.viz.collaboration.comm.provider.user;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 5, 2012 jkorman Initial creation
|
* Mar 5, 2012 jkorman Initial creation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VenueUserId extends UserId implements IChatID {
|
public class VenueUserId extends UserId implements IChatID {
|
||||||
|
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param userName
|
* @param userName
|
||||||
|
@ -110,15 +109,4 @@ public class VenueUserId extends UserId implements IChatID {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param user
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static IChatID convertFrom(org.eclipse.ecf.core.user.IUser user) {
|
|
||||||
String name = Tools.parseName(user.getName());
|
|
||||||
String host = Tools.parseHost(user.getName());
|
|
||||||
return new VenueUserId(name, user.getNickname(), host);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue