geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject svn commit: r1806653 - /geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java
Date Tue, 29 Aug 2017 23:12:32 GMT
Author: johndament
Date: Tue Aug 29 23:12:31 2017
New Revision: 1806653

URL: http://svn.apache.org/viewvc?rev=1806653&view=rev
Log:
GERONIMO-6580 - Allow a user to instantiate system properties, rather than rely on a system
property.

Modified:
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java?rev=1806653&r1=1806652&r2=1806653&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/configsource/SystemPropertyConfigSource.java
Tue Aug 29 23:12:31 2017
@@ -24,6 +24,7 @@ import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.Vetoed;
 import java.util.Map;
 
+import static java.lang.Boolean.valueOf;
 import static java.util.function.Function.identity;
 import static java.util.stream.Collectors.toMap;
 
@@ -35,10 +36,15 @@ import static java.util.stream.Collector
 @Typed
 @Vetoed
 public class SystemPropertyConfigSource extends BaseConfigSource {
+    private static final String COPY_PROPERTY = "org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy";
     private final Map<String, String> instance;
 
     public SystemPropertyConfigSource() {
-        instance = "true".equalsIgnoreCase(System.getProperty("org.apache.geronimo.config.configsource.SystemPropertyConfigSource.copy",
"true")) ?
+        this(valueOf(System.getProperty(COPY_PROPERTY, "true")));
+    }
+
+    public SystemPropertyConfigSource(boolean copy) {
+        instance = copy ?
                 System.getProperties().stringPropertyNames().stream().collect(toMap(identity(),
System::getProperty)) :
                 Map.class.cast(System.getProperties());
         initOrdinal(400);



Mime
View raw message