Issue #2295 - CAVE updates for ALR
- Amend: relocated qpid connection string comment - Amend: replaced stacktrace printing with UFStatus - Amend: removed unused code - Amend: ThinClientNoficationManagerJob JavaDoc Change-Id: I091aa29700378149e8eb09dcd11cdfc020e96c76 Former-commit-id:4e4405b0f5
[formerly 5a76eabc142619df4c8454c3f2fe93f5283346db] Former-commit-id:aa8691edfd
This commit is contained in:
parent
60c544c7a9
commit
4342c463b2
10 changed files with 86 additions and 90 deletions
|
@ -50,6 +50,8 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* 7/1/06 chammack Initial Creation.
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
|
||||
* jms connection string
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,16 +72,10 @@ public final class VizApp {
|
|||
|
||||
private static String httpServer;
|
||||
|
||||
private static String jmsServer;
|
||||
private static String jmsConnectionString;
|
||||
|
||||
private static String pypiesServer;
|
||||
|
||||
private static String dataDeliveryServer;
|
||||
|
||||
private static String dataDeliveryLcmServer;
|
||||
|
||||
private static String dataDeliveryQueryServer;
|
||||
|
||||
static {
|
||||
ManagementFactory.getRuntimeMXBean().getName();
|
||||
}
|
||||
|
@ -240,12 +236,12 @@ public final class VizApp {
|
|||
VizApp.httpServer = System.getProperty("awips.httpServer", httpServer);
|
||||
}
|
||||
|
||||
public static String getJmsServer() {
|
||||
return jmsServer;
|
||||
public static String getJmsConnectionString() {
|
||||
return jmsConnectionString;
|
||||
}
|
||||
|
||||
public static void setJmsServer(String jmsServer) {
|
||||
VizApp.jmsServer = jmsServer;
|
||||
public static void setJmsConnectionString(String jmsConnectionString) {
|
||||
VizApp.jmsConnectionString = jmsConnectionString;
|
||||
}
|
||||
|
||||
public static String getPypiesServer() {
|
||||
|
|
|
@ -20,14 +20,13 @@
|
|||
|
||||
package com.raytheon.uf.viz.core.comm;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
|
||||
import org.apache.qpid.client.AMQConnectionFactory;
|
||||
import org.apache.qpid.url.URLSyntaxException;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
/**
|
||||
|
@ -43,16 +42,23 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
* Nov 2, 2011 #7391 bkowal Ensure that the generated WsId is properly formatted to be
|
||||
* included in a url.
|
||||
* May 09, 2013 1814 rjpeter Updated prefetch to 10.
|
||||
* Aug 27, 2013 2295 bkowal The entire connection string is now provided by EDEX; so, it
|
||||
* no longer needs to be constructed. Replaced stacktrace
|
||||
* printing with UFStatus.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JMSConnection {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(JMSConnection.class);
|
||||
|
||||
private static final String WSID_PLACEHOLDER = "__WSID__";
|
||||
|
||||
private static JMSConnection instance;
|
||||
|
||||
private final String jndiProviderUrl;
|
||||
private final String connectionUrl;
|
||||
|
||||
private AMQConnectionFactory factory;
|
||||
|
||||
|
@ -65,38 +71,27 @@ public class JMSConnection {
|
|||
}
|
||||
|
||||
public JMSConnection() {
|
||||
this(VizApp.getJmsServer());
|
||||
this(VizApp.getJmsConnectionString());
|
||||
}
|
||||
|
||||
public JMSConnection(String jndiProviderUrl) {
|
||||
this.jndiProviderUrl = jndiProviderUrl;
|
||||
public JMSConnection(String connectionUrl) {
|
||||
this.connectionUrl = connectionUrl;
|
||||
try {
|
||||
// do not enable retry/connectdelay connection and factory will
|
||||
// silently reconnect and user will never be notified qpid is down
|
||||
// and cave/text workstation will just act like they are hung
|
||||
// up to each individual component that opens a connection to handle
|
||||
// reconnect
|
||||
this.factory = new AMQConnectionFactory(
|
||||
"amqp://guest:guest@"
|
||||
+ URLEncoder.encode(VizApp.getWsId().toString(),
|
||||
"UTF-8")
|
||||
+ "/edex?brokerlist='"
|
||||
+ this.jndiProviderUrl
|
||||
+ "?connecttimeout='5000'&heartbeat='0''&maxprefetch='10'&sync_publish='all'&failover='nofailover'");
|
||||
} catch (URLSyntaxException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
String wsid = URLEncoder.encode(VizApp.getWsId().toString(),
|
||||
"UTF-8");
|
||||
this.factory = new AMQConnectionFactory(this.connectionUrl.replace(
|
||||
WSID_PLACEHOLDER, wsid));
|
||||
} catch (Exception e) {
|
||||
statusHandler.fatal("Failed to connect to the JMS Server!", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jndiProviderUrl
|
||||
*
|
||||
* @return the jms connection url
|
||||
*/
|
||||
public String getJndiProviderUrl() {
|
||||
return jndiProviderUrl;
|
||||
public String getConnectionUrl() {
|
||||
return connectionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
* Nov 5, 2009 mschenke Initial creation
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -125,7 +127,7 @@ public class LocalizationInitializer {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setHttpServer(resp.getHttpServer());
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
VizApp.setPypiesServer(resp.getPypiesServer());
|
||||
VizServers.getInstance().setServerLocations(resp.getServerLocations());
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
* May 19, 2007 #1127 randerso Implemented error handling
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -147,8 +149,8 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
this.overrideServer = false;
|
||||
this.overrideSite = false;
|
||||
try {
|
||||
localizationStore = new ScopedPreferenceStore(new InstanceScope(),
|
||||
"localization");
|
||||
localizationStore = new ScopedPreferenceStore(
|
||||
InstanceScope.INSTANCE, "localization");
|
||||
localizationStore.addPropertyChangeListener(this);
|
||||
loadHttpServer();
|
||||
loadAlertServer();
|
||||
|
@ -222,7 +224,7 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setHttpServer(resp.getHttpServer());
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
VizApp.setPypiesServer(resp.getPypiesServer());
|
||||
VizServers.getInstance().setServerLocations(
|
||||
resp.getServerLocations());
|
||||
|
@ -910,40 +912,6 @@ public class LocalizationManager implements IPropertyChangeListener {
|
|||
return responses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request to the UtilitySrv
|
||||
*
|
||||
* @param request
|
||||
* the request to make
|
||||
* @return the responses from the request
|
||||
* @throws VizException
|
||||
*/
|
||||
private AbstractUtilityResponse[] makeRequest(
|
||||
PrivilegedUtilityRequestMessage request)
|
||||
throws LocalizationOpFailedException {
|
||||
|
||||
AbstractUtilityResponse[] responseList = null;
|
||||
|
||||
UtilityResponseMessage localizationResponse = null;
|
||||
try {
|
||||
localizationResponse = (UtilityResponseMessage) ThriftClient
|
||||
.sendLocalizationRequest(request);
|
||||
} catch (VizException e) {
|
||||
throw new LocalizationOpFailedException("Localization error", e);
|
||||
}
|
||||
if (localizationResponse != null) {
|
||||
responseList = localizationResponse.getResponses();
|
||||
|
||||
for (AbstractUtilityResponse response : responseList) {
|
||||
if (!response.successful()) {
|
||||
throw new LocalizationOpFailedException(
|
||||
response.getFormattedErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return responseList;
|
||||
}
|
||||
|
||||
public boolean isOverrideServer() {
|
||||
return overrideServer;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,9 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Listens to changes to the "Disable JMS" option in the Thin Client
|
||||
* Preferences. Will automatically connect to and disconnect from the
|
||||
* JMS Server as the option is updated.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -44,6 +46,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 29, 2011 bsteffen Initial creation
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
|
||||
* provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -96,13 +100,14 @@ public class ThinClientNotificationManagerJob extends NotificationManagerJob
|
|||
if (disableJMS) {
|
||||
disconnect(true);
|
||||
} else {
|
||||
if (VizApp.getJmsServer() == null) {
|
||||
if (VizApp.getJmsConnectionString() == null) {
|
||||
GetServersRequest req = new GetServersRequest();
|
||||
GetServersResponse resp;
|
||||
try {
|
||||
resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp
|
||||
.getJmsConnectionString());
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -48,8 +48,10 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 23, 2011 bsteffen Initial creation
|
||||
* Dec 06, 2012 1396 njensen Added setting VizServers
|
||||
* Dec 06, 2012 1396 njensen Added setting VizServers
|
||||
* Jan 14, 2013 1469 bkowal Removed setting the hdf5 data directory
|
||||
* Aug 27, 2013 2295 bkowal The entire jms connection string is
|
||||
* now provided by EDEX.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -92,7 +94,7 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
|
|||
GetServersResponse resp = (GetServersResponse) ThriftClient
|
||||
.sendLocalizationRequest(req);
|
||||
if (!disableJMS) {
|
||||
VizApp.setJmsServer(resp.getJmsServer());
|
||||
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
|
||||
}
|
||||
}
|
||||
VizApp.setHttpServer(servicesProxy);
|
||||
|
@ -103,12 +105,13 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
|
|||
HttpClient.getInstance().setCompressRequests(compressRequests);
|
||||
|
||||
// use the proxy for all servers in VizServers
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> serversMap = new DefaultedMap(servicesProxy);
|
||||
VizServers.getInstance().setServerLocations(serversMap);
|
||||
} else {
|
||||
processGetServers();
|
||||
if (disableJMS) {
|
||||
VizApp.setJmsServer(null);
|
||||
VizApp.setJmsConnectionString(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ export EBXML_REGISTRY_FEDERATION_ENABLED=false
|
|||
export HTTP_PORT=9581
|
||||
export HTTP_SERVER=http://localhost:${HTTP_PORT}/services
|
||||
export JMS_SERVER=tcp://localhost:5672
|
||||
export JMS_VIRTUALHOST=edex
|
||||
export RADAR_SERVER=tcp://localhost:8813
|
||||
export DATADELIVERY_SERVER=http://${DATADELIVERY_HOST}:${DATADELIVERY_PORT}/services
|
||||
export EBXML_REGISTRY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/services
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<!-- specify the connection to the broker (qpid) -->
|
||||
<!-- MaxPrefetch set at 0, due to DataPool routers getting messages backed up behind long running tasks -->
|
||||
<bean id="amqConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
|
||||
<constructor-arg type="java.lang.String" value="amqp://guest:guest@/edex?brokerlist='tcp://${BROKER_ADDR}?retries='9999'&connecttimeout='5000'&connectdelay='5000''&maxprefetch='0'&sync_publish='all'&sync_ack='true'"/>
|
||||
<constructor-arg type="java.lang.String" value="amqp://guest:guest@/${JMS_VIRTUALHOST}?brokerlist='tcp://${BROKER_ADDR}?retries='9999'&connecttimeout='5000'&connectdelay='5000''&maxprefetch='0'&sync_publish='all'&sync_ack='true'"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jmsPooledConnectionFactory" class="com.raytheon.uf.common.jms.JmsPooledConnectionFactory">
|
||||
|
|
|
@ -43,6 +43,8 @@ import com.raytheon.uf.common.util.registry.GenericRegistry;
|
|||
* Jan 14, 2013 1469 bkowal No longer includes the hdf5 data directory
|
||||
* in the response.
|
||||
* May 28, 2013 1989 njensen Uses env variables instead of system props
|
||||
* Aug 27, 2013 2295 bkowal Return the entire jms connection url in
|
||||
* the response.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,18 +63,41 @@ public class GetServersHandler extends GenericRegistry<String, String>
|
|||
GetServersResponse response = new GetServersResponse();
|
||||
String httpServer = System.getenv("HTTP_SERVER");
|
||||
String jmsServer = System.getenv("JMS_SERVER");
|
||||
String jmsVirtualHost = System.getenv("JMS_VIRTUALHOST");
|
||||
String pypiesServer = System.getenv("PYPIES_SERVER");
|
||||
String jmsConnectionString = this.constructJMSConnectionString(
|
||||
jmsServer, jmsVirtualHost);
|
||||
|
||||
logger.info("http.server=" + httpServer);
|
||||
logger.info("jms.server=" + jmsServer);
|
||||
logger.info("jms.virtualhost=" + jmsVirtualHost);
|
||||
logger.info("pypies.server=" + pypiesServer);
|
||||
logger.info("server locations=" + registry);
|
||||
;
|
||||
response.setHttpServer(httpServer);
|
||||
response.setJmsServer(jmsServer);
|
||||
response.setJmsConnectionString(jmsConnectionString);
|
||||
response.setPypiesServer(pypiesServer);
|
||||
response.setServerLocations(Collections.unmodifiableMap(this.registry));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
// do not enable retry/connectdelay connection and factory will
|
||||
// silently reconnect and user will never be notified qpid is down
|
||||
// and cave/text workstation will just act like they are hung
|
||||
// up to each individual component that opens a connection to handle
|
||||
// reconnect
|
||||
private String constructJMSConnectionString(String jmsServer,
|
||||
String jmsVirtualHost) {
|
||||
/* build the connection String that CAVE will use. */
|
||||
StringBuilder stringBuilder = new StringBuilder(
|
||||
"amqp://guest:guest@__WSID__/");
|
||||
stringBuilder.append(jmsVirtualHost);
|
||||
stringBuilder.append("?brokerlist='");
|
||||
stringBuilder.append(jmsServer);
|
||||
stringBuilder
|
||||
.append("?connecttimeout='5000'&heartbeat='0''&maxprefetch='10'&sync_publish='all'&failover='nofailover'&sync_ack='true'");
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Aug 6, 2009 mschenke Initial creation
|
||||
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
|
||||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory
|
||||
* Aug 27, 2013 2995 bkowal Removed jms server; added jms connection string
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,7 +51,7 @@ public class GetServersResponse implements ISerializableObject {
|
|||
private String httpServer;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String jmsServer;
|
||||
private String jmsConnectionString;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String pypiesServer;
|
||||
|
@ -66,12 +67,12 @@ public class GetServersResponse implements ISerializableObject {
|
|||
this.httpServer = httpServer;
|
||||
}
|
||||
|
||||
public String getJmsServer() {
|
||||
return jmsServer;
|
||||
public String getJmsConnectionString() {
|
||||
return jmsConnectionString;
|
||||
}
|
||||
|
||||
public void setJmsServer(String jmsServer) {
|
||||
this.jmsServer = jmsServer;
|
||||
public void setJmsConnectionString(String jmsConnectionString) {
|
||||
this.jmsConnectionString = jmsConnectionString;
|
||||
}
|
||||
|
||||
public String getPypiesServer() {
|
||||
|
|
Loading…
Add table
Reference in a new issue