Преглед на файлове

HPCC-13787 Return cluster type in TpLogicalClusterQuery

The cluster type is added into WsTopology.TpLogicalClusterQuery
response.

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx преди 10 години
родител
ревизия
131b48ea18
променени са 2 файла, в които са добавени 14 реда и са изтрити 23 реда
  1. 2 1
      esp/scm/ws_topology.ecm
  2. 12 22
      esp/services/ws_topology/ws_topologyService.cpp

+ 2 - 1
esp/scm/ws_topology.ecm

@@ -58,6 +58,7 @@ ESPStruct TpLogicalCluster
     string Queue;
         [min_ver("1.14")] string LanguageVersion;
     [min_ver("1.11")] string Process;
+    [min_ver("1.22")] string Type;
 };
 //  ===========================================================================
 
@@ -583,7 +584,7 @@ ESPresponse [exceptions_inline,encode(0)] TpGetServicePluginsResponse
     ESParray<ESPstruct TpEspServicePlugin, Plugin> Plugins;
 };
 
-ESPservice [noforms, version("1.21"), exceptions_inline("./smc_xslt/exceptions.xslt")] WsTopology
+ESPservice [noforms, version("1.22"), exceptions_inline("./smc_xslt/exceptions.xslt")] WsTopology
 {
     ESPuses ESPStruct TpBinding;
     ESPuses ESPstruct TpCluster;

+ 12 - 22
esp/services/ws_topology/ws_topologyService.cpp

@@ -1169,31 +1169,21 @@ bool CWsTopologyEx::onTpLogicalClusterQuery(IEspContext &context, IEspTpLogicalC
         if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
             throw MakeStringException(ECLWATCH_TOPOLOGY_ACCESS_DENIED, "Failed to do Cluster Query. Permission denied.");
 
-        Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
-        Owned<IConstEnvironment> constEnv = factory->openEnvironment();
-        Owned<IPropertyTree> root = &constEnv->getPTree();
-        if (!root)
-            throw MakeStringException(ECLWATCH_CANNOT_GET_ENV_INFO, "Failed to get environment information.");
-
         IArrayOf<IEspTpLogicalCluster> clusters;
-        Owned<IPropertyTreeIterator> clusterIterator = root->getElements("Software/Topology/Cluster");
-        if (clusterIterator->first()) 
+        CConstWUClusterInfoArray wuClusters;
+        getEnvironmentClusterInfo(wuClusters);
+        ForEachItemIn(c, wuClusters)
         {
-            do {
-                IPropertyTree &cluster0 = clusterIterator->query();
-                StringBuffer processName;
-                const char* clusterName0 = cluster0.queryProp("@name");
-                if (!clusterName0 || !*clusterName0)
-                    continue;
-
-                IEspTpLogicalCluster* pService = createTpLogicalCluster("","");
-                pService->setName(clusterName0);
-                pService->setLanguageVersion("3.0.0");
-                clusters.append(*pService);
-
-            } while (clusterIterator->next());
+            IConstWUClusterInfo& wuCluster = wuClusters.item(c);
+            SCMStringBuffer name;
+            wuCluster.getName(name);
+
+            Owned<IEspTpLogicalCluster> cluster = createTpLogicalCluster();
+            cluster->setName(name.str());
+            cluster->setType(clusterTypeString(wuCluster.getPlatform(), false));
+            cluster->setLanguageVersion("3.0.0");
+            clusters.append(*cluster.getClear());
         }
-
         resp.setTpLogicalClusters(clusters);
     }
     catch(IException* e)