From 87e33eb8c274af5405eac66645e0d36faaf35297 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Thu, 6 Dec 2012 17:17:24 -0600 Subject: [PATCH] Issue #1396 fix thin client Change-Id: I58dc3f40594697d8332cc372f45f30bb28927100 Former-commit-id: 52b55cdf65e1bdbfa9b83b6cc45044c61bc178af [formerly 851f8977f3618d3c5524fd64cddad3064175a663] [formerly 020b84e3735277b8ff039edd6da7219561106512] [formerly 52b55cdf65e1bdbfa9b83b6cc45044c61bc178af [formerly 851f8977f3618d3c5524fd64cddad3064175a663] [formerly 020b84e3735277b8ff039edd6da7219561106512] [formerly 03e6f7ee1637fdfb2ee2552333262e5f0d38474b [formerly 020b84e3735277b8ff039edd6da7219561106512 [formerly 1afd50427bff0a11ebbf99eb3b29d2d8c3e02c44]]]] Former-commit-id: 03e6f7ee1637fdfb2ee2552333262e5f0d38474b Former-commit-id: adad056c534a59fdf8004485f2577cf01b111e07 [formerly 7c0941e29220099a67698cb8c7aa83f7b4a00a18] [formerly db935f8f15b87218882a4babaf96d3d58289cbba [formerly 496fa1ede91b2aa7b4e6e32ca99b56e0326eee2a]] Former-commit-id: 502d457e7e9a9564188a34109c31a23d6b0411b1 [formerly c1de3bcff5a0fdd189a8a721fe53958e20df1805] Former-commit-id: 0ffbeecd4e4bf180dc8299b7c76d6afdbae995f1 --- .../localization/LocalizationInitializer.java | 10 ++++++ .../ThinClientLocalizationInitializer.java | 32 ++++++++++--------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationInitializer.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationInitializer.java index 92c4199739..8dabc2bc5e 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationInitializer.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationInitializer.java @@ -110,6 +110,16 @@ public class LocalizationInitializer { } } + processGetServers(); + } + + /** + * Sends a GetServersRequest and sets the references that hold the various + * server addresses + * + * @throws VizException + */ + protected final void processGetServers() throws VizException { GetServersRequest req = new GetServersRequest(); GetServersResponse resp = (GetServersResponse) ThriftClient .sendLocalizationRequest(req); diff --git a/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java b/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java index 8bd7f11d83..a7a11b6be9 100644 --- a/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java +++ b/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java @@ -19,12 +19,16 @@ **/ package com.raytheon.uf.viz.thinclient.localization; +import java.util.Map; + +import org.apache.commons.collections.map.DefaultedMap; import org.eclipse.jface.preference.IPreferenceStore; import com.raytheon.uf.common.comm.HttpClient; import com.raytheon.uf.common.localization.msgs.GetServersRequest; import com.raytheon.uf.common.localization.msgs.GetServersResponse; import com.raytheon.uf.viz.core.VizApp; +import com.raytheon.uf.viz.core.VizServers; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationInitializer; import com.raytheon.uf.viz.core.localization.LocalizationManager; @@ -34,7 +38,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants; import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog; /** - * TODO Add Description + * Initializer that does work of checking localization settings and configuring + * the servers to use based on the preferences. * *
  * 
@@ -43,6 +48,7 @@ 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
  * 
  * 
* @@ -77,10 +83,9 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer { .getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS); if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) { - LocalizationManager - .getInstance() - .setCurrentServer( - store.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY)); + String servicesProxy = store + .getString(ThinClientPreferenceConstants.P_SERVICES_PROXY); + LocalizationManager.getInstance().setCurrentServer(servicesProxy); String dataDir = VizApp.getServerDataDir(); if (dataDir == null || dataDir.isEmpty()) { dataDir = store @@ -96,23 +101,20 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer { VizApp.setJmsServer(resp.getJmsServer()); } } - VizApp.setHttpServer(store - .getString(ThinClientPreferenceConstants.P_SERVICES_PROXY)); + VizApp.setHttpServer(servicesProxy); VizApp.setPypiesServer(store .getString(ThinClientPreferenceConstants.P_PYPIES_PROXY)); boolean compressRequests = store .getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION); HttpClient.getInstance().setCompressRequests(compressRequests); + // use the proxy for all servers in VizServers + Map serversMap = new DefaultedMap(servicesProxy); + VizServers.getInstance().setServerLocations(serversMap); } else { - GetServersRequest req = new GetServersRequest(); - GetServersResponse resp = (GetServersResponse) ThriftClient - .sendLocalizationRequest(req); - VizApp.setHttpServer(resp.getHttpServer()); - VizApp.setPypiesServer(resp.getPypiesServer()); - VizApp.setServerDataDir(resp.getServerDataDir()); - if (!disableJMS) { - VizApp.setJmsServer(resp.getJmsServer()); + processGetServers(); + if (disableJMS) { + VizApp.setJmsServer(null); } } store.setValue(ThinClientPreferenceConstants.P_SERVER_DATA_DIR,