knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject knox git commit: KNOX-1077 - Knox should notice simple descriptors on startup (Phil Zampino via lmccay)
Date Thu, 19 Oct 2017 19:12:09 GMT
Repository: knox
Updated Branches:
  refs/heads/master 228823178 -> 8ecac9216


KNOX-1077 - Knox should notice simple descriptors on startup (Phil Zampino via lmccay)

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/8ecac921
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/8ecac921
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/8ecac921

Branch: refs/heads/master
Commit: 8ecac9216e6512afe84e0325a6e6b27d87689fde
Parents: 2288231
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Thu Oct 19 15:11:45 2017 -0400
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Thu Oct 19 15:12:04 2017 -0400

----------------------------------------------------------------------
 .../topology/impl/DefaultTopologyService.java        | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/8ecac921/gateway-server/src/main/java/org/apache/hadoop/gateway/services/topology/impl/DefaultTopologyService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/topology/impl/DefaultTopologyService.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/topology/impl/DefaultTopologyService.java
index a493bc4..a8d6de8 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/topology/impl/DefaultTopologyService.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/topology/impl/DefaultTopologyService.java
@@ -496,6 +496,17 @@ public class DefaultTopologyService
       SharedProviderConfigMonitor spm = new SharedProviderConfigMonitor(dm, descriptorsDirectory);
       initListener(sharedProvidersDirectory, spm, spm);
 
+      // For all the descriptors currently in the descriptors dir at start-up time, trigger
topology generation.
+      // This happens prior to the start-up loading of the topologies.
+      String[] descriptorFilenames =  descriptorsDirectory.list();
+      if (descriptorFilenames != null) {
+          for (String descriptorFilename : descriptorFilenames) {
+              if (DescriptorsMonitor.isDescriptorFile(descriptorFilename)) {
+                  dm.onFileChange(new File(descriptorsDirectory, descriptorFilename));
+              }
+          }
+      }
+
     } catch (IOException | SAXException io) {
       throw new ServiceLifecycleException(io.getMessage());
     }
@@ -521,6 +532,10 @@ public class DefaultTopologyService
     private Map<String, List<String>> providerConfigReferences = new HashMap<>();
 
 
+    static boolean isDescriptorFile(String filename) {
+      return SUPPORTED_EXTENSIONS.contains(FilenameUtils.getExtension(filename));
+    }
+
     public DescriptorsMonitor(File topologiesDir, AliasService aliasService) {
       this.topologiesDir  = topologiesDir;
       this.aliasService   = aliasService;


Mime
View raw message