Omaha #3288 collaboration feed venue config comes from server

Change-Id: I5bc747507e44cc31093d7a7f470a263d0cf116c0

Former-commit-id: f38f9fae51 [formerly 8205f7cd56] [formerly e93c5642291bd6c8ebb4fc3528e55bf08184500d [formerly b6a2bf0ae4]] [formerly 84e3f967d9 [formerly b6a2bf0ae4 [formerly baab2ea12e1117446295ae60bc06228eb6139895]]]
Former-commit-id: 84e3f967d9
Former-commit-id: d0ae674bb4714971796f2565a9a4ddf679e2c503 [formerly 5436efb886]
Former-commit-id: 4dc81aabfa
This commit is contained in:
Brian Clements 2014-06-16 14:57:29 -05:00
parent 10196f93a0
commit 2ffe303324
16 changed files with 851 additions and 79 deletions

View file

@ -48,6 +48,8 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.xmpp.PacketConstants;
import com.raytheon.uf.common.xmpp.iq.AuthInfo;
import com.raytheon.uf.common.xmpp.iq.AuthInfoProvider;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfig;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfigProvider;
import com.raytheon.uf.viz.collaboration.comm.Activator;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IAccountManager;
@ -62,12 +64,14 @@ import com.raytheon.uf.viz.collaboration.comm.provider.account.AccountManager;
import com.raytheon.uf.viz.collaboration.comm.provider.account.ClientAuthManager;
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueUserEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CreateSessionData;
import com.raytheon.uf.viz.collaboration.comm.provider.session.FeedVenueConfigManager;
import com.raytheon.uf.viz.collaboration.comm.provider.session.PeerToPeerChat;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserSearch;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
@ -121,6 +125,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Apr 23, 2014 2822 bclement added resource name and getCollaborationVersion()
* May 09, 2014 3107 bclement added ability for packet timeout to be set via system properties
* May 19, 2014 3180 bclement added getJoinedVenueSessions()
* Jun 16, 2014 3288 bclement feed venue configuration changes
*
* </pre>
*
@ -137,6 +142,8 @@ public class CollaborationConnection implements IEventPublisher {
PacketConstants.COLLAB_XMLNS, new SessionPayloadProvider());
pm.addIQProvider(PacketConstants.QUERY_ELEMENT_NAME,
AuthInfo.AUTH_QUERY_XMLNS, new AuthInfoProvider());
pm.addIQProvider(PacketConstants.QUERY_ELEMENT_NAME,
FeedVenueConfig.FEED_QUERY_XMLNS, new FeedVenueConfigProvider());
/*
* smack doesn't support some of the OWNER operations such as getting
* all subscriptions on a node. PubSubOperations creates the request
@ -437,6 +444,7 @@ public class CollaborationConnection implements IEventPublisher {
}
connection = null;
}
FeedVenueConfigManager.reset();
PeerToPeerCommHelper.reset();
synchronized (CollaborationConnection.class) {
if (this == instance) {
@ -483,9 +491,9 @@ public class CollaborationConnection implements IEventPublisher {
SharedDisplayVenueInvite sdvInvite = (SharedDisplayVenueInvite) invitation
.getInvite();
String sessionId = invitation.getInvite().getSessionId();
String venueName = invitation.getRoomId().getName();
VenueId venueId = invitation.getRoomId();
SharedDisplaySession rval = new SharedDisplaySession(eventBus, this,
venueName, handle, sessionId);
venueId, handle, sessionId);
setupCollaborationVenue(rval, sdvInvite.getSessionLeader(),
sdvInvite.getDataProvider());
return rval;
@ -526,12 +534,12 @@ public class CollaborationConnection implements IEventPublisher {
* server. The session should be unregistered when no longer active using
* {@link CollaborationConnection#removeSession(ISession)}
*
* @param venueName
* @param venueId
* @param handle
* @return
*/
public VenueSession createTextOnlyVenue(String venueName, String handle) {
return createTextOnlyVenue(new CreateSessionData(venueName, handle));
public VenueSession createTextOnlyVenue(VenueId venueId, String handle) {
return createTextOnlyVenue(new CreateSessionData(venueId, handle));
}
/**
@ -551,14 +559,13 @@ public class CollaborationConnection implements IEventPublisher {
/**
* Check if venue exists on server
*
* @param subdomain
* @param venueName
* @return false on error
*/
public boolean venueExistsOnServer(String venueName) {
String roomId = VenueSession.getRoomId(connection.getServiceName(),
venueName);
public boolean venueExistsOnServer(String subdomain, String venueName) {
try {
return VenueSession.roomExistsOnServer(connection, roomId);
return VenueSession.roomExistsOnServer(subdomain, venueName);
} catch (XMPPException e) {
statusHandler.error("Unable to check for room on server", e);
return false;
@ -674,4 +681,5 @@ public class CollaborationConnection implements IEventPublisher {
protected static IUFStatusHandler getStatusHandler() {
return statusHandler;
}
}

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
/**
* Configuration used to create a new session
*
@ -32,6 +34,7 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
* Jan 30, 2014 2698 bclement moved to collaboration.comm project from collaboration.ui
* added handle
* Mar 10, 2014 2848 bclement added constructor with required fields
* Jun 16, 2014 3288 bclement changed String venueName to VenueId venueId
*
* </pre>
*
@ -39,7 +42,7 @@ package com.raytheon.uf.viz.collaboration.comm.provider.session;
* @version 1.0
*/
public class CreateSessionData {
private String name;
private VenueId venueId;
private String handle;
@ -54,13 +57,13 @@ public class CreateSessionData {
private String sessionId;
/**
* @param name
* name of session venue
* @param id
* id of session venue
* @param handle
* name user is known by in venue
*/
public CreateSessionData(String name, String handle) {
this.name = name;
public CreateSessionData(VenueId venueId, String handle) {
this.venueId = venueId;
this.handle = handle;
this.collaborationSession = false;
}
@ -73,12 +76,18 @@ public class CreateSessionData {
this.sessionId = sessionId;
}
public String getName() {
return name;
/**
* @return
*/
public VenueId getVenueId() {
return venueId;
}
public void setName(String name) {
this.name = name;
/**
* @param venueId
*/
public void setVenueId(VenueId venueId) {
this.venueId = venueId;
}
/**

View file

@ -0,0 +1,120 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.comm.provider.session;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.SyncPacketSend;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.xmpp.BaseProvider;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfig;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfig.VenueType;
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
/**
* Utility responsible for retrieving feed venue configuration from XMPP server
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 16, 2014 3288 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class FeedVenueConfigManager {
private static final IUFStatusHandler log = UFStatus
.getHandler(FeedVenueConfigManager.class);
private static FeedVenueConfig feedVenueConfig = null;
private static final String FEED_VENUE_FALLBACK_SUBDOMAIN = "conference";
private static final String FEED_VENUE_FALLBACK_NAME = "nws-collaboration";
private static final VenueType FEED_VENUE_FALLBACK_TYPE = VenueType.SINGLE;
/**
* Get feed venue configuration from server. Results from server are cached.
*
* @return defaults if configuration cannot be retrieved from server
*/
public static synchronized FeedVenueConfig getConfig(){
FeedVenueConfig rval;
if ( feedVenueConfig == null){
XMPPConnection conn = CollaborationConnection.getConnection()
.getXmppConnection();
rval = new FeedVenueConfig(FEED_VENUE_FALLBACK_SUBDOMAIN,
FEED_VENUE_FALLBACK_NAME, FEED_VENUE_FALLBACK_TYPE);
if (canQueryForConfig(conn)) {
IQ query = FeedVenueConfig.createGet();
try {
Packet reply = SyncPacketSend.getReply(conn, query);
if (reply instanceof FeedVenueConfig) {
rval = feedVenueConfig = (FeedVenueConfig) reply;
} else {
log.error("Unexpected feed venue config return type: "
+ reply.getClass());
}
} catch (XMPPException e) {
log.error("Problem querying for feed venue configuration",
e);
}
}
} else {
rval = feedVenueConfig;
}
return rval;
}
/**
* @param conn
* @return true if server returns that it supports feed venue configuration
*/
private static boolean canQueryForConfig(XMPPConnection conn) {
boolean rval = false;
try {
rval = BaseProvider.serverSupportsFeature(conn,
FeedVenueConfig.FEED_QUERY_XMLNS);
} catch (XMPPException e) {
log.error("Unable to determine if server supports "
+ "feed venue configuration queries", e);
}
return rval;
}
/**
* reset internal state
*/
public static synchronized void reset() {
feedVenueConfig = null;
}
}

View file

@ -71,6 +71,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.LeaderChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
@ -105,6 +106,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Apr 29, 2014 3061 bclement added createInviteMessage()
* May 09, 2014 3107 bclement default to trust transfer event when verify errors out
* May 14, 2014 3061 bclement added better checks for when to send invite/session payloads
* Jun 16, 2014 3288 bclement feed venue configuration changes
*
* </pre>
*
@ -133,9 +135,9 @@ public class SharedDisplaySession extends VenueSession implements
private boolean closed = false;
public SharedDisplaySession(EventBus externalBus,
CollaborationConnection manager, String venueName, String handle,
CollaborationConnection manager, VenueId venueId, String handle,
String sessionId) {
super(externalBus, manager, venueName, handle, sessionId);
super(externalBus, manager, venueId, handle, sessionId);
init();
}

View file

@ -61,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueUserEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
/**
@ -111,6 +112,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* Apr 23, 2014 2822 bclement added formatInviteAddress()
* Apr 29, 2014 3061 bclement moved invite payload to shared display session
* May 09, 2014 3107 bclement removed catch from isRoomOwner() so callers know about errors
* Jun 16, 2014 3288 bclement changed String venueName to VenueId venueId, added createVenueId()
*
*
* </pre>
@ -142,7 +144,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
private volatile boolean admin = false;
private String venueName;
private VenueId venueId;
private volatile boolean otherParticipants = false;
@ -152,9 +154,9 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param eventBus
*/
public VenueSession(EventBus externalBus, CollaborationConnection manager,
String venueName, String handle, String sessionId) {
VenueId venueId, String handle, String sessionId) {
super(externalBus, manager, sessionId);
this.venueName = venueName;
this.venueId = venueId;
this.handle = handle;
}
@ -166,7 +168,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
public VenueSession(EventBus externalBus, CollaborationConnection manager,
CreateSessionData data) {
super(externalBus, manager);
this.venueName = data.getName();
this.venueId = data.getVenueId();
this.handle = data.getHandle();
}
@ -313,34 +315,12 @@ public class VenueSession extends BaseSession implements IVenueSession {
*/
CollaborationConnection manager = getSessionManager();
XMPPConnection conn = manager.getXmppConnection();
String roomId = getRoomId(conn.getServiceName(), venueName);
this.muc = new MultiUserChat(conn, roomId);
this.muc = new MultiUserChat(conn, venueId.getFQName());
this.venue = new Venue(conn, muc);
createListeners();
setHandle(manager, handle);
}
/**
* Construct room id from name and host
*
* @param host
* @param roomName
* @return
*/
public static String getRoomId(String host, String roomName) {
return roomName + "@" + getQualifiedHost(host);
}
/**
* Prepend conference subdomain on host
*
* @param host
* @return
*/
public static String getQualifiedHost(String host) {
return "conference." + host;
}
/**
* Create room and connect to it
*
@ -352,7 +332,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
try {
CollaborationConnection manager = getSessionManager();
XMPPConnection conn = manager.getXmppConnection();
String roomId = getRoomId(conn.getServiceName(), data.getName());
String roomId = venueId.getFQName();
if (roomExistsOnServer(conn, roomId)) {
throw new CollaborationException("Session name already in use");
}
@ -360,7 +340,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
createListeners();
setHandle(manager, data.getHandle());
muc.create(this.handle);
muc.sendConfigurationForm(getRoomConfig(data.getName()));
muc.sendConfigurationForm(getRoomConfig());
muc.changeSubject(data.getSubject());
this.venue = new Venue(conn, muc);
sendPresence(CollaborationConnection.getConnection().getPresence());
@ -378,7 +358,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
msg = xmppError.getCondition();
}
} else {
msg = "Error creating venue " + data.getName();
msg = "Error creating venue " + data.getVenueId();
}
closeMuc();
throw new CollaborationException(msg, e);
@ -403,11 +383,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
/**
* Get filled out configuration form for room creation
*
* @param roomName
* @return
* @throws CollaborationException
*/
protected Form getRoomConfig(String roomName) throws CollaborationException {
protected Form getRoomConfig() throws CollaborationException {
Form form;
try {
form = muc.getConfigurationForm();
@ -425,8 +404,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
submitForm.setDefaultAnswer(field.getVariable());
}
}
submitForm.setAnswer("muc#roomconfig_roomname", roomName);
submitForm.setAnswer("muc#roomconfig_roomdesc", roomName);
submitForm.setAnswer("muc#roomconfig_roomname", venueId.getName());
submitForm.setAnswer("muc#roomconfig_roomdesc", venueId.getName());
submitForm.setAnswer("muc#roomconfig_publicroom", false);
submitForm.setAnswer("muc#roomconfig_membersonly", true);
submitForm.setAnswer("muc#roomconfig_allowinvites", true);
@ -440,11 +419,12 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @return true if room exists on server
* @throws XMPPException
*/
public static boolean roomExistsOnServer(String roomName)
public static boolean roomExistsOnServer(String subdomain, String roomName)
throws XMPPException {
CollaborationConnection conn = CollaborationConnection.getConnection();
XMPPConnection xmpp = conn.getXmppConnection();
String id = getRoomId(xmpp.getServiceName(), roomName);
String id = new VenueId(subdomain, xmpp.getServiceName(), roomName)
.getFQName();
return roomExistsOnServer(conn.getXmppConnection(), id);
}
@ -858,10 +838,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
message.setBody(moddedBody);
TextMessage msg = new TextMessage(message.getFrom(),
message.getBody());
UserId account = CollaborationConnection.getConnection()
.getUser();
msg.setFrom(new VenueParticipant(this.getVenueName(),
getQualifiedHost(account.getHost()), msgHandle));
venueId.getHost(), msgHandle));
msg.setTimeStamp(time);
msg.setSubject(site);
msg.setStatus(SEND_HISTORY);
@ -939,8 +917,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
@Override
public VenueParticipant getUserID() {
UserId account = getAccount();
return new VenueParticipant(this.getVenueName(),
getQualifiedHost(account.getHost()), handle, account);
return new VenueParticipant(this.getVenueName(), venueId.getHost(),
handle, account);
}
/**
@ -998,7 +976,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
*/
@Override
public String getVenueName() {
return venueName;
return venueId.getName();
}
/*
@ -1011,4 +989,19 @@ public class VenueSession extends BaseSession implements IVenueSession {
public boolean hasOtherParticipants() {
return otherParticipants;
}
/**
* Create a venue ID with the default subdomain on the currently connected
* server
*
* @param venueName
* @return
*/
public static VenueId createVenueId(String venueName) {
CollaborationConnection conn = CollaborationConnection.getConnection();
XMPPConnection xmpp = conn.getXmppConnection();
return new VenueId(VenueId.DEFAULT_SUBDOMAIN, xmpp.getServiceName(),
venueName);
}
}

View file

@ -34,6 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
* Mar 29, 2012 jkorman Initial creation
* Feb 13, 2014 2751 bclement removed resource, fixed getFQN
* May 19, 2014 3180 bclement added isSameVenue() fromString() and hashcode/equals
* Jun 16, 2014 3288 bclement added constructors, default subdomain
*
* </pre>
*
@ -43,10 +44,39 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
public class VenueId implements IQualifiedID {
public static final String DEFAULT_SUBDOMAIN = "conference";
private String host;
private String name;
/**
*
*/
public VenueId() {
}
/**
* @param host
* @param name
*/
public VenueId(String host, String name) {
this.host = host;
this.name = name;
}
/**
* subdomain and domain are combined to create the host
*
* @param subdomain
* @param domain
* @param name
*/
public VenueId(String subdomain, String domain, String name) {
this.host = subdomain + "." + domain;
this.name = name;
}
/**
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHost(java.lang.String)
*/

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Collaboration UI Plugin
Bundle-SymbolicName: com.raytheon.uf.viz.collaboration.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.14.0
Bundle-Activator: com.raytheon.uf.viz.collaboration.ui.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
@ -19,4 +19,5 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.core;bundle-version="1.12.1174",
org.jivesoftware.smack;bundle-version="3.3.0"
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.viz.core.maps.display
Import-Package: com.raytheon.uf.common.xmpp.iq,
com.raytheon.uf.viz.core.maps.display

View file

@ -61,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.connection.PeerToPeerComm
import com.raytheon.uf.viz.collaboration.comm.provider.session.CreateSessionData;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.ISharedEditorsManagerListener;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
@ -95,6 +96,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Mar 06, 2014 2848 bclement moved session creation logic to separate method
* Apr 16, 2014 3021 bclement increased width of dialog
* Apr 22, 2014 3056 bclement made room name lowercase to match xmpp server
* Jun 16, 2014 3288 bclement added call to get full venue ID for chosen name
*
* </pre>
*
@ -471,8 +473,9 @@ public class CreateSessionDialog extends CaveSWTDialog {
}
if (focusField == null) {
CreateSessionData result = new CreateSessionData(name,
handle);
VenueId venueId = VenueSession.createVenueId(name);
CreateSessionData result = new CreateSessionData(
venueId, handle);
result.setSubject(subject);
result.setCollaborationSessioh(sharedSessionDisplay
.getSelection());
@ -574,7 +577,8 @@ public class CreateSessionDialog extends CaveSWTDialog {
err = "Session name contains invalid characters.";
} else {
try {
if (VenueSession.roomExistsOnServer(name)) {
if (VenueSession.roomExistsOnServer(VenueId.DEFAULT_SUBDOMAIN,
name)) {
err = "Session already exists. Pick a different name.";
}
} catch (XMPPException e) {

View file

@ -68,6 +68,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
* Mar 06, 2014 2848 bclement moved join logic to separate method
* Mar 27, 2014 2632 mpduff Set the OK button as the default button.
* Apr 18, 2014 2955 mpduff Make dialog non-modal.
* Jun 16, 2014 3288 bclement pass along venueId instead of just the name
*
* </pre>
*
@ -299,7 +300,7 @@ public class InviteDialog extends CaveSWTDialogBase {
*/
public void join(IVenueInvitationEvent invitation, String handle)
throws CollaborationException {
String venueName = invitation.getRoomId().getName();
VenueId venueId = invitation.getRoomId();
CollaborationConnection connection = CollaborationConnection
.getConnection();
// create session object
@ -314,7 +315,7 @@ public class InviteDialog extends CaveSWTDialogBase {
SharedDisplayRole.PARTICIPANT);
session = displaySession;
} else {
session = connection.createTextOnlyVenue(venueName, handle);
session = connection.createTextOnlyVenue(venueId, handle);
}
try {
// join session

View file

@ -33,15 +33,19 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.jivesoftware.smack.XMPPConnection;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfig;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.session.FeedVenueConfigManager;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil;
import com.raytheon.uf.viz.collaboration.ui.session.SessionFeedView;
@ -66,6 +70,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
* Mar 06, 2014 2848 bclement removed CollaborationConnection.joinTextOnlyVenue()
* Apr 10, 2014 2937 bgonzale Connect to the venue after the feed view is available
* to display messages.
* Jun 16, 2014 3288 bclement feed venue configuration changes
*
* </pre>
*
@ -78,9 +83,6 @@ public class DisplayFeedAction extends Action {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DisplayFeedAction.class);
// TODO make this configurable?
public static final String FEED_VENUE = "nws-collaboration";
public DisplayFeedAction() {
super("Display Feed", SWT.TOGGLE);
setImageDescriptor(IconUtil.getImageDescriptor(Activator.getDefault()
@ -108,8 +110,9 @@ public class DisplayFeedAction extends Action {
String sessionId = null;
for (ISession session : connection.getSessions()) {
if (session instanceof IVenueSession) {
if (((IVenueSession) session).getVenueName()
.equalsIgnoreCase(FEED_VENUE)) {
FeedVenueConfig config = FeedVenueConfigManager.getConfig();
if (((IVenueSession) session).getVenueName().equalsIgnoreCase(
config.getName())) {
sessionId = session.getSessionId();
}
}
@ -128,7 +131,9 @@ public class DisplayFeedAction extends Action {
CollaborationConnection connection = CollaborationConnection
.getConnection();
String defaultHandle = HandleUtil.getDefaultHandle();
VenueSession session = connection.createTextOnlyVenue(FEED_VENUE,
FeedVenueConfig config = FeedVenueConfigManager.getConfig();
VenueId venueId = createVenueId(config);
VenueSession session = connection.createTextOnlyVenue(venueId,
defaultHandle);
try {
session.configureVenue();
@ -150,13 +155,29 @@ public class DisplayFeedAction extends Action {
}
}
/**
* Create venue ID using configuration and the server name of the XMPP
* server currently connected
*
* @param config
* @return
*/
private static VenueId createVenueId(FeedVenueConfig config) {
CollaborationConnection conn = CollaborationConnection.getConnection();
XMPPConnection xmpp = conn.getXmppConnection();
return new VenueId(config.getSubdomain(), xmpp.getServiceName(),
config.getName());
}
@Override
public void run() {
CollaborationConnection connection = CollaborationConnection
.getConnection();
if (!connection.venueExistsOnServer(FEED_VENUE)) {
FeedVenueConfig config = FeedVenueConfigManager.getConfig();
if (!connection.venueExistsOnServer(config.getSubdomain(),
config.getName())) {
statusHandler.info("Feed venue doesn't exist on server: "
+ FEED_VENUE);
+ config.getName());
setChecked(false);
return;
}

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.common.xmpp.iq;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import com.raytheon.uf.common.xmpp.PacketConstants;
import com.raytheon.uf.common.xmpp.XmlBuilder;
import com.raytheon.uf.common.xmpp.XmlBuilder.Pair;
/**
* Info Query packet for feed venue configuration
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 16, 2014 3288 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class FeedVenueConfig extends IQ {
public static enum VenueType {
/* SINGLE is a normal room, AGGREGATE is multiple rooms viewed as one */
SINGLE, AGGREGATE;
}
public static final String FEED_QUERY_XMLNS = "urn:uf:viz:collaboration:iq:feed";
public static final String FEED_VENUE_SUBDOMAIN_ATTRIBUTE = "subdomain";
public static final String FEED_VENUE_NAME_ATTRIBUTE = "name";
public static final String FEED_VENUE_TYPE_ATTRIBUTE = "type";
private String subdomain;
private String name;
private VenueType venueType;
/**
*
*/
public FeedVenueConfig() {
}
/**
* @param iq
*/
public FeedVenueConfig(IQ iq) {
super(iq);
}
/**
* Create a query packet
*
* @return
*/
public static FeedVenueConfig createGet() {
FeedVenueConfig rval = new FeedVenueConfig();
rval.setType(Type.GET);
return rval;
}
/**
* @param subdomain
* @param name
* @param type
*/
public FeedVenueConfig(String subdomain, String name, VenueType type) {
this.subdomain = subdomain;
this.name = name;
this.venueType = type;
}
/*
* (non-Javadoc)
*
* @see org.jivesoftware.smack.packet.IQ#getChildElementXML()
*/
@Override
public String getChildElementXML() {
XmlBuilder builder = new XmlBuilder();
List<Pair> attributes = new ArrayList<XmlBuilder.Pair>(3);
addAttributeIfPresent(attributes, FEED_VENUE_SUBDOMAIN_ATTRIBUTE, name);
addAttributeIfPresent(attributes, FEED_VENUE_SUBDOMAIN_ATTRIBUTE,
subdomain);
addAttributeIfPresent(attributes, FEED_VENUE_TYPE_ATTRIBUTE, venueType);
builder.appendTag(PacketConstants.QUERY_ELEMENT_NAME, FEED_QUERY_XMLNS,
attributes, true);
return builder.toXml();
}
/**
* Add a new pair object to list if value is non-null. Attribute value will
* be the object's toString() value
*
* @param attributes
* @param attributeName
* @param valueObject
*/
private static void addAttributeIfPresent(List<Pair> attributes,
String attributeName, Object valueObject) {
if (valueObject != null) {
attributes.add(new Pair(attributeName, valueObject.toString()));
}
}
/**
* @return the subdomain
*/
public String getSubdomain() {
return subdomain;
}
/**
* @param subdomain
* the subdomain to set
*/
public void setSubdomain(String subdomain) {
this.subdomain = subdomain;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the venueType
*/
public VenueType getVenueType() {
return venueType;
}
/**
* @param venueType
* the venueType to set
*/
public void setVenueType(VenueType venueType) {
this.venueType = venueType;
}
}

View file

@ -0,0 +1,105 @@
/**
* 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.common.xmpp.iq;
import java.io.IOException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import com.raytheon.uf.common.xmpp.BaseProvider;
import com.raytheon.uf.common.xmpp.PacketConstants;
import com.raytheon.uf.common.xmpp.iq.FeedVenueConfig.VenueType;
/**
* Info Query parsing support for feed venue configuration packets
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 16, 2014 3288 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class FeedVenueConfigProvider extends BaseProvider<FeedVenueConfig>
implements IQProvider {
/**
*/
public FeedVenueConfigProvider() {
super(PacketConstants.QUERY_ELEMENT_NAME);
}
/*
* (non-Javadoc)
*
* @see org.jivesoftware.smack.provider.IQProvider#parseIQ(org.xmlpull.v1.
* XmlPullParser)
*/
@Override
public IQ parseIQ(XmlPullParser parser) throws Exception {
String subdomain = null;
String name = null;
VenueType type = null;
do {
String tagName = parser.getName();
switch (parser.getEventType()) {
case XmlPullParser.START_TAG:
if (PacketConstants.QUERY_ELEMENT_NAME.equals(tagName)) {
subdomain = parser.getAttributeValue(null,
FeedVenueConfig.FEED_VENUE_SUBDOMAIN_ATTRIBUTE);
name = parser.getAttributeValue(null,
FeedVenueConfig.FEED_VENUE_NAME_ATTRIBUTE);
String typeStr = parser.getAttributeValue(null,
FeedVenueConfig.FEED_VENUE_TYPE_ATTRIBUTE);
if (typeStr != null && !typeStr.trim().isEmpty()) {
type = VenueType.valueOf(typeStr.trim().toUpperCase());
}
}
break;
}
parser.next();
} while (!atEndOfPacket(parser));
return new FeedVenueConfig(subdomain, name, type);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.xmpp.BaseProvider#parseInternal(org.xmlpull.v1
* .XmlPullParser)
*/
@Override
protected FeedVenueConfig parseInternal(XmlPullParser parser)
throws XmlPullParserException, IOException {
return super.parse(parser);
}
}

View file

@ -46,6 +46,7 @@ import com.raytheon.openfire.plugin.configuration.collaboration.configuration.Co
import com.raytheon.openfire.plugin.configuration.collaboration.http.HttpStatusMonitor;
import com.raytheon.openfire.plugin.configuration.collaboration.iq.AbstractConfigHandler;
import com.raytheon.openfire.plugin.configuration.collaboration.iq.DataAuthHandler;
import com.raytheon.openfire.plugin.configuration.collaboration.iq.FeedVenueConfigHandler;
import com.raytheon.openfire.plugin.configuration.collaboration.iq.HttpAddressHandler;
import com.raytheon.openfire.plugin.configuration.collaboration.iq.SecurityToggleHandler;
import com.raytheon.openfire.plugin.configuration.collaboration.listener.CollaborationSessionEventListener;
@ -66,6 +67,7 @@ import com.raytheon.openfire.plugin.configuration.collaboration.listener.Collabo
* Feb 14, 2013 2756 bclement rename and refactor for operation with generic http
* server configured over XMPP
* Mar 04, 2014 2756 bclement added dataserver security toggle update to setLegacySupport
* Jun 16, 2014 3288 bclement feed venue configuration handler
*
* </pre>
*
@ -153,8 +155,9 @@ public class HttpConfigurationPlugin implements Plugin {
DataAuthHandler authHandler = new DataAuthHandler();
HttpAddressHandler addressHandler = new HttpAddressHandler();
SecurityToggleHandler secTogHandler = new SecurityToggleHandler();
registerConfigHandlers(server,
Arrays.asList(authHandler, addressHandler, secTogHandler));
FeedVenueConfigHandler feedConfigHandler = new FeedVenueConfigHandler();
registerConfigHandlers(server, Arrays.asList(authHandler,
addressHandler, secTogHandler, feedConfigHandler));
/* Retrieve openfire components. */
serverId = new JID(server.getServerInfo().getXMPPDomain());

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.openfire.plugin.configuration.collaboration.iq;
import java.util.Arrays;
import org.dom4j.Element;
import org.dom4j.tree.DefaultAttribute;
import org.jivesoftware.openfire.IQHandlerInfo;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.muc.MUCRoom;
import org.jivesoftware.openfire.muc.MultiUserChatManager;
import org.jivesoftware.openfire.muc.MultiUserChatService;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.IQ;
/**
* Handler for feed venue configuration queries
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 16, 2014 3288 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class FeedVenueConfigHandler extends AbstractConfigHandler {
private static final Logger log = LoggerFactory
.getLogger(FeedVenueConfigHandler.class);
public static enum VenueType {
/* SINGLE is a normal room, AGGREGATE is multiple rooms viewed as one */
SINGLE, AGGREGATE;
}
/* XML constants */
public static final String FEED_QUERY_XMLNS = "urn:uf:viz:collaboration:iq:feed";
public static final String FEED_VENUE_SUBDOMAIN_ATTRIBUTE = "subdomain";
public static final String FEED_VENUE_NAME_ATTRIBUTE = "name";
public static final String FEED_VENUE_TYPE_ATTRIBUTE = "type";
/* config storage constants */
public static final String FEED_VENUE_SUBDOMAIN_KEY = "plugin.collaboration.feed.venue.subdomain";
public static final String FEED_VENUE_SUBDOMAIN_DEFAULT = "conference";
public static final String FEED_VENUE_NAME_KEY = "plugin.collaboration.feed.venue.name";
public static final String FEED_VENUE_NAME_DEFAULT = "nws-collaboration";
public static final String FEED_VENUE_TYPE_KEY = "plugin.collaboration.feed.venue.type";
public static final VenueType FEED_VENUE_TYPE_DEFAULT = VenueType.SINGLE;
/**
*
*/
public FeedVenueConfigHandler() {
super("Collaboration Dataserver Feed Venue Configuration Handler",
Arrays.asList(FEED_QUERY_XMLNS), new IQHandlerInfo(
QUERY_ELEMENT_NAME, FEED_QUERY_XMLNS));
}
/* (non-Javadoc)
* @see com.raytheon.openfire.plugin.configuration.collaboration.iq.AbstractConfigHandler#handleGet(org.xmpp.packet.IQ)
*/
@Override
protected IQ handleGet(IQ packet) throws UnauthorizedException {
String subdomain = getFeedVenueSubdomain();
String name = getFeedVenueName();
/* always default until we implement aggregate */
VenueType type = FEED_VENUE_TYPE_DEFAULT;
Element query = packet.getChildElement();
query.setParent(null);
query.add(new DefaultAttribute(FEED_VENUE_SUBDOMAIN_ATTRIBUTE,
subdomain));
query.add(new DefaultAttribute(FEED_VENUE_NAME_ATTRIBUTE, name));
query.add(new DefaultAttribute(FEED_VENUE_TYPE_ATTRIBUTE, type
.toString()));
IQ rval = IQ.createResultIQ(packet);
rval.setChildElement(query);
return rval;
}
/* (non-Javadoc)
* @see com.raytheon.openfire.plugin.configuration.collaboration.iq.AbstractConfigHandler#handleSet(org.xmpp.packet.IQ)
*/
@Override
protected IQ handleSet(IQ packet) throws UnauthorizedException {
log.debug("Received unsupported packet type: " + packet.getType());
throw new UnauthorizedException(
"Feed Venue configuration can only be queried");
}
/**
* @param subdomain
* @param name
* @return false if subdomain or name do not exist on server
*/
public static boolean setFeedVenueConfig(String subdomain, String name) {
XMPPServer server = XMPPServer.getInstance();
MultiUserChatManager mucManager = server.getMultiUserChatManager();
MultiUserChatService service = mucManager
.getMultiUserChatService(subdomain);
boolean rval = false;
if (service != null) {
MUCRoom chatRoom = service.getChatRoom(name);
if (chatRoom != null) {
JiveGlobals.setProperty(FEED_VENUE_SUBDOMAIN_KEY, subdomain);
JiveGlobals.setProperty(FEED_VENUE_NAME_KEY, name);
rval = true;
}
}
return rval;
}
/**
* @return
*/
public static String getFeedVenueSubdomain() {
return JiveGlobals.getProperty(FEED_VENUE_SUBDOMAIN_KEY,
FEED_VENUE_SUBDOMAIN_DEFAULT);
}
/**
* @return
*/
public static String getFeedVenueName() {
return JiveGlobals.getProperty(FEED_VENUE_NAME_KEY,
FEED_VENUE_NAME_DEFAULT);
}
}

View file

@ -19,6 +19,11 @@
url="http-collaboration-monitor-admin.jsp"
description="Click to administer settings for the Http Collaboration Monitor." />
</sidebar>
<sidebar id="sidebar-server-settings">
<id item="feed-venue-admin" name="Feed Venue Settings"
url="feed-venue-admin.jsp"
description="Click to administer settings for the Collaboration Feed Venue." />
</sidebar>
</tab>
</adminconsole>
</plugin>

View file

@ -0,0 +1,121 @@
<%@ page
import="org.jivesoftware.openfire.XMPPServer,
com.raytheon.openfire.plugin.configuration.collaboration.iq.FeedVenueConfigHandler,
org.jivesoftware.util.ParamUtils,
java.util.HashMap,
java.util.Map"
errorPage="error.jsp"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%!
public static String getSafeParam(HttpServletRequest request, String name){
String rval = ParamUtils.getParameter(request, name, true);
return rval != null ? rval : "";
}
%>
<%
boolean save = ((request.getParameter("save") == null) == false);
String feedVenueName = getSafeParam(request, "feedVenueName");
String feedVenueSubdomain = getSafeParam(request, "feedVenueSubdomain");
/* feeVenueType will be added when aggregate rooms are implemented */
if (save)
{
boolean success = FeedVenueConfigHandler.setFeedVenueConfig(feedVenueSubdomain, feedVenueName);
response.sendRedirect("feed-venue-admin.jsp?settingsSaved=" + success);
return;
}
feedVenueName = FeedVenueConfigHandler.getFeedVenueName();
feedVenueSubdomain = FeedVenueConfigHandler.getFeedVenueSubdomain();
%>
<html>
<head>
<title>Collaboration Feed Venue Settings</title>
<meta name="pageID" content="feed-venue-admin" />
</head>
<body>
<form name="collabPrefForm" action="feed-venue-admin.jsp?save" method="post" onsubmit="return validTest();" >
<div class="jive-contentBoxHeader">
Collaboration Feed Venue Settings
</div>
<div class="jive-contextBox">
<% if (ParamUtils.getBooleanParameter(request, "settingsSaved")) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Settings Saved Successfully!</td>
</tr>
</tbody>
</table>
</div>
<% }else if (ParamUtils.getParameter(request, "settingsSaved") != null){ %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Invalid configuration settings, check that subdomain and room exist on server</td>
</tr>
</tbody>
</table>
</div>
<% } %>
<p>
Set Multi-User Chat Subdomain for Feed Venue chatroom
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="5%" valign="top">Subdomain:&nbsp;</td>
<td width="95%">
<input type="text" id="feedVenueSubdomain" name="feedVenueSubdomain"
value="<%= feedVenueSubdomain %>">
</td>
</tr>
</tbody>
</table>
</br></br></br>
<p>
Set Feed Venue chatroom name
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="5%" valign="top">Room Name:&nbsp;</td>
<td width="95%">
<input type="text" id="feedVenueName" name="feedVenueName"
value="<%= feedVenueName %>">
</td>
</tr>
</tbody>
</table>
</div>
<input id="btnSubmit" type="submit" value="Save Settings" />
</form>
</body>
</html>