tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject incubator-tamaya git commit: Adapted some feature to match documentation in Environment.
Date Fri, 28 Nov 2014 17:00:58 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master b2098a65d -> daca772e6


Adapted some feature to match documentation in Environment.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/daca772e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/daca772e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/daca772e

Branch: refs/heads/master
Commit: daca772e6ce8efe1176a1a10bd7dc371f9f55cc7
Parents: b2098a6
Author: anatole <anatole@apache.org>
Authored: Fri Nov 28 18:00:49 2014 +0100
Committer: anatole <anatole@apache.org>
Committed: Fri Nov 28 18:00:49 2014 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/tamaya/Environment.java    | 10 +---------
 .../tamaya/core/config/AbstractConfiguration.java   | 10 ++++++----
 .../tamaya/core/config/ConfigurationDecorator.java  |  4 ++--
 .../tamaya/core/env/BuildableEnvironment.java       | 16 ++--------------
 .../core/properties/AggregatedPropertyProvider.java |  4 ++--
 .../core/properties/ClasspathPropertyProvider.java  |  5 +++--
 .../core/properties/ContextualPropertyProvider.java |  4 ++--
 .../core/properties/DelegatingPropertyProvider.java |  5 +++--
 .../core/properties/FilteredPropertyProvider.java   |  4 ++--
 .../core/properties/FreezedPropertyProvider.java    |  4 +++-
 .../core/properties/MapBasedPropertyProvider.java   |  3 ++-
 .../core/properties/ReplacingPropertyProvider.java  |  4 ++--
 .../properties/SubtractingPropertyProvider.java     |  4 ++--
 .../tamaya/management/ManagedEnvironment.java       |  2 +-
 14 files changed, 33 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/api/src/main/java/org/apache/tamaya/Environment.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/Environment.java b/api/src/main/java/org/apache/tamaya/Environment.java
index 3523083..46b64a4 100644
--- a/api/src/main/java/org/apache/tamaya/Environment.java
+++ b/api/src/main/java/org/apache/tamaya/Environment.java
@@ -83,14 +83,6 @@ public interface Environment extends StageSupplier, Iterable<Environment>{
     Set<String> keySet();
 
     /**
-     * Get an qualified path to this environment instance, by appending the
-     * current environment id and type (in backets) with the ones of its parent and so on,
e.g.
-     * <code>root[system].HumanOne[ear].rest[webapp].atsticks[user]</code>
-     * @return the qualified path of this environment instance
-     */
-    String getContext();
-
-    /**
      * Get the parent context.
      * @return the parent context, or null.
      */
@@ -141,7 +133,7 @@ public interface Environment extends StageSupplier, Iterable<Environment>{
      * @param contextId the target context, not null.
      * @return the corresponding environment, if available.
      */
-    public static Optional<Environment> getEnvironment(String environmentType, String
contextId){
+    public static Optional<Environment> of(String environmentType, String contextId){
         return EnvironmentManager.getEnvironment(environmentType, contextId);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java b/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java
index e090a90..5b2967c 100644
--- a/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java
+++ b/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java
@@ -70,13 +70,13 @@ public abstract class AbstractConfiguration extends AbstractPropertyProvider
imp
     /**
      * This method reloads the content of this PropertyMap by reloading the contents delegate.
      */
-    protected void reload(){ }
+    protected ConfigChangeSet reload(){ return ConfigChangeSet.emptyChangeSet(this);}
 
     /**
      * This method reloads the content of this PropertyMap by reloading the contents delegate.
      */
     @Override
-    public void load(){
+    public ConfigChangeSet load(){
         Configuration oldState = null;
         Configuration newState = null;
         synchronized(LOCK) {
@@ -84,11 +84,13 @@ public abstract class AbstractConfiguration extends AbstractPropertyProvider
imp
             reload();
             newState = FreezedConfiguration.of(this);
             if(oldState.hasSameProperties(newState)){
-                return;
+                return ConfigChangeSet.emptyChangeSet(this);
             }
             this.version = UUID.randomUUID().toString();
         }
-        publishPropertyChangeEvents(ConfigChangeSetBuilder.of(oldState).addChanges(newState).build().getEvents());
+        ConfigChangeSet changeSet = ConfigChangeSetBuilder.of(oldState).addChanges(newState).build();
+        publishPropertyChangeEvents(changeSet.getEvents());
+        return changeSet;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/config/ConfigurationDecorator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationDecorator.java
b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationDecorator.java
index cf2ba17..3e639d4 100644
--- a/core/src/main/java/org/apache/tamaya/core/config/ConfigurationDecorator.java
+++ b/core/src/main/java/org/apache/tamaya/core/config/ConfigurationDecorator.java
@@ -82,8 +82,8 @@ public class ConfigurationDecorator extends AbstractConfiguration{
     }
 
     @Override
-    protected void reload() {
-        provider.load();
+    protected ConfigChangeSet reload() {
+        return provider.load();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java b/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
index f37b4bb..f75c1e7 100644
--- a/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
+++ b/core/src/main/java/org/apache/tamaya/core/env/BuildableEnvironment.java
@@ -48,24 +48,12 @@ class BuildableEnvironment implements Environment {
     }
 
     @Override
-    public String getContext() {
-        return id;
-    }
-
-    @Override
     public String getEnvironmentId() {
-        StringBuilder b = new StringBuilder();
-        if(getParentEnvironment()!=null) {
-            b.append(getParentEnvironment().getContext());
-        }
-        if(b.length()>0)
-            b.append('.');
-        b.append(getFullId());
-        return b.toString();
+        return id;
     }
 
     public String getFullId() {
-        return getContext()+'('+getEnvironmentType()+')';
+        return getEnvironmentId()+'('+getEnvironmentType()+')';
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/AggregatedPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/AggregatedPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/AggregatedPropertyProvider.java
index 93e424c..91ddf2b 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/AggregatedPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/AggregatedPropertyProvider.java
@@ -127,11 +127,11 @@ class AggregatedPropertyProvider extends AbstractPropertyProvider{
 	}
 
     @Override
-	public void load() {
+	public ConfigChangeSet load() {
 		for (PropertyProvider unit : units) {
 			unit.load();
 		}
-        super.load();
+        return super.load();
 	}
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/ClasspathPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/ClasspathPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/ClasspathPropertyProvider.java
index d464007..58f71f7 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/ClasspathPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/ClasspathPropertyProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.core.properties;
 
+import org.apache.tamaya.ConfigChangeSet;
 import org.apache.tamaya.MetaInfo;
 import java.util.*;
 
@@ -120,7 +121,7 @@ public class ClasspathPropertyProvider extends AbstractPropertyProvider{
 	}
 
 	@Override
-	public void load() {
+	public ConfigChangeSet load() {
 		Map<String, String> props = new HashMap<>();
 		ClassLoader cl = Thread.currentThread().getContextClassLoader();
 		if (cl == null) {
@@ -133,7 +134,7 @@ public class ClasspathPropertyProvider extends AbstractPropertyProvider{
 			}
 			cl = cl.getParent();
 		}
-        super.load();
+        return super.load();
 	}
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/ContextualPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/ContextualPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/ContextualPropertyProvider.java
index bdc440a..1caa234 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/ContextualPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/ContextualPropertyProvider.java
@@ -88,8 +88,8 @@ class ContextualPropertyProvider implements PropertyProvider{
     }
 
     @Override
-    public void load(){
-        getContextualMap().load();
+    public ConfigChangeSet load(){
+        return getContextualMap().load();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/DelegatingPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/DelegatingPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/DelegatingPropertyProvider.java
index 36c2aef..69c4768 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/DelegatingPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/DelegatingPropertyProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.core.properties;
 
+import org.apache.tamaya.ConfigChangeSet;
 import org.apache.tamaya.MetaInfo;
 import org.apache.tamaya.MetaInfoBuilder;
 import org.apache.tamaya.PropertyProvider;
@@ -60,8 +61,8 @@ class DelegatingPropertyProvider implements PropertyProvider{
     }
 
     @Override
-    public void load(){
-        mainMap.load();
+    public ConfigChangeSet load(){
+        return mainMap.load();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/FilteredPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/FilteredPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/FilteredPropertyProvider.java
index d0d6b0f..bf6c9e2 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/FilteredPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/FilteredPropertyProvider.java
@@ -52,9 +52,9 @@ class FilteredPropertyProvider extends AbstractPropertyProvider{
     }
 
     @Override
-    public void load(){
+    public ConfigChangeSet load(){
         unit.load();
-        super.load();
+        return super.load();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/FreezedPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/FreezedPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/FreezedPropertyProvider.java
index 4964ef6..83b230e 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/FreezedPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/FreezedPropertyProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.core.properties;
 
+import org.apache.tamaya.ConfigChangeSet;
 import org.apache.tamaya.MetaInfo;
 import org.apache.tamaya.MetaInfoBuilder;
 import org.apache.tamaya.PropertyProvider;
@@ -53,7 +54,8 @@ final class FreezedPropertyProvider implements PropertyProvider, Serializable{
     }
 
     @Override
-    public void load(){
+    public ConfigChangeSet load(){
+        return ConfigChangeSet.emptyChangeSet(this);
     }
 
     public int size(){

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/MapBasedPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/MapBasedPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/MapBasedPropertyProvider.java
index 7c6a23c..9d9969a 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/MapBasedPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/MapBasedPropertyProvider.java
@@ -78,8 +78,9 @@ class MapBasedPropertyProvider extends AbstractPropertyProvider{
     }
 
     @Override
-    public void load(){
+    public ConfigChangeSet load(){
         // Can not reload...
+        return ConfigChangeSet.emptyChangeSet(this);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
index 40630cc..7eb69fa 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
@@ -54,8 +54,8 @@ class ReplacingPropertyProvider implements PropertyProvider{
     }
 
     @Override
-    public void load(){
-        mainMap.load();
+    public ConfigChangeSet load(){
+        return mainMap.load();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
b/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
index 95791f1..0ecb837 100644
--- a/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
+++ b/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
@@ -56,9 +56,9 @@ class SubtractingPropertyProvider extends AbstractPropertyProvider{
     }
 
     @Override
-    public void load(){
+    public ConfigChangeSet load(){
         unit.load();
-        super.load();
+        return super.load();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/daca772e/modules/managed/src/main/java/org/apache/tamaya/management/ManagedEnvironment.java
----------------------------------------------------------------------
diff --git a/modules/managed/src/main/java/org/apache/tamaya/management/ManagedEnvironment.java
b/modules/managed/src/main/java/org/apache/tamaya/management/ManagedEnvironment.java
index 7c3549e..b91d363 100644
--- a/modules/managed/src/main/java/org/apache/tamaya/management/ManagedEnvironment.java
+++ b/modules/managed/src/main/java/org/apache/tamaya/management/ManagedEnvironment.java
@@ -51,7 +51,7 @@ public class ManagedEnvironment implements ManagedEnvironmentMBean{
     @Override
     public Map<String, String> getEnvironment(String environmentType, String context)
{
         try {
-            Optional<Environment> env = Environment.getEnvironment(environmentType,
context);
+            Optional<Environment> env = Environment.of(environmentType, context);
             if (env.isPresent()) {
                 return env.get().toMap();
             }


Mime
View raw message