tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [1/2] incubator-tamaya-sandbox git commit: Rewrite/adaptation based on JSR API.
Date Wed, 03 Jan 2018 08:37:35 GMT
Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/configjsr [created] f7037fbdc


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirConfigSourceProvider.java
----------------------------------------------------------------------
diff --git a/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirConfigSourceProvider.java
b/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirConfigSourceProvider.java
new file mode 100644
index 0000000..8da14ca
--- /dev/null
+++ b/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirConfigSourceProvider.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tamaya.propertysources;
+
+
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.format.MappedConfigurationDataConfigSource;
+import org.apache.tamaya.resource.AbstractPathConfigSourceProvider;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A property provider implementation that tries to read all files in a directory as
+ * configuration.
+ */
+public class ConfigDirConfigSourceProvider extends AbstractPathConfigSourceProvider {
+
+    public ConfigDirConfigSourceProvider() {
+        super(getConfigLocation());
+    }
+
+    private static String getConfigLocation() {
+        String location = System.getProperty("configdir");
+        if (location == null) {
+            location = "./config";
+        }
+        if (!location.endsWith("/")) {
+            location += "/";
+        }
+        if (!location.startsWith("file:")) {
+            location = "file:" + location;
+        }
+        return location + "**/*.*";
+    }
+
+    @Override
+    protected Collection<PropertySource> getPropertySources(URL url) {
+        try {
+            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
+            if (config == null) {
+                Logger.getLogger(getClass().getName()).log(Level.INFO,
+                        "Failed to read configuration from " + url);
+                return Collections.emptySet();
+            }
+            return asCollection(new MappedConfigurationDataConfigSource(config));
+        } catch (Exception e) {
+            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
+                    "Failed to read configuration from " + url, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private Collection<PropertySource> asCollection(PropertySource propertySource)
{
+        List<PropertySource> result = new ArrayList<>(1);
+        result.add(propertySource);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirPropertySourceProvider.java
b/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirPropertySourceProvider.java
deleted file mode 100644
index 19a7dfb..0000000
--- a/propertysources/src/main/java/org/apache/tamaya/propertysources/ConfigDirPropertySourceProvider.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tamaya.propertysources;
-
-
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationFormats;
-import org.apache.tamaya.format.MappedConfigurationDataPropertySource;
-import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A property provider implementation that tries to read all files in a directory as
- * configuration.
- */
-public class ConfigDirPropertySourceProvider extends AbstractPathPropertySourceProvider {
-
-    public ConfigDirPropertySourceProvider() {
-        super(getConfigLocation());
-    }
-
-    private static String getConfigLocation() {
-        String location = System.getProperty("configdir");
-        if (location == null) {
-            location = "./config";
-        }
-        if (!location.endsWith("/")) {
-            location += "/";
-        }
-        if (!location.startsWith("file:")) {
-            location = "file:" + location;
-        }
-        return location + "**/*.*";
-    }
-
-    @Override
-    protected Collection<PropertySource> getPropertySources(URL url) {
-        try {
-            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
-            if (config == null) {
-                Logger.getLogger(getClass().getName()).log(Level.INFO,
-                        "Failed to read configuration from " + url);
-                return Collections.emptySet();
-            }
-            return asCollection(new MappedConfigurationDataPropertySource(config));
-        } catch (Exception e) {
-            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
-                    "Failed to read configuration from " + url, e);
-            return Collections.emptySet();
-        }
-    }
-
-    private Collection<PropertySource> asCollection(PropertySource propertySource)
{
-        List<PropertySource> result = new ArrayList<>(1);
-        result.add(propertySource);
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigConfigSourceProvider.java
----------------------------------------------------------------------
diff --git a/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigConfigSourceProvider.java
b/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigConfigSourceProvider.java
new file mode 100644
index 0000000..48fd563
--- /dev/null
+++ b/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigConfigSourceProvider.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tamaya.propertysources;
+
+
+import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.ConfigurationFormats;
+import org.apache.tamaya.format.MappedConfigurationDataConfigSource;
+import org.apache.tamaya.resource.AbstractPathConfigSourceProvider;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Property source provider that reads all resources from {@code META-INF/config/**}
+ * into configuration sources..
+ */
+public class MetainfConfigConfigSourceProvider extends AbstractPathConfigSourceProvider {
+
+    public MetainfConfigConfigSourceProvider() {
+        super("classpath:META-INF/config/**/*.*");
+    }
+
+    @Override
+    protected Collection<PropertySource> getPropertySources(URL url) {
+        try {
+            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
+            return asCollection(new MappedConfigurationDataConfigSource(config));
+        } catch (Exception e) {
+            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
+                    "Failed to read configuration from " + url, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private Collection<PropertySource> asCollection(PropertySource propertySource)
{
+        List<PropertySource> result = new ArrayList<>(1);
+        result.add(propertySource);
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProvider.java
b/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProvider.java
deleted file mode 100644
index fe5759f..0000000
--- a/propertysources/src/main/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tamaya.propertysources;
-
-
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationFormats;
-import org.apache.tamaya.format.MappedConfigurationDataPropertySource;
-import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Property source provider that reads all resources from {@code META-INF/config/**}
- * into configuration sources..
- */
-public class MetainfConfigPropertySourceProvider extends AbstractPathPropertySourceProvider
{
-
-    public MetainfConfigPropertySourceProvider() {
-        super("classpath:META-INF/config/**/*.*");
-    }
-
-    @Override
-    protected Collection<PropertySource> getPropertySources(URL url) {
-        try {
-            ConfigurationData config = ConfigurationFormats.readConfigurationData(url);
-            return asCollection(new MappedConfigurationDataPropertySource(config));
-        } catch (Exception e) {
-            Logger.getLogger(getClass().getName()).log(Level.SEVERE,
-                    "Failed to read configuration from " + url, e);
-            return Collections.emptySet();
-        }
-    }
-
-    private Collection<PropertySource> asCollection(PropertySource propertySource)
{
-        List<PropertySource> result = new ArrayList<>(1);
-        result.add(propertySource);
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/propertysources/src/test/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProviderTest.java
----------------------------------------------------------------------
diff --git a/propertysources/src/test/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProviderTest.java
b/propertysources/src/test/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProviderTest.java
index 0250ff6..541b404 100644
--- a/propertysources/src/test/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProviderTest.java
+++ b/propertysources/src/test/java/org/apache/tamaya/propertysources/MetainfConfigPropertySourceProviderTest.java
@@ -29,7 +29,7 @@ public class MetainfConfigPropertySourceProviderTest {
 
     @Test
     public void getPropertySources_Default() throws Exception {
-        MetainfConfigPropertySourceProvider provider = new MetainfConfigPropertySourceProvider();
+        MetainfConfigConfigSourceProvider provider = new MetainfConfigConfigSourceProvider();
         assertNotNull(provider.getPropertySources());
         // TODO add test for containing property sources.
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/remote/pom.xml
----------------------------------------------------------------------
diff --git a/remote/pom.xml b/remote/pom.xml
index 37f2bf5..4f82181 100644
--- a/remote/pom.xml
+++ b/remote/pom.xml
@@ -33,11 +33,6 @@ under the License.
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
             <version>3.1.0</version>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/uom/pom.xml
----------------------------------------------------------------------
diff --git a/uom/pom.xml b/uom/pom.xml
index 8b29c85..2103499 100644
--- a/uom/pom.xml
+++ b/uom/pom.xml
@@ -31,12 +31,6 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
             <artifactId>tamaya-core</artifactId>
             <version>${project.parent.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/usagetracker/pom.xml
----------------------------------------------------------------------
diff --git a/usagetracker/pom.xml b/usagetracker/pom.xml
index 06cb59a..c1b00ff 100644
--- a/usagetracker/pom.xml
+++ b/usagetracker/pom.xml
@@ -36,11 +36,6 @@ under the License.
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
             <artifactId>tamaya-core</artifactId>
             <version>${project.parent.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/validation/pom.xml
----------------------------------------------------------------------
diff --git a/validation/pom.xml b/validation/pom.xml
index 870bcaa..58859c5 100644
--- a/validation/pom.xml
+++ b/validation/pom.xml
@@ -35,11 +35,6 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
             <artifactId>tamaya-core</artifactId>
             <version>${project.parent.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f7037fbd/vertx/pom.xml
----------------------------------------------------------------------
diff --git a/vertx/pom.xml b/vertx/pom.xml
index ede9c64..0348fd5 100644
--- a/vertx/pom.xml
+++ b/vertx/pom.xml
@@ -40,11 +40,6 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
-            <artifactId>tamaya-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tamaya</groupId>
             <artifactId>tamaya-core</artifactId>
             <version>${project.parent.version}</version>
             <scope>test</scope>


Mime
View raw message