tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [4/5] incubator-tamaya git commit: Merge remote-tracking branch 'origin/master'
Date Sat, 20 Dec 2014 14:31:09 GMT
Merge remote-tracking branch 'origin/master'

Conflicts:
	api/src/main/java/org/apache/tamaya/Codec.java
	api/src/main/java/org/apache/tamaya/annotation/WithCodec.java
	api/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
	api/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
	core/src/main/java/org/apache/tamaya/core/config/MappedConfiguration.java
	core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
	core/src/main/java/org/apache/tamaya/core/internal/inject/ConfigTemplateInvocationHandler.java
	core/src/main/java/org/apache/tamaya/core/internal/inject/ConfiguredField.java
	core/src/main/java/org/apache/tamaya/core/internal/inject/ConfiguredInstancesManager.java
	core/src/main/java/org/apache/tamaya/core/internal/inject/ConfiguredMethod.java
	core/src/main/java/org/apache/tamaya/core/internal/inject/ConfiguredType.java
	core/src/main/java/org/apache/tamaya/core/internal/properties/DefaultPropertyAdaptersSingletonSpi.java
	core/src/main/java/org/apache/tamaya/core/spi/AdapterProviderSpi.java
	core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
	core/src/test/java/org/apache/tamaya/core/config/MutableConfigTest.java


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

Branch: refs/heads/master
Commit: f8c9103103680bb905c95d38c32bf7f07607911f
Parents: c9e62e2 31161df
Author: anatole <anatole@apache.org>
Authored: Sat Dec 20 15:29:49 2014 +0100
Committer: anatole <anatole@apache.org>
Committed: Sat Dec 20 15:29:49 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/tamaya/Configuration.java   |  2 +-
 .../org/apache/tamaya/EnvironmentManager.java   |  6 +--
 .../spi/DefaultServiceContextProvider.java      |  6 +--
 .../spi/EnvironmentManagerSingletonSpi.java     |  2 -
 .../tamaya/TestEnvironmentManagerSingleton.java |  6 ---
 .../core/config/AbstractConfiguration.java      | 15 +++---
 .../core/config/ConfigurationBuilder.java       | 19 ++++---
 .../tamaya/core/config/MappedConfiguration.java | 19 ++++---
 .../tamaya/core/env/BuildableEnvironment.java   |  1 -
 .../core/env/ConfiguredSystemProperties.java    | 31 ++++++++----
 .../org/apache/tamaya/core/internal/Utils.java  |  3 +-
 ...DefaultConfigurationManagerSingletonSpi.java | 50 +++++++++---------
 .../config/WeakConfigListenerManager.java       | 20 --------
 .../internal/el/SystemPropertyResolver.java     |  5 +-
 ...DependentApplicationEnvironmentProvider.java | 27 +++++-----
 ...ssLoaderDependentEarEnvironmentProvider.java |  4 +-
 .../env/InitialEnvironmentProvider.java         | 13 +++--
 .../internal/env/SingleEnvironmentManager.java  |  1 -
 .../core/internal/format/PropertiesFormat.java  |  1 +
 .../internal/format/PropertiesXmlFormat.java    |  3 +-
 .../internal/inject/ConfigurationInjector.java  |  3 +-
 .../core/internal/logging/Log4j2Logger.java     |  2 +-
 .../core/internal/resources/io/ClassUtils.java  | 12 ++---
 .../resources/io/InputStreamResource.java       |  1 -
 .../core/internal/resources/io/StringUtils.java |  8 ---
 .../core/properties/AbstractPropertySource.java | 15 ++++--
 .../properties/DelegatingPropertySource.java    |  1 -
 .../core/properties/FreezedPropertySource.java  | 14 ++++--
 .../properties/IntersectingPropertySource.java  |  7 +--
 .../properties/PathBasedPropertySource.java     |  3 +-
 .../core/properties/PropertySourceBuilder.java  | 22 ++++----
 .../core/properties/PropertySourceFactory.java  | 19 ++++---
 .../properties/ReplacingPropertySource.java     |  1 -
 .../core/properties/URLBasedPropertySource.java |  3 +-
 .../apache/tamaya/core/resource/Resource.java   |  2 -
 .../tamaya/core/spi/EnvironmentProvider.java    |  5 +-
 ...tionManagerSingletonSpiSingletonSpiTest.java |  5 +-
 .../java/org/apache/tamaya/JavaOneDemo.java     | 12 ++---
 .../env/ConfiguredSystemPropertiesTest.java     |  7 ++-
 .../internal/MutableTestConfigProvider.java     | 16 +++---
 .../samples/annotations/ConfiguredTest.java     |  9 ++--
 .../simple/SimplePropertiesAndCLISample.java    | 13 ++---
 .../apache/tamaya/ucs/UC1ReadProperties.java    | 28 ++++++-----
 .../apache/tamaya/ucs/UC2CombineProperties.java |  7 +--
 docs/pom.xml                                    | 53 ++++++++++++++++++--
 docs/src/main/asciidoc/example/example.adoc     | 15 +++++-
 .../integration/cdi/ConfigurationExtension.java |  2 +-
 pom.xml                                         | 15 ++++++
 48 files changed, 294 insertions(+), 240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/config/AbstractConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/config/ConfigurationBuilder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/Utils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
index e3e0bba,d3551e7..d4d2f1d
--- a/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/config/DefaultConfigurationManagerSingletonSpi.java
@@@ -18,24 -18,29 +18,38 @@@
   */
  package org.apache.tamaya.core.internal.config;
  
- import org.apache.tamaya.*;
+ import java.lang.reflect.Proxy;
+ import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.List;
+ import java.util.Map;
+ import java.util.Optional;
+ import java.util.concurrent.ConcurrentHashMap;
+ import java.util.function.Consumer;
+ import java.util.function.Predicate;
+ 
+ import org.apache.tamaya.AggregationPolicy;
+ import org.apache.tamaya.ConfigChangeSet;
+ import org.apache.tamaya.ConfigException;
+ import org.apache.tamaya.Configuration;
+ import org.apache.tamaya.PropertySource;
  import org.apache.tamaya.core.internal.el.DefaultExpressionEvaluator;
 +import org.apache.tamaya.core.internal.inject.ConfigTemplateInvocationHandler;
  import org.apache.tamaya.core.internal.inject.ConfigurationInjector;
  import org.apache.tamaya.core.properties.PropertySourceBuilder;
  import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
  import org.apache.tamaya.core.spi.ExpressionEvaluator;
 +
- import org.apache.tamaya.spi.ServiceContext;
  import org.apache.tamaya.spi.ConfigurationManagerSingletonSpi;
+ import org.apache.tamaya.spi.ServiceContext;
  
 +import java.lang.annotation.Annotation;
 +import java.lang.reflect.Proxy;
 +import java.util.*;
 +import java.util.concurrent.ConcurrentHashMap;
 +import java.util.function.Consumer;
 +import java.util.function.Predicate;
 +
  
  /**
   * Default SPI that implements the behaviour of {@link org.apache.tamaya.spi.ConfigurationManagerSingletonSpi}.
@@@ -72,34 -93,28 +87,20 @@@ public class DefaultConfigurationManage
      }
  
      /**
 -     * Creates a proxy implementing the given target interface.
       *
 -     * @param config the configuration to be used for providing values.
 -     * @param type   the target interface.
 -     * @param <T>    the target interface type.
 -     * @return the corresponding implementing proxy, never null.
 +     * @param instance the instance with configuration annotations, not null.
 +     * @param configurations the configurations to be used for evaluating the values for
injection into {@code instance}.
 +     *                If no items are passed, the default configuration is used.
       */
 -    private <T> T createAdapterProxy(Configuration config, Class<T> type) {
 -        ClassLoader cl = Optional.ofNullable(Thread.currentThread()
 -                .getContextClassLoader()).orElse(getClass().getClassLoader());
 -        return (T) Proxy.newProxyInstance(cl, new Class[]{type}, new ConfigTemplateInvocationHandler(type,
config));
 -    }
 -
      @Override
 -    public void configure(Object instance) {
 -        ConfigurationInjector.configure(instance);
 +    public void configure(Object instance, Configuration... configurations) {
 +        ConfigurationInjector.configure(instance, configurations);
      }
  
-     private String getConfigId(Annotation... qualifiers) {
-         if (qualifiers == null || qualifiers.length == 0) {
-             return "";
-         }
-         StringBuilder b = new StringBuilder();
-         for (Annotation annot : qualifiers) {
-             b.append('[');
-             b.append(annot.annotationType().getName());
-             b.append(':');
-             b.append(annot.toString());
-             b.append(']');
-         }
-         return b.toString();
-     }
  
      @Override
 -    public String evaluateValue(Configuration config, String expression) {
 -        return expressionEvaluator.evaluate(expression);
 +    public String evaluateValue(String expression, Configuration... configurations) {
 +        return expressionEvaluator.evaluate(expression, configurations);
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/el/SystemPropertyResolver.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/tamaya/core/internal/el/SystemPropertyResolver.java
index ef1ffc6,cf60a52..c384a1d
--- a/core/src/main/java/org/apache/tamaya/core/internal/el/SystemPropertyResolver.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/el/SystemPropertyResolver.java
@@@ -18,14 -18,13 +18,13 @@@
   */
  package org.apache.tamaya.core.internal.el;
  
+ import java.util.Optional;
+ 
  import org.apache.tamaya.ConfigException;
- import org.apache.tamaya.Configuration;
  import org.apache.tamaya.core.spi.ExpressionResolver;
  
- import java.util.*;
- 
  /**
 - * Created by Anatole on 28.09.2014.
 + * Property resolver implementation that interprets the resolver expression as system property
name.
   */
  public final class SystemPropertyResolver implements ExpressionResolver{
  

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/inject/ConfigurationInjector.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/tamaya/core/internal/inject/ConfigurationInjector.java
index 026b4e0,ccc8251..1345625
--- a/core/src/main/java/org/apache/tamaya/core/internal/inject/ConfigurationInjector.java
+++ b/core/src/main/java/org/apache/tamaya/core/internal/inject/ConfigurationInjector.java
@@@ -31,13 -30,8 +32,13 @@@ public final class ConfigurationInjecto
  
      private static final ConfigurationInjector INSTANCE = new ConfigurationInjector();
  
-     private Map<Class, ConfiguredType> configuredTypes = new ConcurrentHashMap<>();
+ 	private Map<Class, ConfiguredType> configuredTypes = new ConcurrentHashMap<>();
  
 +    /**
 +     * Extract the configuration annotation config and registers it per class, for later
reuse.
 +     * @param type the type to be configured.
 +     * @return the configured type registered.
 +     */
      public static ConfiguredType registerType(Class<?> type){
          if (!ConfiguredType.isConfigured(type)) {
              return null;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/resources/io/ClassUtils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/internal/resources/io/StringUtils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/properties/AbstractPropertySource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/properties/PropertySourceBuilder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertySource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/main/java/org/apache/tamaya/core/resource/Resource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/test/java/org/apache/tamaya/internal/MutableTestConfigProvider.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/test/java/org/apache/tamaya/samples/annotations/ConfiguredTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
index d794eff,61785ac..80ec280
--- a/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
+++ b/core/src/test/java/org/apache/tamaya/ucs/UC1ReadProperties.java
@@@ -32,8 -23,19 +23,19 @@@ import static org.junit.Assert.assertEq
  import static org.junit.Assert.assertFalse;
  import static org.junit.Assert.assertNotNull;
  
+ import java.util.Map;
+ import java.util.stream.Collectors;
+ 
+ import org.apache.tamaya.AggregationPolicy;
+ import org.apache.tamaya.Configuration;
+ import org.apache.tamaya.MetaInfo;
+ import org.apache.tamaya.PropertySource;
+ import org.apache.tamaya.core.config.ConfigFunctions;
+ import org.apache.tamaya.core.properties.PropertySourceBuilder;
+ import org.junit.Test;
+ 
  /**
 - * Configuration is organized as key/value pairs. This basically can be modeled as {@code
Map<String,String>}
 + * Configuration is organized as key/keys pairs. This basically can be modeled as {@code
Map<String,String>}
   * Configuration should be as simple as possible. A {@code Map<String,String>} instance
has methods that may not
   * be used in many use cases and/or are not easy to implement. Currently the following functionality
   * must be supported:

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f8c91031/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
index ccb4909,73f475f..ba522a7
--- a/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
+++ b/core/src/test/java/org/apache/tamaya/ucs/UC2CombineProperties.java
@@@ -22,10 -25,8 +25,8 @@@ import org.apache.tamaya.PropertySource
  import org.apache.tamaya.core.properties.PropertySourceBuilder;
  import org.junit.Test;
  
- import static junit.framework.TestCase.assertTrue;
- 
  /**
 - * Configuration is organized as key/value pairs. This basically can be modeled as {@code
Map<String,String>}
 + * Configuration is organized as key/keys pairs. This basically can be modeled as {@code
Map<String,String>}
   * Configuration should be as simple as possible. Advanced use cases can often easily implemented
by combining
   * multiple property maps and applying hereby some combination policy. This test class demonstrates
the different
   * options Tamaya is providing and the according mechanisms.


Mime
View raw message