http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
----------------------------------------------------------------------
diff --git 
a/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java 
b/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
index b15d966..03ce7ea 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
@@ -18,139 +18,61 @@
  */
 package org.apache.tamaya.events;
 
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.ConfigQuery;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import javax.config.Config;
+import javax.config.spi.ConfigSource;
+import java.util.*;
+import java.util.function.UnaryOperator;
+
 
 /**
  * Created by Anatole on 24.03.2015.
  */
-public class TestConfigView implements ConfigOperator{
+public class TestConfigView implements UnaryOperator<Config>{
 
     private static final TestConfigView INSTANCE = new TestConfigView();
 
     private TestConfigView(){}
 
-    public static ConfigOperator of(){
+    public static TestConfigView of(){
         return INSTANCE;
     }
 
     @Override
-    public Configuration operate(final Configuration config) {
-        return new Configuration() {
+    public Config apply(final Config config) {
+        return new Config() {
             @Override
-            public Map<String, String> getProperties() {
-                Map<String, String> result = new HashMap<>();
-                for (Map.Entry<String, String> en : 
config.getProperties().entrySet()) {
-                    if (en.getKey().startsWith("test")) {
-                        result.put(en.getKey(), en.getValue());
+            public Iterable<String> getPropertyNames() {
+                Set<String> result = new HashSet<>();
+                for (String key: config.getPropertyNames()) {
+                    if (key.startsWith("test")) {
+                        result.add(key);
                     }
                 }
                 return result;
-//                return config.getProperties().entrySet().stream().filter(e 
-> e.getKey().startsWith("test")).collect(
-//                        Collectors.toMap(en -> en.getKey(), en -> 
en.getProperty()));
-            }
-
-            @Override
-            public Configuration with(ConfigOperator operator) {
-                return null;
-            }
-
-            @Override
-            public <T> T query(ConfigQuery<T> query) {
-                return null;
-            }
-
-            @Override
-            public ConfigurationContext getContext() {
-                return config.getContext();
             }
 
             @Override
-            public String get(String key) {
-                return getProperties().get(key);
+            public Iterable<ConfigSource> getConfigSources() {
+                return config.getConfigSources();
             }
 
             @Override
-            public String getOrDefault(String key, String defaultValue) {
-                String val = get(key);
-                if(val==null){
-                    return defaultValue;
+            public <T> T getValue(String key, Class<T> type) {
+                if (key.startsWith("test")) {
+                    return config.getValue(key, type);
                 }
-                return val;
+                throw new NoSuchElementException(key);
             }
 
             @Override
-            public <T> T getOrDefault(String key, Class<T> type, T 
defaultValue) {
-                T val = get(key, type);
-                if(val==null){
-                    return defaultValue;
+            public <T> Optional<T> getOptionalValue(String key, Class<T> type) 
{
+                if (key.startsWith("test")) {
+                    return config.getOptionalValue(key, type);
                 }
-                return val;
+                return Optional.empty();
             }
 
-            @SuppressWarnings("unchecked")
-                       @Override
-            public <T> T get(String key, Class<T> type) {
-                return (T) get(key, TypeLiteral.of(type));
-            }
-
-            /**
-             * Accesses the current String value for the given key and tries 
to convert it
-             * using the {@link org.apache.tamaya.spi.PropertyConverter} 
instances provided by the current
-             * {@link org.apache.tamaya.spi.ConfigurationContext}.
-             *
-             * @param key  the property's absolute, or relative path, e.g. 
@code
-             *             a/b/c/d.myProperty}.
-             * @param type The target type required, not null.
-             * @param <T>  the value type
-             * @return the converted value, never null.
-             */
-            @Override
-            public <T> T get(String key, TypeLiteral<T> type) {
-                String value = get(key);
-                if (value != null) {
-                    List<PropertyConverter<T>> converters = getContext()
-                            .getPropertyConverters(type);
-                    ConversionContext context = new ConversionContext.Builder(
-                            key,type).build();
-                    for (PropertyConverter<T> converter : converters) {
-                        try {
-                            T t = converter.convert(value, context);
-                            if (t != null) {
-                                return t;
-                            }
-                        } catch (Exception e) {
-                            Logger.getLogger(getClass().getName())
-                                    .log(Level.FINEST, "PropertyConverter: " + 
converter + " failed to convert value: "
-                                            + value, e);
-                        }
-                    }
-                    throw new ConfigException("Unparseable config value for 
type: " + type.getRawType().getName() + ": "
-                            + key + ", supportedFormats: " + 
context.getSupportedFormats());
-                }
-                return null;
-            }
-
-            @Override
-            public <T> T getOrDefault(String key, TypeLiteral<T> type, T 
defaultValue) {
-                T val = get(key, type);
-                if(val==null){
-                    return defaultValue;
-                }
-                return val;
-            }
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/FileChangeListener.java
----------------------------------------------------------------------
diff --git 
a/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/FileChangeListener.java
 
b/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/FileChangeListener.java
index 9b6b93a..e0d67f5 100644
--- 
a/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/FileChangeListener.java
+++ 
b/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/FileChangeListener.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tamaya.events.folderobserver;
 
-import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.events.ConfigSourceChange;
 
 import java.io.IOException;
 import java.nio.file.FileSystem;
@@ -35,7 +35,7 @@ import java.util.logging.Logger;
 
 /**
  * Class that has the responsibility to watch the folder and then publish the 
changes to a
- * {@link org.apache.tamaya.events.PropertySourceChange}.
+ * {@link ConfigSourceChange}.
  * @see ObservingPropertySourceProvider
  * This listener will wait to events and wait to one second to watch again.
  * <p>If new file was created or modified will commit from this file.</p>
@@ -128,7 +128,7 @@ class FileChangeListener implements Runnable {
     /**
      * Exception if file listening fails.
      */
-    static class FileChangeListenerException extends ConfigException {
+    static class FileChangeListenerException extends IllegalStateException {
         /** Serialversion UID. */
         private static final long serialVersionUID = -8965486770881001513L;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
----------------------------------------------------------------------
diff --git 
a/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
 
b/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
index c821d43..30ff4b8 100644
--- 
a/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
+++ 
b/modules/events/src/test/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
@@ -39,21 +39,21 @@ import java.util.concurrent.Executors;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spisupport.propertysource.BasePropertySource;
+import org.apache.tamaya.base.configsource.BaseConfigSource;
+import org.apache.tamaya.events.ConfigSourceChange;
+
+import javax.config.spi.ConfigSource;
+import javax.config.spi.ConfigSourceProvider;
 
 /**
  * This implementation runs in a folder taking up all files compatible with 
the given
  * ConfigurationFormats. When a file is added, deleted or modified the 
PropertySourceProvider
  * will adapt the changes automatically and trigger according
- * {@link org.apache.tamaya.events.PropertySourceChange} events.
+ * {@link ConfigSourceChange} events.
  * The default folder is META-INF/config, but you can change it via an 
absolute path in the
  * "-Dtamaya.configdir" parameter.
  */
-public class ObservingPropertySourceProvider implements 
PropertySourceProvider, FileChangeObserver {
+public class ObservingPropertySourceProvider implements ConfigSourceProvider, 
FileChangeObserver {
     /**
      * The logger.
      */
@@ -61,7 +61,7 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
     /**
      * The current active property sources of this provider.
      */
-    private final List<PropertySource> propertySources = 
Collections.synchronizedList(new LinkedList<PropertySource>());
+    private final List<ConfigSource> configSources = 
Collections.synchronizedList(new LinkedList<ConfigSource>());
     /**
      * The thread pool used.
      */
@@ -77,8 +77,8 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
             directory = getDirectory();
         }
         if (directory!=null){
-            synchronized (this.propertySources) {
-                this.propertySources.addAll(readConfiguration(directory));
+            synchronized (this.configSources) {
+                this.configSources.addAll(readConfiguration(directory));
             }
             final Runnable runnable = new FileChangeListener(directory, this);
             executor.execute(runnable);
@@ -92,12 +92,12 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
      *
      * @param directory the target directory, not null.
      */
-    private List<PropertySource> readConfiguration(Path directory) {
-        final List<PropertySource> result = new ArrayList<>();
+    private List<ConfigSource> readConfiguration(Path directory) {
+        final List<ConfigSource> result = new ArrayList<>();
         try {
-            synchronized (propertySources) {
+            synchronized (configSources) {
                 for (final Path path : Files.newDirectoryStream(directory, 
"*")) {
-                    result.addAll(getPropertySources(path));
+                    result.addAll(getConfigSources(path));
                 }
                 return result;
             }
@@ -113,12 +113,12 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
      * @param file source of the property sources.
      * @return property sources from the given file.
      */
-    protected Collection<PropertySource> getPropertySources(final Path file) {
-        return Arrays.asList(new PropertySource[]{new 
BasePropertySource(file.toString()) {
-            private final Map<String,PropertyValue> props = 
readProperties(file);
+    protected Collection<ConfigSource> getConfigSources(final Path file) {
+        return Arrays.asList(new ConfigSource[]{new 
BaseConfigSource(file.toString()) {
+            private final Map<String,String> props = readProperties(file);
 
             @Override
-            public Map<String, PropertyValue> getProperties() {
+            public Map<String, String> getProperties() {
                 return props;
             }
         }});
@@ -130,14 +130,14 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
      * @param file the file, not null.
      * @return properties as read from the given file.
      */
-    protected static Map<String,PropertyValue> readProperties(Path file) {
+    protected static Map<String,String> readProperties(Path file) {
         try (InputStream is = file.toUri().toURL().openStream()){
             final Properties props = new Properties();
                 props.load(is);
-            final Map<String,PropertyValue> result = new HashMap<>();
+            final Map<String,String> result = new HashMap<>();
             for(final Map.Entry<Object,Object> en:props.entrySet()){
                 String key = String.valueOf(en.getKey());
-                result.put(key, PropertyValue.of(key, 
String.valueOf(en.getValue()), file.toString()));
+                result.put(key, en.getValue().toString());
             }
             return result;
         } catch (final Exception e) {
@@ -166,7 +166,7 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
             try {
                 return Paths.get(resource.toURI());
             } catch (final URISyntaxException e) {
-                throw new ConfigException("An error to find the directory to 
watch", e);
+                throw new IllegalArgumentException("An error to find the 
directory to watch", e);
             }
         }
         return null;
@@ -175,17 +175,17 @@ public class ObservingPropertySourceProvider implements 
PropertySourceProvider,
 
     @Override
     public void directoryChanged(Path directory) {
-        synchronized (this.propertySources) {
-            propertySources.clear();
-            final Collection<PropertySource> sourcesRead = 
readConfiguration(directory);
-            this.propertySources.addAll(sourcesRead);
+        synchronized (this.configSources) {
+            configSources.clear();
+            final Collection<ConfigSource> sourcesRead = 
readConfiguration(directory);
+            this.configSources.addAll(sourcesRead);
         }
     }
 
     @Override
-    public Collection<PropertySource> getPropertySources() {
-        synchronized (propertySources) {
-            return new ArrayList<>(this.propertySources);
+    public Collection<ConfigSource> getConfigSources(ClassLoader classLoader) {
+        synchronized (configSources) {
+            return new ArrayList<>(this.configSources);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserverTest.java
----------------------------------------------------------------------
diff --git 
a/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserverTest.java
 
b/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserverTest.java
index e0fa52b..31ff765 100644
--- 
a/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserverTest.java
+++ 
b/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserverTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tamaya.events.internal;
 
-import org.apache.tamaya.events.FrozenConfiguration;
+import org.apache.tamaya.events.FrozenConfig;
 import org.junit.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -67,9 +67,9 @@ public class DefaultConfigChangeObserverTest {
 
         observer.checkConfigurationUpdate();
 
-        FrozenConfiguration config1 = observer.getLastConfig();
+        FrozenConfig config1 = observer.getLastConfig();
         observer.checkConfigurationUpdate();
-        FrozenConfiguration config2 = observer.getLastConfig();
+        FrozenConfig config2 = observer.getLastConfig();
 
         assertThat(config1).describedAs("After the firt check last 
configuration must be set.")
                                             .isNotEqualTo(config2);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git 
a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
 
b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
index 9c2b9f6..b0d532a 100644
--- 
a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ 
b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -16,4 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-org.apache.tamaya.events.RandomPropertySource
+org.apache.tamaya.events.RandomConfigSource

Reply via email to