Issue #232 Initial collaboration framework plugin checkin

Former-commit-id: 4368616970 [formerly 526a2633ce] [formerly 4368616970 [formerly 526a2633ce] [formerly 5a91d71c12 [formerly 2351a53e68bbc8cfe11917d202cbc5424768b5a6]]]
Former-commit-id: 5a91d71c12
Former-commit-id: f242c1a430 [formerly 2fea86a591]
Former-commit-id: e40ee702aa
This commit is contained in:
James Korman 2012-03-07 15:38:20 -06:00
parent 9c3c717032
commit fe7db93589
45 changed files with 5155 additions and 0 deletions

View file

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

View file

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

View file

@ -0,0 +1,8 @@
#Fri Feb 24 08:50:10 CST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -0,0 +1,24 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Collaboratioin
Bundle-SymbolicName: com.raytheon.uf.viz.collaboration
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.collaboration.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ecf;bundle-version="3.1.300",
org.eclipse.ecf.presence;bundle-version="2.0.0",
org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.collaboration,
com.raytheon.uf.viz.collaboration.comm,
com.raytheon.uf.viz.collaboration.comm.identity,
com.raytheon.uf.viz.collaboration.comm.identity.info,
com.raytheon.uf.viz.collaboration.comm.identity.listener,
com.raytheon.uf.viz.collaboration.comm.identity.roster,
com.raytheon.uf.viz.collaboration.comm.identity.user,
com.raytheon.uf.viz.collaboration.comm.provider,
com.raytheon.uf.viz.collaboration.comm.provider.info,
com.raytheon.uf.viz.collaboration.comm.provider.roster,
com.raytheon.uf.viz.collaboration.comm.provider.user

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -0,0 +1,30 @@
package com.raytheon.uf.viz.collaboration;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,199 @@
/**
* 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;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.ContainerCreateException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.security.ConnectContextFactory;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationSession;
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
/**
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class SessionManager {
public static final String SESSION_P2P = "peertopeer";
public static final String SESSION_COLLABORATION = "collaboration";
public static final String SESSION_CHAT_ONLY = "chatOnly";
public static final String PROVIDER = "ecf.xmpp.smack";
private String account;
private String password;
private IContainer container = null;
/**
* @throws ContainerCreateException
*
*/
public SessionManager(String account, String password) throws Exception {
container = ContainerFactory.getDefault().createContainer(PROVIDER);
this.account = account;
this.password = password;
}
/**
*
* @return
*/
public ISession createPeerToPeerSession() {
return (ISession) createSession(SESSION_P2P);
}
/**
*
* @return
*/
public IVenueSession createChatOnlySession() {
return (IVenueSession) createSession(SESSION_CHAT_ONLY);
}
/**
*
* @return
*/
public IVenueSession createCollaborationSession() {
return (IVenueSession) createSession(SESSION_COLLABORATION);
}
/**
*
* @param sessionKind
* @return
*/
public ISession createSession(String sessionKind) {
ISession session = null;
if(sessionKind != null) {
if(SESSION_P2P.equals(sessionKind)) {
System.out.println(sessionKind + " Not currently implemented");
} else if(SESSION_COLLABORATION.equals(sessionKind)) {
session = new CollaborationSession(container);
} else if(SESSION_CHAT_ONLY.equals(sessionKind)) {
System.out.println(sessionKind + " Not currently implemented");
} else {
System.out.println(sessionKind + " is not a valid session kind.");
}
}
if(session != null) {
session.connect(account, password);
} else {
System.out.println("Could not connect session");
}
return session;
}
/**
*
* @return
*/
public Collection<IVenueInfo> getVenueInfo() {
// Check to see if the container has been connected. If no, do so
connectToContainer();
IPresenceContainerAdapter presence = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
IChatRoomManager venueManager = presence.getChatRoomManager();
Collection<IVenueInfo> info = new ArrayList<IVenueInfo>();
if(venueManager != null) {
IChatRoomInfo [] roomInfo = venueManager.getChatRoomInfos();
for(IChatRoomInfo rInfo : roomInfo) {
IVenueInfo vi = InfoAdapter.createVenueInfo(rInfo);
if(vi != null) {
info.add(vi);
}
}
}
return info;
}
private void connectToContainer() {
if(container.getConnectedID() == null) {
Namespace namespace = container.getConnectNamespace();
ID targetID = IDFactory.getDefault().createID(namespace, account);
// Now connect
try {
container.connect(targetID, ConnectContextFactory.createPasswordConnectContext(password));
System.out.println("Container connected as " + container.getConnectedID());
} catch (ContainerConnectException e) {
System.out.println("Error attempting to connect");
e.printStackTrace();
}
}
}
/**
*
*/
public void closeManager() {
if(container != null) {
container.dispose();
}
}
}

View file

@ -0,0 +1,136 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IMessage extends IPropertied {
public enum MessageType { CHAT, COLLABORATION };
static final String MESSAGE_TYPE = "type";
static final String TIMESTAMP = "timestamp";
/**
* @return the to
*/
IQualifiedID getTo();
/**
* @param to
* the to to set
*/
void setTo(IQualifiedID to);
/**
* @return the from
*/
IQualifiedID getFrom();
/**
* @param from
* the from to set
*/
void setFrom(IQualifiedID from);
/**
* Get the subject of this message.
* @return The subject of this message. The subject may be null.
*/
String getSubject();
/**
* Set the subject of this message. If not set the
* subject is set to null.
* @param subject The subject of this message.
*/
void setSubject(String subject);
/**
*
* @return
*/
MessageType getMessageType();
/**
* Get the body of this message.
* @return The body of this message. The body may be null.
*/
String getBody();
/**
* Set the data to be transmitted in the message. If not set the
* body is set to null.
* @param body The data to be transmitted in the message.
*/
void setBody(String body);
/**
* Returns the body of the message as a byte array.
* @return The body of the message as binary data.
*/
byte [] getBodyAsBinary();
/**
* Set the body of the message as a byte array.
* @param body The binary data to be transmitted in the message.
*/
void getBodyAsBinary(byte [] body);
/**
* Get the status of this message.
* @return The message status.
*/
String getStatus();
/**
* Set the status of this message.
* @param The message status.
*/
void setStatus(String status);
/**
* Get the receipt time for this message in milliseconds from
* Jan 1, 1970.
* @return The receipt time stamp.
*/
long getTimeStamp();
}

View file

@ -0,0 +1,106 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity;
/**
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IPresence extends IPropertied {
public static enum Mode {
AVAILABLE("available"), AWAY("away"), CHAT("chat"), DND("dnd"), EXTENDED_AWAY(
"extended_away"), INVISIBLE("invisible");
private final String mode;
private Mode(String mode) {
this.mode = mode;
}
public String getMode() {
return mode;
}
};
public static enum Type {
AVAILABLE("available"), ERROR("error"), SUBSCRIBE("subscribe"), SUBSCRIBED(
"subscribed"), UNAVAILABLE("unavailable"), UNKNOWN("unknown"), UNSUBSCRIBE(
"unsubscribe"), UNSUBSCRIBED("unsubscribed");
private final String type;
/**
*
* @param type
*/
private Type(String type) {
this.type = type;
}
/**
*
* @return
*/
public String getType() {
return type;
}
};
/**
*
* @return
*/
Mode getMode();
/**
*
* @return
*/
void setMode(Mode mode);
/**
*
* @return
*/
Type getType();
/**
*
* @return
*/
void setType(Type type);
}

View file

@ -0,0 +1,153 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.Collection;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IPropertied {
public static class Property {
private String value;
private String key;
/**
*
* @param key
* @param value
*/
public Property(String key, String value) {
this.key = key;
this.value = value;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @param key the key to set
*/
public void setKey(String key) {
this.key = key;
}
@Override
public String toString() {
return String.format("[%s{%s}]", key, value);
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Property other = (Property) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}
/**
*
* @param key
* @param defaultValue
* @return
*/
void setProperty(String key, String value);
/**
*
* @param key
* @param defaultValue
* @return
*/
String getProperty(String key, String defaultValue);
/**
* Gets the message properties as a collection of key, value
* pairs. Always returns a not-null value.
* @return
*/
Collection<Property> getProperties();
}

View file

@ -0,0 +1,166 @@
/**
* 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.
**/
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.Collection;
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.roster.IRosterManager;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
*
* Implementations of ISession do not support polling for messages but instead
* make exclusive use of listener based callbacks to make incoming data available.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface ISession {
/**
*
* @param userName
* @param password
*/
void connect(String userName, String password);
/**
*
* @return
*/
IQualifiedID getUserID();
/**
* Gets the connection status of the session.
* @return The connection status.
*/
boolean isConnected();
/**
* Close and clean up this session. After a close, isConnected must return false.
*/
void close();
/**
* Allow the user to send presence information to the transport provider.
* @param presence
* @return Return status information.
*/
int sendPresence(IPresence presence);
/**
* Get the roster manager for this user on this session.
* @return The roster manager.
*/
IRosterManager getRosterManager();
/**
* Send a Text message.
* @param message
*/
int sendTextMessage(IMessage message);
/**
* Send a Text message to a specific receiver.
* @param to The intended receiver.
* @param message The message to send.
*/
int sendTextMessage(String to, String message);
/**
* Add a listener for incoming messages. These messages will be filtered using
* the supplied message filter.
* @param listener A listener for incoming messages.
* @param filter A filter that either accepts/rejects messages.
* @return The listener that was added.
*/
IMessageListener addMessageListener(IMessageListener listener, IMessageFilter filter);
/**
* Get the message listeners defined for the session.
* @return A not null collection of message listeners defined for the session.
*/
Collection<IMessageListener> getMessageListeners();
/**
* Remove a message listener from the session.
* @param listener A listener to remove.
* @return The listener that was removed. If the listener was not
* found, a null reference is returned.
*/
IMessageListener removeMessageListener(IMessageListener listener);
/**
*
* @param filter
* @return
*/
IPresenceListener addPresenceListener(IPresenceListener listener, IMessageFilter filter);
/**
* Get the presence listeners defined for the session.
* @return A not null collection of presence listeners defined for the session.
*/
Collection<IPresenceListener> getPresenceListeners();
/**
* Remove a presence listener from the session.
* @param listener A listener to remove.
* @return The listener that was removed. If the listener was not
* found, a null reference is returned.
*/
IPresenceListener removePresenceListener(IPresenceListener listener);
}

View file

@ -0,0 +1,155 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.Collection;
import java.util.List;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
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.IVenueParticipantListener;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenueSession extends ISession {
/**
* Joins an existing multiple user collaboration.
* @param venueName Name of the venue.
*/
int joinVenue(String venueName);
/**
* Creates a multiple user collaboration.
* @param venueName Name of the venue.
* @param subject The subject of the collaboration.
*/
int createVenue(String venueName, String subject);
/**
* Returns information about a venue.
* @return Information about a venue
*/
IVenue getVenue();
/**
* Send a Text message to the venue.
* @param message The message text to send.
*/
int sendTextMessage(String message);
/**
* Send a Collaboration message.
* @param message The message to send.
*/
int sendCollaborationMessage(IMessage message);
/**
* Send a Collaboration message.
* @param message The message to send.
*/
int sendCollaborationMessage(String message);
/**
* 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
*/
int sendInvitation(String room, String id, String subject, String body);
/**
* Send an invitation from this venue to another user.
* @param room The target venue for this invitation.
* @param ids A list of target users for this invitation.
* @param subject The intended subject of the venue conversation.
* @param body Any text that the user may wish to include.
* @return
*/
int sendInvitation(String room, List<String> ids, String subject, String body);
/**
*
* @param message
*/
int sendMessageToVenue(String message);
/**
* Add a venue participant listener to this session.
* @param listener The listener to add.
* @return
*/
public IVenueParticipantListener addVenueParticipantListener(IVenueParticipantListener listener);
/**
* Get the venue participant listeners defined for the session.
* @return A not null collection of venue participant listeners defined for the session.
*/
public Collection<IVenueParticipantListener> getVenueParticipantListeners();
/**
* Remove a venue participant listener from this session.
* @param listener A listener to remove.
* @return The listener that was removed. If the listener was not
* found, a null reference is returned.
*/
public IVenueParticipantListener removeVenueParticipantListener(IVenueParticipantListener listener);
/**
*
* @param listener
* @param filter
* @return
*/
public IMessageListener addCollaborationListener(IMessageListener listener, IMessageFilter filter);
/**
* Get the collaboration listeners defined for the session.
* @return A not null collection of collaboration listeners defined for the session.
*/
public Collection<IMessageListener> getCollaborationListeners();
/**
* Remove a collaboration listener from the session.
* @param listener A listener to remove.
* @return The listener that was removed. If the listener was not
* found, a null reference is returned.
*/
public IMessageListener removeCollaborationListener(IMessageListener listener);
}

View file

@ -0,0 +1,76 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.info;
import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
* Provides information about a venue. In addition implementations will
* act as a target for participant updates such as
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenue {
/**
*
* @return
*/
IVenueInfo getInfo();
/**
*
* @return
*/
void setInfo(IVenueInfo info);
/**
*
* @return
*/
Collection<IVenueParticipant> getParticipants();
/**
*
* @return
*/
void addParticipant(IVenueParticipant participant);
/**
*
* @return
*/
void removeParticipant(IVenueParticipant participant);
}

View file

@ -0,0 +1,91 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.info;
import java.util.Collection;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenueInfo {
/**
*
* @return
*/
String getVenueDescription();
/**
* Get a long name for venue
* @return
*/
String getVenueName();
/**
*
* @return
*/
String getVenueSubject();
/**
*
* @return
*/
String getVenueID();
/**
* Get a count of the current number of room participants
* @return Count of the current number of room participants
*/
int getParticipantCount();
/**
*
* @return
*/
boolean isModerated();
/**
*
* @return
*/
boolean isPersistent();
/**
*
* @return
*/
boolean requiresPassword();
}

View file

@ -0,0 +1,52 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
/**
* Message filters are used to determine if a given message should be processed.
* These filters are paired with an associated IMessageListener or IPresenceListener
* when the listener added.
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IMessageFilter {
/**
* Should this message be processed?
* @param message A message to examine.
* @return Should this message be processed?
*/
boolean filter(IMessage message);
}

View file

@ -0,0 +1,48 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IMessageListener {
/**
*
* @param message
*/
void processMessage(IMessage message);
}

View file

@ -0,0 +1,49 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IPresenceListener {
/**
*
* @param message
*/
void notifyPresence(IPresence presence);
}

View file

@ -0,0 +1,67 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 29, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IRosterListener {
/**
* Notification that an entry has been added to the roster.
*
* @param entry
* The entry that was added.
*/
void rosterEntryAdded(IRosterEntry entry);
/**
* Notification that an entry in the roster has been modified.
*
* @param entry
* The entry that was modified.
*/
void rosterEntryUpdated(IRosterEntry entry);
/**
* Notification that an entry has been removed from the roster.
*
* @param entry
* The entry that was removed.
*/
void rosterEntryRemoved(IRosterEntry entry);
}

View file

@ -0,0 +1,70 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.listener;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 6, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IVenueParticipantListener {
/**
* A participant has arrived in the venue.
* @param participant The participant who has arrived.
*/
public void handleArrived(IVenueParticipant participant);
/**
* A participant has has updated their information.
* @param participant The participant whose information has been updated.
*/
public void handleUpdated(IVenueParticipant participant);
/**
* A participant has departed this venue.
* @param participant The participant who has departed.
*/
public void handleDeparted(IVenueParticipant participant);
/**
* Presence information about the participant who has arrived, updated, or
* departed the venue.
* @param fromID
* @param presence
*/
public void handlePresenceUpdated(IVenueParticipant fromID, IPresence presence);
}

View file

@ -0,0 +1,111 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.roster;
import java.util.Collection;
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.IQualifiedID;
/**
* The Roster provides a structure to maintain user contacts. These
* contacts may be organized into groups beneath the Roster. A single
* user contact may be associated with more than a single group. As
* of this time nesting is not allowed, that is groups may not contain
* groups.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IRoster {
/**
* Add an entry directly to the roster.
* @param item
*/
void addRosterEntry(IRosterEntry entry);
/**
* Add this user to the roster. An IRosterListener.rosterEntryAdded
* event will be triggered if the addition is successful.
* @param user
* @param nickName
* @param groups
*/
void addRosterEntry(IQualifiedID user, String nickName, String [] groups);
/**
* Request that the specified entry be modified in the roster. An IRosterListener.rosterEntryAdded
* event will be triggered if the addition is successful.
* @param entry The entry to modify. This entry will contain the modifications
* to apply.
*/
void modifyRosterEntry(IRosterEntry entry);
/**
* Request that the user be removed from the roster. An IRosterListener.rosterEntryUpdated
* event will be triggered if the update is successful.
* @param user The identification of the user to be removed.
*/
void removeFromRoster(ID user);
/**
* Get all entries associated with this roster.
* @return A Collection of entries belonging to this Roster.
*/
Collection<IRosterEntry> getEntries();
/**
* Get all groups associated with this roster.
* @return A Collection of groups belonging to this Roster.
*/
Collection<IRosterGroup> getGroups();
/**
*
* @return
*/
IChatID getUser();
/**
* Does this roster support nested groups?
* @return This roster supports nested groups.
*/
boolean supportsNestedGroups();
/**
* Signifies whether this roster associated with a chat room.
* @return Is this roster associated with a chat room.
*/
boolean isRoomRoster();
}

View file

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

View file

@ -0,0 +1,59 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.roster;
import java.util.Collection;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IRosterGroup extends IRosterItem {
/**
* Collection of entries belonging to this group. This method must
* always return a not null collection with zero or more entries.
* @return Entries belonging to this group.
*/
Collection<IRosterEntry> getEntries();
/**
* Collection of nested groups belonging to this group. This method must
* return a null reference if nested groups are not allowed. If nested
* groups are allowed the method must return a not null collection with
* zero or more entries.
* @return Groups belonging to this group.
*/
Collection<IRosterGroup> getGroups();
}

View file

@ -0,0 +1,59 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.roster;
/**
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IRosterItem {
/**
*
* @return
*/
String getName();
/**
*
* @return
*/
IRosterItem getParent();
/**
* Get a reference to the roster containing this item.
* @return The containing roster.
*/
IRoster getRoster();
}

View file

@ -0,0 +1,78 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.roster;
import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 29, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IRosterManager {
/**
* Get the underlying Roster.
*
* @return The Roster.
*/
IRoster getRoster();
/**
*
* @param listener
* A roster listener to add to the manager.
* @return The listener that was added.
*/
IRosterListener addRosterListener(IRosterListener listener);
/**
* Return a collection of all roster listeners for the manager.
*
* @return
*/
Collection<IRosterListener> getRosterListeners();
/**
* Removes a roster listener from the manager.
*
* @param listener
* The listener to remove.
* @return Was the removal successful.
*/
IRosterListener removeRosterListener(IRosterListener listener);
}

View file

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

View file

@ -0,0 +1,58 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.user;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface ID {
/**
*
* @param userName
*/
void setName(String userName);
/**
*
*/
String getName();
/**
*
* @return
*/
String getFQName();
}

View file

@ -0,0 +1,65 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.identity.user;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface IQualifiedID extends ID {
/**
*
* @param hostName
*/
void setHost(String hostName);
/**
*
* @return
*/
String getHost();
/**
*
* @param resource
*/
void setResource(String resource);
/**
*
* @return
*/
String getResource();
}

View file

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

View file

@ -0,0 +1,247 @@
/**
* 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;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public abstract class BaseMessage implements Serializable, IMessage {
private static final long serialVersionUID = 1L;
private Map<String, String> properties = null;
private String body;
private IQualifiedID to;
private IQualifiedID from;
private String subject;
private String status;
private final long timeStamp;
/**
*
* @param to
* @param body
*/
protected BaseMessage(IQualifiedID to, String body) {
this.body = body;
this.to = to;
initProperties();
timeStamp = setTimeStamp();
}
/**
* @return the to
*/
@Override
public IQualifiedID getTo() {
return to;
}
/**
* @param to
* the to to set
*/
@Override
public void setTo(IQualifiedID to) {
this.to = to;
}
/**
* @return the from
*/
@Override
public IQualifiedID getFrom() {
return from;
}
/**
* @param from
* the from to set
*/
@Override
public void setFrom(IQualifiedID from) {
this.from = from;
}
/**
* @param body
* the body to set
*/
@Override
public void setBody(String body) {
this.body = body;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getBody()
*/
@Override
public String getBody() {
return body;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getBodyAsBinary()
*/
@Override
public byte[] getBodyAsBinary() {
return null;
}
/**
*
*/
private void initProperties() {
if (properties == null) {
properties = new HashMap<String, String>();
}
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setProperty(java.lang.String,
* java.lang.String)
*/
@Override
public void setProperty(String key, String value) {
properties.put(key, value);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperty(java.lang.String,
* java.lang.String)
*/
@Override
public String getProperty(String key, String defaultValue) {
String retValue = defaultValue;
if (properties != null) {
if(properties.containsKey(key)) {
retValue = properties.get(key);
}
}
return retValue;
}
/**
* Gets the message properties as a collection of key, value
* pairs. Always returns a not-null value.
* @return A Collection of properties associated with this message.
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperties()
*/
@Override
public Collection<Property> getProperties() {
Collection<Property> p = new ArrayList<Property>();
for(String s : properties.keySet()) {
p.add(new Property(s,properties.get(s)));
}
return p;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getSubject()
*/
@Override
public String getSubject() {
return subject;
}
/**
*
* @param subject
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setSubject(java.lang.String)
*/
@Override
public void setSubject(String subject) {
this.subject = subject;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getStatus()
*/
@Override
public String getStatus() {
return status;
}
/**
*
* @param status
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setStatus(java.lang.String)
*/
@Override
public void setStatus(String status) {
this.status = status;
}
/**
* Get the receipt time for this message in milliseconds from
* Jan 1, 1970.
* @return The receipt time stamp.
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getTimeStamp()
*/
@Override
public long getTimeStamp() {
return timeStamp;
}
/**
*
* @return
*/
private long setTimeStamp() {
long timestamp = System.currentTimeMillis();
properties.put(TIMESTAMP, Long.toHexString(timestamp));
return timestamp;
}
}

View file

@ -0,0 +1,71 @@
/**
* 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;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class CollaborationMessage extends BaseMessage {
private static final long serialVersionUID = 1L;
/**
*
* @param to
* @param body
*/
protected CollaborationMessage(IQualifiedID to, String body) {
super(to,body);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getMessageType()
*/
@Override
public MessageType getMessageType() {
return MessageType.COLLABORATION;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getBodyAsBinary(byte[])
*/
@Override
public void getBodyAsBinary(byte[] body) {
}
}

View file

@ -0,0 +1,967 @@
/**
* 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;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.security.ConnectContextFactory;
import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.presence.IIMMessageEvent;
import org.eclipse.ecf.presence.IIMMessageListener;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.IPresenceSender;
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import org.eclipse.ecf.presence.chatroom.IChatRoomInvitationSender;
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessage;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessageEvent;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessageSender;
import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
import org.eclipse.ecf.presence.im.IChatID;
import org.eclipse.ecf.presence.im.IChatMessage;
import org.eclipse.ecf.presence.im.IChatMessageSender;
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
import com.raytheon.uf.viz.collaboration.comm.SessionManager;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
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.listener.IVenueParticipantListener;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
/**
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class CollaborationSession implements IVenueSession {
/**
*
* 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 IContainer container = null;
private IPresenceContainerAdapter presence = null;
private IChatMessageSender chatSender = null;
private Namespace namespace = null;
private IChatRoomManager venueManager = null;
private IChatRoomContainer venueContainer = null;
private IChatRoomInfo venueInfo = null;
private List<InternalListener> messageListeners = null;
private List<IVenueParticipantListener> venueParticipantListeners = null;
private List<InternalListener> collaborationListeners = null;
private List<InternalListener> presenceListeners = null;
private IIMMessageListener intListener = null;
private IQualifiedID receiver = null;
private IQualifiedID userID = null;
/**
*
*/
public CollaborationSession(IContainer container) {
this.container = container;
initListeners();
try {
setup();
} catch (ECFException e) {
}
}
/**
*
* @param userName
* @param password
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#connect(java.lang.String, java.lang.String)
*/
@Override
public void connect(String userName, String password) {
if(!isConnected()) {
ID targetID = IDFactory.getDefault().createID(namespace, userName);
// Now connect
try {
container.connect(targetID, ConnectContextFactory.createPasswordConnectContext(password));
System.out.println("Container connected as " + container.getConnectedID());
} catch (ContainerConnectException e) {
System.out.println("Error attempting to connect");
e.printStackTrace();
}
}
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID()
*/
@Override
public IQualifiedID getUserID() {
return userID;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#isConnected()
*/
@Override
public boolean isConnected() {
boolean connected = false;
if(container != null) {
connected = (container.getConnectedID() != null);
}
return connected;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#close()
*/
@Override
public void close() {
if(container != null) {
// Ensure the listeners are cleared first.
// unhook the internal listener first.
if(intListener != null) {
venueContainer.removeMessageListener(intListener);
}
messageListeners.clear();
messageListeners = null;
collaborationListeners.clear();
collaborationListeners = null;
presenceListeners.clear();
presenceListeners = null;
// Now dispose of the comm container.
container.dispose();
container = null;
}
}
/**
*
* @throws ECFException
*/
private void setup() throws ECFException {
if (container == null) {
container = ContainerFactory.getDefault().createContainer(SessionManager.PROVIDER);
}
if(container != null) {
namespace = container.getConnectNamespace();
presence = (IPresenceContainerAdapter) container
.getAdapter(IPresenceContainerAdapter.class);
chatSender = presence.getChatManager().getChatMessageSender();
}
}
/**
*
* @param name
* @return
*/
private ID createID(String name) {
return IDFactory.getDefault().createID(container.getConnectNamespace(), name);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#joinVenue(java.lang.String)
*/
@Override
public int joinVenue(String venueName) {
int errorStatus = -1;
try {
// Create chat room container from manager
venueManager = presence.getChatRoomManager();
venueInfo = venueManager.getChatRoomInfo(venueName);
if(venueInfo != null) {
errorStatus = completeVenueConnection(venueInfo);
} else {
// Could not join venue.
}
} catch (Exception e) {
System.out.println(String.format("joinVenue(%s)", venueName));
e.printStackTrace();
}
return errorStatus;
}
/**
*
* @param venueName
* @throws Exception
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#createVenue(java.lang.String, java.lang.String)
*/
@Override
public int createVenue(String venueName, String subject) {
int errorStatus = -1;
try {
// Create chat room container from manager
venueManager = presence.getChatRoomManager();
venueInfo = venueManager.getChatRoomInfo(venueName);
if(venueInfo == null) {
Map<String, String> props = null;
if(subject != null) {
props = new HashMap<String,String>();
props.put(Tools.VENUE_SUBJECT_PROP, subject);
}
venueInfo = venueManager.createChatRoom(venueName, props);
errorStatus = completeVenueConnection(venueInfo);
} else {
// The venue already exists.
errorStatus = -2;
}
} catch (Exception e) {
System.out.println(String.format("createVenue(%s)", venueName));
e.printStackTrace();
}
return errorStatus;
}
/**
*
* @return
*/
private int completeVenueConnection(IChatRoomInfo venueInfo) {
int errorStatus = 0;
if (venueInfo != null) {
try {
venueContainer = venueInfo.createChatRoomContainer();
venueContainer.connect(venueInfo.getRoomID(), null);
if (venueContainer.getConnectedID() != null) {
intListener = new IIMMessageListener() {
public void handleMessageEvent(
IIMMessageEvent messageEvent) {
if (messageEvent instanceof IChatRoomMessageEvent) {
IChatRoomMessage m = ((IChatRoomMessageEvent) messageEvent)
.getChatRoomMessage();
distributeMessage(createMessage(m));
}
}
};
venueContainer.addMessageListener(intListener);
IChatRoomParticipantListener pListener = new IChatRoomParticipantListener() {
@Override
public void handleArrived(IUser participant) {
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleArrived(p);
}
}
@Override
public void handleUpdated(IUser participant) {
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleUpdated(p);
}
}
@Override
public void handleDeparted(IUser participant) {
IVenueParticipant p = new VenueParticipant(participant.getName(), participant.getNickname());
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handleDeparted(p);
}
}
@Override
public void handlePresenceUpdated(
ID fromID,
org.eclipse.ecf.presence.IPresence presence) {
fromID.getName();
IVenueParticipant vp = new VenueParticipant();
vp.setName(fromID.getName());
IPresence p = Presence.convertPresence(presence);
for(IVenueParticipantListener listener : venueParticipantListeners) {
listener.handlePresenceUpdated(vp, p);
}
}
};
venueContainer.addChatRoomParticipantListener(pListener);
}
} catch (Exception e) {
errorStatus = -1;
}
}
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()) {
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;
}
/**
*
*/
@Override
public int sendPresence(IPresence userPresence) {
// Assume success
int status = 0;
IPresenceSender sender = presence.getRosterManager().getPresenceSender();
try {
sender.sendPresenceUpdate(null, Presence.convertPresence(userPresence));
} catch (ECFException e) {
status = -1;
}
return status;
}
/**
* @return Get the roster manager for this session.
*/
@Override
public IRosterManager getRosterManager() {
return null;
}
/**
*
*/
@Override
public int sendTextMessage(IMessage message) {
// Assume success
int status = 0;
if(chatSender != null) {
ID toID = createID(message.getTo().getName());
String subject = message.getSubject();
String body = message.getBody();
Collection<Property> properties = message.getProperties();
Map<String, String> props = null;
if((properties != null) && (properties.size() > 0)) {
props = new HashMap<String, String>();
for(Property p : properties) {
props.put(p.getKey(),p.getValue());
}
}
try {
chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT, subject, body, props);
} catch (ECFException e) {
System.out.println("Error sending message");
e.printStackTrace();
}
fireMessageListeners(message);
}
return status;
}
/**
*
* @param to
* @param message
*/
@Override
public int sendTextMessage(String to, String message) {
// Assume success
int status = 0;
ID toID = createID(to);
try {
chatSender.sendChatMessage(toID, message);
IMessage msg = new TextMessage(receiver, message);
status = sendTextMessage(msg);
} catch (ECFException e) {
System.out.println("Error sending message");
e.printStackTrace();
}
return status;
}
/**
*
* @param message
*/
@Override
public int sendTextMessage(String message) {
IMessage msg = new TextMessage(receiver, message);
return sendTextMessage(msg);
}
/**
* @param message A message to send.
*/
public int sendMessageToVenue(String message) {
// Assume success
int status = 0;
if(venueContainer != null) {
IChatRoomMessageSender sender = venueContainer.getChatRoomMessageSender();
try {
sender.sendMessage(message);
} catch (ECFException e) {
e.printStackTrace();
}
}
return status;
}
/**
*
* @param message
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendCollaborationMessage(com.raytheon.uf.viz.collaboration.comm.identity.IMessage)
*/
@Override
public int sendCollaborationMessage(IMessage message) {
// Assume success
int status = 0;
// for now we're sending everything via regular messages.
return sendMessageToVenue(message.getBody());
}
/**
*
* @param message
* @see com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession#sendCollaborationMessage(java.lang.String)
*/
@Override
public int sendCollaborationMessage(String message) {
IMessage msg = new CollaborationMessage(receiver, message);
return sendCollaborationMessage(msg);
}
/**
* 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 = 0;
IChatRoomInvitationSender sender = presence.getChatRoomManager().getInvitationSender();
if(sender != null) {
ID roomId = presence.getChatRoomManager().getChatRoomInfo(room).getConnectedID();
ID userId = IDFactory.getDefault().createID(namespace, id + "@awipscm.omaha.us.ray.com");
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 = 0;
if(ids != null) {
for(String id : ids) {
sendInvitation(room, id, subject, body);
}
} else {
status = -1;
}
return status;
}
@Override
public IMessageListener addMessageListener(IMessageListener listener, IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener, filter);
messageListeners.add(messageListener);
return listener;
}
/**
*
*/
@Override
public Collection<IMessageListener> getMessageListeners() {
Collection<IMessageListener> listeners = new ArrayList<IMessageListener>();
synchronized(messageListeners) {
for(InternalListener intListener : messageListeners) {
listeners.add(intListener.messageListener);
}
}
return listeners;
}
/**
*
*/
@Override
public IMessageListener removeMessageListener(IMessageListener listener) {
IMessageListener removed = null;
if(messageListeners.remove(listener)) {
removed = listener;
}
return removed;
}
/**
*
*/
@Override
public IVenueParticipantListener addVenueParticipantListener(IVenueParticipantListener listener) {
if(listener != null) {
venueParticipantListeners.add(listener);
} else {
// TODO : Need some error condition here?
}
return listener;
}
/**
*
*/
@Override
public Collection<IVenueParticipantListener> getVenueParticipantListeners() {
Collection<IVenueParticipantListener> listeners = new ArrayList<IVenueParticipantListener>();
synchronized(collaborationListeners) {
for(IVenueParticipantListener listener : venueParticipantListeners) {
listeners.add(listener);
}
}
return listeners;
}
/**
*
*/
@Override
public IVenueParticipantListener removeVenueParticipantListener(IVenueParticipantListener listener) {
IVenueParticipantListener removed = null;
if(venueParticipantListeners.remove(listener)) {
removed = listener;
}
return removed;
}
/**
*
*/
@Override
public IMessageListener addCollaborationListener(IMessageListener listener, IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener, filter);
collaborationListeners.add(messageListener);
return listener;
}
/**
*
*/
@Override
public Collection<IMessageListener> getCollaborationListeners() {
Collection<IMessageListener> listeners = new ArrayList<IMessageListener>();
synchronized(collaborationListeners) {
for(InternalListener intListener : collaborationListeners) {
listeners.add(intListener.messageListener);
}
}
return listeners;
}
/**
*
*/
@Override
public IMessageListener removeCollaborationListener(IMessageListener listener) {
IMessageListener removed = null;
if(collaborationListeners.remove(listener)) {
removed = listener;
}
return removed;
}
/**
*
*/
@Override
public IPresenceListener addPresenceListener(IPresenceListener listener, IMessageFilter filter) {
InternalListener presenceListener = new InternalListener(listener, filter);
presenceListeners.add(presenceListener);
return listener;
}
/**
*
*/
@Override
public Collection<IPresenceListener> getPresenceListeners() {
Collection<IPresenceListener> listeners = new ArrayList<IPresenceListener>();
synchronized(presenceListeners) {
for(InternalListener intListener : presenceListeners) {
listeners.add(intListener.presenceListener);
}
}
return listeners;
}
@Override
public IPresenceListener removePresenceListener(IPresenceListener listener) {
IPresenceListener removed = null;
if(presenceListeners.remove(listener)) {
removed = listener;
}
return removed;
}
/**
* Set up the various message listener lists.
*/
private void initListeners() {
messageListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
venueParticipantListeners = Collections.synchronizedList(new ArrayList<IVenueParticipantListener>());
presenceListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
collaborationListeners = Collections.synchronizedList(new ArrayList<InternalListener>());
}
/**
*
* @param message
*/
private void distributeMessage(IMessage message) {
if(message != null) {
fireMessageListeners(message);
// if(IMessage.MessageType.CHAT.equals(message.getMessageType())) {
// fireMessageListeners(message);
// } else if (IMessage.MessageType.COLLABORATION.equals(message.getMessageType())) {
// fireCollaborationListeners(message);
// }
}
}
/**
*
* @param message
*/
private void fireMessageListeners(IMessage message) {
synchronized(messageListeners) {
for(InternalListener listener : messageListeners) {
if(listener.filter(message)) {
listener.processMessage(message);
}
}
}
}
/**
*
* @param message
*/
private void fireCollaborationListeners(IMessage message) {
synchronized(collaborationListeners) {
for(InternalListener listener : collaborationListeners) {
if(listener.filter(message)) {
listener.processMessage(message);
}
}
}
}
/**
*
* @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);
}
}
}
}
}
/**
*
* @param msg
* @return
*/
private IMessage createMessage(IChatMessage msg) {
IMessage message = null;
Map props = msg.getProperties();
if(props != null) {
Map<String, String> p = new HashMap<String, String>();
for(Object k : props.keySet()) {
Object v = props.get(k);
if((k instanceof String) && (v instanceof String)) {
p.put((String) k,(String) v);
}
}
String s = (String) props.get(IMessage.MESSAGE_TYPE);
if(IMessage.MessageType.CHAT.name().equals(s)) {
IQualifiedID to = null;
message = new TextMessage(to, msg.getBody());
} else if(IMessage.MessageType.COLLABORATION.name().equals(s)) {
IQualifiedID to = null;
message = new CollaborationMessage(to, msg.getBody());
} else {
}
}
return message;
}
/**
*
* @param msg
* @return
*/
private IMessage createMessage(IChatRoomMessage msg) {
IMessage message = null;
String body = msg.getMessage();
if(body != null) {
message = new CollaborationMessage(null, msg.getMessage());
IChatID cID = (IChatID) msg.getFromID();
XMPPRoomID rID = (XMPPRoomID) msg.getChatRoomID();
System.out.println("nickname = " + rID.getNickname());
IQualifiedID id = new VenueUserId(cID.getUsername(), rID.getHostname());
message.setFrom(id);
}
return message;
}
}

View file

@ -0,0 +1,193 @@
/**
* 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;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
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>();
static {
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.AVAILABLE, IPresence.Type.AVAILABLE);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.ERROR, IPresence.Type.ERROR);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBE, IPresence.Type.SUBSCRIBE);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBED, IPresence.Type.SUBSCRIBED);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNAVAILABLE, IPresence.Type.UNAVAILABLE);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBE, IPresence.Type.UNSUBSCRIBE);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNSUBSCRIBED, IPresence.Type.UNSUBSCRIBED);
TYPE_MAP.put(org.eclipse.ecf.presence.IPresence.Type.UNKNOWN, IPresence.Type.UNKNOWN);
}
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 Type type;
/**
*
*/
public Presence() {
mode = Mode.AVAILABLE;
type = Type.AVAILABLE;
}
/**
*
*/
@Override
public Mode getMode() {
return mode;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPresence#setMode(com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode)
*/
@Override
public void setMode(Mode mode) {
this.mode = mode;
}
/**
*
*/
@Override
public Type getType() {
return type;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPresence#setType(com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type)
*/
@Override
public void setType(Type type) {
this.type = type;
}
private void ensureProperties() {
if(properties == null) {
properties = new HashMap<String,Property>();
}
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#setProperty(java.lang.String, java.lang.String)
*/
@Override
public void setProperty(String key, String value) {
ensureProperties();
properties.put(key, new Property(key,value));
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperty(java.lang.String, java.lang.String)
*/
@Override
public String getProperty(String key, String defaultValue) {
String retValue = defaultValue;
if(properties != null) {
Property property = properties.get(key);
retValue = (property != null) ? property.getValue() : defaultValue;
}
return retValue;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getProperties()
*/
@Override
public Collection<Property> getProperties() {
return properties.values();
}
/**
*
* @param presence
* @return
*/
public static IPresence convertPresence(org.eclipse.ecf.presence.IPresence presence) {
IPresence newPresence = null;
if(presence != null) {
newPresence = new Presence();
newPresence.setType(TYPE_MAP.get(presence.getType()));
newPresence.setMode(MODE_MAP.get(presence.getMode()));
System.out.println(presence.getStatus());
}
return newPresence;
}
/**
*
* @param presence
* @return
*/
public static org.eclipse.ecf.presence.IPresence convertPresence(IPresence presence) {
org.eclipse.ecf.presence.IPresence newPresence = null;
if(presence != null) {
}
return newPresence;
}
}

View file

@ -0,0 +1,66 @@
/**
* 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;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class TextMessage extends BaseMessage {
private static final long serialVersionUID = 1L;
/**
*
* @param to
* @param body
*/
public TextMessage(IQualifiedID to, String body) {
super(to,body);
}
/**
*
*/
@Override
public MessageType getMessageType() {
return MessageType.CHAT;
}
@Override
public void getBodyAsBinary(byte[] body) {
}
}

View file

@ -0,0 +1,52 @@
/**
* 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;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.ecf.presence.IPresence.Type;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public abstract class Tools {
public static final String VENUE_SUBJECT_PROP = "subject";
}

View file

@ -0,0 +1,257 @@
/**
* 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.info;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class InfoAdapter {
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
private static class MutableVenueInfo implements IVenueInfo {
private String description;
private String name;
private String subject;
private String id;
private int participantCount;
private boolean isModerated = false;
private boolean isPersistent = false;
private boolean requiresPassword = false;
/**
*
* @param description
*/
public void setVenueDescription(String description) {
this.description = description;
}
/**
*
* @param name
*/
public void setVenueName(String name) {
this.name = name;
}
/**
*
* @param subject
*/
public void setVenueSubject(String subject) {
this.subject = subject;
}
/**
*
* @param id
*/
public void setVenueID(String id) {
this.id = id;
}
/**
*
* @param count
*/
public void setParticipantCount(int count) {
participantCount = count;
}
/**
*
* @param moderated
*/
public void setModerated(boolean moderated) {
isModerated = moderated;
}
/**
*
* @param persistent
*/
public void setPersistent(boolean persistent) {
isPersistent = persistent;
}
public void setRequiresPassword(boolean requiresPassword) {
this.requiresPassword = requiresPassword;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueDescription()
*/
@Override
public String getVenueDescription() {
return description;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueName()
*/
@Override
public String getVenueName() {
return name;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueSubject()
*/
@Override
public String getVenueSubject() {
return subject;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueID()
*/
@Override
public String getVenueID() {
return id;
}
/**
*
*/
@Override
public int getParticipantCount() {
return participantCount;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isModerated()
*/
@Override
public boolean isModerated() {
return isModerated;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isPersistent()
*/
@Override
public boolean isPersistent() {
return isPersistent;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#requiresPassword()
*/
@Override
public boolean requiresPassword() {
return requiresPassword;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("[%s]:", name));
sb.append(String.format("[%s]:", id));
sb.append(String.format("mod[%s]:", (isModerated) ? "T" : "F"));
sb.append(String.format("pers[%s]:", (isPersistent) ? "T" : "F"));
sb.append(String.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
sb.append(String.format("\n subject : %s", subject));
sb.append(String.format("\n description : %s", description));
return sb.toString();
}
}
/**
* Convert ECF room into to a VenueInfo instance.
* @param info
* @return
*/
public static IVenueInfo createVenueInfo(IChatRoomInfo info) {
MutableVenueInfo venue = null;
if(info != null) {
venue = new MutableVenueInfo();
venue.setVenueDescription(info.getDescription());
venue.setVenueName(info.getName());
venue.setVenueSubject(info.getSubject());
venue.setVenueID(info.getRoomID().toExternalForm());
venue.setParticipantCount(info.getParticipantsCount());
venue.setModerated(info.isModerated());
venue.setPersistent(info.isPersistent());
venue.setRequiresPassword(info.requiresPassword());
}
return venue;
}
}

View file

@ -0,0 +1,103 @@
/**
* 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.info;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class Venue implements IVenue {
private IVenueInfo info;
private Map<String, IVenueParticipant> participants;
/**
*
*/
public Venue() {
participants = new HashMap<String, IVenueParticipant>();
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getInfo()
*/
@Override
public IVenueInfo getInfo() {
return info;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#setInfo(com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo)
*/
@Override
public void setInfo(IVenueInfo info) {
this.info = info;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#getParticipants()
*/
@Override
public Collection<IVenueParticipant> getParticipants() {
return participants.values();
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#addParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant)
*/
@Override
public void addParticipant(IVenueParticipant participant) {
participants.put(participant.getName(), participant);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue#removeParticipant(com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant)
*/
@Override
public void removeParticipant(IVenueParticipant participant) {
participants.remove(participant).getName();
}
}

View file

@ -0,0 +1,140 @@
/**
* 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.info;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class VenueInfo implements IVenueInfo {
private String description;
private String name;
private String subject;
private String id;
private int participantCount;
private boolean isModerated = false;
private boolean isPersistent = false;
private boolean requiresPassword = false;
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueDescription()
*/
@Override
public String getVenueDescription() {
return description;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueName()
*/
@Override
public String getVenueName() {
return name;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueSubject()
*/
@Override
public String getVenueSubject() {
return subject;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getVenueID()
*/
@Override
public String getVenueID() {
return id;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#getParticipantCount()
*/
@Override
public int getParticipantCount() {
return participantCount;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isModerated()
*/
@Override
public boolean isModerated() {
return isModerated;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#isPersistent()
*/
@Override
public boolean isPersistent() {
return isPersistent;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo#requiresPassword()
*/
@Override
public boolean requiresPassword() {
return requiresPassword;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("[%s]:", name));
sb.append(String.format("[%s]:", id));
sb.append(String.format("mod[%s]:", (isModerated) ? "T" : "F"));
sb.append(String.format("pers[%s]:", (isPersistent) ? "T" : "F"));
sb.append(String.format("pass[%s]:", (requiresPassword) ? "T" : "F"));
sb.append(String.format("\n subject : %s", subject));
sb.append(String.format("\n description : %s", description));
return sb.toString();
}
}

View file

@ -0,0 +1,46 @@
/**
* 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.roster;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
interface IMutableRosterEntry extends IRosterEntry {
void setPresence(IPresence presence);
}

View file

@ -0,0 +1,168 @@
/**
* 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.roster;
import java.util.ArrayList;
import java.util.Collection;
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.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
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.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class Roster extends RosterItem implements IRoster {
private Collection<IRosterEntry> entries;
private Collection<IRosterGroup> groups;
private final IChatID user;
private boolean roomRoster = false;
// From ecf . . . .
// IPresenceContainerAdapter presence = (IPresenceContainerAdapter)
// container
// .getAdapter(IPresenceContainerAdapter.class);
// private IPresenceContainerAdapter presenceAdapter = null;
//
//
// presenceAdapter.getRosterManager.getRoster();
// We will then build our internal roster from the ecf roster.
//
/**
*
* @param user
*/
public Roster(IChatID user) {
this.user = user;
entries = new ArrayList<IRosterEntry>();
}
/**
* @return
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getUser()
*/
@Override
public IChatID getUser() {
return user;
}
/**
* Does this roster support nested groups?
*
* @return This roster support nested groups.
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#supportsNestedGroups()
*/
public boolean supportsNestedGroups() {
return false;
}
/**
* Is this a roster for a chat room?
*
* @return Is this a chat room roster?
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#isRoomRoster()
*/
@Override
public boolean isRoomRoster() {
return roomRoster;
}
/**
* @param entry
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#addEntry(com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry)
*/
@Override
public void addRosterEntry(IRosterEntry entry) {
entries.add(entry);
}
/**
* Get all entries belonging with this roster.
*
* @return A Collection of entries belonging to this Roster.
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#getEntries()
*/
@Override
public Collection<IRosterEntry> getEntries() {
return entries;
}
/**
* Get all groups associated with this roster.
*
* @return A Collection of groups belonging to this Roster.
*/
@Override
public Collection<IRosterGroup> getGroups() {
return groups;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#addRosterEntry(com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID,
* java.lang.String, java.lang.String[])
*/
@Override
public void addRosterEntry(IQualifiedID user, String nickName,
String[] groups) {
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#modifyRosterEntry(com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry)
*/
@Override
public void modifyRosterEntry(IRosterEntry entry) {
}
/*
*
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster#
* removeFromRoster(com.raytheon.uf.viz.collaboration.comm.identity.user.ID)
*/
@Override
public void removeFromRoster(ID user) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,154 @@
package com.raytheon.uf.viz.collaboration.comm.provider.roster;
import java.util.ArrayList;
import java.util.Collection;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
public class RosterEntry extends RosterItem implements IRosterEntry, IMutableRosterEntry {
private IChatID userId = null;
private IPresence presence = null;
private Collection<IRosterGroup> groups = null;
/**
*
* @param id
*/
public RosterEntry(IChatID id) {
userId = id;
groups = new ArrayList<IRosterGroup>();
}
/**
*
*/
@Override
public IChatID getUser() {
return userId;
}
/**
*
* @param group
*/
public void addGroup(IRosterGroup group) {
groups.add(group);
}
/**
*
*/
@Override
public Collection<IRosterGroup> getGroups() {
return null;
}
/**
*
* @param presence
*/
public void setPresence(IPresence presence) {
this.presence = presence;
}
/**
*
* @return
*/
@Override
public IPresence getPresence() {
return presence;
}
public static final void main(String [] args) {
IChatID id = new IChatID() {
private String name = null;
private String nickName = null;
private String host = null;
private String resource = null;
@Override
public void setName(String userName) {
name = userName;
}
@Override
public String getName() {
return name;
}
@Override
public void setNickname(String nickname) {
nickName = nickname;
}
@Override
public String getNickname() {
return nickName;
}
@Override
public void setHost(String hostName) {
host = hostName;
}
@Override
public String getHost() {
return host;
}
@Override
public String getResource() {
return resource;
}
@Override
public void setResource(String resource) {
this.resource = resource;
}
@Override
public String getFQName() {
StringBuilder sb = new StringBuilder(name);
sb.append("@");
sb.append(host);
if(resource != null) {
sb.append("/");
sb.append(resource);
}
return sb.toString();
}
};
id.setName("fred");
id.setHost("awipscm.omaha.us.ray.com");
id.setResource("smack");
IMutableRosterEntry entry = new RosterEntry(id);
entry.setPresence(new Presence());
IRosterEntry en = entry;
System.out.println(id.getFQName());
}
}

View file

@ -0,0 +1,113 @@
/**
* 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.roster;
import java.util.ArrayList;
import java.util.Collection;
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.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class RosterGroup extends RosterItem implements IRosterGroup {
private Collection<IRosterEntry> entries = null;
private Collection<IRosterGroup> groups = null;
/**
*
*/
public RosterGroup(String name, IRosterItem parent, IRoster roster) {
super(name, parent, roster);
if(roster.supportsNestedGroups()) {
groups = new ArrayList<IRosterGroup>();
}
}
/**
*
*/
private void ensureEntries() {
if(entries == null) {
entries = new ArrayList<IRosterEntry>();
}
}
/**
*
* @param entry
*/
public void addEntry(IRosterEntry entry) {
ensureEntries();
entries.add(entry);
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup#getEntries()
*/
@Override
public Collection<IRosterEntry> getEntries() {
return entries;
}
/**
*
* @param entry
* @return
*/
public IRosterEntry removeEntry(IRosterEntry entry) {
IRosterEntry removed = null;
if(entries != null) {
if(entries.remove(entry)) {
removed = entry;
}
}
return removed;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup#getGroups()
*/
@Override
public Collection<IRosterGroup> getGroups() {
return groups;
}
}

View file

@ -0,0 +1,147 @@
/**
* 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.roster;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 29, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class RosterItem implements IRosterItem {
//
private String name = null;
//
private IRosterItem parent = null;
//
private IRoster roster = null;
/**
*
* @param name
* @param parent
* @param roster
*/
public RosterItem(String name, IRosterItem parent, IRoster roster) {
this.name = name;
this.parent = parent;
this.roster = roster;
}
/**
*
*/
public RosterItem() {
this(null,null,null);
}
/**
*
* @param name
* @param item
*/
public RosterItem(String name, IRosterItem item) {
this(name, item, null);
}
/**
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getName()
*/
@Override
public String getName() {
return name;
}
/**
*
* @param item
*/
public void setParent(IRosterItem item) {
parent = item;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getParent()
*/
@Override
public IRosterItem getParent() {
return parent;
}
/**
*
* @param roster
*/
public void setRoster(IRoster roster) {
this.roster = roster;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem#getRoster()
*/
@Override
public IRoster getRoster() {
return null;
}
}

View file

@ -0,0 +1,145 @@
/**
* 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.IQualifiedID;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 24, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class UserId implements IQualifiedID {
private String name;
private String host;
private String resource;
/**
*
* @param userName
* @param hostName
*/
public UserId(String userName, String hostName) {
this.name = userName;
this.host = hostName;
resource = null;
}
/**
*
* @param userName
* @param hostName
* @param resourceName
*/
public UserId(String userName, String hostName, String resourceName) {
this.name = userName;
this.host = hostName;
resource = resourceName;
}
/**
* @param userName
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setUserName(java.lang.String)
*/
@Override
public void setName(String userName) {
name = userName;
}
/**
* @return The user name associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getUserName()
*/
@Override
public String getName() {
return name;
}
/**
*
* @param hostName
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String)
*/
@Override
public void setHost(String hostName) {
host = hostName;
}
/**
*
* @return The host name associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getHostName()
*/
@Override
public String getHost() {
return host;
}
/**
*
* @param resourceName The resource associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResourceName(java.lang.String)
*/
@Override
public void setResource(String resourceName) {
resource = resourceName;
}
/**
*
* @return The resource associated with this id.
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource()
*/
@Override
public String getResource() {
return resource;
}
/**
*
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getFQName()
*/
@Override
public String getFQName() {
StringBuilder sb = new StringBuilder(name);
sb.append("@");
sb.append(host);
if(resource != null) {
sb.append("/");
sb.append(resource);
}
return sb.toString();
}
}

View file

@ -0,0 +1,181 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.provider.user;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class VenueParticipant implements IVenueParticipant {
private Map<String, String> properties;
private String name;
private String nickname;
private String host;
private String resource;
/**
*
*/
public VenueParticipant() {
properties = new HashMap<String, String>();
}
/**
*
*/
public VenueParticipant(String name, String nickName) {
this(name, nickName, null);
}
/**
*
*/
public VenueParticipant(String name, String nickName, String host) {
this();
this.name = name;
this.nickname = nickName;
this.host = host;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#setProperty(java.lang.String, java.lang.String)
*/
@Override
public void setProperty(String key, String value) {
properties.put(key, value);
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperty(java.lang.String, java.lang.String)
*/
@Override
public String getProperty(String key, String defaultValue) {
String value = properties.get(key);
if(value == null) {
value = defaultValue;
}
return value;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.IPropertied#getProperties()
*/
@Override
public Collection<Property> getProperties() {
return null;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant#getName()
*/
@Override
public String getName() {
return name;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant#getNickname()
*/
@Override
public String getNickname() {
return nickname;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant#setName(java.lang.String)
*/
@Override
public void setName(String name) {
this.name = name;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant#getNickname(java.lang.String)
*/
@Override
public void setNickname(String nickName) {
this.nickname = nickName;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHost(java.lang.String)
*/
@Override
public void setHost(String hostName) {
host = hostName;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getHost()
*/
@Override
public String getHost() {
return host;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResource(java.lang.String)
*/
@Override
public void setResource(String resource) {
this.resource = resource;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource()
*/
@Override
public String getResource() {
return resource;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.ID#getFQName()
*/
@Override
public String getFQName() {
return null;
}
}

View file

@ -0,0 +1,81 @@
/**
* 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;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class VenueUserId extends UserId implements IChatID {
private String nickName;
/**
*
* @param userName
* @param hostName
*/
public VenueUserId(String userName, String hostName) {
super(userName, hostName);
nickName = null;
}
/**
*
* @param userName
* @param hostName
*/
public VenueUserId(String userName, String nickName, String hostName) {
super(userName, hostName);
this.nickName = nickName;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#setNickname(java.lang.String)
*/
@Override
public void setNickname(String nickname) {
this.nickName = nickname;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID#getNickname()
*/
@Override
public String getNickname() {
return nickName;
}
}