smolnar82 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_r366063930
##########
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:
This is an implementation which converts one or more descriptors in a Hadoop
XML into one or more simplified descriptors in JSON format.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services