You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2020/01/13 19:05:15 UTC

[GitHub] [knox] risdenk commented on a change in pull request #236: KNOX-2160 - Introducing Hadoop XML type descriptor format

risdenk commented on a change in pull request #236: KNOX-2160 - Introducing Hadoop XML type descriptor format
URL: https://github.com/apache/knox/pull/236#discussion_r365972788
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
 ##########
 @@ -859,28 +858,34 @@ public void onFileDelete(File file) {
     @Override
     public void onFileChange(File file) {
       try {
-        // When a simple descriptor has been created or modified, generate the new topology descriptor
-        Map<String, File> result = SimpleDescriptorHandler.handle(gatewayConfig, file, topologiesDir, aliasService);
-        log.generatedTopologyForDescriptorChange(result.get(SimpleDescriptorHandler.RESULT_TOPOLOGY).getName(),
-            file.getName());
-
-        // Add the provider config reference relationship for handling updates to the provider config
-        String providerConfig =
-            FilenameUtils.normalize(result.get(SimpleDescriptorHandler.RESULT_REFERENCE).getAbsolutePath());
-        if (!providerConfigReferences.containsKey(providerConfig)) {
-          providerConfigReferences.put(providerConfig, new ArrayList<>());
-        }
-        List<String> refs = providerConfigReferences.get(providerConfig);
-        String descriptorName = FilenameUtils.normalize(file.getAbsolutePath());
-        if (!refs.contains(descriptorName)) {
-          // Need to check if descriptor had previously referenced another provider config, so it can be removed
-          for (List<String> descs : providerConfigReferences.values()) {
-            descs.remove(descriptorName);
+        if (isXmlTypeDescriptorFile(file.getAbsolutePath())) {
+          XmlDescriptorParser.parse(file.getAbsolutePath()).forEach(simpleDescriptor -> {
+            topologyService.deployDescriptor(simpleDescriptor.getName() + ".json", JsonUtils.renderAsJsonString(simpleDescriptor));
 
 Review comment:
   Is `.json` correct here? This is in the xml type descriptor?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services