TAMAYA-321 Add ConfigurationBuilder to core API.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/27c0d76b Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/27c0d76b Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/27c0d76b Branch: refs/heads/master Commit: 27c0d76bb0b3bc5b5a2df337289fcbcfbee48218 Parents: b9ce149 Author: Anatole Tresch <anat...@apache.org> Authored: Sun Nov 26 23:51:15 2017 +0100 Committer: Anatole Tresch <anat...@apache.org> Committed: Sun Nov 26 23:51:15 2017 +0100 ---------------------------------------------------------------------- .../examples/minimal/TestConfigProvider.java | 73 -------------------- 1 file changed, 73 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/27c0d76b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/TestConfigProvider.java ---------------------------------------------------------------------- diff --git a/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/TestConfigProvider.java b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/TestConfigProvider.java deleted file mode 100644 index 632f886..0000000 --- a/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/TestConfigProvider.java +++ /dev/null @@ -1,73 +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.examples.minimal; - -import org.apache.tamaya.Configuration; -import org.apache.tamaya.core.internal.CoreConfigurationContextBuilder; -import org.apache.tamaya.spi.ConfigurationContext; -import org.apache.tamaya.spi.ConfigurationContextBuilder; -import org.apache.tamaya.spi.ConfigurationProviderSpi; - -/** - * Configuration provider that allows to set and reset a configuration - * different per thread. - */ -public class TestConfigProvider implements ConfigurationProviderSpi{ - - private ThreadLocal<Configuration> threadedConfig = new ThreadLocal<>(); - - @Override - public Configuration getConfiguration() { - Configuration config = threadedConfig.get(); - if(config!=null){ - return config; - } - config = createConfiguration(new CoreConfigurationContextBuilder() - .addDefaultPropertyFilters() - .addDefaultPropertySources() - .addDefaultPropertyConverters() - .build()); - threadedConfig.set(config); - return config; - } - - @Override - public Configuration createConfiguration(ConfigurationContext context) { - return null; - } - - @Override - public ConfigurationContextBuilder getConfigurationContextBuilder() { - return null; - } - - @Override - public void setConfiguration(Configuration config) { - if(config==null){ - threadedConfig.remove(); - }else { - threadedConfig.set(config); - } - } - - @Override - public boolean isConfigurationSettable() { - return false; - } -}