brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [11/50] [abbrv] brooklyn-server git commit: Make Brooklyn management context available to config suppliers.
Date Mon, 01 Feb 2016 17:50:27 GMT
Make Brooklyn management context available to config suppliers.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c458e73d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c458e73d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c458e73d

Branch: refs/heads/0.8.0-incubating
Commit: c458e73dd4ca021eea199f105f395d436574da15
Parents: eeac6e6
Author: Alasdair Hodge <github@alasdairhodge.co.uk>
Authored: Thu Jul 16 09:24:28 2015 +0100
Committer: Alasdair Hodge <github@alasdairhodge.co.uk>
Committed: Tue Aug 25 11:51:20 2015 +0100

----------------------------------------------------------------------
 .../config/external/AbstractExternalConfigSupplier.java   | 10 +++++++++-
 .../config/external/InPlaceExternalConfigSupplier.java    |  6 ++++--
 .../external/PropertiesFileExternalConfigSupplier.java    |  5 +++--
 .../internal/BasicExternalConfigSupplierRegistry.java     |  4 ++--
 4 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c458e73d/core/src/main/java/brooklyn/config/external/AbstractExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/external/AbstractExternalConfigSupplier.java
b/core/src/main/java/brooklyn/config/external/AbstractExternalConfigSupplier.java
index 6aa6967..7f0cec0 100644
--- a/core/src/main/java/brooklyn/config/external/AbstractExternalConfigSupplier.java
+++ b/core/src/main/java/brooklyn/config/external/AbstractExternalConfigSupplier.java
@@ -18,18 +18,26 @@
  */
 package brooklyn.config.external;
 
+import brooklyn.management.ManagementContext;
+
 
 /**
  * Default superclass for all {@link ExternalConfigSupplier} implementations.
  */
 abstract public class AbstractExternalConfigSupplier implements ExternalConfigSupplier {
 
+    private final ManagementContext managementContext;
     private final String name;
 
-    protected AbstractExternalConfigSupplier(String name) {
+    protected AbstractExternalConfigSupplier(ManagementContext managementContext, String
name) {
+        this.managementContext = managementContext;
         this.name = name;
     }
 
+    public ManagementContext getManagementContext() {
+        return managementContext;
+    }
+
     public String getName() {
         return name;
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c458e73d/core/src/main/java/brooklyn/config/external/InPlaceExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/external/InPlaceExternalConfigSupplier.java
b/core/src/main/java/brooklyn/config/external/InPlaceExternalConfigSupplier.java
index 2279386..697bc89 100644
--- a/core/src/main/java/brooklyn/config/external/InPlaceExternalConfigSupplier.java
+++ b/core/src/main/java/brooklyn/config/external/InPlaceExternalConfigSupplier.java
@@ -20,6 +20,8 @@ package brooklyn.config.external;
 
 import java.util.Map;
 
+import brooklyn.management.ManagementContext;
+
 
 /**
  * Instances are populated via sub-keys specified directly in the <tt>brooklyn.properties</tt>
file:
@@ -37,8 +39,8 @@ public class InPlaceExternalConfigSupplier extends AbstractExternalConfigSupplie
 
     private final Map<?,?> config;
 
-    public InPlaceExternalConfigSupplier(String name, Map<?, ?> config) {
-        super(name);
+    public InPlaceExternalConfigSupplier(ManagementContext managementContext, String name,
Map<?, ?> config) {
+        super(managementContext, name);
         this.config = config;
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c458e73d/core/src/main/java/brooklyn/config/external/PropertiesFileExternalConfigSupplier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/external/PropertiesFileExternalConfigSupplier.java
b/core/src/main/java/brooklyn/config/external/PropertiesFileExternalConfigSupplier.java
index a4d48d9..34a67c4 100644
--- a/core/src/main/java/brooklyn/config/external/PropertiesFileExternalConfigSupplier.java
+++ b/core/src/main/java/brooklyn/config/external/PropertiesFileExternalConfigSupplier.java
@@ -24,6 +24,7 @@ import java.net.URL;
 import java.util.Map;
 import java.util.Properties;
 
+import brooklyn.management.ManagementContext;
 import brooklyn.util.stream.Streams;
 
 
@@ -42,8 +43,8 @@ public class PropertiesFileExternalConfigSupplier extends AbstractExternalConfig
 
     private final Properties properties;
 
-    public PropertiesFileExternalConfigSupplier(String name, Map<?, ?> config) throws
IOException {
-        super(name);
+    public PropertiesFileExternalConfigSupplier(ManagementContext managementContext, String
name, Map<?, ?> config) throws IOException {
+        super(managementContext, name);
         this.properties = loadProperties((String) config.get(PROPERTIES_URL));
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c458e73d/core/src/main/java/brooklyn/management/internal/BasicExternalConfigSupplierRegistry.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/management/internal/BasicExternalConfigSupplierRegistry.java
b/core/src/main/java/brooklyn/management/internal/BasicExternalConfigSupplierRegistry.java
index 16f7ed5..8d81d69 100644
--- a/core/src/main/java/brooklyn/management/internal/BasicExternalConfigSupplierRegistry.java
+++ b/core/src/main/java/brooklyn/management/internal/BasicExternalConfigSupplierRegistry.java
@@ -103,8 +103,8 @@ public class BasicExternalConfigSupplierRegistry implements ExternalConfigSuppli
 
             try {
                 Class<? extends ExternalConfigSupplier> providerClass = (Class<?
extends ExternalConfigSupplier>) classloader.loadClass(providerClassname);
-                Constructor<? extends ExternalConfigSupplier> constructor = providerClass.getConstructor(String.class,
Map.class);
-                ExternalConfigSupplier configSupplier = constructor.newInstance(name, config);
+                Constructor<? extends ExternalConfigSupplier> constructor = providerClass.getConstructor(ManagementContext.class,
String.class, Map.class);
+                ExternalConfigSupplier configSupplier = constructor.newInstance(this, name,
config);
                 addProvider(name, configSupplier);
 
             } catch (Exception e) {


Mime
View raw message