knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pzamp...@apache.org
Subject [4/7] knox git commit: KNOX-1397 - Admin UI Topologies List needs to Refresh on New or Deleted Topologies
Date Tue, 24 Jul 2018 18:39:35 GMT
http://git-wip-us.apache.org/repos/asf/knox/blob/7a7450b9/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
----------------------------------------------------------------------
diff --git a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
index 1cfac54..81e0c75 100644
--- a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
+++ b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
@@ -105,26 +105,27 @@ public class TopologiesResource {
   public Topology getTopology(@PathParam("id") String id) {
     GatewayServices services =
               (GatewayServices) request.getServletContext().getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
-    GatewayConfig config =
-                    (GatewayConfig) request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
-
-    TopologyService ts = services.getService(GatewayServices.TOPOLOGY_SERVICE);
-
-    for (org.apache.knox.gateway.topology.Topology t : ts.getTopologies()) {
-      if (t.getName().equals(id)) {
-        try {
-          t.setUri(new URI( buildURI(t, config, request) ));
-        } catch (URISyntaxException se) {
-          t.setUri(null);
-        }
+    if (services != null) {
+      TopologyService ts = services.getService(GatewayServices.TOPOLOGY_SERVICE);
 
-        // For any read-only override topology, mark it as generated to discourage modification.
-        List<String> ambariManagedTopos = config.getReadOnlyOverrideTopologyNames();
-        if (ambariManagedTopos.contains(t.getName())) {
-          t.setGenerated(true);
+      GatewayConfig config =
+                (GatewayConfig) request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      for (org.apache.knox.gateway.topology.Topology t : ts.getTopologies()) {
+        if (t.getName().equals(id)) {
+          try {
+            t.setUri(new URI( buildURI(t, config, request) ));
+          } catch (URISyntaxException se) {
+            t.setUri(null);
+          }
+
+          // For any read-only override topology, mark it as generated to discourage modification.
+          List<String> ambariManagedTopos = config.getReadOnlyOverrideTopologyNames();
+          if (ambariManagedTopos.contains(t.getName())) {
+            t.setGenerated(true);
+          }
+
+          return BeanConverter.getTopology(t);
         }
-
-        return BeanConverter.getTopology(t);
       }
     }
     return null;


Mime
View raw message