geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1794191 - in /geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config: ConfigImpl.java DefaultConfigBuilder.java DefaultConfigProvider.java
Date Sun, 07 May 2017 10:23:48 GMT
Author: struberg
Date: Sun May  7 10:23:48 2017
New Revision: 1794191

URL: http://svn.apache.org/viewvc?rev=1794191&view=rev
Log:
adopt to latest mp-config api changes

Modified:
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java?rev=1794191&r1=1794190&r2=1794191&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
Sun May  7 10:23:48 2017
@@ -133,7 +133,7 @@ public class ConfigImpl implements Confi
     private <T> Converter getConverter(Class<T> asType) {
         Converter converter = converters.get(asType);
         if (converter == null) {
-            throw new UnsupportedOperationException("No Converter registered for class "
+ asType);
+            throw new IllegalArgumentException("No Converter registered for class " + asType);
         }
         return converter;
     }

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java?rev=1794191&r1=1794190&r2=1794191&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
Sun May  7 10:23:48 2017
@@ -47,6 +47,7 @@ public class DefaultConfigBuilder implem
     private final List<Converter<?>> converters = new ArrayList<>();
     private boolean ignoreDefaultSources = true;
     private boolean ignoreDiscoveredSources = true;
+    private boolean ignoreDiscoveredConverters = true;
 
     @Override
     public ConfigBuilder addDefaultSources() {
@@ -79,6 +80,12 @@ public class DefaultConfigBuilder implem
     }
 
     @Override
+    public ConfigBuilder addDiscoveredConverters() {
+        ignoreDiscoveredConverters = false;
+        return this;
+    }
+
+    @Override
     public Config build() {
         List<ConfigSource> configSources = new ArrayList<>();
          if (forClassLoader == null) {
@@ -105,8 +112,10 @@ public class DefaultConfigBuilder implem
                             .forEach(configSource -> configSources.add(configSource)));
         }
 
-        ServiceLoader<Converter> converterLoader = ServiceLoader.load(Converter.class,
forClassLoader);
-        converterLoader.forEach(converter -> converters.add(converter));
+        if (!ignoreDiscoveredConverters) {
+            ServiceLoader<Converter> converterLoader = ServiceLoader.load(Converter.class,
forClassLoader);
+            converterLoader.forEach(converter -> converters.add(converter));
+        }
 
         ConfigImpl config = new ConfigImpl();
         config.addConfigSources(configSources);

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java?rev=1794191&r1=1794190&r2=1794191&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigProvider.java
Sun May  7 10:23:48 2017
@@ -55,7 +55,11 @@ public class DefaultConfigProvider exten
             synchronized (DefaultConfigProvider.class) {
                 config = existingConfig(forClassLoader);
                 if (config == null) {
-                    config = getBuilder().forClassLoader(forClassLoader).addDefaultSources().addDiscoveredSources().build();
+                    config = getBuilder().forClassLoader(forClassLoader)
+                            .addDefaultSources()
+                            .addDiscoveredSources()
+                            .addDiscoveredConverters()
+                            .build();
                     registerConfig(config, forClassLoader);
                 }
             }



Mime
View raw message