[07/10] incubator-tamaya git commit: TAMAYA-182: Fixed test issues.
TAMAYA-182: Fixed test issues. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/0ed18648 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/0ed18648 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/0ed18648 Branch: refs/heads/master Commit: 0ed186482faa265571ad178626613fe1765ee28c Parents: 4cfc2d3 aac361a Author: anatole <anat...@apache.org> Authored: Fri Oct 28 00:28:37 2016 +0200 Committer: anatole <anat...@apache.org> Committed: Fri Oct 28 00:28:37 2016 +0200 -- .../src/test/java/org/apache/tamaya/ConfigurationTest.java| 1 - .../test/java/org/apache/tamaya/core/ConfigurationTest.java | 7 --- .../core/propertysource/PropertiesFilePropertySourceTest.java | 2 +- .../tamaya/core/propertysource/SimplePropertySourceTest.java | 4 ++-- .../tamaya/core/provider/JavaConfigurationProviderTest.java | 2 +- 5 files changed, 4 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0ed18648/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java --
[06/10] incubator-tamaya git commit: TAMAYA-182: Added Null check.
TAMAYA-182: Added Null check. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/4cfc2d31 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/4cfc2d31 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/4cfc2d31 Branch: refs/heads/master Commit: 4cfc2d31f02894414f3c3f94f0051592ccaeacb4 Parents: 76963e7 Author: anatole <anat...@apache.org> Authored: Fri Oct 28 00:27:31 2016 +0200 Committer: anatole <anat...@apache.org> Committed: Fri Oct 28 00:27:31 2016 +0200 -- .../tamaya/core/internal/DefaultConfigurationContextBuilder.java | 4 ++-- .../apache/tamaya/core/propertysource/SimplePropertySource.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4cfc2d31/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java index f3d823e..486fb05 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java @@ -172,7 +172,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB return this; } -public PropertySource getPropertySource(String name) { +private PropertySource getPropertySource(String name) { for(PropertySource ps:propertySources){ if(ps.getName().equals(name)){ return ps; @@ -357,7 +357,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB } -protected Map<TypeLiteral, Collection> getDefaultPropertyConverters() { +private Map<TypeLiteral, Collection> getDefaultPropertyConverters() { Map<TypeLiteral, Collection> result = new HashMap<>(); for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices( PropertyConverter.class)) { http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4cfc2d31/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java index e875d8c..bce68da 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java +++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java @@ -70,7 +70,7 @@ public class SimplePropertySource extends BasePropertySource { */ public SimplePropertySource(URL propertiesLocation) { super(0); -this.properties = load(propertiesLocation); +this.properties = load(Objects.requireNonNull(propertiesLocation)); this.name = propertiesLocation.toString(); }
[1/2] incubator-tamaya git commit: Added tests and bugfixes for Tamaya OSGI support.
Repository: incubator-tamaya Updated Branches: refs/heads/master 36c8ac241 -> 77850ea31 Added tests and bugfixes for Tamaya OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/05b6514e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/05b6514e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/05b6514e Branch: refs/heads/master Commit: 05b6514e4d9caacccd58a8ce0a73295f1da51962 Parents: 36c8ac2 Author: anatole <anat...@apache.org> Authored: Mon Dec 12 17:02:41 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 12 17:13:17 2016 +0100 -- pom.xml | 90 +--- 1 file changed, 55 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/05b6514e/pom.xml -- diff --git a/pom.xml b/pom.xml index 48ba0fb..2cc4d6b 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,7 @@ under the License. 1.7.20 3.0.4 +1.10.19 0.12 1.1 @@ -220,7 +221,7 @@ under the License. org.mockito mockito-core -1.10.19 +${mockito.version} test @@ -263,11 +264,6 @@ under the License. -org.mockito -mockito-core - - - rubygems asciidoctor-diagram ${asciidoctor-diagramm.version} @@ -456,6 +452,30 @@ under the License. +biz.aQute.bnd +bnd-maven-plugin +3.3.0 + + +ch.qos.logback +logback-core +1.1.3 + + +org.slf4j +slf4j-api +1.7.13 + + + + + +bnd-process + + + + + org.apache.maven.plugins maven-scm-publish-plugin 1.1 @@ -467,14 +487,6 @@ under the License. 3.4 true - org.apache.maven.wagon wagon-ssh @@ -684,27 +696,25 @@ under the License. - biz.aQute.bnd - bnd-maven-plugin - 3.3.0 - - - - bnd-process - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - +org.apache.maven.plugins +maven-compiler-plugin + +1.7 +1.7 + + + +biz.aQute.bnd +bnd-maven-plugin +3.3.0 + + + +bnd-process + + + + @@ -800,6 +810,16 @@ under the License. false + + +java8 + +[1.8,) + + +-Xdoclint:none + +
[2/2] incubator-tamaya git commit: Fixed registration issue with converters. Improved toString formatting.
Fixed registration issue with converters. Improved toString formatting. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/77850ea3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/77850ea3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/77850ea3 Branch: refs/heads/master Commit: 77850ea316369b3d259ffd174cc80bac3c47dedd Parents: 05b6514 Author: anatole <anat...@apache.org> Authored: Mon Dec 12 17:06:22 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 12 17:14:15 2016 +0100 -- buildconfigurations/pom.xml | 2 +- .../core/internal/DefaultConfiguration.java | 7 ++ .../internal/DefaultConfigurationContext.java | 103 --- .../DefaultConfigurationContextBuilder.java | 4 +- .../internal/DefaultConfigurationProvider.java | 3 +- .../core/internal/PropertyConverterManager.java | 2 +- .../core/ConfigurationContextBuilderTest.java | 8 +- .../DefaultConfigurationContextBuilderTest.java | 4 +- .../internal/PropertyConverterManagerTest.java | 15 +-- 9 files changed, 72 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77850ea3/buildconfigurations/pom.xml -- diff --git a/buildconfigurations/pom.xml b/buildconfigurations/pom.xml index 3973395..c53d8df 100644 --- a/buildconfigurations/pom.xml +++ b/buildconfigurations/pom.xml @@ -47,5 +47,5 @@ under the License. vote02-tamaya-0.2-incubating - + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77850ea3/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java index 1b37233..268d825 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java @@ -222,4 +222,11 @@ public class DefaultConfiguration implements Configuration { public ConfigurationContext getConfigurationContext() { return configurationContext; } + +@Override +public String toString() { +return "Configuration{\n " + +configurationContext + +'}'; +} } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77850ea3/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java index 280793a..c3031f0 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java @@ -81,33 +81,10 @@ public class DefaultConfigurationContext implements ConfigurationContext { propertySources.addAll(builder.propertySources); // now sort them according to their ordinal values immutablePropertySources = Collections.unmodifiableList(propertySources); -StringBuilder b= new StringBuilder(); -b.append("Registered " + immutablePropertySources.size() + " property sources: \n"); -b.append(" NAME [TYPE]\n"); -b.append(" ---\n"); -for(PropertySource ps: immutablePropertySources){ -b.append(" ").append(ps.getName()).append(" [").append(ps.getClass().getSimpleName()).append("],\n"); -} -if(b.length()>0) { -b.setLength(b.length() - 2); -} -LOG.info(b.toString()); -b.setLength(0); // as next step we pick up the PropertyFilters pretty much the same way List propertyFilters = new ArrayList<>(builder.getPropertyFilters()); immutablePropertyFilters = Collections.unmodifiableList(propertyFilters); -b.append("Registered " + immutablePropertyFilters.size() + " property filters: \n"); -b.append(" TYPE\n"); -b.append(" --\n"); -for(PropertyFilter pf: immutablePropertyFilters){ -
incubator-tamaya-extensions git commit: Synched parent pom with api/core version. Added constructors for programmatic use of config formats. Removed dependency of functions module from spi-support. Un
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master d672b2d99 -> 97141bc81 Synched parent pom with api/core version. Added constructors for programmatic use of config formats. Removed dependency of functions module from spi-support. Unified behaviour related to metadata for default datasources. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/97141bc8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/97141bc8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/97141bc8 Branch: refs/heads/master Commit: 97141bc817ba270885678d6d14c15fd9af51c89d Parents: d672b2d Author: anatole <anat...@apache.org> Authored: Mon Dec 12 17:09:14 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 12 17:09:14 2016 +0100 -- modules/formats/base/pom.xml| 5 ++ .../tamaya/format/ConfigurationFormats.java | 38 +++- .../MappedConfigurationDataPropertySource.java | 91 +++- .../yaml/CommonJSONTestCaseCollection.java | 9 +- modules/functions/pom.xml | 5 -- modules/pom.xml | 6 +- modules/spi-support/pom.xml | 2 +- .../tamaya/spisupport/CLIPropertySource.java| 2 +- .../tamaya/spisupport/DefaultConfiguration.java | 7 ++ .../spisupport/DefaultConfigurationContext.java | 65 +- pom.xml | 83 +- 11 files changed, 215 insertions(+), 98 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/97141bc8/modules/formats/base/pom.xml -- diff --git a/modules/formats/base/pom.xml b/modules/formats/base/pom.xml index 7af96a0..8e5643b 100644 --- a/modules/formats/base/pom.xml +++ b/modules/formats/base/pom.xml @@ -52,6 +52,11 @@ under the License. tamaya-spisupport ${project.version} + +org.apache.tamaya.ext +tamaya-functions +${project.version} + org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/97141bc8/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java -- diff --git a/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java b/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java index c6b85bf..4624538 100644 --- a/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java +++ b/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java @@ -124,6 +124,18 @@ public final class ConfigurationFormats { * @throws IOException if the resource cannot be read. */ public static ConfigurationData readConfigurationData(URL url, ConfigurationFormat... formats) throws IOException { +return readConfigurationData(url, Arrays.asList(formats)); +} + +/** + * Tries to read configuration data from a given URL, hereby explicitly trying all given formats in order. + * + * @param url the url from where to read, not null. + * @param formats the formats to try. + * @return the ConfigurationData read, or null. + * @throws IOException if the resource cannot be read. + */ +public static ConfigurationData readConfigurationData(URL url, Collection formats) throws IOException { return readConfigurationData(url.toString(), url.openStream(), formats); } @@ -133,7 +145,17 @@ public final class ConfigurationFormats { * @return the {@link org.apache.tamaya.format.ConfigurationData} of the files successfully decoded by the * given formats. */ -public static Collection getPropertySources(Collection urls, ConfigurationFormat... formats) { +public static Collection readConfigurationData(Collection urls, ConfigurationFormat... formats) { +return readConfigurationData(urls, formats); +} + +/** + * @param urlsthe urls from where to read, not null. + * @param formats the formats to try. + * @return the {@link org.apache.tamaya.format.ConfigurationData} of the files successfully decoded by the + * given formats. + */ +public static Collection readConfigurationData(Collection urls, Collection formats) { final List dataRead = new ArrayList<>(); for (final URL url : urls) { try { @@ -159,6 +181,20 @@ public final class ConfigurationFormats {
[5/5] incubator-tamaya-sandbox git commit: Added tests for OSGI support, simplified OSGI support. Implemented base functionality for metamodel support, including first testing.
Added tests for OSGI support, simplified OSGI support. Implemented base functionality for metamodel support, including first testing. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/afc19d0e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/afc19d0e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/afc19d0e Branch: refs/heads/master Commit: afc19d0e74cde66603dc3d440d6799b917efb815 Parents: f0dfa86 Author: anatole <anat...@apache.org> Authored: Mon Dec 12 17:12:06 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 12 17:12:06 2016 +0100 -- metamodel/pom.xml | 7 + .../org/apache/tamaya/metamodel/Context.java| 171 - .../metamodel/FilteredPropertySource.java | 166 + .../tamaya/metamodel/MetaConfiguration.java | 144 .../apache/tamaya/metamodel/MetaContext.java| 330 ++ .../apache/tamaya/metamodel/Refreshable.java| 32 + .../metamodel/RefreshablePropertySource.java| 150 + .../RefreshablePropertySourceProvider.java | 106 +++ .../tamaya/metamodel/dsl/MetaConfiguration.java | 122 .../metamodel/dsl/TamayaConfigurator.java | 234 --- .../metamodel/dsl/WrappedPropertySource.java| 127 .../DSLLoadingConfigurationProviderSpi.java | 81 --- .../NamedDSLPropertySourceProvider.java | 53 -- .../ResourceDSLPropertySourceProvider.java | 82 --- .../internal/CombinationPolicyReader.java | 61 ++ .../internal/ComponentConfigurator.java | 87 +++ .../metamodel/internal/ComponentFactory.java| 112 .../metamodel/internal/ContextReader.java | 66 ++ .../DSLLoadingConfigurationProviderSpi.java | 114 ...efaultRefreshablePropertySourceProvider.java | 72 -- .../metamodel/internal/FactoryManager.java | 140 .../internal/PropertyConverterReader.java | 88 +++ .../internal/PropertyFilterOrderingReader.java | 63 ++ .../internal/PropertyFilterReader.java | 83 +++ .../internal/PropertySourceOrderingReader.java | 64 ++ .../internal/PropertySourceReader.java | 103 +++ .../tamaya/metamodel/internal/Refreshable.java | 37 -- .../tamaya/metamodel/internal/SourceConfig.java | 466 ++--- .../internal/factories/CLIArgumentsFactory.java | 47 ++ .../factories/EnvPropertiesFactory.java | 46 ++ .../factories/FilePropertySourceFactory.java| 77 +++ .../ResourcePropertySourceFactory.java | 64 ++ .../ResourcePropertySourceProviderFactory.java | 115 .../factories/SysPropertiesFactory.java | 46 ++ .../factories/URLPropertySourceFactory.java | 152 + .../tamaya/metamodel/spi/ItemFactory.java | 51 ++ .../metamodel/spi/ItemFactoryManager.java | 145 .../metamodel/spi/MetaConfigurationReader.java | 8 +- .../metamodel/spi/PropertySourceFactory.java| 48 -- .../spi/PropertySourceProviderFactory.java | 49 -- ...maya.metamodel.spi.DSLPropertySourceProvider | 20 - .../org.apache.tamaya.metamodel.spi.ItemFactory | 26 + ...tamaya.metamodel.spi.MetaConfigurationReader | 26 + ...g.apache.tamaya.spi.ConfigurationProviderSpi | 3 +- .../resources/IntegrationTests/empty-config.xml | 24 + metamodel/src/test/resources/tamaya-config.xml | 73 ++- pom.xml | 657 ++- 47 files changed, 3529 insertions(+), 1509 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/pom.xml -- diff --git a/metamodel/pom.xml b/metamodel/pom.xml index 13c5c47..a103441 100644 --- a/metamodel/pom.xml +++ b/metamodel/pom.xml @@ -71,6 +71,13 @@ tamaya-formats ${project.version} + +org.apache.tamaya.ext +tamaya-resources +${project.version} +provided +true + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/Context.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/Context.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/Context.java deleted file mode 100644 index b4b65d2..000 --- a/metamodel/src/main/java/org/apache/tamaya/metamodel/Context.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work fo
[3/5] incubator-tamaya-sandbox git commit: Added tests for OSGI support, simplified OSGI support. Implemented base functionality for metamodel support, including first testing.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java new file mode 100644 index 000..4578640 --- /dev/null +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java @@ -0,0 +1,145 @@ +/* + * 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.metamodel.spi; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.ServiceContextManager; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Created by atsticks on 04.12.16. + */ +public final class ItemFactoryManager { + +private static final Logger LOG = Logger.getLogger(ItemFactoryManager.class.getName()); + +private Map> factoryRegistry = new ConcurrentHashMap<>(); + +private static ItemFactoryManager INSTANCE = new ItemFactoryManager(); + +private ItemFactoryManager(){ +} + +public static ItemFactoryManager getInstance(){ +return INSTANCE; +} + +public List getFactories(Class type){ +List factories = factoryRegistry.get(type); +if(factories==null){ +Collection allFactories = + ServiceContextManager.getServiceContext().getServices(ItemFactory.class); +for(ItemFactory fact:allFactories){ +registerItemFactory(fact); +} +} +factories = factoryRegistry.get(type); +if(factories==null){ +return Collections.emptyList(); +} +return List.class.cast(factories); +} + +public ItemFactory getFactory(Class type, String id) { +List factories = getFactories(type); +for(ItemFactory f:factories){ +if(id.equals(f.getName())){ +return f; +} +} +// try creating a new factory with the given id as fully qualified class name... +try{ +Class instanceType = (Class) Class.forName(id); +ItemFactory factory = new SimpleItemFactory(type, instanceType); +registerItemFactory(factory); +return factory; +}catch(Exception e){ +LOG.severe("Failed to create factory for configured class: " + type.getName() + +" and type: " + id); +return null; +} +} + +public void registerItemFactory(ItemFactory factory) { +List factories = factoryRegistry.get(factory.getType()); +if(factories==null){ +factories = new ArrayList<>(); +factoryRegistry.put(factory.getType(), factories); +} +factories.add(factory); +} + +private static class SimpleItemFactory implements ItemFactory { + +private Class type; +private Class instanceType; + +public SimpleItemFactory(Class type, Class instanceType) { +this.type = Objects.requireNonNull(type); +this.instanceType = Objects.requireNonNull(instanceType); +} + +@Override +public String getName() { +return getType().getName(); +} + +@Override +public I create(Map parameters) { +try { +return instanceType.newInstance(); +} catch (Exception e) { +LOG.log(Level.SEVERE, "Failed to create configured instance of type:" + instanceType, e); +return null; +} +} + +@Override +public Class getType() { +return type; +} + +@Override +public boolean equals(Object o) { +if (this == o) return true; +if (!(o instanceof SimpleItemFactory)) return false; +
[4/5] incubator-tamaya-sandbox git commit: Added tests for OSGI support, simplified OSGI support. Implemented base functionality for metamodel support, including first testing.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentFactory.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentFactory.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentFactory.java new file mode 100644 index 000..906b704 --- /dev/null +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentFactory.java @@ -0,0 +1,112 @@ +/* + * 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.metamodel.internal; + +import org.apache.tamaya.spi.ServiceContextManager; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Small helper class for loading of configured instances. + */ +public final class ComponentFactory { + +private Class type; +private MapserviceContext = new HashMap<>(); +private Set loaded = new HashSet<>(); + +/** + * Constructor. + * @param type the service type, not null. + */ +public ComponentFactory(Class type){ +this.type = Objects.requireNonNull(type); +for(T service: ServiceContextManager.getServiceContext().getServices(type)){ +serviceContext.put(service.getClass().getName(), service); +} +} + +/** + * Creates an instance of the given type based on a type configuration. + * Type hereby is + * + * A fully qualified class name + * A simple class name of a filter class registered with the current + * ServiceContext. + * + * @param identifier the configured type + * @return the component found, or null. + */ +public T getComponent(String identifier) +throws IllegalAccessException, InstantiationException { +T comp = this.serviceContext.get(identifier); +if(comp==null){ +for(Map.Entry en:serviceContext.entrySet()){ +if(en.getKey().endsWith("."+identifier)){ +comp = en.getValue(); +} +} +} +// Multiple instances: create a new instance using the parameterless constructor for all subsequent +// resolutions. +if(loaded.contains(comp.getClass().getName())){ +return (T)comp.getClass().newInstance(); +} +// Ensure that the next access will return a new instance. +loaded.add(comp.getClass().getName()); +return comp; +} + +public Collection loadInstances(NodeList nodeList) { +List items = new ArrayList<>(); +for(int i=0;i incubator-tamaya-sandbox git commit: Fixed OSGI support. Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master afc19d0e7 -> 6aa6bb751 Fixed OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/6aa6bb75 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/6aa6bb75 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/6aa6bb75 Branch: refs/heads/master Commit: 6aa6bb751f6968f3d68f3994ffbfc324e20800b9 Parents: afc19d0 Author: anatole <anat...@apache.org> Authored: Sun Dec 18 23:52:33 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Dec 18 23:52:33 2016 +0100 -- apache-commons/pom.xml | 24 --- camel/pom.xml | 12 -- configured-sysprops/pom.xml | 26 --- consul/pom.xml | 16 -- etcd/pom.xml| 17 -- hazelcast/pom.xml | 17 -- jodatime/pom.xml| 26 --- management/bnd.bnd | 2 + management/pom.xml | 17 -- metamodel/pom.xml | 21 --- .../tamaya/metamodel/dsl/IntegrationTest.java | 57 +++ osgi/bnd.bnd| 4 - osgi/common/bnd.bnd | 4 + osgi/common/pom.xml | 67 .../org/apache/tamaya/osgi/OSGIKarafTest.java | 115 - osgi/features/pom.xml | 65 ++- osgi/features/src/main/features/features.xml| 5 +- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 168 +++ .../META-INF/javaconfiguration.properties | 21 +++ .../test/resources/org.ops4j.pax.logging.cfg| 48 ++ osgi/pom.xml| 2 +- propertysources/pom.xml | 24 --- remote/pom.xml | 16 -- server/pom.xml | 24 --- tamaya-sandbox.iml | 9 +- ui/base/bnd.bnd | 5 + ui/events/bnd.bnd | 2 + ui/mutableconfig/bnd.bnd| 2 + usagetracker/pom.xml| 21 --- validation/pom.xml | 2 +- 30 files changed, 380 insertions(+), 459 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/apache-commons/pom.xml -- diff --git a/apache-commons/pom.xml b/apache-commons/pom.xml index 4486b29..4be8e5c 100644 --- a/apache-commons/pom.xml +++ b/apache-commons/pom.xml @@ -48,28 +48,4 @@ under the License. - - - -org.apache.felix -maven-bundle-plugin -true - - - -org.apache.tamaya, -org.apache.tamaya.spi, -org.apache.tamaya.format, -org.apache.commons, -javax.annotation, -* - - -org.apache.tamaya.integration.commons - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/camel/pom.xml -- diff --git a/camel/pom.xml b/camel/pom.xml index 806508e..0e06bd7 100644 --- a/camel/pom.xml +++ b/camel/pom.xml @@ -48,18 +48,6 @@ under the License. - -org.apache.felix -maven-bundle-plugin -true - - - -org.apache.tamaya.integration.camel - - - - http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/configured-sysprops/pom.xml -- diff --git a/configured-sysprops/pom.xml b/configured-sysprops/pom.xml index 780e8d8..980821b 100644 --- a/configured-sysprops/pom.xml +++ b/configured-sysprops/pom.xml @@ -30,32 +30,6 @@ under the License. Apache Tamaya Modules - Configured System Properties jar - - - -o
[1/3] incubator-tamaya git commit: Added missing import.
Repository: incubator-tamaya Updated Branches: refs/heads/master 4de9e8b41 -> f6cce93bf Added missing import. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/3d851c6c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/3d851c6c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/3d851c6c Branch: refs/heads/master Commit: 3d851c6c4b7560ccc563cbeb79cb4fef21e20522 Parents: 77850ea Author: anatole <anat...@apache.org> Authored: Sun Dec 18 15:04:23 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Dec 18 15:04:23 2016 +0100 -- .../apache/tamaya/core/internal/DefaultConfigurationContext.java| 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3d851c6c/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java index c3031f0..2272d54 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java @@ -25,6 +25,7 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder; import org.apache.tamaya.spi.PropertyConverter; import org.apache.tamaya.spi.PropertyFilter; import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; import org.apache.tamaya.spi.PropertyValueCombinationPolicy; import org.apache.tamaya.spi.ServiceContextManager;
[1/2] incubator-tamaya-extensions git commit: Fixed OSGI support.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 8b94067b6 -> 4a70f5309 Fixed OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/4a70f530 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/4a70f530 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/4a70f530 Branch: refs/heads/master Commit: 4a70f5309b055646ed20f18ad6dcb47689655082 Parents: ad8dfd8 Author: anatole <anat...@apache.org> Authored: Sun Dec 18 23:51:55 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Dec 18 23:54:31 2016 +0100 -- modules/injection/cdi-ee/pom.xml| 30 +-- modules/injection/cdi-se/pom.xml| 33 +--- modules/injection/injection-api/pom.xml | 18 --- modules/pom.xml | 81 modules/spring/pom.xml | 28 -- pom.xml | 7 ++- 6 files changed, 8 insertions(+), 189 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/cdi-ee/pom.xml -- diff --git a/modules/injection/cdi-ee/pom.xml b/modules/injection/cdi-ee/pom.xml index 8e3e3d3..89f05f9 100644 --- a/modules/injection/cdi-ee/pom.xml +++ b/modules/injection/cdi-ee/pom.xml @@ -28,7 +28,7 @@ under the License. tamaya-cdi Apache Tamaya Modules - Injection CDI -bundle +jar 1.6.2 @@ -43,34 +43,6 @@ under the License. 1.7.1 - - - -org.jacoco -jacoco-maven-plugin - - -prepare-agent - -prepare-agent - - - - - -org.apache.felix -maven-bundle-plugin -true - - - -org.apache.tamaya.integration.cdi - - - - - - org.apache.tamaya.ext http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/cdi-se/pom.xml -- diff --git a/modules/injection/cdi-se/pom.xml b/modules/injection/cdi-se/pom.xml index 0f2e93a..712c57c 100644 --- a/modules/injection/cdi-se/pom.xml +++ b/modules/injection/cdi-se/pom.xml @@ -28,7 +28,7 @@ under the License. tamaya-cdi-se Apache Tamaya Modules - Injection CDI (Direct) -bundle +jar 1.6.2 @@ -40,37 +40,6 @@ under the License. 1.1.0 - - - -org.jacoco -jacoco-maven-plugin - - -prepare-agent - -prepare-agent - - - - - -org.apache.felix -maven-bundle-plugin -true - - - -org.apache.tamaya.integration.cdi.config - - -org.apache.tamaya.integration.cdi.internal - - - - - - junit http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/injection-api/pom.xml -- diff --git a/modules/injection/injection-api/pom.xml b/modules/injection/injection-api/pom.xml index bb7624e..47aaeca 100644 --- a/modules/injection/injection-api/pom.xml +++ b/modules/injection/injection-api/pom.xml @@ -60,22 +60,4 @@ under the License. - - - -org.apache.felix -maven-bundle-plugin -true - - - -org.apache.tamaya.inject.api, -org.apache.tamaya.inject.spi - - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/
incubator-tamaya-site git commit: TAMAYA-145: Updated OSGI documentation.
Repository: incubator-tamaya-site Updated Branches: refs/heads/master 3147ee23c -> a83cd574c TAMAYA-145: Updated OSGI documentation. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/commit/a83cd574 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/tree/a83cd574 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/diff/a83cd574 Branch: refs/heads/master Commit: a83cd574ceb5d6828541a7013eddc41e084f627c Parents: 3147ee2 Author: anatole <anat...@apache.org> Authored: Sun Dec 25 12:19:22 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Dec 25 12:19:22 2016 +0100 -- content/documentation/extensions/mod_osgi.adoc | 168 1 file changed, 102 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/a83cd574/content/documentation/extensions/mod_osgi.adoc -- diff --git a/content/documentation/extensions/mod_osgi.adoc b/content/documentation/extensions/mod_osgi.adoc index 3a3ffd4..9a6a55d 100644 --- a/content/documentation/extensions/mod_osgi.adoc +++ b/content/documentation/extensions/mod_osgi.adoc @@ -10,44 +10,20 @@ toc::[] == Tamaya OSGI Support === Overview -Tamaya provides also support for integration with OSGI. Hereby several options are available how Tamaya can be used in -an OSGI context: - -. All Tamaya modules, its API and core library are actually valid OSGI bundles. So adding them into your OSGI modules - and using Tamaya is basically directly supported. Nevertheless OSGI works rather differently from a class- and - resource loading perspective. As long as you rely on Tamaya's mechanisms for resource loading things should work - out of the box. In the back Tamaya's core module actually comes with implicit OSGI support, which is automatically - activated, if Tamaya is running in an OSGI context. This support actually - ** Listens on deployed bundles and actively reads all resources configured as +java.util.ServiceLoader+ services and - registers them as OSGI services. Hereby integration is complete meaning you can also register Tamaya services - as normal OSGI services, e.g. your own +PropertySource+ instances. - ** Uses the OSGI bundle to resolve for resources, because accessing them from the classloader directly - typically fails in an OSGI context. -. Adding Tamaya's OSGI integration module replaces the existing OSGI +ConfigAdmin+ service with an istance based on - Tamaya. Hereby several aspects can be configured using system properties: - ** +org.tamaya.integration.osgi.cm.ranking+ (int) allows to configure the OSGI service ranking used by the Tamaya -BundleActivator to register Tamaya's +ConfigAdmin+ service. In OSGI higher ranking precede lower rankings. By default -Tamaya's OSGI extending service registration mechanism is reusing any annotated +@Priority+ priority values as -corresponsing rankings. - ** +org.tamaya.integration.osgi.cm.override+ (boolean) allows to configure if Tamaya is overriding any existing -values from the default +ConfigAdmin+ instance, or only extending them. In other words this setting allows you to -define, which configuration subsystem has precedence for evaluating the final values, either Tamaya based -configuration (default) or the configuration mechanisms provided by default from your OSGI container (when this flag -is set to +false+). - ** +org.tamaya.integration.osgi.cm.inject+ allows you to deactivate injection of configuration values into your -OSGI services (by default injection is enabled). In all cases accessing the OSGI +ConfigAdmin+ service to -read your configuration is working as usual. But Tamaya adds additional injection functionality, which allows -to inject typed configuration as described by the Tamaya injection api. - -It is also possible to combine things, e.g. when you only define a low ranking for Tamaya's configuration service and -the same time allow injection to be active, you will have Tamaya's injection support based on your default -OSGI configuration. +Tamaya provides also support for integration with OSGI. Hereby Tamaya implements the OSGI +ConfigAdmin+ service, +which is the OSGI basic component providing configuration. Tamaya by default overrides the OSGI default configuration +but can also be configured to extend it. === Compatibility All module described are based on Java 7, so it will run on Java 7 and beyond. -The modules are built against OSGI Compendium version 5.0. +The modules are built against OSGI Compendium version 5.0. Tamaya OSGI support is tested against the following OSGI +runtimes: + +* Apache Karaf
[3/5] incubator-tamaya git commit: TAMAYA-217: Added equals/hashCode for converters.
TAMAYA-217: Added equals/hashCode for converters. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/0c7ed25c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/0c7ed25c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/0c7ed25c Branch: refs/heads/master Commit: 0c7ed25c3ec2b321196645b7a82a610b9e41b671 Parents: 7796303 Author: anatole <anat...@apache.org> Authored: Thu Dec 22 21:55:11 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 21:55:11 2016 +0100 -- .../DefaultConfigurationContextBuilder.java | 54 .../tamaya/core/internal/OSGIActivator.java | 16 +- .../core/internal/OSGIServiceContext.java | 33 ++-- .../tamaya/core/internal/OSGIServiceLoader.java | 11 ++-- .../converters/BigDecimalConverter.java | 10 .../converters/BigIntegerConverter.java | 10 .../internal/converters/BooleanConverter.java | 10 .../core/internal/converters/ByteConverter.java | 10 .../core/internal/converters/CharConverter.java | 9 .../internal/converters/ClassConverter.java | 10 .../internal/converters/CurrencyConverter.java | 10 .../internal/converters/DoubleConverter.java| 10 .../core/internal/converters/EnumConverter.java | 13 + .../core/internal/converters/FileConverter.java | 10 .../internal/converters/FloatConverter.java | 10 .../internal/converters/IntegerConverter.java | 10 .../core/internal/converters/LongConverter.java | 9 .../internal/converters/NumberConverter.java| 10 .../core/internal/converters/PathConverter.java | 10 .../internal/converters/ShortConverter.java | 10 .../core/internal/converters/URIConverter.java | 10 .../core/internal/converters/URLConverter.java | 10 22 files changed, 273 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0c7ed25c/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java index 2e34842..f825614 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java @@ -20,6 +20,11 @@ package org.apache.tamaya.core.internal; import org.apache.tamaya.Configuration; import org.apache.tamaya.TypeLiteral; +import org.apache.tamaya.core.internal.converters.*; +import org.apache.tamaya.core.propertysource.CLIPropertySource; +import org.apache.tamaya.core.propertysource.EnvironmentPropertySource; +import org.apache.tamaya.core.propertysource.SystemPropertySource; +import org.apache.tamaya.core.propertysource.JavaConfigurationPropertySource; import org.apache.tamaya.spi.ConfigurationContext; import org.apache.tamaya.spi.ConfigurationContextBuilder; import org.apache.tamaya.spi.PropertyConverter; @@ -29,16 +34,14 @@ import org.apache.tamaya.spi.PropertySourceProvider; import org.apache.tamaya.spi.PropertyValueCombinationPolicy; import org.apache.tamaya.spi.ServiceContextManager; +import java.io.File; import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.URI; +import java.net.URL; +import java.nio.file.Path; +import java.util.*; import java.util.logging.Logger; /** @@ -131,6 +134,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB public ConfigurationContextBuilder addDefaultPropertySources() { checkBuilderState(); List propertySources = new ArrayList<>(); +addCorePropertyResources(propertySources); propertySources.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class)); for(PropertySourceProvider provider: ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){ @@ -140,6 +144,13 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB return addPropertySources(propertySources); } +private void addCorePropertyResources(List propertySources) { +propertySources.add(new Environ
[5/5] incubator-tamaya git commit: Added logging for loading of the SPI.
Added logging for loading of the SPI. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/9c073a73 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/9c073a73 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/9c073a73 Branch: refs/heads/master Commit: 9c073a739cbd6f7b78564b52485088e7949e7e75 Parents: ff03e51 Author: anatole <anat...@apache.org> Authored: Thu Dec 22 22:01:21 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 22:01:21 2016 +0100 -- .../src/main/java/org/apache/tamaya/ConfigurationProvider.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c073a73/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java index e4bbb9a..6927d94 100644 --- a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java +++ b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java @@ -23,11 +23,14 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder; import org.apache.tamaya.spi.ConfigurationProviderSpi; import org.apache.tamaya.spi.ServiceContextManager; +import java.util.logging.Logger; + /** * Static access to the {@link Configuration} for the very application. */ public final class ConfigurationProvider { +private static final Logger LOG = Logger.getLogger(ConfigurationProvider.class.getName()); private static final ConfigurationProviderSpi PROVIDER_SPI = loadSpi(); private static ConfigurationProviderSpi loadSpi() { @@ -36,7 +39,7 @@ public final class ConfigurationProvider { if(spi==null){ throw new IllegalStateException("ConfigurationProviderSpi not available."); } - +LOG.info("TAMAYA Loaded ConfigurationProviderSpi: " + spi.getClass().getName()); return spi; } @@ -103,6 +106,7 @@ public final class ConfigurationProvider { * applying a new Configuration. */ public static void setConfiguration(Configuration config) { +LOG.info("TAMAYA Applying new Configuration: " + config); PROVIDER_SPI.setConfiguration(config); }
[2/3] incubator-tamaya-extensions git commit: TAMAYA-212: Rendered default comparators into singletons.
TAMAYA-212: Rendered default comparators into singletons. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/fe77d58f Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/fe77d58f Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/fe77d58f Branch: refs/heads/master Commit: fe77d58fe50b0f9a9ea5d473d96e3aa439356f4a Parents: 9e4991b Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:50:43 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:50:43 2016 +0100 -- .../DefaultConfigurationContextBuilder.java | 3 --- .../tamaya/spisupport/PriorityServiceComparator.java | 12 .../spisupport/PropertiesResourcePropertySource.java | 4 +++- .../tamaya/spisupport/PropertyFilterComparator.java | 14 +- .../tamaya/spisupport/PropertySourceComparator.java | 13 + .../spisupport/PriorityServiceComparatorTest.java | 10 -- 6 files changed, 45 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe77d58f/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java index 3ed8946..d3b6930 100644 --- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java @@ -46,9 +46,6 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB private static final Logger LOG = Logger.getLogger(DefaultConfigurationContextBuilder.class.getName()); -public static final Comparator DEFAULT_PROPERTYSOURCE_COMPARATOR = new PropertySourceComparator(); -public static final Comparator DEFAULT_PROPERTYFILTER_COMPARATOR = new PriorityServiceComparator(); - List propertyFilters = new ArrayList<>(); List propertySources = new ArrayList<>(); PropertyValueCombinationPolicy combinationPolicy = http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe77d58f/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PriorityServiceComparator.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PriorityServiceComparator.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PriorityServiceComparator.java index 8f15696..90a8387 100644 --- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PriorityServiceComparator.java +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PriorityServiceComparator.java @@ -29,6 +29,18 @@ public class PriorityServiceComparator implements Comparator, Serializab private static final long serialVersionUID = 1L; +private static final PriorityServiceComparator INSTANCE = new PriorityServiceComparator(); + +private PriorityServiceComparator(){} + +/** + * Get the shared instance of the comparator. + * @return the shared instance, never null. + */ +public static PriorityServiceComparator getInstance(){ +return INSTANCE; +} + @Override public int compare(Object o1, Object o2) { int prio = getPriority(o1) - getPriority(o2); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe77d58f/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertiesResourcePropertySource.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertiesResourcePropertySource.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertiesResourcePropertySource.java index 3744c94..1dc7586 100644 --- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertiesResourcePropertySource.java +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertiesResourcePropertySource.java @@ -18,6 +18,8 @@ */ package org.apache.tamaya.spisupport; +import org.apache.tamaya.spi.ServiceContextManager; + import java.io.InputStream; import java.net.URL; import java.util.HashMap; @@ -77,7 +79,7 @@ public class PropertiesResourcePropertySource extends MapPropertySource { if(cl
[1/4] incubator-tamaya-sandbox git commit: TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. TAMAYA-148: Further tests with OSGI/Karaf.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 6aa6bb751 -> 9e1cd74c9 TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. TAMAYA-148: Further tests with OSGI/Karaf. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/7b9971d8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/7b9971d8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/7b9971d8 Branch: refs/heads/master Commit: 7b9971d81f98c486fb356bff28eacb23af122706 Parents: 6aa6bb7 Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:57:48 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:57:48 2016 +0100 -- .../tamaya/osgi/OSGIEnhancedConfiguration.java | 117 --- .../tamaya/osgi/TamayaConfigAdminImpl.java | 30 ++--- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 8 +- .../src/test/resources/META-INF/OSGIResource| 17 +++ osgi/pom.xml| 28 - 5 files changed, 32 insertions(+), 168 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/7b9971d8/osgi/common/src/main/java/org/apache/tamaya/osgi/OSGIEnhancedConfiguration.java -- diff --git a/osgi/common/src/main/java/org/apache/tamaya/osgi/OSGIEnhancedConfiguration.java b/osgi/common/src/main/java/org/apache/tamaya/osgi/OSGIEnhancedConfiguration.java deleted file mode 100644 index 117ae1b..000 --- a/osgi/common/src/main/java/org/apache/tamaya/osgi/OSGIEnhancedConfiguration.java +++ /dev/null @@ -1,117 +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.osgi; -// -//import org.apache.tamaya.spi.PropertySource; -//import org.apache.tamaya.spisupport.BasePropertySource; -//import org.apache.tamaya.spisupport.DefaultConfiguration; -//import org.apache.tamaya.spisupport.DefaultConfigurationContext; -// -//import java.util.Dictionary; -//import java.util.Enumeration; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -//import java.util.Objects; -// -///** -// * Configuration object that also reflects the values provided by the OSGI ConfigAdmin Configuration. -// * Similar to other tamaya areas adding a tamaya.ordinal into the corresponding OSGI configuration for -// * a pif/factoryPid allows to control the ordinal/priority of the OSGI configuration related to other -// * configured Tamaya Property Sources. Overall the configuration evaluation for Tamaya follows the -// * same rules, with the difference that each bunldle owns its own ConfigAdmin based part. From -// * Tamaya, the granularity depends on the implementation of the ConfigurationProviderSpi. By default -// * Tamaya configuration is managed as a global resource/config tree, wheres bundle specific sections are -// * selected only. -// */ -//public class OSGIEnhancedConfiguration extends DefaultConfiguration{ -///** The default ordinal used for the OSGI config, */ -//private static final int OSGI_DEFAULT_ORDINAL = 0; -// -///** -// * Constructor. -// * -// * @param osgiConfiguration The OSGI configuration found. -// */ -//public OSGIEnhancedConfiguration(org.osgi.service.cm.Configuration osgiConfiguration) { -//super(new OSGIConfigurationContext(osgiConfiguration)); -//} -// -///** -// * Class that models a Tamaya ConfigurationContext, which implicitly contains the bundle specific -// * Configuration wrapped into a Tamaya PropertySource. -// */ -//private static final class OSGIConfigurationContext extends DefaultConfigurationContext{ -//private OSGIPropertySource osgiPropertySource; -// -//public OSGIConfigurationContext(org.osgi.service.cm.Configuration osgiConfiguration){ -//
[1/3] incubator-tamaya-extensions git commit: TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. Added create method.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master a35fb2a0b -> a8b7f757e TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. Added create method. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/9e4991b6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/9e4991b6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/9e4991b6 Branch: refs/heads/master Commit: 9e4991b63ba223e57b9736c89d0e0441245632b7 Parents: a35fb2a Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:50:23 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:50:23 2016 +0100 -- modules/injection/cdi-ee/pom.xml| 5 ++ .../integration/cdi/CDIAwareServiceContext.java | 45 ++- .../cdi/ServiceLoaderServiceContext.java| 82 +++- .../integration/cdi/CDIAwareServiceContext.java | 45 ++- .../cdi/ServiceLoaderServiceContext.java| 73 + .../resolver/internal/ResourceResolver.java | 3 +- .../internal/ClassPathResourceLocator.java | 4 +- .../resource/internal/ClasspathCollector.java | 5 +- .../spisupport/DefaultConfigurationContext.java | 2 +- 9 files changed, 217 insertions(+), 47 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9e4991b6/modules/injection/cdi-ee/pom.xml -- diff --git a/modules/injection/cdi-ee/pom.xml b/modules/injection/cdi-ee/pom.xml index 89f05f9..c16b3a7 100644 --- a/modules/injection/cdi-ee/pom.xml +++ b/modules/injection/cdi-ee/pom.xml @@ -73,6 +73,11 @@ under the License. provided +org.apache.tamaya.ext +tamaya-spisupport +${project.version} + + org.apache.openejb javaee-api ${javaee-api.version} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9e4991b6/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/CDIAwareServiceContext.java -- diff --git a/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/CDIAwareServiceContext.java b/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/CDIAwareServiceContext.java index 5bfb1c1..8c1312f 100644 --- a/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/CDIAwareServiceContext.java +++ b/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/CDIAwareServiceContext.java @@ -25,12 +25,13 @@ import javax.annotation.Priority; import javax.enterprise.inject.Instance; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; +import java.io.IOException; +import java.net.URL; import java.text.MessageFormat; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; /** @@ -100,6 +101,42 @@ public class CDIAwareServiceContext implements ServiceContext { return found; } +@Override +public T create(Class serviceType) { +T serv = getService(serviceType); +if(serv!=null){ +try { +return (T)serv.getClass().newInstance(); +} catch (Exception e) { +Logger.getLogger(getClass().getName()) +.log(Level.SEVERE, "Failed to create new instance of: " +serviceType.getName(), e); +} +} +return null; +} + +@Override +public Enumeration getResources(String resource, ClassLoader cl) throws IOException { +if(cl==null){ +cl = Thread.currentThread().getContextClassLoader(); +} +if(cl==null){ +cl = getClass().getClassLoader(); +} +return cl.getResources(resource); +} + +@Override +public URL getResource(String resource, ClassLoader cl) { +if(cl==null){ +cl = Thread.currentThread().getContextClassLoader(); +} +if(cl==null){ +cl = getClass().getClassLoader(); +} +return cl.getResource(resource); +} + /** * Checks the given instance for a @Priority annotation. If present the annotation's value s evaluated. If no such * annotation is present, a default priority is returned (1); http://git-wip-us.apache.org/repos/asf/incubator-tamaya
[3/3] incubator-tamaya-extensions git commit: TAMAYA-145: Fixed tests for basic OSGI support of the core functionality.
TAMAYA-145: Fixed tests for basic OSGI support of the core functionality. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/a8b7f757 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/a8b7f757 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/a8b7f757 Branch: refs/heads/master Commit: a8b7f757eb84e8070e051504b5a486bb2f6b5ef7 Parents: fe77d58 Author: anatole <anat...@apache.org> Authored: Thu Dec 22 22:14:06 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 22:14:06 2016 +0100 -- .../apache/tamaya/spisupport/DefaultConfigurationContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a8b7f757/modules/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java -- diff --git a/modules/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java b/modules/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java index 5b23897..f1f34c6 100644 --- a/modules/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java +++ b/modules/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java @@ -59,7 +59,7 @@ public class DefaultConfigurationContextTest { assertEquals(ctx.getPropertySources().size(), 0); ctx = new DefaultConfigurationContextBuilder().addDefaultPropertySources().build(); assertNotNull(ctx.getPropertySources()); -assertEquals(3, ctx.getPropertySources().size()); +assertEquals(4, ctx.getPropertySources().size()); } @Test
[1/5] incubator-tamaya git commit: TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. Added create method.
Repository: incubator-tamaya Updated Branches: refs/heads/master c2aee961b -> 9c073a739 TAMAYA-210: Added additional resource location logic. Tested and implemented especially with OSGI. Added create method. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/b31278a3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/b31278a3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/b31278a3 Branch: refs/heads/master Commit: b31278a39be485a5b72d50408e3a2d2e557f1008 Parents: c2aee96 Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:41:02 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:41:02 2016 +0100 -- .../org/apache/tamaya/spi/ServiceContext.java | 35 +++ .../tamaya/spi/ServiceContextManagerTest.java | 18 .../apache/tamaya/spi/ServiceContextTest.java | 22 +++- .../apache/tamaya/spi/TestServiceContext.java | 38 --- code/core/bnd.bnd | 4 +- .../core/internal/DefaultServiceContext.java| 63 +-- .../tamaya/core/internal/OSGIActivator.java | 5 +- .../core/internal/OSGIServiceContext.java | 83 --- .../tamaya/core/internal/OSGIServiceLoader.java | 104 --- .../internal/PriorityServiceComparator.java | 3 + .../provider/JavaConfigurationProvider.java | 16 +-- pom.xml | 1 + 12 files changed, 324 insertions(+), 68 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b31278a3/code/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/code/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java index c66b87b..9f1d28e 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java @@ -18,6 +18,9 @@ */ package org.apache.tamaya.spi; +import java.io.IOException; +import java.net.URL; +import java.util.Enumeration; import java.util.List; @@ -45,6 +48,19 @@ public interface ServiceContext { T getService(Class serviceType); /** + * Factory method to create a type, hereby a new instance is created on each access. + * If multiple implementations for the very serviceType exist then + * the one with the highest {@link javax.annotation.Priority} will be used as the base + * for creating subsequent instances. + * + * @param the type of the service type. + * @param serviceType the service type. + * @return The new instance to be used, or {@code null} + * @throws org.apache.tamaya.ConfigException if there are multiple service implementations with the maximum priority. + */ + T create(Class serviceType); + +/** * Access a list current services, given its type. The bootstrap mechanism should * order the instance for precedence, hereby the most significant should be * first in order. @@ -56,4 +72,23 @@ public interface ServiceContext { */ List getServices(Class serviceType); +/** + * Loads resources from the current runtime context. This method allows to use runtime + * specific code to load resources, e.g. within OSGI environments. + * @param resource the resource, not null. + * @param cl the desired classloader context, if null, the current thread context classloader is used. + * @return the resources found + * @throws IOException + */ +Enumeration getResources(String resource, ClassLoader cl) throws IOException; + +/** + * Loads a resource from the current runtime context. This method allows to use runtime + * specific code to load a resource, e.g. within OSGI environments. + * @param resource the resource, not null. + * @param cl the desired classloader context, if null, the current thread context classloader is used. + * @return the resource found, or null. + * @throws IOException + */ +URL getResource(String resource, ClassLoader cl); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b31278a3/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java -- diff --git a/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java b/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java index 7e9a010..423a707 100644 --- a/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java +++ b/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextM
[2/5] incubator-tamaya git commit: TAMAYA-212: Rendered default comparators into singletons.
TAMAYA-212: Rendered default comparators into singletons. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/7796303d Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/7796303d Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/7796303d Branch: refs/heads/master Commit: 7796303ddffd590a8ff14d3091278ef540ba041b Parents: b31278a Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:49:15 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:49:15 2016 +0100 -- .../core/internal/DefaultConfigurationContextBuilder.java | 5 + .../tamaya/core/internal/PropertyFilterComparator.java| 3 +++ .../tamaya/core/internal/PropertySourceComparator.java| 3 +++ .../core/internal/PriorityServiceComparatorTest.java | 10 -- 4 files changed, 11 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7796303d/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java index b3dcc82..2e34842 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java @@ -48,9 +48,6 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB private static final Logger LOG = Logger.getLogger(DefaultConfigurationContextBuilder.class.getName()); -public static final Comparator DEFAULT_PROPERTYSOURCE_COMPARATOR = new PropertySourceComparator(); -public static final Comparator DEFAULT_PROPERTYFILTER_COMPARATOR = new PriorityServiceComparator(); - List propertyFilters = new ArrayList<>(); List propertySources = new ArrayList<>(); PropertyValueCombinationPolicy combinationPolicy = @@ -139,7 +136,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){ propertySources.addAll(provider.getPropertySources()); } -Collections.sort(propertySources, DEFAULT_PROPERTYSOURCE_COMPARATOR); +Collections.sort(propertySources, PropertySourceComparator.getInstance()); return addPropertySources(propertySources); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7796303d/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyFilterComparator.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyFilterComparator.java b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyFilterComparator.java index e0bd8e0..96779df 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyFilterComparator.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyFilterComparator.java @@ -33,6 +33,9 @@ public class PropertyFilterComparator implements Comparator, Ser private static final PropertyFilterComparator INSTANCE = new PropertyFilterComparator(); +/** Singleton constructor. */ +private PropertyFilterComparator(){} + /** * Get the shared instance of the comparator. * @return the shared instance, never null. http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7796303d/code/core/src/main/java/org/apache/tamaya/core/internal/PropertySourceComparator.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertySourceComparator.java b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertySourceComparator.java index f686ee3..0b46f1c 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertySourceComparator.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertySourceComparator.java @@ -32,6 +32,9 @@ public class PropertySourceComparator implements Comparator, Ser private static final PropertySourceComparator INSTANCE = new PropertySourceComparator(); +/** Singleton constructor. */ +private PropertySourceComparator(){} + /** * Get the shared instance of the comparator. * @return the shared instance, never null. http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/7796303d/code/core/src/test/jav
[4/4] incubator-tamaya-sandbox git commit: TAMAYA-212: Rendered default comparators into singletons.
TAMAYA-212: Rendered default comparators into singletons. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/9e1cd74c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/9e1cd74c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/9e1cd74c Branch: refs/heads/master Commit: 9e1cd74c93eec37eddb25d492e6a471853e8ff20 Parents: a144252 Author: anatole <anat...@apache.org> Authored: Thu Dec 22 22:18:27 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 22:18:27 2016 +0100 -- .../internal/DSLLoadingConfigurationProviderSpi.java | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9e1cd74c/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java index 47ce7f0..b6247c5 100644 --- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java @@ -19,13 +19,17 @@ package org.apache.tamaya.metamodel.internal; import org.apache.tamaya.metamodel.MetaConfiguration; -import org.apache.tamaya.spi.*; import org.apache.tamaya.Configuration; +import org.apache.tamaya.spi.ConfigurationContext; +import org.apache.tamaya.spi.ConfigurationContextBuilder; +import org.apache.tamaya.spi.ConfigurationProviderSpi; +import org.apache.tamaya.spi.ServiceContextManager; import org.apache.tamaya.spisupport.DefaultConfiguration; import org.apache.tamaya.spisupport.DefaultConfigurationContextBuilder; +import org.apache.tamaya.spisupport.PropertyFilterComparator; +import org.apache.tamaya.spisupport.PropertySourceComparator; import javax.annotation.Priority; -import java.util.Comparator; import java.util.Objects; /** @@ -93,10 +97,8 @@ public class DSLLoadingConfigurationProviderSpi implements ConfigurationProvider .addDefaultPropertyConverters() .addDefaultPropertyFilters() .addDefaultPropertySources() -.sortPropertyFilter( -(Comparator) - DefaultConfigurationContextBuilder.DEFAULT_PROPERTYFILTER_COMPARATOR) - .sortPropertySources(DefaultConfigurationContextBuilder.DEFAULT_PROPERTYSOURCE_COMPARATOR) + .sortPropertyFilter(PropertyFilterComparator.getInstance()) + .sortPropertySources(PropertySourceComparator.getInstance()) .build()); } }
[4/5] incubator-tamaya git commit: TAMAYA-214: Rendered provider into property source for better OSGI support.
TAMAYA-214: Rendered provider into property source for better OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ff03e511 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ff03e511 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ff03e511 Branch: refs/heads/master Commit: ff03e511babeccf37f4fc8ddb2ae9e774f5e6f16 Parents: 0c7ed25 Author: anatole <anat...@apache.org> Authored: Thu Dec 22 22:00:14 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 22:00:14 2016 +0100 -- .../core/propertysource/BasePropertySource.java | 13 ++ .../JavaConfigurationPropertySource.java| 135 +++ .../propertysource/SimplePropertySource.java| 2 +- .../provider/JavaConfigurationProvider.java | 116 .../org.apache.tamaya.spi.PropertySource| 3 +- ...org.apache.tamaya.spi.PropertySourceProvider | 19 --- .../DefaultConfigurationContextTest.java| 2 +- .../provider/JavaConfigurationProviderTest.java | 14 +- ...org.apache.tamaya.spi.PropertySourceProvider | 1 - 9 files changed, 155 insertions(+), 150 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ff03e511/code/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java index 75c4893..c59f78f 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java +++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java @@ -155,4 +155,17 @@ public abstract class BasePropertySource implements PropertySource { public boolean isScannable(){ return true; } + +@Override +public boolean equals(Object o) { +if (this == o) return true; +if (!(o instanceof BasePropertySource)) return false; +BasePropertySource that = (BasePropertySource) o; +return Objects.equals(getName(), that.getName()); +} + +@Override +public int hashCode() { +return Objects.hash(getName()); +} } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ff03e511/code/core/src/main/java/org/apache/tamaya/core/propertysource/JavaConfigurationPropertySource.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/JavaConfigurationPropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/JavaConfigurationPropertySource.java new file mode 100644 index 000..90abb72 --- /dev/null +++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/JavaConfigurationPropertySource.java @@ -0,0 +1,135 @@ +/* + * 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.core.propertysource; + +import org.apache.tamaya.ConfigException; +import org.apache.tamaya.core.internal.PropertySourceComparator; +import org.apache.tamaya.core.propertysource.SimplePropertySource; +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertySourceProvider; +import org.apache.tamaya.spi.ServiceContextManager; + +import java.io.IOException; +import java.net.URL; +import java.util.*; + +import static java.lang.String.format; +import static java.lang.Thread.currentThread; + +/** + * Provider which reads all {@value DEFAULT_SIMPLE_PROPERTIES_FILE_NAME} and + * {@value DEFAULT_XML_PROPERTIES_FILE_NAME} files found in the + * classpath. By setting + * {@code tamaya.defaultprops.disable} or {@code tamaya.defaults.disable} + * as system or environment property this feature can be disabled. + */ +public class JavaConfigurationPropertySource extends BasePropertySource { +
[2/4] incubator-tamaya-sandbox git commit: TAMAYA-145: Added support for Refreshable and property source level filtering.
TAMAYA-145: Added support for Refreshable and property source level filtering. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/20c558d0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/20c558d0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/20c558d0 Branch: refs/heads/master Commit: 20c558d0771a07da54fe26a9a8f28b80cb06014e Parents: 7b9971d Author: anatole <anat...@apache.org> Authored: Wed Dec 21 16:58:40 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Dec 21 16:58:40 2016 +0100 -- .../org/apache/tamaya/metamodel/Enabled.java| 37 + .../tamaya/metamodel/EnabledPropertySource.java | 135 +++ .../EnabledPropertySourceProvider.java | 112 +++ .../apache/tamaya/metamodel/MetaContext.java| 10 ++ .../metamodel/internal/ContextReader.java | 4 +- .../DSLLoadingConfigurationProviderSpi.java | 10 +- .../internal/PropertySourceReader.java | 78 +++ 7 files changed, 375 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20c558d0/metamodel/src/main/java/org/apache/tamaya/metamodel/Enabled.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/Enabled.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/Enabled.java new file mode 100644 index 000..b3051d3 --- /dev/null +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/Enabled.java @@ -0,0 +1,37 @@ +/* + * 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.metamodel; + +/** + * Common interface for items that can be enabled or disabled. + */ +public interface Enabled { + +/** + * Returns the enabled property. + * @return the enabled value. + */ +boolean isEnabled(); + +/** + * Enables/disables this property source. + * @param enabled the enabled value. + */ +void setEnabled(boolean enabled); +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20c558d0/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java new file mode 100644 index 000..e231930 --- /dev/null +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java @@ -0,0 +1,135 @@ +/* + * 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.metamodel; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.logging.Logger; + + +/** + * Wrapped property source that allows enabling a property source using an + *
[3/4] incubator-tamaya-sandbox git commit: TAMAYA-145: Fixed tests for basic OSGI support of the core functionality.
TAMAYA-145: Fixed tests for basic OSGI support of the core functionality. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/a144252f Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/a144252f Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/a144252f Branch: refs/heads/master Commit: a144252f06417ce34e31f90f799d7b86e3e01a99 Parents: 20c558d Author: anatole <anat...@apache.org> Authored: Thu Dec 22 22:02:46 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Thu Dec 22 22:02:46 2016 +0100 -- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 23 +++- 1 file changed, 22 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/a144252f/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java -- diff --git a/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java b/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java index c0c3880..236913c 100644 --- a/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java +++ b/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java @@ -20,6 +20,7 @@ package org.apache.tamaya.osgi; import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeaturesService; +import org.apache.tamaya.spi.ServiceContextManager; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -33,6 +34,7 @@ import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; import org.ops4j.pax.exam.options.BootClasspathLibraryOption; import org.ops4j.pax.exam.options.MavenUrlReference; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; import org.ops4j.pax.exam.spi.reactors.PerMethod; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -43,6 +45,9 @@ import javax.inject.Inject; import javax.swing.*; import java.awt.*; import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Enumeration; import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; @@ -152,7 +157,7 @@ public class OSGIKarafTest { assertEquals(config.getProperties().get("my.testProperty4"), "success4"); StringBuilder b = new StringBuilder(); b.append("Print all configs\n\n"); -org.osgi.service.cm.Configuration[] configs = configAdmin.listConfigurations("*"); +org.osgi.service.cm.Configuration[] configs = configAdmin.listConfigurations(null); for (org.osgi.service.cm.Configuration cfg : configs) { b.append("\nConfiguration found in Karaf OSGI Container: " + cfg); b.append("\n-"); @@ -160,6 +165,22 @@ public class OSGIKarafTest { System.out.println(b.toString()); } +@Test +public void testResourceIsVisible(){ +assertNotNull(ServiceContextManager.getServiceContext() +.getResource("META-INF/javaconfiguration.properties", null)); +} + +@Test +public void testResourcesAreVisible() throws IOException { +Enumeration urls = ServiceContextManager.getServiceContext() +.getResources("META-INF/javaconfiguration.properties", null); +assertNotNull(urls); +assertTrue(urls.hasMoreElements()); +URL url = urls.nextElement(); +assertNotNull(url); +} + public ConfigurationAdmin getConfigAdmin() { return bundleContext.getService(bundleContext.getServiceReference(ConfigurationAdmin.class)); }
[1/2] incubator-tamaya-extensions git commit: TAMAYA-198: Analyzed and applied patch to prevent reread of streams.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 4a70f5309 -> b9299af45 TAMAYA-198: Analyzed and applied patch to prevent reread of streams. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/b6be1178 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/b6be1178 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/b6be1178 Branch: refs/heads/master Commit: b6be11784398e4a0ac2f9118e2851e6ca472114a Parents: 4a70f53 Author: anatole <anat...@apache.org> Authored: Mon Dec 19 23:23:45 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 19 23:23:45 2016 +0100 -- .../BaseFormatPropertySourceProvider.java | 14 +++--- .../FormatPropertySourceProviderTest.java | 50 2 files changed, 58 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b6be1178/modules/formats/base/src/main/java/org/apache/tamaya/format/BaseFormatPropertySourceProvider.java -- diff --git a/modules/formats/base/src/main/java/org/apache/tamaya/format/BaseFormatPropertySourceProvider.java b/modules/formats/base/src/main/java/org/apache/tamaya/format/BaseFormatPropertySourceProvider.java index 84d6cfa..90e1143 100644 --- a/modules/formats/base/src/main/java/org/apache/tamaya/format/BaseFormatPropertySourceProvider.java +++ b/modules/formats/base/src/main/java/org/apache/tamaya/format/BaseFormatPropertySourceProvider.java @@ -139,13 +139,15 @@ public abstract class BaseFormatPropertySourceProvider implements PropertySource public Collection getPropertySources() { List propertySources = new ArrayList<>(); for (URL res : this.paths) { -try(InputStream is = res.openStream()) { -for (ConfigurationFormat format : configFormats) { -ConfigurationData data = format.readConfiguration(res.toString(), is); -propertySources.addAll(getPropertySources(data)); +for (ConfigurationFormat format : configFormats) { +try(InputStream is = res.openStream()) { +if (format.accepts(res)) { +ConfigurationData data = format.readConfiguration(res.toString(), is); +propertySources.addAll(getPropertySources(data)); +} +} catch (Exception e) { +LOG.log(Level.WARNING, "Failed to put resource based config: " + res, e); } -} catch (Exception e) { -LOG.log(Level.WARNING, "Failed to put resource based config: " + res, e); } } return propertySources; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b6be1178/modules/formats/base/src/test/java/org/apache/tamaya/format/FormatPropertySourceProviderTest.java -- diff --git a/modules/formats/base/src/test/java/org/apache/tamaya/format/FormatPropertySourceProviderTest.java b/modules/formats/base/src/test/java/org/apache/tamaya/format/FormatPropertySourceProviderTest.java new file mode 100644 index 000..3a4ec16 --- /dev/null +++ b/modules/formats/base/src/test/java/org/apache/tamaya/format/FormatPropertySourceProviderTest.java @@ -0,0 +1,50 @@ +/* + * 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.format; + +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertySourceProvider; +import org.junit.Test; +import static org.junit.Assert.*; + +public class FormatPropertySourceProviderTest +extends BaseFormatPropertySourceProvider { +public FormatPropertySourceProviderTest()
[1/2] incubator-tamaya git commit: Fixed OSGI support.
Repository: incubator-tamaya Updated Branches: refs/heads/master 4950b41c1 -> c2aee961b Fixed OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/c2aee961 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/c2aee961 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/c2aee961 Branch: refs/heads/master Commit: c2aee961befec98929f7cc5fa819fad37b090e6a Parents: 33722ab Author: anatole <anat...@apache.org> Authored: Mon Dec 19 23:56:50 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Dec 19 23:57:15 2016 +0100 -- code/core/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2aee961/code/core/pom.xml -- diff --git a/code/core/pom.xml b/code/core/pom.xml index 5c7be94..2cc76b5 100644 --- a/code/core/pom.xml +++ b/code/core/pom.xml @@ -27,7 +27,7 @@ under the License. tamaya-core Apache Tamaya Core Implementation -bundle +jar 5.0.0 @@ -79,7 +79,6 @@ under the License. !--> -Djava.security.policy=${project.basedir}/src/test/resources/java-security.policy -
incubator-tamaya-extensions git commit: TAMAYA-207: Fixed endless loop in readConfigurationData. Added tests.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master b9299af45 -> a35fb2a0b TAMAYA-207: Fixed endless loop in readConfigurationData. Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/a35fb2a0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/a35fb2a0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/a35fb2a0 Branch: refs/heads/master Commit: a35fb2a0b5b0eea67340bfcfc5850fbbe8ca7df3 Parents: b9299af Author: anatole <anat...@apache.org> Authored: Tue Dec 20 00:24:48 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Tue Dec 20 00:24:48 2016 +0100 -- .../tamaya/format/ConfigurationFormats.java | 2 +- .../tamaya/format/ConfigurationFormatsTest.java | 75 ++-- 2 files changed, 71 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a35fb2a0/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java -- diff --git a/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java b/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java index 4624538..5b2d819 100644 --- a/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java +++ b/modules/formats/base/src/main/java/org/apache/tamaya/format/ConfigurationFormats.java @@ -146,7 +146,7 @@ public final class ConfigurationFormats { * given formats. */ public static Collection readConfigurationData(Collection urls, ConfigurationFormat... formats) { -return readConfigurationData(urls, formats); +return readConfigurationData(urls, Arrays.asList(formats)); } /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a35fb2a0/modules/formats/base/src/test/java/org/apache/tamaya/format/ConfigurationFormatsTest.java -- diff --git a/modules/formats/base/src/test/java/org/apache/tamaya/format/ConfigurationFormatsTest.java b/modules/formats/base/src/test/java/org/apache/tamaya/format/ConfigurationFormatsTest.java index 0839714..7d42dfb 100644 --- a/modules/formats/base/src/test/java/org/apache/tamaya/format/ConfigurationFormatsTest.java +++ b/modules/formats/base/src/test/java/org/apache/tamaya/format/ConfigurationFormatsTest.java @@ -18,10 +18,14 @@ */ package org.apache.tamaya.format; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * Tests for {@link org.apache.tamaya.format.ConfigurationFormats}. @@ -43,24 +47,85 @@ public class ConfigurationFormatsTest { formats = ConfigurationFormats.getFormats(getClass().getResource("/Test.properties")); assertNotNull(formats); assertEquals(formats.size(), 1); -//formats = ConfigurationFormats.getFormats(getClass().getResource("/Test.xml")); -//assertNotNull(formats); -//assertEquals(formats.size(), 1); } @org.junit.Test public void testReadConfigurationData_URL() throws Exception { -ConfigurationData data = ConfigurationFormats.readConfigurationData(getClass().getResource("/Test.ini")); +ConfigurationData data = ConfigurationFormats.readConfigurationData( +getClass().getResource("/Test.ini")); assertNotNull(data); data = ConfigurationFormats.readConfigurationData(getClass().getResource("/Test.properties")); assertNotNull(data); } @org.junit.Test +public void testReadConfigurationData_URL_ConfiguratonFormat() throws Exception { +ConfigurationData data = ConfigurationFormats.readConfigurationData( +getClass().getResource("/Test.ini"), +ConfigurationFormats.getFormats("ini")); +assertNotNull(data); +} + +@org.junit.Test +public void testReadConfigurationData_URL_CollectionOfConfiguratonFormat() throws Exception { +List formats = new ArrayList<>(); +formats.add(ConfigurationFormats.getFormats("ini").get(0)); +ConfigurationData data = ConfigurationFormats.readConfigurationData( +getClass().getResource("/Test.ini"), +formats); +assertNotNull(data); +} + +@org.junit.Test +public void testReadConfigurat
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-260: Implemented Microprofile.io Config API, added basic tests.
TAMAYA-260: Implemented Microprofile.io Config API, added basic tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/2852c48e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/2852c48e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/2852c48e Branch: refs/heads/master Commit: 2852c48e11e932d7b42ed3a09f71a8c792990bb1 Parents: 7efb64e Author: anatole <anat...@apache.org> Authored: Fri Mar 24 22:53:34 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Fri Mar 24 22:53:34 2017 +0100 -- .../microprofile/MicroprofileAdapter.java | 182 +++ .../tamaya/microprofile/MicroprofileConfig.java | 82 + .../microprofile/MicroprofileConfigBuilder.java | 84 + .../MicroprofileConfigProviderResolver.java | 73 .../microprofile/MicroprofileConfigSource.java | 78 .../MicroprofileConfigSourceProvider.java | 64 +++ .../microprofile/MicroprofileConverter.java | 50 + .../microprofile/TamayaConfiguration.java | 96 ++ .../microprofile/TamayaPropertyConverter.java | 48 + .../microprofile/TamayaPropertySource.java | 76 .../TamayaPropertySourceProvider.java | 56 ++ .../org/eclipse/microprofile/config/Config.java | 126 + .../microprofile/config/ConfigProvider.java | 102 +++ .../config/inject/ConfigProperty.java | 112 .../config/inject/package-info.java | 40 .../microprofile/config/package-info.java | 75 .../microprofile/config/spi/ConfigBuilder.java | 83 + .../config/spi/ConfigProviderResolver.java | 164 + .../microprofile/config/spi/ConfigSource.java | 107 +++ .../config/spi/ConfigSourceProvider.java| 58 ++ .../microprofile/config/spi/Converter.java | 77 .../microprofile/config/spi/package-info.java | 30 +++ ...croprofile.config.spi.ConfigProviderResolver | 20 ++ .../MicroprofileConfigProviderTest.java | 63 +++ .../microprofile/MicroprofileConfigTest.java| 89 + 25 files changed, 2035 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/2852c48e/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java new file mode 100644 index 000..29f563c --- /dev/null +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java @@ -0,0 +1,182 @@ +/* + * 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.microprofile; + + +import org.apache.tamaya.*; +import org.apache.tamaya.spi.ConfigurationContextBuilder; +import org.apache.tamaya.spi.PropertyConverter; +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; +import org.eclipse.microprofile.config.Config; +import org.eclipse.microprofile.config.spi.ConfigBuilder; +import org.eclipse.microprofile.config.spi.ConfigSource; +import org.eclipse.microprofile.config.spi.Converter; + +import java.util.*; + +/** + * Utility class for adapting microprofile artifacts into Tamaya artifacts and vice versa. + */ +public final class MicroprofileAdapter{ + +/** + * Singleton constructor. + */ +private MicroprofileAdapter(){} + +/** + * Converts a Tamaya {@link Configuration} into a Microprofile.io {@Config}. + * @param config the Tamaya {@link Configuration} instance, not null. + * @return the corresponding Microprofile.io {@Config} instance, never null. + */ +public static Config toConfig(Configuration config
incubator-tamaya-sandbox git commit: TAMAYA-260: Added basic tests for MP builder spi.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 2852c48e1 -> 5ee4802c7 TAMAYA-260: Added basic tests for MP builder spi. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/5ee4802c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/5ee4802c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/5ee4802c Branch: refs/heads/master Commit: 5ee4802c7d0a2170a3c7e0b1ed79ad68ac8d82fd Parents: 2852c48 Author: anatole <anat...@apache.org> Authored: Thu Mar 30 17:47:15 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Thu Mar 30 17:47:15 2017 +0200 -- .../tamaya/microprofile/MicroprofileConfig.java | 4 +- .../MicroprofileConfigProviderResolver.java | 5 +- .../microprofile/MicroprofileConfigSource.java | 4 +- .../MicroprofileConfigSourceProvider.java | 4 +- .../microprofile/MicroprofileConverter.java | 4 +- .../microprofile/TamayaConfiguration.java | 4 +- .../microprofile/TamayaPropertyConverter.java | 4 +- .../microprofile/TamayaPropertySource.java | 4 +- .../TamayaPropertySourceProvider.java | 4 +- .../MicroprofileConfigBuilderTest.java | 101 +++ .../MicroprofileConfigProviderResolverTest.java | 75 ++ .../MPSystemPropertiesConfigSource.java | 34 +++ ...eclipse.microprofile.config.spi.ConfigSource | 19 13 files changed, 249 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/5ee4802c/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java index fa8d7b0..3dc4b34 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java @@ -29,11 +29,11 @@ import java.util.*; /** * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance. */ -final class MicroprofileConfig implements Config { +public class MicroprofileConfig implements Config { private Configuration delegate; -MicroprofileConfig(Configuration delegate){ +public MicroprofileConfig(Configuration delegate){ this.delegate = Objects.requireNonNull(delegate); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/5ee4802c/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java index f1d336e..c35bd35 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java @@ -25,6 +25,7 @@ import org.eclipse.microprofile.config.spi.ConfigProviderResolver; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; /** * Created by atsticks on 23.03.17. @@ -56,7 +57,9 @@ public class MicroprofileConfigProviderResolver extends ConfigProviderResolver { @Override public void registerConfig(Config config, ClassLoader classLoader) { if(configs.containsKey(classLoader)){ -throw new IllegalArgumentException("Alreadsy a config registered with classloader: " + classLoader); +Logger.getLogger(getClass().getName()) +.warning("Replacing existing config for classloader: " + classLoader); +//throw new IllegalArgumentException("Already a config registered with classloader: " + classLoader); } this.configs.put(classLoader, config); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/5ee4802c/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java index fbb02b4..39ca119 100644 --- a/microprofile/src/main/java/org/apache/tama
incubator-tamaya-site git commit: TAMAYA-238: Unified CDI injection modules.
Repository: incubator-tamaya-site Updated Branches: refs/heads/master 8f1fa3a86 -> d7b279051 TAMAYA-238: Unified CDI injection modules. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/commit/d7b27905 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/tree/d7b27905 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/diff/d7b27905 Branch: refs/heads/master Commit: d7b2790519add746120ba63dc18e9cd51d68aaaf Parents: 8f1fa3a Author: anatole <anat...@apache.org> Authored: Sun Mar 19 23:16:46 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 23:16:46 2017 +0100 -- content/documentation/extensions.adoc | 32 ++--- content/documentation/extensions/mod_cdi.adoc | 52 -- 2 files changed, 45 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/d7b27905/content/documentation/extensions.adoc -- diff --git a/content/documentation/extensions.adoc b/content/documentation/extensions.adoc index b8e082a..bc1fd83 100644 --- a/content/documentation/extensions.adoc +++ b/content/documentation/extensions.adoc @@ -22,7 +22,6 @@ Mature extensions have a stable API and SPI, similar to the API and Implementati |+org.apache.tamaya.ext:tamaya-injection-api+ |Provides Tamaya's injection annotations API. |link:extensions/mod_injection.html[Documentation] |+org.apache.tamaya.ext:tamaya-injection+ |Provides configuration injection services and congiruation template support. |link:extensions/mod_injection.html[Documentation] |+org.apache.tamaya.ext:tamaya-injection-cdi+ | Java EE/standalone compliant CDI integration using CDI for injection. | link:extensions/mod_cdi.html[Documentation] -|+org.apache.tamaya.ext:tamaya-injection-cdi-se+ | Java EE/standalone compliant CDI integration using Tamaya SE injection mechanism. | link:extensions/mod_cdi.html[Documentation] |+org.apache.tamaya.ext:tamaya-jndi+ |Provides a JNDI based PropertySource. |link:extensions/mod_jndi.html[Documentation] |+org.apache.tamaya.ext:tamaya-json+ |Provides format support for JSON based configuration. |link:extensions/mod_json.html[Documentation] |+org.apache.tamaya.ext:tamaya-mutable-config+|Provides API/SPI for writing configuration |link:extensions/mod_mutable_config.html[Documentation] @@ -48,21 +47,22 @@ NOTE: All extensions currently run on Java 7 as well as on Java 8. [width="100%",frame="1",options="header",grid="all"] |=== |_Artifact_ |_Description_ |_Links_ -|+org.apache.tamaya.ext:tamaya-camel+ |Integration with Apache Camel. | link:extensions/mod_camel.html[Documentation] +|+org.apache.tamaya.ext:tamaya-camel_beta+ |Integration with Apache Camel.| link:extensions/mod_camel.html[Documentation] |+org.apache.tamaya.ext:tamaya-classloader-support+ |Configuration services considering classloaderas. |link:extensions/mod_classloader_support.html[Documentation] -|+org.apache.tamaya.ext:tamaya-commons+ |Integration Support for Apache Commons. | - -|+org.apache.tamaya.ext:tamaya-configured-sysprops+ | Tamaya configuration to be provided as +System.getProperties()+. | link:extensions/mod_sysprops.html[Documentation] -|+org.apache.tamaya.ext:tamaya-consul+ |Integration with consul clusters. | link:extensions/mod_consul.html[Documentation] -|+org.apache.tamaya.ext:tamaya-etcd+|Integration with etcd clusters. | link:extensions/mod_etcd.html[Documentation] -|+org.apache.tamaya.ext:tamaya-hazelcast+ |Integration with Hazelcast datagrids. | link:extensions/mod_hazelcast.html[Documentation] -|+org.apache.tamaya.ext:tamaya-jodatime+|Provides support for JodaTime. | link:extensions/mod_jodatime.html[Documentation] -|+org.apache.tamaya.ext:tamaya-management+ |Provides JMX support for inspecting configuration.|link:extensions/mod_management.html[Documentation] -|+org.apache.tamaya.ext:tamaya-metamodel+ |Provides an XML API for building configuration. |link:extensions/mod_metamodel-staged.html[Documentation] -|+org.apache.tamaya.ext:tamaya-osgi+|Integration with OSGI containers. | link:extensions/mod_osgi.html[Documentation] -|+org.apache.tamaya.ext:tamaya-remote+ |Remote configuration support using the server API.|link:extensions/mod_remote.html[Documentation] -|+org.apache.tamaya.ext
[06/12] incubator-tamaya-extensions git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/b90a4bb5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/b90a4bb5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/b90a4bb5 Branch: refs/heads/master Commit: b90a4bb5abcfee632d563554b3bc2a2e94b58d51 Parents: ce61cf1 a44a2ab Author: anatole <anat...@apache.org> Authored: Sun Mar 19 18:18:25 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 18:18:25 2017 +0100 -- .../tamaya/functions/CombinedConfiguration.java | 33 +- .../functions/CombinedConfigurationTest.java| 337 ++- .../tamaya/functions/MethodNotMockedAnswer.java | 38 +++ 3 files changed, 390 insertions(+), 18 deletions(-) --
[05/12] incubator-tamaya-extensions git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/ce61cf16 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/ce61cf16 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/ce61cf16 Branch: refs/heads/master Commit: ce61cf16e9d1872ada8345e7cb060a6cb3db5aa0 Parents: b3bcddc ebc9941 Author: anatole <anat...@apache.org> Authored: Sun Mar 19 00:22:30 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 00:22:30 2017 +0100 -- modules/functions/pom.xml | 5 ++ .../tamaya/functions/CombinedConfiguration.java | 7 ++- .../tamaya/functions/MappedConfiguration.java | 3 + .../functions/CombinedConfigurationTest.java| 50 - .../tamaya/functions/InMemoryConfiguration.java | 35 .../functions/MappedConfigurationTest.java | 58 pom.xml | 17 ++ running-mutation-tests.adoc | 19 +++ 8 files changed, 180 insertions(+), 14 deletions(-) --
[03/12] incubator-tamaya-extensions git commit: TAMAYA-238: Unified CDI injection modules.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi-ee/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java -- diff --git a/modules/injection/cdi-ee/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java b/modules/injection/cdi-ee/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java deleted file mode 100644 index 6b73294..000 --- a/modules/injection/cdi-ee/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java +++ /dev/null @@ -1,83 +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.integration.cdi; -// -//import org.junit.Test; -// -//import java.util.Map; -//import java.util.Properties; -// -//import static org.junit.Assert.assertEquals; -// -///** -// * Tests the related environment properties exist -// */ -//public class EnvironmentsTest { -// -//@Test -//public void testGetProperties() throws Exception { -// -//final Properties test = Environments.getProperties("test"); -// -//// loaded from test.properties -//assertEquals("classpath:/test-service-wsdl.xml", test.getProperty("remote.wsdl.location")); -// -//// loaded from base.properties -//assertEquals("joecool", test.getProperty("remote.username")); -//} -// -//@Test(expected = IllegalArgumentException.class) -//public void noEnvFound() { -//Environments.getProperties("does not exists"); -//} -// -//@Test -//public void dev() throws Exception { -// -//final Properties test = Environments.getProperties("dev"); -// -//assertEquals("org.apache.openejb.cipher.StaticDESPasswordCipher", test.getProperty("cipher")); -//assertEquals("NjAq6q2agYVnvSMz+eYUZg==", test.getProperty("remote.password")); -//assertEquals("1443", test.getProperty("remote.port")); -// assertEquals("https://srv1114.supertribe.org:1443/remote/service/url;, test.getProperty("remote.target.url")); -//assertEquals("srv1114.supertribe.org:1443", test.getProperty("remote.address")); -//assertEquals("srv1114.supertribe.org", test.getProperty("remote.host")); -//assertEquals("classpath:/service-wsdl.xml", test.getProperty("remote.wsdl.location")); -//assertEquals("joecool", test.getProperty("remote.username")); -//} -// -//@Test -//public void cert() throws Exception { -//final Properties test = Environments.getProperties("cert"); -//assertEquals("srv1016.supertribe.org", test.getProperty("remote.host")); -//assertEquals("joecool", test.getProperty("remote.username")); -//} -// -//@Test -//public void prod() throws Exception { -//final Properties test = Environments.getProperties("prod"); -//assertEquals("remotedb001.supertribe.org", test.getProperty("remote.host")); -//assertEquals("joecool", test.getProperty("remote.username")); -//} -// -// -//private static void generateAsserts(Properties test) { -//for (Map.Entry
[10/12] incubator-tamaya-extensions git commit: TAMAYA-238: Fxed tests.
ot;)); +//assertEquals("${not an address}/webapp", interpolated.getProperty("urlUnchanged")); +//} +// +//@Test +//public void test() throws Exception { +// +//final ClassLoader loader = Thread.currentThread().getContextClassLoader(); +// +//final URL resource = loader.getResource("test.properties"); +//final Properties properties = Interpolation.interpolate(IO.readProperties(resource)); +// +////remote.wsdl.location = classpath:/lx01116-zhr-active-partner-service-wsdl.xml +//assertEquals("classpath:/test-service-wsdl.xml", properties.getProperty("remote.wsdl.location")); +//} +// +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java -- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java new file mode 100644 index 000..56151ec --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java @@ -0,0 +1,78 @@ +///* +// * 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.integration.cdi; +// +//import org.apache.tamaya.inject.api.Config; +//import org.tomitribe.util.Duration; +// +//import javax.inject.Inject; +//import java.io.File; +// +//public class NotFoundNoDefault { +// +//@Inject +//@Config("string.bla") +//private String string; +// +//@Inject +//@Config("file.bla") +//private File file; +// +//@Inject +//@Config("duration.bla") +//private Duration duration; +// +//@Inject +//@Config("boolean.bla") +//private Boolean aBoolean; +// +//@Inject +//@Config("integer.bla") +//private Integer integer; +// +//public String getString() { +//return string; +//} +// +//public File getFile() { +//return file; +//} +// +//public Duration getDuration() { +//return duration; +//} +// +//public Boolean getaBoolean() { +//return aBoolean; +//} +// +//public Integer getInteger() { +//return integer; +//} +// +//@Override +//public String toString() { +//return "NotFoundNoDefault{" + +//"string='" + string + '\'' + +//", file=" + file + +//", duration=" + duration + +//", aBoolean=" + aBoolean + +//", integer=" + integer + +//'}'; +//} +// +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/cfg/ProvidedPropertySource.java -- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/cfg/ProvidedPropertySource.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/cfg/ProvidedPropertySource.java new file mode 100644 index 000..8ed0588 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/cfg/ProvidedPropertySource.java @@ -0,0 +1,66 @@ +/* + * 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 current the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless req
[08/12] incubator-tamaya-extensions git commit: TAMAYA-259: Added tests.
TAMAYA-259: Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/9050e020 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/9050e020 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/9050e020 Branch: refs/heads/master Commit: 9050e020b8cb9595e64fd0f7e600157bb8eb779a Parents: 2c1f5df Author: anatole <anat...@apache.org> Authored: Sun Mar 19 22:02:04 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 22:02:04 2017 +0100 -- .../java/org/apache/tamaya/features/Features.java| 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9050e020/modules/features/src/main/java/org/apache/tamaya/features/Features.java -- diff --git a/modules/features/src/main/java/org/apache/tamaya/features/Features.java b/modules/features/src/main/java/org/apache/tamaya/features/Features.java index 3b73635..de1b2af 100644 --- a/modules/features/src/main/java/org/apache/tamaya/features/Features.java +++ b/modules/features/src/main/java/org/apache/tamaya/features/Features.java @@ -163,12 +163,23 @@ public final class Features { } /** - * Checks if the given class canm be loaded, using {@code Class.forName(classname)}. + * Checks if the given class canm be loaded, using {@code Class.forName(classname)} + * using the current Thread Context ClassLoader. + * @param classname the fully qualified classname. * @return true, if the given class canm be loaded. */ public static boolean checkClassIsLoadable(String classname) { +return checkClassIsLoadable(classname, Thread.currentThread().getContextClassLoader()); +} + +/** + * Checks if the given class canm be loaded, using {@code Class.forName(classname)}. + * @param classname the fully qualified classname. + * @return true, if the given class canm be loaded. + */ +public static boolean checkClassIsLoadable(String classname, ClassLoader classLoader) { try{ -Class.forName(Objects.requireNonNull(classname), false, Thread.currentThread().getContextClassLoader()); +Class.forName(Objects.requireNonNull(classname), false, classLoader); return true; }catch(Throwable e){ return false;
[07/12] incubator-tamaya-extensions git commit: TAMAYA-259: Added tests.
TAMAYA-259: Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/2c1f5dfd Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/2c1f5dfd Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/2c1f5dfd Branch: refs/heads/master Commit: 2c1f5dfdd550ade9327e01d7a6850ea30d8d64bf Parents: b90a4bb Author: anatole <anat...@apache.org> Authored: Sun Mar 19 21:46:02 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 21:46:02 2017 +0100 -- modules/features/pom.xml| 84 .../org/apache/tamaya/features/Features.java| 12 +- .../apache/tamaya/features/FeaturesTest.java| 115 .../tamaya/features/FeaturesTestNoOnly.java | 135 +++ 4 files changed, 340 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/2c1f5dfd/modules/features/pom.xml -- diff --git a/modules/features/pom.xml b/modules/features/pom.xml index 4bc274b..30677d2 100644 --- a/modules/features/pom.xml +++ b/modules/features/pom.xml @@ -57,6 +57,90 @@ under the License. junit junit + +org.apache.tamaya.ext +tamaya-injection +${project.version} +test + + +org.apache.tamaya.ext +tamaya-optional +${project.version} +test + + +org.apache.tamaya.ext +tamaya-formats +${project.version} +test + + +org.apache.tamaya.ext +tamaya-cdi +${project.version} +test + + +org.apache.tamaya.ext +tamaya-resolver +${project.version} +test + + +org.apache.tamaya.ext +tamaya-resources +${project.version} +test + + +org.apache.tamaya.ext +tamaya-mutable-config +${project.version} +test + + +org.apache.tamaya.ext +tamaya-spring +${project.version} +test + + +org.apache.tamaya.ext +tamaya-filter +${project.version} +test + + +org.apache.tamaya.ext +tamaya-spisupport +${project.version} +test + + +org.apache.tamaya.ext +tamaya-events +${project.version} +test + + +org.apache.tamaya.ext +tamaya-jndi +${project.version} +test + + +org.springframework +spring-core +4.2.4.RELEASE +test + + +org.apache.felix +org.osgi.compendium +1.0.0 +test + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/2c1f5dfd/modules/features/src/main/java/org/apache/tamaya/features/Features.java -- diff --git a/modules/features/src/main/java/org/apache/tamaya/features/Features.java b/modules/features/src/main/java/org/apache/tamaya/features/Features.java index 6abb6c5..3b73635 100644 --- a/modules/features/src/main/java/org/apache/tamaya/features/Features.java +++ b/modules/features/src/main/java/org/apache/tamaya/features/Features.java @@ -57,7 +57,7 @@ public final class Features { * Checks if tamaya-injection is on the classpath. * @return true, if tamaya-injection is on the classpath. */ -public static boolean injectionAvailable() { +public static boolean injectionStandaloneAvailable() { return checkClassIsLoadable("org.apache.tamaya.inject.ConfigurationInjector"); } @@ -66,7 +66,7 @@ public final class Features { * @return true, if tamaya-injection-cdi or tamaya-injection-ee is on the classpath. */ public static boolean injectionCDIAvailable() { -return checkClassIsLoadable("org.apache.tamaya.integration.cdi.TamayaCDIIntegration"); +return checkClassIsLoadable("org.apache.tamaya.cdi.DefaultDynamicValue"); } /** @@ -74,7 +74,7 @@ public final class Features { * @return true, if tamaya-mutableconfig is on the classpath. */ public static boolean mutableConfigAvailable
[09/12] incubator-tamaya-extensions git commit: TAMAYA-238: Fxed tests.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java -- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java deleted file mode 100644 index 6e86b8d..000 --- a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.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 current 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.integration.cdi.cfg; - -import org.apache.tamaya.spi.PropertySource; -import org.apache.tamaya.spi.PropertyValue; - -import javax.inject.Singleton; -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Anatole on 17.09.2015. - */ -@Singleton -public class TestPropertySource implements PropertySource{ - -final Map<String,String> config = new HashMap<>(); - -public TestPropertySource(){ -config.put("a.b.c.key1", "keys current a.b.c.key1"); -config.put("a.b.c.key2", "keys current a.b.c.key2"); -config.put("a.b.key3", "keys current a.b.key3"); -config.put("a.b.key4", "keys current a.b.key4"); -config.put("a.key5", "keys current a.key5"); -config.put("a.key6", "keys current a.key6"); -config.put("int1", "123456"); -config.put("int2", "111222"); -config.put("testProperty", "testPropertyValue!"); -config.put("booleanT", "true"); -config.put("double1", "1234.5678"); -config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789"); -config.put("testProperty", "keys current testProperty"); -config.put("runtimeVersion", "${java.version}"); -config.put("{meta}source.type:"+getClass().getName(), "PropertySource"); -} - -public int getOrdinal() { -return 10; -} - -@Override -public String getName() { -return getClass().getName(); -} - -@Override -public PropertyValue get(String key) { -String val = this.config.get(key); -if(val!=null) { -return PropertyValue.of(key, val, getName()); -} -return null; -} - -@Override -public Map<String, PropertyValue> getProperties() { -return PropertyValue.map(config ,getName()); -} - -@Override -public boolean isScannable() { -return true; -} -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension -- diff --git a/modules/injection/cdi/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/modules/injection/cdi/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension new file mode 100644 index 000..6ffa57c --- /dev/null +++ b/modules/injection/cdi/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension @@ -0,0 +1,20 @@ +# +# 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 current 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. +# +org.apache.tamaya.cdi.TamayaCDIInjectionExtension +org.apache.tamaya.cdi.TamayaSEInjectionExtension
[11/12] incubator-tamaya-extensions git commit: TAMAYA-238: Fxed tests.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/TamayaSEInjectionExtension.java -- diff --git a/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/TamayaSEInjectionExtension.java b/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/TamayaSEInjectionExtension.java new file mode 100644 index 000..024b895 --- /dev/null +++ b/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/TamayaSEInjectionExtension.java @@ -0,0 +1,109 @@ +/* + * 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.cdi; + + +import org.apache.tamaya.inject.ConfigurationInjection; +import org.apache.tamaya.inject.api.Config; +import org.apache.tamaya.inject.api.ConfigDefaultSections; + +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.event.Observes; +import javax.enterprise.inject.Vetoed; +import javax.enterprise.inject.spi.*; +import javax.inject.Inject; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Set; + +/** + * CDI portable extension that integrates {@link org.apache.tamaya.inject.ConfigurationInjector} + * with CDI by adding configuration features to CDI (config enable CDI beans). + */ +@Vetoed +public final class TamayaSEInjectionExtension implements Extension { + +/** + * Method that injects the values into any configured fields, by wrapping the given + * InjectionTarget. + * @param pit the injection target + * @param the target type + */ +public void initializeConfiguredFields(final @Observes ProcessInjectionTarget pit) { +final AnnotatedType at = pit.getAnnotatedType(); +if (!isConfigured(at.getJavaClass())) { +return; +} +final InjectionTarget it = pit.getInjectionTarget(); +InjectionTarget wrapped = new InjectionTarget() { +@Override +public void inject(T instance, CreationalContext ctx) { +it.inject(instance, ctx); + ConfigurationInjection.getConfigurationInjector().configure(instance); +} + +@Override +public void postConstruct(T instance) { +it.postConstruct(instance); +} + +@Override +public void preDestroy(T instance) { +it.dispose(instance); +} + +@Override +public void dispose(T instance) { +it.dispose(instance); +} + +@Override +public Set getInjectionPoints() { +return it.getInjectionPoints(); +} + +@Override +public T produce(CreationalContext ctx) { +return it.produce(ctx); +} +}; +pit.setInjectionTarget(wrapped); +} + +private boolean isConfigured(Class type) { +if (type.getAnnotation(ConfigDefaultSections.class) != null) { +return true; +} +// if no class level annotation is there we might have field level annotations only +for (Field field : type.getDeclaredFields()) { +if (field.isAnnotationPresent(Config.class) && !field.isAnnotationPresent(Inject.class)) { +return true; +} +} +// if no class level annotation is there we might have method level annotations only +for (Method method : type.getDeclaredMethods()) { +if(method.isAnnotationPresent(Config.class)) { +return true; +} +} +return false; +} + + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/extra/ConfiguredVetoExtension.java -- diff --git a/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/extra/ConfiguredVetoExtension.java b/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/extra/ConfiguredVetoExtension.java new file mode 100644 index
[12/12] incubator-tamaya-extensions git commit: TAMAYA-238: Fxed tests.
TAMAYA-238: Fxed tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/346a4f38 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/346a4f38 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/346a4f38 Branch: refs/heads/master Commit: 346a4f38744cff476e8753913d56b34cd368c520 Parents: 9050e02 Author: anatole <anat...@apache.org> Authored: Sun Mar 19 23:05:24 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 23:05:24 2017 +0100 -- .../javax.enterprise.inject.spi.Extension | 20 - modules/injection/cdi/bnd.bnd | 4 +- modules/injection/cdi/pom.xml | 63 --- .../tamaya/cdi/CDIAwareServiceContext.java | 206 .../apache/tamaya/cdi/CDIConfiguredField.java | 77 +++ .../apache/tamaya/cdi/CDIConfiguredMethod.java | 77 +++ .../apache/tamaya/cdi/CDIConfiguredType.java| 94 .../tamaya/cdi/ConfigurationExtension.java | 290 +++ .../tamaya/cdi/ConfigurationProducer.java | 162 ++ .../apache/tamaya/cdi/DefaultDynamicValue.java | 497 +++ .../tamaya/cdi/ServiceLoaderServiceContext.java | 190 +++ .../apache/tamaya/cdi/TamayaCDIAccessor.java| 52 ++ .../tamaya/cdi/TamayaCDIInjectionExtension.java | 277 +++ .../tamaya/cdi/TamayaSEInjectionExtension.java | 109 .../cdi/extra/ConfiguredVetoExtension.java | 43 ++ .../integration/cdi/CDIAwareServiceContext.java | 206 .../integration/cdi/CDIConfiguredField.java | 77 --- .../integration/cdi/CDIConfiguredMethod.java| 77 --- .../integration/cdi/CDIConfiguredType.java | 94 .../integration/cdi/ConfigurationExtension.java | 290 --- .../integration/cdi/ConfigurationProducer.java | 253 -- .../integration/cdi/DefaultDynamicValue.java| 497 --- .../cdi/ServiceLoaderServiceContext.java| 190 --- .../integration/cdi/TamayaCDIAccessor.java | 52 -- .../cdi/TamayaCDIInjectionExtension.java| 277 --- .../cdi/TamayaSEInjectionExtension.java | 108 .../cdi/extra/ConfiguredVetoExtension.java | 43 -- .../javax.enterprise.inject.spi.Extension | 6 +- .../org.apache.tamaya.spi.ServiceContext| 2 +- ...onfigurationProducerFailedInjectionTest.java | 33 ++ .../tamaya/cdi/ConfigurationProducerTest.java | 171 +++ .../tamaya/cdi/ConfigurationResolverTest.java | 112 + .../org/apache/tamaya/cdi/ConfiguredClass.java | 111 + .../org/apache/tamaya/cdi/ConfiguredTest.java | 83 .../org/apache/tamaya/cdi/EnvironmentsTest.java | 83 .../org/apache/tamaya/cdi/InjectedClass.java| 62 +++ .../apache/tamaya/cdi/InterpolationTest.java| 62 +++ .../apache/tamaya/cdi/NotFoundNoDefault.java| 78 +++ .../tamaya/cdi/cfg/ProvidedPropertySource.java | 66 +++ .../tamaya/cdi/cfg/TestConfigProvider.java | 45 ++ .../tamaya/cdi/cfg/TestPropertySource.java | 82 +++ ...onfigurationProducerFailedInjectionTest.java | 33 -- .../cdi/ConfigurationProducerTest.java | 169 --- .../cdi/ConfigurationResolverTest.java | 112 - .../tamaya/integration/cdi/ConfiguredClass.java | 111 - .../tamaya/integration/cdi/ConfiguredTest.java | 83 .../integration/cdi/EnvironmentsTest.java | 83 .../tamaya/integration/cdi/InjectedClass.java | 62 --- .../integration/cdi/InterpolationTest.java | 62 --- .../integration/cdi/NotFoundNoDefault.java | 78 --- .../cdi/cfg/ProvidedPropertySource.java | 66 --- .../integration/cdi/cfg/TestConfigProvider.java | 45 -- .../integration/cdi/cfg/TestPropertySource.java | 82 --- .../javax.enterprise.inject.spi.Extension | 20 + 54 files changed, 3088 insertions(+), 3239 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/346a4f38/modules/injection/cdi-se/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension -- diff --git a/modules/injection/cdi-se/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/modules/injection/cdi-se/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension deleted file mode 100644 index 8580a42..000 --- a/modules/injection/cdi-se/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension +++ /dev/null @@ -1,20 +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 copyrig
incubator-tamaya-extensions git commit: TAMAYA-238: Unified modules for CDI based injection.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 304824b69 -> f38853f20 TAMAYA-238: Unified modules for CDI based injection. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/f38853f2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/f38853f2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/f38853f2 Branch: refs/heads/master Commit: f38853f20af335c17d22b5eaeefab9d3dc2ff533 Parents: 304824b Author: anatole <anat...@apache.org> Authored: Mon Mar 20 08:55:47 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 20 08:55:47 2017 +0100 -- .../cdi/ServiceLoaderServiceContext.java| 197 - .../integration/cdi/TamayaCDIIntegration.java | 52 --- .../src/main/resources/META-INF/beans.xml | 19 - .../org.apache.tamaya.spi.ServiceContext| 38 -- .../src/test/resources/META-INF/beans.xml | 19 - modules/injection/cdi-se/pom.xml| 181 .../integration/cdi/CDIAwareServiceContext.java | 206 - .../cdi/DefaultConfigurationContext.java| 223 -- .../cdi/DefaultConfigurationContextBuilder.java | 152 --- .../tamaya/integration/cdi/EnumConverter.java | 71 --- .../cdi/PropertyConverterManager.java | 427 --- .../integration/cdi/TamayaConfigProvider.java | 55 --- .../META-INF/javaconfiguration.properties | 20 - modules/injection/pom.xml | 3 +- 14 files changed, 1 insertion(+), 1662 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f38853f2/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/ServiceLoaderServiceContext.java -- diff --git a/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/ServiceLoaderServiceContext.java b/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/ServiceLoaderServiceContext.java deleted file mode 100644 index 4b82429..000 --- a/modules/injection/cdi-ee/src/main/java/org/apache/tamaya/integration/cdi/ServiceLoaderServiceContext.java +++ /dev/null @@ -1,197 +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.integration.cdi; - -import org.apache.tamaya.ConfigException; -import org.apache.tamaya.spi.ServiceContext; -import org.apache.tamaya.spisupport.PriorityServiceComparator; - -import javax.annotation.Priority; -import java.io.IOException; -import java.net.URL; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; -import java.util.ServiceConfigurationError; -import java.util.ServiceLoader; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * This class implements the (default) {@link ServiceContext} interface and hereby uses the JDK - * {@link ServiceLoader} to load the services required. - */ -final class ServiceLoaderServiceContext implements ServiceContext { -private static final Logger LOG = Logger.getLogger(ServiceLoaderServiceContext.class.getName()); -/** - * List current services loaded, per class. - */ -private final ConcurrentHashMap<Class, List> servicesLoaded = new ConcurrentHashMap<>(); -/** - * Singletons. - */ -private final Map<Class, Object> singletons = new ConcurrentHashMap<>(); -private Map<Class, Class> factoryTypes = new ConcurrentHashMap<>(); - -@Override -public T getService(Class serviceType) { -Object cached = singletons.get(serviceType); -if (cached == null) { -cached = create(serviceType); -
incubator-tamaya-extensions git commit: TAMAYA-238: Added test with unresolvable deps.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 346a4f387 -> 304824b69 TAMAYA-238: Added test with unresolvable deps. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/304824b6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/304824b6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/304824b6 Branch: refs/heads/master Commit: 304824b69eacd22d8e4a4f58827b4ddfa64f972b Parents: 346a4f3 Author: anatole <anat...@apache.org> Authored: Mon Mar 20 08:55:08 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 20 08:55:08 2017 +0100 -- .../tamaya/cdi/ConfigurationProducerTest.java | 18 --- .../tamaya/cdi/ConfigurationResolverTest.java | 112 - .../org/apache/tamaya/cdi/ConfiguredTest.java | 5 + .../org/apache/tamaya/cdi/EnvironmentsTest.java | 83 -- .../apache/tamaya/cdi/InterpolationTest.java| 62 .../apache/tamaya/cdi/NotFoundNoDefault.java| 159 ++- 6 files changed, 86 insertions(+), 353 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java -- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java index 127deb2..b62eb66 100644 --- a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java @@ -87,14 +87,6 @@ public class ConfigurationProducerTest { @Config(value = "defaultFile.value", defaultValue = "./") private File defaultFile; -//@Inject -//@Config(value = "duration.value", defaultValue = "2 hours and 54 minutes") -//private Duration duration; -// -//@Inject -//@Config(value = "defaultDuration.value", defaultValue = "2 hours and 54 minutes") -//private Duration defaultDuration; - @Inject @Config(value = "boolean.value", defaultValue = "true") private Boolean aBoolean; @@ -119,10 +111,6 @@ public class ConfigurationProducerTest { return file; } -//public Duration getDuration() { -//return duration; -//} - public Boolean getaBoolean() { return aBoolean; } @@ -139,10 +127,6 @@ public class ConfigurationProducerTest { return defaultFile; } -//public Duration getDefaultDuration() { -//return defaultDuration; -//} - public Boolean getDefaultBoolean() { return defaultBoolean; } @@ -158,8 +142,6 @@ public class ConfigurationProducerTest { ", defaultString='" + defaultString + '\'' + ", file=" + file + ", defaultFile=" + defaultFile + -//", duration=" + duration + -//", defaultDuration=" + defaultDuration + ", aBoolean=" + aBoolean + ", defaultBoolean=" + defaultBoolean + ", integer=" + integer + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java -- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java deleted file mode 100644 index f7e501d..000 --- a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java +++ /dev/null @@ -1,112 +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 appl
incubator-tamaya git commit: Added test for createConfiguration, removed markers.
Repository: incubator-tamaya Updated Branches: refs/heads/master 32661ef7a -> ca19d2d42 Added test for createConfiguration, removed markers. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ca19d2d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ca19d2d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ca19d2d4 Branch: refs/heads/master Commit: ca19d2d42e4eccfef8cb1b04a53d1c6061636bad Parents: 32661ef Author: anatole <anat...@apache.org> Authored: Wed Mar 22 00:38:47 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Mar 22 00:38:47 2017 +0100 -- .../core/internal/DefaultConfigurationProviderTest.java | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ca19d2d4/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java -- diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java index b5fb80c..2f45896 100644 --- a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java +++ b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java @@ -18,6 +18,7 @@ */ package org.apache.tamaya.core.internal; +import org.apache.tamaya.spi.ConfigurationContext; import org.junit.Test; import static org.junit.Assert.*; @@ -38,6 +39,14 @@ public class DefaultConfigurationProviderTest { } @Test +public void createConfiguration() throws Exception { +ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build(); +assertNotNull(new DefaultConfigurationProvider().createConfiguration(ctx)); +assertEquals(ctx, +new DefaultConfigurationProvider().createConfiguration(ctx).getContext()); +} + +@Test public void getConfigurationContext() throws Exception { assertNotNull(new DefaultConfigurationProvider().getConfigurationContext()); }
incubator-tamaya git commit: Added tests fir with and query, reenabled methods.
Repository: incubator-tamaya Updated Branches: refs/heads/master 4d5f5187c -> 32661ef7a Added tests fir with and query, reenabled methods. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/32661ef7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/32661ef7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/32661ef7 Branch: refs/heads/master Commit: 32661ef7ac89b9908a471043cc6fc47a748bffef Parents: 4d5f518 Author: anatole <anat...@apache.org> Authored: Wed Mar 22 00:16:50 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Wed Mar 22 00:17:40 2017 +0100 -- .../core/internal/DefaultConfiguration.java | 2 - .../propertysource/SystemPropertySource.java| 4 +- .../core/internal/DefaultConfigurationTest.java | 41 3 files changed, 43 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32661ef7/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java index 48cd555..54cd186 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java @@ -219,13 +219,11 @@ public class DefaultConfiguration implements Configuration { @Override public Configuration with(ConfigOperator operator) { -// todo obf if (1==1) throw new RuntimeException("No tests written."); return operator.operate(this); } @Override public T query(ConfigQuery query) { -// todo obf if (1==1) throw new RuntimeException("No tests written."); return query.query(this); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32661ef7/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java index 4dca29d..7759827 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java +++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java @@ -138,9 +138,9 @@ public class SystemPropertySource extends BasePropertySource { Map<String,PropertyValue> values = new HashMap<>(); for (Map.Entry<Object,Object> entry : sysProps.entrySet()) { if(prefix==null) { -values.put((String) entry.getKey(), PropertyValue.of((String) entry.getKey(), (String)entry.getValue(), getName())); +values.put(entry.getKey().toString(), PropertyValue.of(entry.getKey().toString(), entry.getValue().toString(), getName())); }else { -values.put(prefix + entry.getKey(), PropertyValue.of(prefix + entry.getKey(), (String)entry.getValue(), getName())); +values.put(prefix + entry.getKey(), PropertyValue.of(prefix + entry.getKey(), entry.getValue().toString(), getName())); } } return values; http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32661ef7/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java -- diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java index 541689f..c12d157 100644 --- a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java +++ b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java @@ -18,6 +18,9 @@ */ package org.apache.tamaya.core.internal; +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.*; import org.junit.Test; @@ -26,6 +29,8 @@ import org.mockito.internal.matchers.Null; import java.util.List; import java.util.Map; +import static org.junit.Assert.assertEquals; + public class DefaultConfigurationTest { /* @@ -129,6 +134,42 @@ public class DefaultConfigurationTest { c.getOrDefault("a", null); } +@Test(ex
incubator-tamaya-extensions git commit: TAMAYA-238: Added explicit bundle names.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 01ba7463e -> fe572c185 TAMAYA-238: Added explicit bundle names. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/fe572c18 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/fe572c18 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/fe572c18 Branch: refs/heads/master Commit: fe572c185baa831796a8626fed4eebc3416135ff Parents: 01ba746 Author: anatole <anat...@apache.org> Authored: Sat Mar 11 23:36:54 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sat Mar 11 23:36:54 2017 +0100 -- modules/events/bnd.bnd | 3 ++- modules/features/bnd.bnd| 3 ++- modules/filter/bnd.bnd | 3 ++- modules/injection/cdi-ee/bnd.bnd| 3 +++ modules/injection/injection-api/bnd.bnd | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe572c18/modules/events/bnd.bnd -- diff --git a/modules/events/bnd.bnd b/modules/events/bnd.bnd index 95aebbc..21036e3 100644 --- a/modules/events/bnd.bnd +++ b/modules/events/bnd.bnd @@ -1,3 +1,4 @@ Export-Package: \ org.apache.tamaya.events,\ - org.apache.tamaya.events.spi \ No newline at end of file + org.apache.tamaya.events.spi +Bundle-SymbolicName: org.apache.tamaya.events \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe572c18/modules/features/bnd.bnd -- diff --git a/modules/features/bnd.bnd b/modules/features/bnd.bnd index e0d0b58..708dedd 100644 --- a/modules/features/bnd.bnd +++ b/modules/features/bnd.bnd @@ -1,2 +1,3 @@ Export-Package: \ - org.apache.tamaya.features \ No newline at end of file + org.apache.tamaya.features +Bundle-SymbolicName: org.apache.tamaya.features \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe572c18/modules/filter/bnd.bnd -- diff --git a/modules/filter/bnd.bnd b/modules/filter/bnd.bnd index 4e2f0f8..b0a3aa3 100644 --- a/modules/filter/bnd.bnd +++ b/modules/filter/bnd.bnd @@ -1,2 +1,3 @@ Export-Package: \ - org.apache.tamaya.filter \ No newline at end of file + org.apache.tamaya.filter +Bundle-SymbolicName: org.apache.tamaya.filter \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe572c18/modules/injection/cdi-ee/bnd.bnd -- diff --git a/modules/injection/cdi-ee/bnd.bnd b/modules/injection/cdi-ee/bnd.bnd new file mode 100644 index 000..a97720d --- /dev/null +++ b/modules/injection/cdi-ee/bnd.bnd @@ -0,0 +1,3 @@ +Export-Package: \ + org.apache.tamaya.inject +Bundle-SymbolicName: org.apache.tamaya.inject-ee \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/fe572c18/modules/injection/injection-api/bnd.bnd -- diff --git a/modules/injection/injection-api/bnd.bnd b/modules/injection/injection-api/bnd.bnd index 3516930..f34b1f9 100644 --- a/modules/injection/injection-api/bnd.bnd +++ b/modules/injection/injection-api/bnd.bnd @@ -1,7 +1,7 @@ Export-Package: \ org.apache.tamaya.inject.api,\ org.apache.tamaya.inject.spi -Bundle-SymbolicName: org.apache.tamaya.inject.api Import-Package: org.apache.tamaya,\ org.apache.tamaya.inject.api,\ -org.apache.tamaya.spi \ No newline at end of file +org.apache.tamaya.spi +Bundle-SymbolicName: org.apache.tamaya.inject.api \ No newline at end of file
incubator-tamaya-site git commit: TAMAYA-256: Fixed Java version, tests and added documentation for Vertx support.
Repository: incubator-tamaya-site Updated Branches: refs/heads/master 5a66c777e -> 8f1fa3a86 TAMAYA-256: Fixed Java version, tests and added documentation for Vertx support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/commit/8f1fa3a8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/tree/8f1fa3a8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/diff/8f1fa3a8 Branch: refs/heads/master Commit: 8f1fa3a86e2979ccc3424905b3714f8d4763cece Parents: 5a66c77 Author: anatole <anat...@apache.org> Authored: Sat Mar 11 00:04:29 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sat Mar 11 23:37:22 2017 +0100 -- content/documentation/extensions.adoc | 1 + content/documentation/extensions/mod_vertx.adoc | 189 +++ 2 files changed, 190 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/8f1fa3a8/content/documentation/extensions.adoc -- diff --git a/content/documentation/extensions.adoc b/content/documentation/extensions.adoc index 0c643f1..b8e082a 100644 --- a/content/documentation/extensions.adoc +++ b/content/documentation/extensions.adoc @@ -64,4 +64,5 @@ NOTE: All extensions currently run on Java 7 as well as on Java 8. |+org.apache.tamaya.ext:tamaya-ui+ |Provides a web UI for a VM running Tamaya.|link:extensions/mod_ui.html[Documentation] |+org.apache.tamaya.ext:tamaya-usagetracker+ |Allows tracking of configuration usage. |link:extensions/mod_usagetracker.html[Documentation] |+org.apache.tamaya.ext:tamaya-validation+ |Provides an XML API for validating configuration. |link:extensions/mod_validation.html[Documentation] +|+org.apache.tamaya.ext:tamaya-vertx-alpha+ |Provides Vertx integration. |link:extensions/mod_vertx.html[Documentation] |=== http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/8f1fa3a8/content/documentation/extensions/mod_vertx.adoc -- diff --git a/content/documentation/extensions/mod_vertx.adoc b/content/documentation/extensions/mod_vertx.adoc new file mode 100644 index 000..4bb93d5 --- /dev/null +++ b/content/documentation/extensions/mod_vertx.adoc @@ -0,0 +1,189 @@ +:jbake-type: page +:jbake-status: published + += Apache Tamaya -- Extension: Integration for Vertx + +toc::[] + + +[[JNDI]] +== Integration with Vertx (Extension Module) +Tamaya _JNDI_ is an extension module. Refer to the link:../extensions.html[extensions documentation] for further details. + +=== What functionality this module provides ? + +Tamaya _Vertx_ provides configuration services that can be used in a Vertx environment: + +* +AbstractConfiguredVerticle+ defines a subclass extending +AbstractVerticle+, which allows you to + use Tamaya Injection API. +* Additionally you deply a +ConfigVerticle+, which registers services to access configuration + using asynchronous event bus. + + +=== Compatibility + +The module requires Java 8, so it will not run on Java 7. + + +=== Installation + +To use Tamaya's _Vertx_ support you only must add the corresponding dependency to +your module: + +[source, xml] +--- + + org.apache.tamaya.ext + tamaya-vertx-alpha + {tamaya_version} + +--- + + +=== The Functionality Provided + +NOTE: This module is in alpha state. Please give feedback via our JIRA, so we can improve it. + + + Extending AbstractConfiguredVerticle + +Main artifact is the +AbstractConfiguredVerticle+ class, which implements a +base verticle class for Vertx: + +[source, java] +--- +public abstract class AbstractConfiguredVerticle extends AbstractVerticle{ + +private Configuration configuration; + +public AbstractConfiguredVerticle() { +configure(); +} + +public Configuration getConfiguration(){ +if(this.configuration==null){ + this.configuration = ConfigurationProvider.getConfiguration(); +} +return this.configuration; +} + +public void setConfiguration(Configuration configuration){ +this.configuration = configuration; +configure(); +} + +protected void configure(){ +ConfigurationInjection.getConfigurationInjector().configure(this, getConfiguration()); +} + +protected final String getConfigProperty(String key); +protected final String getConfigPropertyOrDefault(String key, String defaultValue); +protected final T getConfigProperty(String key, Class type); +pro
[4/6] incubator-tamaya git commit: TAMAYA-252: Clarified PropertyValue API.
TAMAYA-252: Clarified PropertyValue 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/8c0081b9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8c0081b9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8c0081b9 Branch: refs/heads/master Commit: 8c0081b9a8f6123f080bdd4c4b33dc0c62fde451 Parents: b59c1ae Author: anatole <anat...@apache.org> Authored: Fri Mar 3 22:27:02 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:29:34 2017 +0100 -- .../org/apache/tamaya/spi/PropertyValue.java| 60 + .../apache/tamaya/spi/PropertyValueBuilder.java | 70 +--- 2 files changed, 108 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8c0081b9/code/api/src/main/java/org/apache/tamaya/spi/PropertyValue.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/PropertyValue.java b/code/api/src/main/java/org/apache/tamaya/spi/PropertyValue.java index 30afeab..0332b85 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/PropertyValue.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/PropertyValue.java @@ -18,6 +18,7 @@ */ package org.apache.tamaya.spi; +import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -29,18 +30,21 @@ import java.util.Objects; * it is possible to create a PropertyValue with a null value. Nevertheless in all cases the provider source (typically * the name of the PropertySource) must be set. */ -public final class PropertyValue { +public final class PropertyValue implements Serializable{ +private static final long serialVersionUID = 1L; /** The requested key. */ private String key; +/** The value. */ +private String value; /** Additional metadata provided by the provider. */ -private Map<String,String> configEntries = new HashMap<>(); +private Map<String,String> metaEntries = new HashMap<>(); PropertyValue(PropertyValueBuilder builder){ this.key = builder.key; -if(builder.contextData!=null) { -this.configEntries.putAll(builder.contextData); +this.value = Objects.requireNonNull(builder.value); +if(builder.metaEntries !=null) { +this.metaEntries.putAll(builder.metaEntries); } -this.configEntries.put(key, Objects.requireNonNull(builder.value)); } /** @@ -51,8 +55,8 @@ public final class PropertyValue { */ private PropertyValue(String key, String value, String source){ this.key = Objects.requireNonNull(key, "key is required."); -this.configEntries.put(key, value); -this.configEntries.put("_"+key+".source", Objects.requireNonNull(source, "source is required.")); +this.value = Objects.requireNonNull(value); +this.metaEntries.put("_"+key+".source", Objects.requireNonNull(source, "source is required.")); } /** @@ -69,7 +73,7 @@ public final class PropertyValue { * {@link PropertySource#get(String)}. */ public String getValue() { -return configEntries.get(key); +return this.value; } /** @@ -77,8 +81,8 @@ public final class PropertyValue { * is also used for subsequent processing, like value filtering. * @return the property value entry map. */ -public Map<String, String> getConfigEntries() { -return Collections.unmodifiableMap(configEntries); +public Map<String, String> getMetaEntries() { +return Collections.unmodifiableMap(metaEntries); } /** @@ -111,7 +115,39 @@ public final class PropertyValue { * @param key the key, not null. * @return the value found, or null. */ -public String get(String key) { -return this.configEntries.get(key); +public String getMetaEntry(String key) { +return this.metaEntries.get(key); +} + +/** + * Creates a new builder instance based on this item. + * @return a new builder, never null. + */ +public PropertyValueBuilder toBuilder() { +return new PropertyValueBuilder(this.getKey(), this.getValue(), this.metaEntries); +} + +@Override +public boolean equals(Object o) { +if (this == o) return true; +if (!(o instanceof PropertyValue)) return false; +PropertyValue that = (PropertyValue) o; +return Objects.equals(getKey(), that.getKey()) && +Objects.equals(getValue(), that.getValue()) && +Objects.equ
[1/6] incubator-tamaya git commit: TAMAYA-252: Unified PropertyValue builder API.
Repository: incubator-tamaya Updated Branches: refs/heads/master b59c1ae26 -> 8ad767b48 TAMAYA-252: Unified PropertyValue builder 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/8ad767b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8ad767b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8ad767b4 Branch: refs/heads/master Commit: 8ad767b484f2e9bb6247b14ca53c8395b773ebe0 Parents: b2dddeb Author: anatole <anat...@apache.org> Authored: Mon Mar 6 00:28:58 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:29:34 2017 +0100 -- .../org/apache/tamaya/spi/FilterContext.java| 47 --- .../apache/tamaya/spi/FilterContextTest.java| 71 +-- .../core/internal/DefaultConfiguration.java | 2 +- .../tamaya/core/internal/PropertyFiltering.java | 123 --- .../core/internal/PropertySourceComparator.java | 4 +- .../core/testdata/TestPropertyFilter.java | 2 +- .../testdata/TestRemovingPropertyFilter.java| 4 +- 7 files changed, 152 insertions(+), 101 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8ad767b4/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java b/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java index d5c7850..e3f4465 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java @@ -18,6 +18,8 @@ */ package org.apache.tamaya.spi; +import org.apache.tamaya.Configuration; + import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -30,7 +32,9 @@ import java.util.Objects; */ public class FilterContext { /** The key. */ -private final String key; +private final PropertyValue value; +/** tHE CURRENT CONTEXT. */ +private final ConfigurationContext context; @Experimental private Map<String, PropertyValue> configEntries = new HashMap(); @Experimental @@ -38,35 +42,50 @@ public class FilterContext { /** - * Creates a new FilterContext. - * @param key the key under evaluation, not null. + * Creates a new FilterContext, for filtering of a multi value access + * using {@link Configuration#getProperties()}. + * @param value the value under evaluation, not null. * @param configEntries the raw configuration data available in the current evaluation context, not null. + * @param context the current context, not null. */ -public FilterContext(String key, Map<String,PropertyValue> configEntries) { +public FilterContext(PropertyValue value, Map<String,PropertyValue> configEntries, ConfigurationContext context) { this.singlePropertyScoped = false; -this.key = Objects.requireNonNull(key); +this.value = Objects.requireNonNull(value); +this.context = Objects.requireNonNull(context); this.configEntries.putAll(configEntries); this.configEntries = Collections.unmodifiableMap(this.configEntries); } -public FilterContext(String key, PropertyValue value) { +/** + * Creates a new FilterContext, for filtering of a single value access + * using {@link Configuration#getProperties()}. + * @param value the value under evaluation, not null. + * @param context the current context, not null. + */ +public FilterContext(PropertyValue value, ConfigurationContext context) { this.singlePropertyScoped = true; -this.key = Objects.requireNonNull(key); -if(value!=null) { -this.configEntries.put(value.getKey(), value); -} +this.context = Objects.requireNonNull(context); +this.value = Objects.requireNonNull(value); this.configEntries = Collections.unmodifiableMap(this.configEntries); } /** - * Get the key accessed. This information is very useful to evaluate additional metadata needed to determine/ + * Get the current context. + * @return the current context, not null. + */ +public ConfigurationContext getContext(){ +return context; +} + +/** + * Get the property value under evaluation. This information is very useful to evaluate additional metadata needed to determine/ * control further aspects of the conversion. * * @return the key. This may be null in case where a default value has to be converted and no unique underlying * key/value configuration is present. */ -public String getKey() { -return key; +
[3/6] incubator-tamaya git commit: TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy.
TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ae4ebe1d Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ae4ebe1d Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ae4ebe1d Branch: refs/heads/master Commit: ae4ebe1d34a03f7f6e3dd97859533eec879bc639 Parents: 855342a Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:27:29 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:29:34 2017 +0100 -- .../org/apache/tamaya/spi/FilterContext.java| 20 ++- .../org/apache/tamaya/spi/PropertyFilter.java | 4 +- .../org/apache/tamaya/spi/PropertySource.java | 51 ++- .../org/apache/tamaya/spi/PropertyValue.java| 77 +- .../apache/tamaya/spi/PropertyValueBuilder.java | 90 .../spi/PropertyValueCombinationPolicy.java | 7 +- .../apache/tamaya/spi/FilterContextTest.java| 29 ++-- .../tamaya/spi/PropertyValueBuilderTest.java| 129 +--- .../apache/tamaya/spi/PropertyValueTest.java| 146 ++- .../core/internal/DefaultConfiguration.java | 86 +-- .../tamaya/core/internal/PropertyFiltering.java | 33 ++--- .../core/internal/PropertySourceComparator.java | 88 +-- .../core/internal/WrappedPropertySource.java| 2 +- .../core/propertysource/BasePropertySource.java | 14 +- .../core/propertysource/CLIPropertySource.java | 16 +- .../EnvironmentPropertySource.java | 29 ++-- .../JavaConfigurationPropertySource.java| 7 +- .../propertysource/SimplePropertySource.java| 39 ++--- .../propertysource/SystemPropertySource.java| 19 +-- .../core/ConfigurationContextBuilderTest.java | 27 ++-- .../apache/tamaya/core/TestPropertySource.java | 7 +- .../DefaultConfigurationContextBuilderTest.java | 19 ++- .../DefaultConfigurationContextTest.java| 2 +- .../ConverterTestsPropertySource.java | 7 +- .../propertysource/BasePropertySourceTest.java | 25 ++-- .../propertysource/CLIPropertySourceTest.java | 18 +-- .../EnvironmentPropertySourceTest.java | 9 +- .../PropertiesFilePropertySourceTest.java | 6 +- .../SimplePropertySourceTest.java | 5 +- .../SystemPropertySourceTest.java | 28 ++-- .../provider/JavaConfigurationProviderTest.java | 2 +- .../testdata/TestPropertyDefaultSource.java | 9 +- .../core/testdata/TestPropertyFilter.java | 7 +- .../testdata/TestPropertySourceProvider.java| 13 +- .../testdata/TestRemovingPropertyFilter.java| 7 +- .../SimplePropertySource.java | 9 +- 36 files changed, 711 insertions(+), 375 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ae4ebe1d/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java b/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java index 3c675c8..d5c7850 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java @@ -32,7 +32,7 @@ public class FilterContext { /** The key. */ private final String key; @Experimental -private Map<String, String> configEntries = new HashMap(); +private Map<String, PropertyValue> configEntries = new HashMap(); @Experimental private boolean singlePropertyScoped; @@ -40,16 +40,24 @@ public class FilterContext { /** * Creates a new FilterContext. * @param key the key under evaluation, not null. - * @param singlePropertyScope true, if the filtering is done only for one single property accessed explcitily. * @param configEntries the raw configuration data available in the current evaluation context, not null. */ -public FilterContext(String key, Map<String,String> configEntries, boolean singlePropertyScope) { -this.singlePropertyScoped = singlePropertyScope; +public FilterContext(String key, Map<String,PropertyValue> configEntries) { +this.singlePropertyScoped = false; this.key = Objects.requireNonNull(key); this.configEntries.putAll(configEntries); this.configEntries = Collections.unmodifiableMap(this.configEntries); } +public FilterContext(String key, PropertyValue value) { +this.singlePropertyScoped = true; +this.key = Objects.requireNonNull(key); +if(value!=null) {
[2/5] incubator-tamaya-extensions git commit: TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy.
etKey().toString(), String.valueOf(en.getValue())); +this.properties.put(en.getKey().toString(), +PropertyValue.of(en.getKey().toString(), String.valueOf(en.getValue()), name)); } } @@ -147,7 +148,10 @@ public abstract class AbstractPathPropertySourceProvider implements PropertySour */ public PropertiesBasedPropertySource(String name, Map<String,String> props) { this.name = Objects.requireNonNull(name); -this.properties.putAll(props); +for (Entry<String, String> en : props.entrySet()) { +this.properties.put(en.getKey(), +PropertyValue.of(en.getKey(), en.getValue(), name)); +} } public int getOrdinal() { @@ -179,11 +183,11 @@ public abstract class AbstractPathPropertySourceProvider implements PropertySour @Override public PropertyValue get(String key) { -return PropertyValue.of(key, getProperties().get(key), getName()); +return this.properties.get(key); } @Override -public Map<String, String> getProperties() { +public Map<String, PropertyValue> getProperties() { return properties; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f915b25/modules/resources/src/test/java/org/apache/tamaya/resource/AbstractPathPropertySourceProviderTest.java -- diff --git a/modules/resources/src/test/java/org/apache/tamaya/resource/AbstractPathPropertySourceProviderTest.java b/modules/resources/src/test/java/org/apache/tamaya/resource/AbstractPathPropertySourceProviderTest.java index 8fe1b2b..0dc6c91 100644 --- a/modules/resources/src/test/java/org/apache/tamaya/resource/AbstractPathPropertySourceProviderTest.java +++ b/modules/resources/src/test/java/org/apache/tamaya/resource/AbstractPathPropertySourceProviderTest.java @@ -20,7 +20,6 @@ package org.apache.tamaya.resource; import org.apache.tamaya.spi.PropertySource; import org.apache.tamaya.spi.PropertyValue; -import org.apache.tamaya.spi.PropertyValueBuilder; import org.junit.Test; import java.net.URL; @@ -121,7 +120,7 @@ public class AbstractPathPropertySourceProviderTest { } @Override -public Map<String, String> getProperties() { +public Map<String, PropertyValue> getProperties() { return Collections.emptyMap(); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f915b25/modules/resources/src/test/java/org/apache/tamaya/resource/internal/PathBasedPropertySourceProvider.java -- diff --git a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/PathBasedPropertySourceProvider.java b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/PathBasedPropertySourceProvider.java index 1299a0c..7e2f622 100644 --- a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/PathBasedPropertySourceProvider.java +++ b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/PathBasedPropertySourceProvider.java @@ -21,16 +21,10 @@ package org.apache.tamaya.resource.internal; import org.apache.tamaya.resource.AbstractPathPropertySourceProvider; import org.apache.tamaya.spi.PropertySource; import org.apache.tamaya.spi.PropertyValue; -import org.apache.tamaya.spi.PropertyValueBuilder; import java.io.InputStream; import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; /** * Created by Anatole on 03.03.2015. @@ -60,27 +54,35 @@ public class PathBasedPropertySourceProvider extends AbstractPathPropertySourceP private final static class PropertiesBasedPropertySource implements PropertySource{ private final String name; -private final Map<String,String> properties = new HashMap<>(); +private final Map<String,PropertyValue> properties = new HashMap<>(); public PropertiesBasedPropertySource(String name, Properties props) { -this.name = name; +this.name = Objects.requireNonNull(name); for (Map.Entry en : props.entrySet()) { -this.properties.put(en.getKey().toString(), String.valueOf(en.getValue())); +this.properties.put(en.getKey().toString(), +PropertyValue.of(en.getKey().toString(), +String.valueOf(en.getValue()), +name)); } } @Override +public int getOrdinal() { +return 0; +} + +@Override public String getName() {
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-252: Unified PropertyValue builder API.
TAMAYA-252: Unified PropertyValue builder API. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/99e68500 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/99e68500 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/99e68500 Branch: refs/heads/master Commit: 99e6850022c7ce14f44e325f72edee573e7dcc65 Parents: 80d6ec2 Author: anatole <anat...@apache.org> Authored: Mon Mar 6 00:28:58 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:28:58 2017 +0100 -- .../apache/tamaya/consul/ConsulPropertySource.java | 4 ++-- .../tamaya/metamodel/ext/FilteredPropertySource.java | 12 ++-- .../usagetracker/internal/DefaultConfigUsage.java| 15 --- .../usagetracker/internal/UsageTrackerFilter.java| 4 ++-- .../tamaya/usagetracker/spi/ConfigUsageSpi.java | 8 +--- 5 files changed, 23 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/99e68500/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java -- diff --git a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java index d65ce35..026a926 100644 --- a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java +++ b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java @@ -147,7 +147,7 @@ implements MutablePropertySource{ props.put(reqKey+".modifyIndex", String.valueOf(value.getModifyIndex())); props.put(reqKey+".lockIndex", String.valueOf(value.getLockIndex())); props.put(reqKey+".flags", String.valueOf(value.getFlags())); -return new PropertyValueBuilder(key, value.getValue().get(), getName()).setMetaEntries(props).build(); +return PropertyValue.builder(key, value.getValue().get(), getName()).setMetaEntries(props).build(); } } catch(Exception e){ LOG.log(Level.FINE, "etcd access failed on " + hostAndPort + ", trying next...", e); @@ -162,7 +162,7 @@ implements MutablePropertySource{ //try{ //Consul consul = Consul.builder().withHostAndPort(hostAndPort).build(); //KeyValueClient kvClient = consul.keyValueClient(); -//Optional valueOpt = kvClient.getValue(reqKey); +//Optional valueOpt = kvClient.getProperty(reqKey); //try{ //Map<String, String> props = kvClient.getProperties(""); //if(!props.containsKey("_ERROR")) { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/99e68500/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java index f82e676..43d1836 100644 --- a/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/ext/FilteredPropertySource.java @@ -18,11 +18,9 @@ */ package org.apache.tamaya.metamodel.ext; -import org.apache.tamaya.spi.FilterContext; -import org.apache.tamaya.spi.PropertyFilter; -import org.apache.tamaya.spi.PropertySource; -import org.apache.tamaya.spi.PropertyValue; +import org.apache.tamaya.spi.*; import org.apache.tamaya.spisupport.BasePropertySource; +import org.apache.tamaya.spisupport.DefaultConfigurationContextBuilder; import org.apache.tamaya.spisupport.PropertySourceComparator; import java.util.ArrayList; @@ -41,6 +39,8 @@ public final class FilteredPropertySource extends BasePropertySource { private PropertySource wrapped; private List filters = new ArrayList<>(); +private ConfigurationContext dummyContext = new DefaultConfigurationContextBuilder() +.addPropertySources(this).build(); /** * Constructor used privately. Use {@link #of(PropertySource)} for making a {@link PropertySource} filterable. @@ -84,7 +84,7 @@ public final class FilteredPropertySource extends BasePropertySource { if(filters!=null){ PropertyValue filteredValue = value; for(PropertyFilter pf:filters){ -filteredValue = pf.filterProperty(filteredValue, new FilterC
[1/2] incubator-tamaya-site git commit: TAMAYA-253: Added replacement policy for raw evaluation.
Repository: incubator-tamaya-site Updated Branches: refs/heads/master 69e489603 -> a449f485a TAMAYA-253: Added replacement policy for raw evaluation. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/commit/b4003211 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/tree/b4003211 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/diff/b4003211 Branch: refs/heads/master Commit: b400321110504fc33807071d429731c77878201f Parents: 69e4896 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:24:25 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 5 21:24:25 2017 +0100 -- content/documentation/api.adoc | 36 ++-- content/documentation/core.adoc | 58 +++- content/documentation/extensions/mod_jndi.adoc | 3 + .../extensions/mod_spi-support.adoc | 6 ++ 4 files changed, 82 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/b4003211/content/documentation/api.adoc -- diff --git a/content/documentation/api.adoc b/content/documentation/api.adoc index 9761a5f..ffd8850 100644 --- a/content/documentation/api.adoc +++ b/content/documentation/api.adoc @@ -33,7 +33,9 @@ The API provides the artifacts as described in the link:../highleveldesign.html[ +PropertySource+ *** provides String based property access for single key/value pairs in _raw_ format (meaning no postprocessing is applied yet). - *** can _optionally_ provide access to a +Map<String,String>+, providing all its properties at once. + *** can _optionally_ provide access to a +Iterable+, providing all its properties at once. + *** defines the default ordinal to be used for establishing the order of significance among all + auto-discovered property sources. ** _PropertySourceProvider:_ allows to automatically register multiple property sources, e.g. all config files found in a file system folder.. ** +ConfigurationProviderSpi+ defines the interface to be implemented by the delegating bean that is implementing the @@ -293,12 +295,11 @@ identified to be necessary: [source,java] public interface PropertySource{ - // This feature is under discussion - // int getOrdinal(); + int getOrdinal(); String getName(); - String get(String key); + PropertyValue get(String key); boolean isScannable(); - Map<String, String> getProperties(); + Iterable getProperties(); } @@ -312,13 +313,14 @@ Hereby properties. If a +PropertySource+ is defined as non scannable accesses to +getProperties()+ may not return all key/value pairs that would be available when accessed directly using the +String get(String)+ method. The fact if a +PropertySource+ is _scannable_ can be determined by calling +isScannable()+. -* TODO Feature is in question: +getOrdinal()+ defines the ordinal of the +PropertySource+. Property sources are managed in an ordered chain, where - property sources with higher ordinals override the ones with lower ordinals. If ordinal are the same, the natural - ordering of the fulloy qualified class names of the property source implementations are used. The reason for - not using +@Priority+ annotations is that property sources can define dynamically their ordinals, e.g. based on - a property contained with the configuration itself. -* Finally +getName()+ returns a (unique) name that identifies the +PropertySource+ within the current - +ConfigurationContext+. +* +int getOrdinal()+ defines the ordinal of the +PropertySource+. Property sources are managed in an ordered chain, where + property sources with higher ordinals override ones with lower ordinals. If the ordinal of two property sources is + the same, the natural ordering of the fully qualified class names of the property source implementations is used. + The reason for not using +@Priority+ annotations is that property sources can define dynamically their ordinals, + e.g. based on a property contained with the configuration itself. + Implementations of this API may provide additional functionality to adapt the default ordinal of auto-discovered + property sources. +* Finally +getName()+ returns a (unique) name that identifies the +PropertySource+ within its containing +ConfigurationContext+. This interface can be implemented by any kind of logic. It could be a simple in memory map, a distributed configuration provided by a data grid, a database, the JNDI tree or other resources.
[2/6] incubator-tamaya git commit: TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy.
ies().entrySet()", -systemEntries.size(), toCheck.size()/2); - -for (Map.Entry<String, String> propertySourceEntry : toCheck.entrySet()) { +int num = 0; +for (PropertyValue propertySourceEntry : toCheck.values()) { if(propertySourceEntry.getKey().startsWith("_")){ continue; // meta entry } +num ++; Assert.assertEquals("Entry values for key '" + propertySourceEntry.getKey() + "' do not match", systemEntries.getProperty(propertySourceEntry.getKey()), propertySourceEntry.getValue()); } - +Assert.assertEquals("size of System.getProperties().entrySet() must be the same as SystemPropertySrouce.getProperties().entrySet()", +systemEntries.size(), num); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ae4ebe1d/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java -- diff --git a/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java b/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java index 26e5291..f7c7f7c 100644 --- a/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java +++ b/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java @@ -42,7 +42,7 @@ public class JavaConfigurationProviderTest { String key = "confkey" + i; String value = "javaconf-value" + i; -assertThat(value, equalTo(propertySource.get(key).get(key))); +assertThat(value, equalTo(propertySource.get(key).getValue())); // check if we had our key in configuration.current assertThat(getConfiguration().getProperties().containsKey(key), is(true)); http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ae4ebe1d/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java ------ diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java index 6c8751c..09d86f1 100644 --- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java +++ b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java @@ -19,6 +19,7 @@ package org.apache.tamaya.core.testdata; import org.apache.tamaya.core.propertysource.BasePropertySource; +import org.apache.tamaya.spi.PropertyValue; import java.util.Collections; import java.util.HashMap; @@ -29,12 +30,12 @@ import java.util.Map; */ public class TestPropertyDefaultSource extends BasePropertySource{ -private Map<String,String> properties = new HashMap<>(); +private Map<String,PropertyValue> properties = new HashMap<>(); public TestPropertyDefaultSource() { super(100); -properties.put("name","Anatole"); -properties.put("name2","Sabine"); +properties.put("name",PropertyValue.of("name", "Anatole", "test")); +properties.put("name2",PropertyValue.of("name2", "Sabine", "test")); properties = Collections.unmodifiableMap(properties); } @@ -44,7 +45,7 @@ public class TestPropertyDefaultSource extends BasePropertySource{ } @Override -public Map<String, String> getProperties() { +public Map<String, PropertyValue> getProperties() { return properties; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ae4ebe1d/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java -- diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java index 071cbb1..f0ae4d3 100644 --- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java +++ b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java @@ -20,6 +20,7 @@ package org.apache.tamaya.core.testdata; import org.apache.tamaya.spi.FilterContext; import org.apache.tamaya.spi.PropertyFilter; +import org.apache.tamaya.spi.PropertyValue; import javax.annotation.Priority; @@ -29,9 +30,11 @@ import javax.annotation.Priority; @Priority(100) public class TestPropertyFilter implements PropertyFilter{ @Override -public St
[5/6] incubator-tamaya git commit: TAMAYA-238: Removed explicit versions.
TAMAYA-238: Removed explicit versions. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/b2dddeb8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/b2dddeb8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/b2dddeb8 Branch: refs/heads/master Commit: b2dddeb864d16f65c48a151103a96f3eccfa1502 Parents: ae4ebe1 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:34:54 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:29:34 2017 +0100 -- code/api/bnd.bnd | 3 +-- code/core/bnd.bnd | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b2dddeb8/code/api/bnd.bnd -- diff --git a/code/api/bnd.bnd b/code/api/bnd.bnd index 4f29bfe..7ca7687 100644 --- a/code/api/bnd.bnd +++ b/code/api/bnd.bnd @@ -1,5 +1,4 @@ Export-Package: \ org.apache.tamaya,\ org.apache.tamaya.spi -Bundle-SymbolicName: org.apache.tamaya -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b2dddeb8/code/core/bnd.bnd -- diff --git a/code/core/bnd.bnd b/code/core/bnd.bnd index 5d14d8c..7aa4182 100644 --- a/code/core/bnd.bnd +++ b/code/core/bnd.bnd @@ -8,5 +8,4 @@ Import-Package: \ org.osgi.framework,\ javax.annotation Bundle-Activator: org.apache.tamaya.core.OSGIActivator -Bundle-SymbolicName: org.apache.tamaya.core -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya.core \ No newline at end of file
[1/5] incubator-tamaya-extensions git commit: TAMAYA-253: Added replacement policy for raw evaluation.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master abb34d651 -> 01ba7463e TAMAYA-253: Added replacement policy for raw evaluation. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/ed226955 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/ed226955 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/ed226955 Branch: refs/heads/master Commit: ed2269552a61141ca36cb0b6cc2295d6e51444b3 Parents: abb34d6 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:24:25 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 5 21:24:25 2017 +0100 -- .../tamaya/spisupport/ConfigValueEvaluator.java | 48 ++ .../spisupport/DefaultConfigValueEvaluator.java | 70 2 files changed, 118 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/ed226955/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/ConfigValueEvaluator.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/ConfigValueEvaluator.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/ConfigValueEvaluator.java new file mode 100644 index 000..92fd614 --- /dev/null +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/ConfigValueEvaluator.java @@ -0,0 +1,48 @@ +/* + * 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.spisupport; + +import org.apache.tamaya.spi.ConfigurationContext; +import org.apache.tamaya.spi.PropertyValue; + +import java.util.Map; + + +/** + * Component SPI which encapsulates the evaluation of a single or full rawvalue + * for a {@link ConfigurationContext}. + */ +public interface ConfigValueEvaluator { + +/** + * Evaluates single value using a {@link ConfigurationContext}. + * @param key the config key, not null. + * @param context the context, not null. + * @return the value, or null. + */ +PropertyValue evaluteRawValue(String key, ConfigurationContext context); + +/** + * Evaluates all property values from a {@link ConfigurationContext}. + * @param context the context, not null. + * @return the value, or null. + */ +Map<String, PropertyValue> evaluateRawValues(ConfigurationContext context); + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/ed226955/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigValueEvaluator.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigValueEvaluator.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigValueEvaluator.java new file mode 100644 index 000..cdfcfdc --- /dev/null +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigValueEvaluator.java @@ -0,0 +1,70 @@ +/* + * 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.spisupport;
[4/5] incubator-tamaya-extensions git commit: TAMAYA-238: Removed explicit versions.
TAMAYA-238: Removed explicit versions. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/0e16f4e4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/0e16f4e4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/0e16f4e4 Branch: refs/heads/master Commit: 0e16f4e4ba06cc7dd41a004101ad64870067922f Parents: 9f915b2 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:34:54 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 5 21:34:54 2017 +0100 -- modules/formats/base/bnd.bnd| 3 +-- modules/formats/json/bnd.bnd| 3 +-- modules/formats/yaml/bnd.bnd| 3 +-- modules/functions/bnd.bnd | 3 +-- modules/injection/injection-api/bnd.bnd | 5 +++-- modules/injection/standalone/bnd.bnd| 3 +-- modules/jndi/bnd.bnd| 6 +- modules/mutable-config/bnd.bnd | 3 +-- modules/optional/bnd.bnd| 3 +-- modules/resolver/bnd.bnd| 3 +-- modules/resources/bnd.bnd | 3 +-- modules/spi-support/bnd.bnd | 3 +-- modules/spring/bnd.bnd | 3 +-- 13 files changed, 19 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modules/formats/base/bnd.bnd -- diff --git a/modules/formats/base/bnd.bnd b/modules/formats/base/bnd.bnd index 0d351d1..610181a 100644 --- a/modules/formats/base/bnd.bnd +++ b/modules/formats/base/bnd.bnd @@ -1,5 +1,4 @@ Export-Package: \ org.apache.tamaya.format,\ org.apache.tamaya.format.formats -Bundle-SymbolicName: org.apache.tamaya.formats -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya.formats \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modules/formats/json/bnd.bnd -- diff --git a/modules/formats/json/bnd.bnd b/modules/formats/json/bnd.bnd index 62cd3f9..c4251d1 100644 --- a/modules/formats/json/bnd.bnd +++ b/modules/formats/json/bnd.bnd @@ -1,4 +1,3 @@ Export-Package: \ org.apache.tamaya.json -Bundle-SymbolicName: org.apache.tamaya.formats.json -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya.formats.json \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modules/formats/yaml/bnd.bnd -- diff --git a/modules/formats/yaml/bnd.bnd b/modules/formats/yaml/bnd.bnd index fc92b02..01ab527 100644 --- a/modules/formats/yaml/bnd.bnd +++ b/modules/formats/yaml/bnd.bnd @@ -1,4 +1,3 @@ Export-Package: \ org.apache.tamaya.yaml -Bundle-SymbolicName: org.apache.tamaya.formats.yaml -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya.formats.yaml \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modules/functions/bnd.bnd -- diff --git a/modules/functions/bnd.bnd b/modules/functions/bnd.bnd index 62bda5d..b12cfd4 100644 --- a/modules/functions/bnd.bnd +++ b/modules/functions/bnd.bnd @@ -1,4 +1,3 @@ Export-Package: \ org.apache.tamaya.functions -Bundle-SymbolicName: org.apache.tamaya.functions -Bundle-Version: 0.3-INCUBATING-SNAPSHOT \ No newline at end of file +Bundle-SymbolicName: org.apache.tamaya.functions \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modules/injection/injection-api/bnd.bnd -- diff --git a/modules/injection/injection-api/bnd.bnd b/modules/injection/injection-api/bnd.bnd index ea781a8..3516930 100644 --- a/modules/injection/injection-api/bnd.bnd +++ b/modules/injection/injection-api/bnd.bnd @@ -2,5 +2,6 @@ Export-Package: \ org.apache.tamaya.inject.api,\ org.apache.tamaya.inject.spi Bundle-SymbolicName: org.apache.tamaya.inject.api -Import-Package: org.apache.tamaya;version="[0.3,1)",\ - org.apache.tamaya.inject.api,org.apache.tamaya.spi;version="[0.3,1)" \ No newline at end of file +Import-Package: org.apache.tamaya,\ +org.apache.tamaya.inject.api,\ +org.apache.tamaya.spi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0e16f4e4/modu
[2/2] incubator-tamaya-site git commit: TAMAYA-252: Unified PropertyValue builder API.
TAMAYA-252: Unified PropertyValue builder API. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/commit/a449f485 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/tree/a449f485 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/diff/a449f485 Branch: refs/heads/master Commit: a449f485a057e7ef05c911f0333463dec40b8e60 Parents: b400321 Author: anatole <anat...@apache.org> Authored: Mon Mar 6 00:28:58 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:28:58 2017 +0100 -- content/documentation/api.adoc | 99 ++--- 1 file changed, 91 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/a449f485/content/documentation/api.adoc -- diff --git a/content/documentation/api.adoc b/content/documentation/api.adoc index ffd8850..9e133fe 100644 --- a/content/documentation/api.adoc +++ b/content/documentation/api.adoc @@ -31,9 +31,10 @@ The API provides the artifacts as described in the link:../highleveldesign.html[ the configuration data provided is managed locally, remotedely. There is even no requirement that the configuration data is always fully available. Summarizing a +PropertySource+ - *** provides String based property access for single key/value pairs in _raw_ format (meaning no postprocessing - is applied yet). - *** can _optionally_ provide access to a +Iterable+, providing all its properties at once. + *** provides property access for single key/value pairs in _raw_ format (meaning no postprocessing + is applied yet). A single property hereby is modelled as +PropertyValue+, which also includes + its source and additional arbitrary metadata entries. + *** can _optionally_ provide access to a +Map<String,PropertyValue>+, providing all its properties at once. *** defines the default ordinal to be used for establishing the order of significance among all auto-discovered property sources. ** _PropertySourceProvider:_ allows to automatically register multiple property sources, e.g. all config files found in @@ -278,6 +279,88 @@ The class +ConfigException+ models the base *runtime* exception used by the conf [[SPI]] == SPI +[[PropertyValue]] +=== PropertyValue, PropertyValueBuilder + +On the API properties are represented as Strings only, whereas in the SPI value are represented as +ProeprtyValue+, +which contain + +* the property's _key_ (String) +* the property's _value_ (String) +* the property's _source_ (String, typically equals to the property source's name) +* any additional meta-data represented as _Map<String,String>_ + +This helps to kepp all value relevant data together in one place and also allows to choose any kind of +representation for meta-data entries. The +PropertyValue+ itself is a final and _serializable_ data container, +which also has a powerful builder API (e.g. for using within filters): + +[source,java] + +public final class PropertyValue implements Serializable{ +[...] + +public static PropertyValue of(String key, String value, String source); + +public String getKey(); +public String getSource(); +public String getValue(); +public Map<String, String> getMetaEntries(); +public String getMetaEntry(String key); +public PropertyValueBuilder toBuilder(); + +public static PropertyValueBuilder builder(String key, String source); +public static PropertyValueBuilder builder(String key, String value, String source); + +/** + * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}. + * @param config the String based map, not null. + * @param source the source name, not null. + * @return the corresponding value based map. + */ +public static Map<String,PropertyValue> map(Map<String, String> config, String source); + +/** + * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}. + * @param config the String based map, not null. + * @param source the source name, not null. + * @param metaData additional metadata, not null. + * @return the corresponding value based map. + */ +public static Map<String,PropertyValue> map(Map<String, String> config, String source, +Map<String,String> metaData); +} + + +When writing y
[3/5] incubator-tamaya-extensions git commit: TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy.
TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/9f915b25 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/9f915b25 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/9f915b25 Branch: refs/heads/master Commit: 9f915b254b91731f2e9fa1eefe8f459f727f6a7c Parents: ed22695 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:29:02 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 5 21:29:02 2017 +0100 -- .../events/FilePropertySourceProvider.java | 7 +- .../tamaya/events/FrozenPropertySource.java | 17 +++- .../events/PropertySourceChangeBuilder.java | 18 ++--- .../events/ChangeableGlobalPropertySource.java | 3 +- .../ChangeableThreadLocalPropertySource.java| 3 +- .../tamaya/events/FrozenPropertySourceTest.java | 5 +- .../tamaya/events/RandomPropertySource.java | 15 ++-- .../ObservingPropertySourceProvider.java| 12 +-- .../tamaya/filter/ConfigurationFilter.java | 3 +- .../org/apache/tamaya/filter/FilterContext.java | 3 +- .../filter/internal/DefaultMetadataFilter.java | 3 +- .../tamaya/filter/ConfigurationFilterTest.java | 21 ++--- .../tamaya/filter/ProgrammableFilterTest.java | 81 +++- .../MappedConfigurationDataPropertySource.java | 8 +- ...ppedConfigurationDataPropertySourceTest.java | 16 ++-- .../apache/tamaya/json/JSONPropertySource.java | 17 ++-- .../org/apache/tamaya/json/JSONVisitor.java | 1 + .../tamaya/yaml/JSONPropertySourceTest.java | 2 +- .../apache/tamaya/yaml/YAMLPropertySource.java | 17 ++-- .../functions/ConfigWrappingPropertySource.java | 9 ++- .../functions/EnrichedPropertySource.java | 30 +--- .../functions/FilteredPropertySource.java | 17 ++-- .../tamaya/functions/MappedPropertySource.java | 23 +++--- .../functions/PropertySourceFunctions.java | 7 +- .../functions/ValueMappedPropertySource.java| 15 ++-- .../functions/ConfigurationFunctionsTest.java | 20 + .../cdi/cfg/ProvidedPropertySource.java | 12 +-- .../integration/cdi/cfg/TestPropertySource.java | 10 ++- .../tamaya/inject/TestPropertySource.java | 13 +++- .../internal/DefaultDynamicValueTest.java | 46 ++- .../apache/tamaya/jndi/JNDIPropertySource.java | 20 - .../org.apache.tamaya.spi.PropertySource| 19 + .../tamaya/jndi/JNDIPropertySourceTest.java | 3 +- .../MutablePropertiesPropertySource.java| 19 + .../MutableXmlPropertiesPropertySource.java | 20 ++--- .../internal/ExpressionResolutionFilter.java| 9 ++- .../tamaya/resolver/MyTestPropertySource.java | 13 +++- .../AbstractPathPropertySourceProvider.java | 16 ++-- .../AbstractPathPropertySourceProviderTest.java | 3 +- .../PathBasedPropertySourceProvider.java| 26 --- .../tamaya/spisupport/BasePropertySource.java | 13 +--- .../tamaya/spisupport/CLIPropertySource.java| 13 +++- .../tamaya/spisupport/DefaultConfiguration.java | 80 +++ .../spisupport/EnvironmentPropertySource.java | 11 ++- .../tamaya/spisupport/MapPropertySource.java| 14 +++- .../spisupport/PropertyFilterManager.java | 16 ++-- .../tamaya/spisupport/PropertyFiltering.java| 17 ++-- .../spisupport/PropertySourceComparator.java| 52 ++--- .../tamaya/spisupport/RegexPropertyFilter.java | 3 +- .../tamaya/spisupport/SimplePropertySource.java | 39 -- .../tamaya/spisupport/SystemPropertySource.java | 22 +++--- .../spisupport/BasePropertySourceTest.java | 25 +++--- .../spisupport/CLIPropertySourceTest.java | 18 ++--- .../DefaultConfigurationContextTest.java| 10 +-- .../EnvironmentPropertySourceTest.java | 9 ++- .../PropertiesFilePropertySourceTest.java | 6 +- .../spisupport/RegexPropertyFilterTest.java | 26 --- .../spisupport/SimplePropertySourceTest.java| 9 ++- .../spisupport/SystemPropertySourceTest.java| 24 +++--- .../spisupport/TestPropertyDefaultSource.java | 9 ++- 60 files changed, 569 insertions(+), 449 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f915b25/examples/04-events-example/src/main/java/org/apache/tamaya/ext/examples/events/FilePropertySourceProvider.java -- diff --git a/examples/04-events-example/src/main/java/org/apache/tamaya/ext/examples/events/FilePropertySourceProvider.java b/examples/04-events-example/src/main/java/org/apache/tamaya/ext/exa
[5/5] incubator-tamaya-extensions git commit: TAMAYA-252: Unified PropertyValue builder API.
TAMAYA-252: Unified PropertyValue builder API. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/01ba7463 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/01ba7463 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/01ba7463 Branch: refs/heads/master Commit: 01ba7463ea705d9f8725bd594aeac6af648df16c Parents: 0e16f4e Author: anatole <anat...@apache.org> Authored: Mon Mar 6 00:28:58 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Mon Mar 6 00:28:58 2017 +0100 -- .../tamaya/events/RandomPropertySource.java | 2 +- .../apache/tamaya/events/TestConfigView.java| 2 +- .../filter/internal/DefaultMetadataFilter.java | 2 +- .../tamaya/filter/ConfigurationFilterTest.java | 10 +- .../tamaya/filter/ProgrammableFilterTest.java | 76 ++- .../integration/cdi/EnvironmentsTest.java | 2 +- .../internal/ExpressionResolutionFilter.java| 4 +- .../tamaya/spisupport/DefaultConfiguration.java | 2 +- .../spisupport/PropertyFilterManager.java | 131 --- .../tamaya/spisupport/PropertyFiltering.java| 110 .../spisupport/PropertySourceComparator.java| 4 +- .../tamaya/spisupport/RegexPropertyFilter.java | 4 +- .../spisupport/RegexPropertyFilterTest.java | 30 +++-- 13 files changed, 125 insertions(+), 254 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/01ba7463/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java -- diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java index 041056b..746c5f3 100644 --- a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java +++ b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java @@ -53,7 +53,7 @@ public class RandomPropertySource implements PropertySource{ @Override public Map<String, PropertyValue> getProperties() { synchronized(data) { -data.put("random.new", new PropertyValueBuilder("random.new", String.valueOf(Math.random()), getName()) +data.put("random.new", PropertyValue.builder("random.new", String.valueOf(Math.random()), getName()) .addMetaEntry("_random.new.timestamp", String.valueOf(System.currentTimeMillis())).build()); return new HashMap<>(data); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/01ba7463/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 8e5b397..0713298 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 @@ -60,7 +60,7 @@ public class TestConfigView implements ConfigOperator{ } return result; //return config.getProperties().entrySet().stream().filter(e -> e.getKey().startsWith("test")).collect( -//Collectors.toMap(en -> en.getKey(), en -> en.getValue())); +//Collectors.toMap(en -> en.getKey(), en -> en.getProperty())); } @Override http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/01ba7463/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java -- diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java index 5694a9d..e9554a2 100644 --- a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java +++ b/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java @@ -34,7 +34,7 @@ public final class DefaultMetadataFilter implements PropertyFilter{ return valueToBeFiltered; } if(ConfigurationFilter.isMetadataFiltered()) { -if (context.getKey().startsWith("_")) { +if (context.getProperty().getKey().startsWith("_")) { /
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 57e984010 -> 99e685002 TAMAYA-252: Unified PropertyValue API and usage, also separating key, value, source and other meta-data and defining a clear builder policy. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/80d6ec20 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/80d6ec20 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/80d6ec20 Branch: refs/heads/master Commit: 80d6ec20ca5a7773efde56c509a0d25e3d49d091 Parents: 57e9840 Author: anatole <anat...@apache.org> Authored: Sun Mar 5 21:29:39 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 5 21:29:39 2017 +0100 -- .../commons/CommonsConfigPropertySource.java| 12 +-- .../tamaya/consul/ConsulPropertySource.java | 4 +- .../tamaya/consul/ConsulPropertySourceTest.java | 7 +- .../apache/tamaya/consul/ConsulWriteTest.java | 3 +- .../apache/tamaya/etcd/EtcdPropertySource.java | 102 +-- .../tamaya/etcd/EtcdPropertySourceTest.java | 7 +- .../hazelcast/HazelcastPropertySource.java | 15 +-- .../tamaya/metamodel/EnabledPropertySource.java | 3 +- .../metamodel/ext/FilteredPropertySource.java | 32 +++--- .../ext/RefreshablePropertySource.java | 3 +- .../propertysources/PropertySourceBuilder.java | 5 +- .../tamaya/remote/BaseRemotePropertySource.java | 6 +- .../apache/tamaya/usagetracker/UsageStat.java | 12 ++- .../internal/DefaultConfigUsage.java| 5 +- .../internal/UsageTrackerFilter.java| 3 +- .../tamaya/usagetracker/spi/ConfigUsageSpi.java | 3 +- 16 files changed, 139 insertions(+), 83 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/80d6ec20/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java -- diff --git a/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java b/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java index 8e8ea2f..2383e68 100644 --- a/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java +++ b/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java @@ -22,10 +22,7 @@ import org.apache.commons.configuration.Configuration; import org.apache.tamaya.spi.PropertySource; import org.apache.tamaya.spi.PropertyValue; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Objects; +import java.util.*; /** * PropertySource that wraps {@link org.apache.commons.configuration.Configuration}. @@ -52,6 +49,7 @@ public class CommonsConfigPropertySource implements PropertySource { } } +@Override public int getOrdinal() { return ordinal; } @@ -68,12 +66,12 @@ public class CommonsConfigPropertySource implements PropertySource { } @Override -public Map<String, String> getProperties() { -Map<String, String> config = new HashMap<>(); +public Map<String, PropertyValue> getProperties() { +Map<String,PropertyValue> config = new HashMap<>(); Iterator keyIter = commonsConfig.getKeys(); while (keyIter.hasNext()) { String key = keyIter.next(); -config.put(key, commonsConfig.getString(key)); +config.put(key, PropertyValue.of(key, commonsConfig.getString(key), getName())); } return config; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/80d6ec20/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java -- diff --git a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java index 7c0b017..d65ce35 100644 --- a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java +++ b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java @@ -147,7 +147,7 @@ implements MutablePropertySource{ props.put(reqKey+".modifyIndex", String.valueOf(value.getModifyIndex())); props.put(reqKey+".lockIndex", String.valueOf(value.getLockIndex())); props.put(reqKey+".flags", String.valueOf(value.getFlags())); -return new PropertyValueBuilder(key, value.getValue().get(), getName()).setContextData(props).build(); +
[3/7] incubator-tamaya-sandbox git commit: Preparing Java 8.
Preparing Java 8. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/098c75f6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/098c75f6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/098c75f6 Branch: refs/heads/master Commit: 098c75f66e75b5679c2e2bc59aa75aaa10b4e11d Parents: 46e3ed0 Author: anatole <anat...@apache.org> Authored: Sat Apr 15 22:13:28 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sat Apr 15 22:13:28 2017 +0200 -- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/098c75f6/pom.xml -- diff --git a/pom.xml b/pom.xml index 836b89a..a788354 100644 --- a/pom.xml +++ b/pom.xml @@ -754,8 +754,9 @@ under the License. osgi management metamodel + uom - +
[4/7] incubator-tamaya-sandbox git commit: TAMAYA-145: Simplified syntax and MetaContext. Added tests.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/10d711e6/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyConverter.java -- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyConverter.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyConverter.java new file mode 100644 index 000..e9ca5a5 --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyConverter.java @@ -0,0 +1,33 @@ +/* + * 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.metamodel.ext; + +import org.apache.tamaya.spi.ConversionContext; +import org.apache.tamaya.spi.PropertyConverter; + +/** + * Created by atsticks on 17.04.17. + */ +public class MyConverter implements PropertyConverter { + +@Override +public String convert(String value, ConversionContext context) { +return value; +} +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/10d711e6/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyFilter.java -- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyFilter.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyFilter.java new file mode 100644 index 000..e819e2f --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyFilter.java @@ -0,0 +1,33 @@ +/* + * 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.metamodel.ext; + +import org.apache.tamaya.spi.FilterContext; +import org.apache.tamaya.spi.PropertyFilter; +import org.apache.tamaya.spi.PropertyValue; + +/** + * Created by atsticks on 17.04.17. + */ +public class MyFilter implements PropertyFilter{ +@Override +public PropertyValue filterProperty(PropertyValue value, FilterContext context) { +return value; +} +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/10d711e6/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyPropertySource.java -- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyPropertySource.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyPropertySource.java new file mode 100644 index 000..cdb4ae8 --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/MyPropertySource.java @@ -0,0 +1,35 @@ +/* + * 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.metamodel.ext; + + +import
[2/7] incubator-tamaya-sandbox git commit: TAMAYA-218: Renamed some methods.
TAMAYA-218: Renamed some methods. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/46e3ed0c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/46e3ed0c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/46e3ed0c Branch: refs/heads/master Commit: 46e3ed0caccc8cafd466740d1a1c7b0ebd3c71f0 Parents: fd26d6c Author: anatole <anat...@apache.org> Authored: Sat Apr 15 22:12:09 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sat Apr 15 22:12:09 2017 +0200 -- .../apache/tamaya/usagetracker/ConfigUsage.java | 31 + .../apache/tamaya/usagetracker/UsageStat.java | 72 ++-- .../internal/DefaultConfigUsage.java| 42 ++-- .../internal/UsageTrackerFilter.java| 4 +- .../tamaya/usagetracker/spi/ConfigUsageSpi.java | 18 ++--- .../tamaya/model/ConfigUsageStatsTest.java | 10 +-- 6 files changed, 90 insertions(+), 87 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/46e3ed0c/usagetracker/src/main/java/org/apache/tamaya/usagetracker/ConfigUsage.java -- diff --git a/usagetracker/src/main/java/org/apache/tamaya/usagetracker/ConfigUsage.java b/usagetracker/src/main/java/org/apache/tamaya/usagetracker/ConfigUsage.java index 963dcb0..5cae8d2 100644 --- a/usagetracker/src/main/java/org/apache/tamaya/usagetracker/ConfigUsage.java +++ b/usagetracker/src/main/java/org/apache/tamaya/usagetracker/ConfigUsage.java @@ -33,6 +33,7 @@ public final class ConfigUsage { /** The logger used. */ private static final Logger LOG = Logger.getLogger(ConfigUsage.class.getName()); + private static final String NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE = "No UsageTrackerSpi component available."; /** The loaded usage tracking SPI. */ @@ -55,7 +56,7 @@ public final class ConfigUsage { * Returns a set of package names that are to be ignored when collecting usage data. * @return the ignored package names, not null. */ -public static Set getIgnoredUsagePackages(){ +public static Set getIgnoredPackages(){ return spi().getIgnoredPackages(); } @@ -63,8 +64,8 @@ public final class ConfigUsage { * Adds the given packageNames to the list of packages to be ignored when collecting usage data. * @param packageName the package names to be added, not null. */ -public static void addIgnoredUsagePackages(String... packageName){ -spi().addIgnoredUsagePackages(packageName); +public static void addIgnoredPackages(String... packageName){ +spi().addIgnoredPackages(packageName); } /** @@ -81,23 +82,23 @@ public final class ConfigUsage { * @param key the fully qualified configuration key, not null. * @return the stats collected, or null. */ -public static UsageStat getUsage(String key){ -return spi().getUsage(key); +public static UsageStat getSinglePropertyStats(String key){ +return spi().getSinglePropertyStats(key); } /** * Get the recorded usage references of configuration. * @return the recorded usge references, never null. */ -public static Collection getUsages() { -return spi().getUsages(); +public static Collection getUsageStats() { +return spi().getUsageStats(); } /** * Clears all collected usage statistics. */ -public static void clearUsageStats() { -spi().clearUsageStats(); +public static void clearStats() { +spi().clearStats(); } /** @@ -105,24 +106,24 @@ public final class ConfigUsage { * If usage stats collection is not activated (default), this method returns null. * @return the stats collected, or null. */ -public static UsageStat getUsageAllProperties(){ -return spi().getUsageAllProperties(); +public static UsageStat getAllPropertiesStats(){ +return spi().getAllPropertiesStats(); } /** * Allows to check if usage tracking is enabled (should be disbled by default). * @return true, if usage tracking is enabled. */ -public static boolean isUsageTrackingEnabled(){ -return spi().isUsageTrackingEnabled(); +public static boolean isTrackingEnabled(){ +return spi().isTrackingEnabled(); } /** * Access the usage statistics for the recorded uses of configuration. * @return usage info or default message. */ -public static String getUsageInfo(){ -return spi().getUsageInfo(); +public static String getInfo(){ +return spi().getInfo(); } } http://git-w
[5/7] incubator-tamaya-sandbox git commit: TAMAYA-145: Simplified syntax and MetaContext. Added tests.
TAMAYA-145: Simplified syntax and MetaContext. Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/10d711e6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/10d711e6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/10d711e6 Branch: refs/heads/master Commit: 10d711e6a7e15996c54baad0edf0b38102d3afa7 Parents: 098c75f Author: anatole <anat...@apache.org> Authored: Tue Apr 18 00:14:42 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Apr 18 00:14:42 2017 +0200 -- .../apache/tamaya/metamodel/CachedFilter.java | 108 +++ .../org/apache/tamaya/metamodel/HideFilter.java | 67 +++ .../tamaya/metamodel/ImmutableFilter.java | 55 ++ .../org/apache/tamaya/metamodel/MapFilter.java | 101 ++ .../org/apache/tamaya/metamodel/MaskFilter.java | 121 .../apache/tamaya/metamodel/MetaContext.java| 112 +++ .../apache/tamaya/metamodel/SecuredFilter.java | 119 .../metamodel/ext/FilteredPropertySource.java | 25 ++- .../internal/CombinationPolicyReader.java | 2 +- .../internal/ComponentConfigurator.java | 19 +- .../metamodel/internal/ContextReader.java | 181 -- .../metamodel/internal/MetaContextReader.java | 185 +++ .../internal/PropertyConverterReader.java | 55 +++--- .../internal/PropertyFilterReader.java | 47 +++-- .../internal/PropertySourceReader.java | 132 +++-- .../factories/FilePropertySourceFactory.java| 10 +- .../ResourcePropertySourceFactory.java | 8 +- .../ResourcePropertySourceProviderFactory.java | 8 +- .../factories/URLPropertySourceFactory.java | 6 +- .../internal/resolver/PropertiesResolver.java | 13 +- .../org.apache.tamaya.metamodel.spi.ItemFactory | 7 + ...tamaya.metamodel.spi.MetaConfigurationReader | 2 +- .../tamaya/metamodel/ext/IntegrationTest.java | 107 ++- .../tamaya/metamodel/ext/MyConverter.java | 33 .../apache/tamaya/metamodel/ext/MyFilter.java | 33 .../tamaya/metamodel/ext/MyPropertySource.java | 35 .../resources/IntegrationTests/context-test.xml | 29 +++ .../default-propertyconverters-test.xml | 31 .../default-propertyfilters-test.xml| 26 +++ .../default-propertysources-test.xml| 29 +++ .../propertyconverters-test.xml | 30 +++ .../IntegrationTests/propertyfilters-test.xml | 26 +++ .../IntegrationTests/propertysources-test.xml | 25 +++ .../org.apache.tamaya.spi.PropertyFilter| 19 ++ metamodel/src/test/resources/tamaya-config.xml | 96 -- 35 files changed, 1419 insertions(+), 483 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/10d711e6/metamodel/src/main/java/org/apache/tamaya/metamodel/CachedFilter.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/CachedFilter.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/CachedFilter.java new file mode 100644 index 000..c07e11d --- /dev/null +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/CachedFilter.java @@ -0,0 +1,108 @@ +package org.apache.tamaya.metamodel;/* + * (C) Copyright 2015-2017 Trivadis AG. All rights reserved. + */ + +import org.apache.tamaya.metamodel.spi.ItemFactory; +import org.apache.tamaya.spi.FilterContext; +import org.apache.tamaya.spi.PropertyFilter; +import org.apache.tamaya.spi.PropertyValue; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; + +/** + * Simple filter that never changes a key/value pair returned, regardless if a value + * is changing underneath, hereby different values for single and multi-property access + * are considered. + */ +public class CachedFilter implements PropertyFilter{ + +private String matches; +private Map<String, CachedEntry> cachedEntries = new ConcurrentHashMap<>(); +private int maxSize = -1; +private long timeout = TimeUnit.MINUTES.toMillis(5); + +/** + * Factory for configuring immutable property filter. + */ +public static final class CachedFilterFactory implements ItemFactory { +@Override +public String getName() { +return "Cached"; +} + +@Override +public PropertyFilter create(Map<String,String> parameters) { +return new CachedFilter(); +} + +@Override +public Class getType() { +return PropertyFilter.class; +} +} + +public Strin
[1/7] incubator-tamaya-sandbox git commit: TAMAYA-150: Renabled UI after refactoring out several functionality into separate modules.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 5ee4802c7 -> d344e7323 TAMAYA-150: Renabled UI after refactoring out several functionality into separate modules. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/fd26d6c0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/fd26d6c0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/fd26d6c0 Branch: refs/heads/master Commit: fd26d6c0b0e4cd44d6408b4449a01e946886f59b Parents: 5ee4802 Author: anatole <anat...@apache.org> Authored: Sat Apr 15 22:10:03 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sat Apr 15 22:10:03 2017 +0200 -- ui/base/pom.xml | 9 + .../org/apache/tamaya/ui/ApplicationLayout.java | 39 ++- .../main/java/org/apache/tamaya/ui/NavBar.java | 8 +- .../java/org/apache/tamaya/ui/TamayaUI.java | 75 +- .../java/org/apache/tamaya/ui/UIConstants.java | 2 + .../java/org/apache/tamaya/ui/VadiinApp.java| 97 --- .../java/org/apache/tamaya/ui/ViewProvider.java | 73 - .../ConfigurationBasedMessageProvider.java | 6 +- .../ui/internal/ConfiguredUserService.java | 2 +- .../tamaya/ui/internal/PageTitleUpdater.java| 4 +- .../internal/ResourceBundleMessageProvider.java | 182 ++--- .../tamaya/ui/internal/URLPropertySource.java | 78 -- .../ui/internal/VerticalSpacedLayout.java | 4 +- .../org/apache/tamaya/ui/spi/LazyProvider.java | 81 -- .../apache/tamaya/ui/spi/MessageProvider.java | 2 +- .../tamaya/ui/spi/SystemInfoProvider.java | 15 ++ .../org/apache/tamaya/ui/spi/UserService.java | 2 +- .../ui/views/AbstractTextInfoProvider.java | 67 + .../org/apache/tamaya/ui/views/ConfigView.java | 263 --- .../org/apache/tamaya/ui/views/HomeView.java| 48 +--- .../org/apache/tamaya/ui/views/SystemView.java | 77 ++ .../views/TamayaGeneralSystemInfoProvider.java | 112 ++-- .../apache/tamaya/ui/views/login/LoginBox.java | 4 +- .../services/org.apache.tamaya.ui.ViewProvider | 3 - ...rg.apache.tamaya.ui.services.MessageProvider | 19 -- .../org.apache.tamaya.ui.services.UserService | 19 -- .../org.apache.tamaya.ui.spi.MessageProvider| 19 ++ .../org.apache.tamaya.ui.spi.SystemInfoProvider | 19 ++ .../org.apache.tamaya.ui.spi.UserService| 19 ++ .../main/resources/ui/lang/tamaya.properties| 6 +- ui/pom.xml | 88 ++- 31 files changed, 665 insertions(+), 777 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/pom.xml -- diff --git a/ui/base/pom.xml b/ui/base/pom.xml index 40914d8..c300feb 100644 --- a/ui/base/pom.xml +++ b/ui/base/pom.xml @@ -33,6 +33,10 @@ under the License. tamaya-ui-base_alpha Apache Tamaya Modules - UI (Base) + +org.apache.tamaya.ui.VadiinApp + + @@ -151,6 +155,11 @@ under the License. true + +vaadin-prereleases +Vaadin Pre-releases +https://maven.vaadin.com/vaadin-prereleases + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java -- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java index 20190be..f1dd7e7 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java @@ -18,11 +18,18 @@ */ package org.apache.tamaya.ui; +import com.vaadin.navigator.Navigator; +import com.vaadin.navigator.View; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI; -import org.apache.tamaya.ui.components.PageTitleUpdater; +import org.apache.tamaya.spi.ServiceContext; +import org.apache.tamaya.spi.ServiceContextManager; +import org.apache.tamaya.ui.spi.MessageProvider; +import org.apache.tamaya.ui.views.ConfigView; import org.apache.tamaya.ui.views.ErrorView; +import org.apache.tamaya.ui.views.HomeView; +import org.apache.tamaya.ui.views.SystemView; /** @@ -32,7 +39,7 @@ public class ApplicationLayout extends HorizontalLayout { private NavBar navBar; private Panel content; -private NavigationBar navigator; +private Navigator navigator; public ApplicationLayout(UI ui) {
incubator-tamaya-extensions git commit: Enabled more fine grained reusage of toString fields.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master 011310556 -> 668a36eb2 Enabled more fine grained reusage of toString fields. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/668a36eb Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/668a36eb Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/668a36eb Branch: refs/heads/master Commit: 668a36eb2a20734e2a7db956f79c24429108f5fe Parents: 0113105 Author: anatole <anat...@apache.org> Authored: Tue Apr 18 11:37:30 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Apr 18 11:39:28 2017 +0200 -- .../format/MappedConfigurationDataPropertySource.java | 6 ++ .../org/apache/tamaya/jndi/JNDIPropertySource.java | 9 +++-- .../MutablePropertiesPropertySource.java | 5 + .../MutableXmlPropertiesPropertySource.java| 6 ++ .../apache/tamaya/spisupport/BasePropertySource.java | 13 + .../apache/tamaya/spisupport/CLIPropertySource.java| 11 +++ .../tamaya/spisupport/EnvironmentPropertySource.java | 7 +++ .../apache/tamaya/spisupport/MapPropertySource.java| 8 .../apache/tamaya/spisupport/SystemPropertySource.java | 7 +++ .../src/test/resources/overrideOrdinal.properties | 2 +- 10 files changed, 55 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/668a36eb/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java -- diff --git a/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java b/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java index e8eef40..ef9f507 100644 --- a/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java +++ b/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java @@ -149,4 +149,10 @@ public class MappedConfigurationDataPropertySource extends BasePropertySource { return result; } +@Override +protected String toStringValues() { +return super.toStringValues() + +" dataSupplier=" + dataSupplier + '\n'; +} + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/668a36eb/modules/jndi/src/main/java/org/apache/tamaya/jndi/JNDIPropertySource.java -- diff --git a/modules/jndi/src/main/java/org/apache/tamaya/jndi/JNDIPropertySource.java b/modules/jndi/src/main/java/org/apache/tamaya/jndi/JNDIPropertySource.java index a944db7..13eb9b4 100644 --- a/modules/jndi/src/main/java/org/apache/tamaya/jndi/JNDIPropertySource.java +++ b/modules/jndi/src/main/java/org/apache/tamaya/jndi/JNDIPropertySource.java @@ -132,12 +132,9 @@ public class JNDIPropertySource extends BasePropertySource { } @Override -public String toString() { -return "JNDIPropertySource{" + -"name=" + getName() + -", ordinal=" + getOrdinal() + -", context=" + context + -'}'; +protected String toStringValues() { +return super.toStringValues() + +"\n context=" + context + '\''; } /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/668a36eb/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java -- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java index 50a1b5f..39b840c 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java @@ -157,5 +157,10 @@ implements MutablePropertySource{ } } +@Override +protected String toStringValues() { +return super.toStringValues() + +" file=" + file + '\n'; +} } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/668a36eb
incubator-tamaya git commit: TAMAYA-260: Added on/off on Boolean conversion. Fixed minor issue in value evaluation.
Repository: incubator-tamaya Updated Branches: refs/heads/java8 57211635f -> 78182381a TAMAYA-260: Added on/off on Boolean conversion. Fixed minor issue in value evaluation. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/78182381 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/78182381 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/78182381 Branch: refs/heads/java8 Commit: 78182381aaedbe151c9c33a01918d19a548538fe Parents: 5721163 Author: anatole <anat...@apache.org> Authored: Mon Aug 14 01:39:43 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 14 01:39:43 2017 +0200 -- .../apache/tamaya/core/internal/DefaultConfigValueEvaluator.java | 2 +- .../java/org/apache/tamaya/core/internal/DefaultConfiguration.java | 2 +- .../apache/tamaya/core/internal/converters/BooleanConverter.java | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78182381/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigValueEvaluator.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigValueEvaluator.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigValueEvaluator.java index f3b30a3..332df89 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigValueEvaluator.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigValueEvaluator.java @@ -42,7 +42,7 @@ public class DefaultConfigValueEvaluator implements ConfigValueEvaluator{ collect(unfilteredValue, key, propertySource); } if(unfilteredValue==null || unfilteredValue.getValue()==null){ -return unfilteredValue; +return null; } return unfilteredValue; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78182381/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java index 54cd186..c768a4c 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java @@ -81,7 +81,7 @@ public class DefaultConfiguration implements Configuration { Objects.requireNonNull(key, "Key must not be null."); PropertyValue value = configEvaluator.evaluteRawValue(key, configurationContext); -if(value==null || value.getValue()==null){ +if(value==null){ return null; } value = PropertyFiltering.applyFilter(value, configurationContext); http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78182381/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java index 61c182b..0d14fc1 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java @@ -44,12 +44,14 @@ public class BooleanConverter implements PropertyConverter { case "y": case "true": case "t": +case "on": return Boolean.TRUE; case "no": case "n": case "false": case "f": case "0": +case "off": return Boolean.FALSE; default: LOG.finest("Unknown boolean value encountered: " + value);
incubator-tamaya-extensions git commit: TAMAYA-260: Fixed classcast exception.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/java8 72c37c5c1 -> 089043d9e TAMAYA-260: Fixed classcast exception. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/089043d9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/089043d9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/089043d9 Branch: refs/heads/java8 Commit: 089043d9ef940635e27c94d1123a0cff533cc1a7 Parents: 72c37c5 Author: anatole <anat...@apache.org> Authored: Mon Aug 14 01:40:33 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 14 01:40:33 2017 +0200 -- .../tamaya/spisupport/SystemPropertySource.java | 22 +++- 1 file changed, 12 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/089043d9/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java index de83a82..bc5f99e 100644 --- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/SystemPropertySource.java @@ -133,16 +133,18 @@ public class SystemPropertySource extends BasePropertySource { final String prefix = this.prefix; Map<String, PropertyValue> entries = new HashMap<>(); for (Map.Entry<Object,Object> entry : sysProps.entrySet()) { -if(prefix==null) { -entries.put((String) entry.getKey(), -PropertyValue.of((String) entry.getKey(), -(String) entry.getValue(), -getName())); -}else { -entries.put(prefix + entry.getKey(), -PropertyValue.of(prefix + entry.getKey(), -(String) entry.getValue(), -getName())); +if(entry.getKey() instanceof String && entry.getValue() instanceof String) { +if (prefix == null) { +entries.put((String) entry.getKey(), +PropertyValue.of((String) entry.getKey(), +(String) entry.getValue(), +getName())); +} else { +entries.put(prefix + entry.getKey(), +PropertyValue.of(prefix + entry.getKey(), +(String) entry.getValue(), +getName())); +} } } return entries;
incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed Boolean conversion to comply with MP TCK.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 4a63a4a4f -> b2c69a1b7 TAMAYA-260: Fixed Boolean conversion to comply with MP TCK. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/b2c69a1b Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/b2c69a1b Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/b2c69a1b Branch: refs/heads/java8 Commit: b2c69a1b71b73e8c0546bf46e5e290a583b38381 Parents: 4a63a4a Author: anatole <anat...@apache.org> Authored: Mon Aug 14 01:38:20 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 14 01:38:20 2017 +0200 -- microprofile/pom.xml| 5 + .../tamaya/microprofile/MicroprofileConfig.java | 20 +++- .../microprofile/cdi/BridgingConfigBean.java| 10 -- .../converter/BooleanAsIntegerConverterFix.java | 13 +++-- .../tck/TamayaConfigArchiveProcessor.java | 5 +++-- 5 files changed, 34 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index ff893b8..37bbb2b 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -77,6 +77,11 @@ under the License. ${tamaya-version} +org.apache.tamaya.ext +tamaya-events +${tamaya-version} + + org.eclipse.microprofile.config microprofile-config-api 1.0 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java index 3dc4b34..61c3cdc 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java @@ -20,16 +20,21 @@ package org.apache.tamaya.microprofile; import org.apache.tamaya.ConfigException; import org.apache.tamaya.Configuration; +import org.apache.tamaya.events.FrozenConfiguration; import org.apache.tamaya.spi.PropertySource; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.spi.ConfigSource; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.util.*; /** * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance. */ -public class MicroprofileConfig implements Config { +public class MicroprofileConfig implements Config, Serializable { private Configuration delegate; @@ -79,4 +84,17 @@ public class MicroprofileConfig implements Config { "delegate=" + delegate + '}'; } + +private void writeObject(ObjectOutputStream out) throws IOException{ +if(!(this.delegate instanceof Serializable)){ +out.writeObject(FrozenConfiguration.of(this.delegate)); +}else { +out.writeObject(this.delegate); +} +} + +private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{ +this.delegate = (Configuration)in.readObject(); +} + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java index deb2496..a08f76f 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java @@ -85,16 +85,6 @@ final class BridgingConfigBean implements Bean { @Override public Object create(CreationalContext creationalContext) { -//Set injectionPoints = delegate.getInjectionPoints(); -//for(InjectionPoint injectionPoint:injectionPoints){ -//final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class); -//String key = annotation.name(); -//
[1/3] incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed CDI issues regarding MP integration.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 41305de43 -> 50927f438 TAMAYA-260: Fixed CDI issues regarding MP integration. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/88b39eff Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/88b39eff Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/88b39eff Branch: refs/heads/java8 Commit: 88b39eff5c92d977414f2e8d229bf0d023173656 Parents: 41305de Author: anatole <anat...@apache.org> Authored: Sun Aug 13 01:27:49 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sun Aug 13 01:27:49 2017 +0200 -- microprofile/pom.xml| 72 + .../microprofile/MicroprofileConfigBuilder.java | 6 +- .../microprofile/cdi/BridgingConfigBean.java| 104 +++ .../tamaya/microprofile/cdi/ConfiguredType.java | 4 +- .../cdi/MicroprofileCDIExtension.java | 94 +++-- .../cdi/MicroprofileConfigurationProducer.java | 63 --- .../converter/ProviderConverter.java| 10 +- microprofile/src/main/resources/beans.xml | 25 + .../AutoDiscoveredConfigSourceTest.java | 2 +- .../imported/CDIPlainInjectionTest.java | 46 ++-- .../imported/CdiOptionalInjectionTest.java | 52 +- .../imported/ConfigProviderTest.java| 29 +- .../microprofile/imported/ConverterTest.java| 2 +- .../imported/CustomConfigSourceTest.java| 21 .../imported/OptionalValuesBean.java| 3 +- .../imported/base/AbstractTest.java | 42 .../imported/broken/ConfigOwner.java| 28 ++--- .../imported/broken/CustomConverterBean.java| 26 ++--- ...MissingConverterOnInstanceInjectionTest.java | 62 --- .../MissingValueOnInstanceInjectionTest.java| 61 --- .../WrongConverterOnInstanceInjectionTest.java | 63 --- .../microprofile/imported/converters/Pizza.java | 9 +- .../imported/converters/PizzaConverter.java | 3 +- .../tck/TamayaConfigArchiveProcessor.java | 4 +- .../src/test/resources/META-INF/beans.xml | 24 + .../META-INF/microprofile-config.properties | 2 + ...rg.eclipse.microprofile.config.spi.Converter | 18 27 files changed, 406 insertions(+), 469 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/88b39eff/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index 4795d36..ff893b8 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -42,7 +42,10 @@ under the License. 1.1.13.Final 2.0.0.Beta5 2.0 -3.0.0.Final +3.0.0.Final +2.2.7.Final +1.1.0 +4.7.1 @@ -73,29 +76,48 @@ under the License. tamaya-functions ${tamaya-version} - - - - - - - - - - - - org.eclipse.microprofile.config microprofile-config-api 1.0 -org.eclipse.microprofile.config -microprofile-config-tck -1.0 +javax.enterprise +cdi-api +1.2 +provided + + +org.apache.geronimo.specs +geronimo-jcdi_1.1_spec +${geronimo-jcdi-1.1-spec.version} +provided + + +org.jboss.weld.se +weld-se +${weld.version} +test + + +org.apache.deltaspike.cdictrl +deltaspike-cdictrl-weld +${deltaspike.version} +test + + +org.apache.deltaspike.modules +deltaspike-test-control-module-api +${deltaspike.version} +test + + +org.apache.deltaspike.modules +deltaspike-test-control-module-impl +${deltaspike.version} test + org.jboss.arquillian.testng arquillian-testng-container @@ -115,19 +137,31 @@ under the License. test pom + +org.apache.openejb +openejb-core +${openejb.version} +provided + -Weld3 +TCK -true +
[2/3] incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed CDI integration for almost any aspects of MP, removed mp from build.
TAMAYA-260: Fixed CDI integration for almost any aspects of MP, removed mp from build. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/029a43ca Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/029a43ca Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/029a43ca Branch: refs/heads/java8 Commit: 029a43ca63eb1fc0a809ac337a63c351ae142d28 Parents: 88b39ef Author: anatole <anat...@apache.org> Authored: Sun Aug 13 23:51:10 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sun Aug 13 23:51:10 2017 +0200 -- .../microprofile/cdi/BridgingConfigBean.java| 2 +- .../microprofile/cdi/ConfiguredField.java | 2 +- .../microprofile/cdi/ConfiguredMethod.java | 2 +- .../tamaya/microprofile/cdi/ConfiguredType.java | 2 +- .../cdi/MicroprofileCDIExtension.java | 2 +- .../cdi/MicroprofileConfigurationProducer.java | 1 + .../converter/ProviderConverter.java| 138 +-- .../org.apache.tamaya.spi.PropertyConverter | 2 +- .../imported/CDIPlainInjectionTest.java | 7 +- .../tck/TamayaConfigArchiveProcessor.java | 5 +- pom.xml | 2 +- 11 files changed, 83 insertions(+), 82 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/029a43ca/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java index 0b22c6a..763f6ed 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java @@ -27,7 +27,7 @@ import java.util.Set; /** * Internally used conversion bean. */ -class BridgingConfigBean implements Bean { +final class BridgingConfigBean implements Bean { private final Bean delegate; private final Set types; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/029a43ca/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java index 1c9607c..29d7122 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java @@ -24,7 +24,7 @@ import java.lang.reflect.Field; /** * CDI implementation for event publishing of configured instances. */ -class ConfiguredField { +public final class ConfiguredField { private final Field field; private String key; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/029a43ca/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java index 74e158a..90204fe 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java @@ -24,7 +24,7 @@ import java.lang.reflect.Method; /** * Implementation of a configured methods for CDI module. */ -public class ConfiguredMethod { +public final class ConfiguredMethod { private final Method method; private String key; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/029a43ca/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java index e94c075..535a556 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java @@ -31,7 +31,7 @@ import java.util.Objects; * Event published for items configured by CDI extensions. This is for example used by the documentation module * to automat
incubator-tamaya-sandbox git commit: TAMAYA-260: Added pom.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master d344e7323 -> 9f8f587e1 TAMAYA-260: Added pom. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/9f8f587e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/9f8f587e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/9f8f587e Branch: refs/heads/master Commit: 9f8f587e19fdd460e0551f393f56e90c1776d1da Parents: d344e73 Author: anatole <anat...@apache.org> Authored: Mon Apr 24 10:28:53 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Apr 24 10:28:53 2017 +0200 -- microprofile/pom.xml | 108 ++ 1 file changed, 108 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9f8f587e/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml new file mode 100644 index 000..1b5d808 --- /dev/null +++ b/microprofile/pom.xml @@ -0,0 +1,108 @@ + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + + +org.apache.tamaya.ext +tamaya-sandbox +0.3-incubating-SNAPSHOT +.. + + +tamaya-microprofile_alpha +Apache Tamaya Modules - Microprofile API +jar + + +1.8 +1.8 +1.0 + 1.0 +1.0 + + + + + +org.apache.maven.plugins +maven-compiler-plugin + +true +${maven.compile.optimize} +${maven.compile.sourceLevel} +${maven.compile.targetLevel} +${project.build.sourceEncoding} + ${maven.compile.deprecation} + + + + + + + + +junit +junit +test + + +org.hamcrest +java-hamcrest +test + + + +org.apache.tamaya +tamaya-core +${project.parent.version} +test + + +org.apache.tamaya +tamaya-api +${project.parent.version} + + +org.apache.tamaya.ext +tamaya-functions +${project.parent.version} + + +org.apache.geronimo.specs +geronimo-atinject_1.0_spec +${geronimo-atinject-1.0-spec.version} +provided +true + + +org.apache.geronimo.specs +geronimo-jcdi_1.1_spec +${geronimo-jcdi-1.1-spec.version} +provided +true + + + + + + + + +
[2/4] incubator-tamaya git commit: TAMAYA-274: Moved to Java 8, added @FunctionalInterface annotations and java.time converters.
TAMAYA-274: Moved to Java 8, added @FunctionalInterface annotations and java.time converters. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/fd6184b8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/fd6184b8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/fd6184b8 Branch: refs/heads/java8 Commit: fd6184b8f7bb665596b04033b7635432a247f22b Parents: d659c1a Author: anatole <anat...@apache.org> Authored: Tue Aug 8 21:45:49 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 21:45:49 2017 +0200 -- .../java/org/apache/tamaya/ConfigOperator.java | 1 + .../java/org/apache/tamaya/ConfigQuery.java | 1 + .../apache/tamaya/spi/PropertyConverter.java| 3 ++ .../org/apache/tamaya/spi/PropertyFilter.java | 1 + .../tamaya/spi/PropertySourceProvider.java | 1 + .../org/apache/tamaya/spi/PropertyValue.java| 3 +- .../org/apache/tamaya/spi/ServiceContext.java | 3 +- .../DefaultConfigurationContextBuilder.java | 1 + .../core/internal/PropertySourceComparator.java | 2 +- .../internal/converters/DurationConverter.java | 51 .../internal/converters/LocalDateConverter.java | 49 +++ .../converters/LocalDateTimeConverter.java | 49 +++ .../internal/converters/LocalTimeConverter.java | 49 +++ .../converters/OffsetDateTimeConverter.java | 50 +++ .../converters/OffsetTimeConverter.java | 50 +++ .../org.apache.tamaya.spi.PropertyConverter | 6 +++ 16 files changed, 316 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/fd6184b8/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java b/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java index 2144218..b14c155 100644 --- a/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java +++ b/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java @@ -23,6 +23,7 @@ package org.apache.tamaya; * to modell additional functionality and applying it to a given {@link org.apache.tamaya.Configuration} instance by calling * the {@link org.apache.tamaya.Configuration#with(org.apache.tamaya.ConfigOperator)} method. */ +@FunctionalInterface public interface ConfigOperator { /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/fd6184b8/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java b/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java index 60e87bb..28b8b93 100644 --- a/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java +++ b/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java @@ -23,6 +23,7 @@ package org.apache.tamaya; * to model additional functionality and applying it to a given {@link Configuration} instance by * calling the {@link Configuration#query(ConfigQuery)} method. */ +@FunctionalInterface public interface ConfigQuery { /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/fd6184b8/code/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java b/code/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java index ef6e2ac..56ac5e6 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java +++ b/code/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java @@ -19,6 +19,8 @@ package org.apache.tamaya.spi; +import jdk.nashorn.internal.objects.annotations.Function; + /** * Interface for an property that converts a configured String into something else. * This is used for implementing type conversion from a property (String) to a certain target @@ -26,6 +28,7 @@ package org.apache.tamaya.spi; * * @param the type of the type literal */ +@FunctionalInterface public interface PropertyConverter{ /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/fd6184b8/code/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java -- diff --git a/code/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/code/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java index 350bd73..3054496 100644 --- a/code/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java +++ b/code/api/src/main/java/org/apach
[4/4] incubator-tamaya git commit: TAMAYA-274: Moved to Java 8, added missing converters.
TAMAYA-274: Moved to Java 8, added missing converters. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/c4285641 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/c4285641 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/c4285641 Branch: refs/heads/java8 Commit: c4285641af328fe7c3a0ee4522eca73c27f4fbdb Parents: c32b45f Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:22:59 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:22:59 2017 +0200 -- .../internal/converters/BooleanConverter.java | 4 +- .../internal/converters/InstantConverter.java | 49 .../internal/converters/OptionalConverter.java | 61 .../org.apache.tamaya.spi.PropertyConverter | 2 + 4 files changed, 115 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4285641/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java index d926b14..61c182b 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java @@ -34,11 +34,12 @@ public class BooleanConverter implements PropertyConverter { @Override public Boolean convert(String value, ConversionContext context) { -context.addSupportedFormats(getClass(), "yes (ignore case)", "y (ignore case)", "true (ignore case)", "t (ignore case)", "no (ignore case)", "n (ignore case)", "false (ignore case)", "f (ignore case)"); +context.addSupportedFormats(getClass(), "yes (ignore case)", "y (ignore case)", "true (ignore case)", "t (ignore case)", "1", "no (ignore case)", "n (ignore case)", "false (ignore case)", "f (ignore case)", "0"); String ignoreCaseValue = Objects.requireNonNull(value) .trim() .toLowerCase(Locale.ENGLISH); switch(ignoreCaseValue) { +case "1": case "yes": case "y": case "true": @@ -48,6 +49,7 @@ public class BooleanConverter implements PropertyConverter { case "n": case "false": case "f": +case "0": return Boolean.FALSE; default: LOG.finest("Unknown boolean value encountered: " + value); http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4285641/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java new file mode 100644 index 000..c0f2bf0 --- /dev/null +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/InstantConverter.java @@ -0,0 +1,49 @@ +/* + * 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.core.internal.converters; + +import org.apache.tamaya.spi.ConversionContext; +import org.apache.tamaya.spi.PropertyConverter; + +import java.time.Instant; +import java.util.logging.Logger; + +/** + * Converter, converting from String to Boolean. + */ +public class InstantConverter im
[3/4] incubator-tamaya-sandbox git commit: TAMAYA-260: Implemented all basic microprofile features. Last 3 failres are to be discussed with MP folks.
TAMAYA-260: Implemented all basic microprofile features. Last 3 failres are to be discussed with MP folks. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/1e2a184f Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/1e2a184f Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/1e2a184f Branch: refs/heads/java8 Commit: 1e2a184f80167576c6b884f004083bf5496cfe95 Parents: d9e2d54 Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:18:52 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:18:52 2017 +0200 -- .../microprofile/MicroprofileAdapter.java | 1 + .../microprofile/MicroprofileConfigBuilder.java | 46 +++- .../MicroprofileConfigProviderResolver.java | 8 +- .../MicroprofileConfigurationProducer.java | 104 .../MicroprofileDefaultProperties.java | 33 +++ .../microprofile/TamayaPropertySource.java | 4 +- .../org.apache.tamaya.spi.PropertySource| 20 ++ .../MicroprofileConfigBuilderTest.java | 3 +- .../MicroprofileConfigProviderTest.java | 2 +- .../microprofile/MicroprofileConfigTest.java| 11 +- .../MPSystemPropertiesConfigSource.java | 34 --- .../AutoDiscoveredConfigSourceTest.java | 64 + .../imported/CDIPlainInjectionTest.java | 226 ++ .../imported/ConfigProviderTest.java| 143 +++ .../microprofile/imported/ConverterTest.java| 235 +++ .../imported/CustomConfigSourceTest.java| 61 + .../imported/OptionalValuesBean.java| 61 + .../imported/broken/ConfigOwner.java| 39 +++ .../imported/broken/CustomConverterBean.java| 46 ...MissingConverterOnInstanceInjectionTest.java | 62 + .../MissingValueOnInstanceInjectionTest.java| 61 + .../WrongConverterOnInstanceInjectionTest.java | 63 + .../CustomConfigSourceProvider.java | 53 + .../configsources/CustomDbConfigSource.java | 69 ++ .../configsources/SampleYamlConfigSource.java | 58 + .../microprofile/imported/converters/Duck.java | 36 +++ .../imported/converters/DuckConverter.java | 33 +++ .../microprofile/imported/converters/Pizza.java | 45 .../imported/converters/PizzaConverter.java | 33 +++ .../imported/matchers/AdditionalMatchers.java | 61 + .../tck/TamayaConfigArchiveProcessor.java | 69 ++ .../microprofile/tck/TamayaConfigExtension.java | 36 +++ .../META-INF/microprofile-config.properties | 100 ...eclipse.microprofile.config.spi.ConfigSource | 2 +- ...microprofile.config.spi.ConfigSourceProvider | 18 ++ jboss.arquillian.core.spi.LoadableExtension | 19 ++ microprofile/src/test/tck-suite.xml | 29 +++ microprofile/tck-suite.xml | 29 --- 38 files changed, 1938 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1e2a184f/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java index 20d5af0..8f5002c 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java @@ -75,6 +75,7 @@ public final class MicroprofileAdapter{ for(PropertySource ps:propertySources){ configSources.add(toConfigSource(ps)); } +Collections.reverse(configSources); return configSources; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1e2a184f/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java index 5e6b613..aacd31b 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java @@ -21,9 +21,14 @@ package org.apache.tamaya.microprofile; import org.apache.tamaya.ConfigurationProvider; import org.apache.tamaya.TypeLiteral; import org.apache.tamaya.spi.ConfigurationContextBuilder; +import org.apache.tamaya.spi.ServiceCo
[1/4] incubator-tamaya-sandbox git commit: TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 a3e01813f -> f30884f9e TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/d9e2d541 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/d9e2d541 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/d9e2d541 Branch: refs/heads/java8 Commit: d9e2d541ed7fe5467955c20954f21c758a354542 Parents: a3e0181 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 21:44:51 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 21:44:51 2017 +0200 -- apache-commons/pom.xml | 2 +- camel/pom.xml | 2 +- configured-sysprops/pom.xml | 2 +- consul/pom.xml | 2 +- etcd/pom.xml| 2 +- hazelcast/pom.xml | 2 +- jodatime/pom.xml| 2 +- management/pom.xml | 2 +- metamodel/pom.xml | 2 +- microprofile/pom.xml| 46 +++- osgi/common/pom.xml | 2 +- osgi/karaf-features/pom.xml | 2 +- osgi/pom.xml| 4 ++-- pom.xml | 22 +-- propertysources/pom.xml | 2 +- remote/pom.xml | 2 +- server/pom.xml | 2 +- ui/base/pom.xml | 2 +- ui/events/pom.xml | 2 +- ui/mutableconfig/pom.xml| 2 +- ui/pom.xml | 2 +- uom/pom.xml | 2 +- usagetracker/pom.xml| 2 +- validation/pom.xml | 2 +- vertx/pom.xml | 2 +- 25 files changed, 75 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/apache-commons/pom.xml -- diff --git a/apache-commons/pom.xml b/apache-commons/pom.xml index 8f4d945..0ed033d 100644 --- a/apache-commons/pom.xml +++ b/apache-commons/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. tamaya-commons-config_beta http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/camel/pom.xml -- diff --git a/camel/pom.xml b/camel/pom.xml index 2dcdc60..f4324bb 100644 --- a/camel/pom.xml +++ b/camel/pom.xml @@ -22,7 +22,7 @@ under the License. org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/configured-sysprops/pom.xml -- diff --git a/configured-sysprops/pom.xml b/configured-sysprops/pom.xml index 884007f..8384d04 100644 --- a/configured-sysprops/pom.xml +++ b/configured-sysprops/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. tamaya-sysprops_beta http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/consul/pom.xml -- diff --git a/consul/pom.xml b/consul/pom.xml index 14dbe65..47ce340 100644 --- a/consul/pom.xml +++ b/consul/pom.xml @@ -22,7 +22,7 @@ under the License. org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/etcd/pom.xml -- diff --git a/etcd/pom.xml b/etcd/pom.xml index 376a469..31ea349 100644 --- a/etcd/pom.xml +++ b/etcd/pom.xml @@ -22,7 +22,7 @@ under the License. org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/hazelcast/pom.xml -- diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index 7f594cd..1052787 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -22,7 +22,7 @@ org.apache.tamaya.ext tamaya-sandbox -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/d9e2d541/j
[1/4] incubator-tamaya git commit: TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT
Repository: incubator-tamaya Updated Branches: refs/heads/java8 0402fd349 -> c4285641a TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/d659c1ae Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/d659c1ae Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/d659c1ae Branch: refs/heads/java8 Commit: d659c1ae3d03893f989cea41274364243e9837de Parents: 0402fd3 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 21:44:51 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 21:44:51 2017 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d659c1ae/pom.xml -- diff --git a/pom.xml b/pom.xml index c9cba10..337cb3b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 2.5 false -1.7 +1.8 5.0.0 ${osgi.version} ${jdkVersion}
[4/4] incubator-tamaya-extensions git commit: TAMAYA-260: Added support for config_ordinal as alternative ordinal key.
TAMAYA-260: Added support for config_ordinal as alternative ordinal key. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/72c37c5c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/72c37c5c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/72c37c5c Branch: refs/heads/java8 Commit: 72c37c5c1e5d3504c87e796b9af923ae476d4436 Parents: 1d1cf72 Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:21:48 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:21:48 2017 +0200 -- .../spisupport/PropertySourceComparator.java| 59 +++- 1 file changed, 32 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/72c37c5c/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertySourceComparator.java -- diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertySourceComparator.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertySourceComparator.java index f4c37ac..6799e4e 100644 --- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertySourceComparator.java +++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/PropertySourceComparator.java @@ -39,6 +39,8 @@ public class PropertySourceComparator implements Comparator, Ser private static final PropertySourceComparator INSTANCE = new PropertySourceComparator(); +private String alternativeOrdinalKey; + private PropertySourceComparator(){} /** @@ -58,9 +60,9 @@ public class PropertySourceComparator implements Comparator, Ser * @return the comparison result. */ private int comparePropertySources(PropertySource source1, PropertySource source2) { -if (getOrdinal(source1) < getOrdinal(source2)) { +if (getOrdinal(source1, alternativeOrdinalKey) < getOrdinal(source2, alternativeOrdinalKey)) { return -1; -} else if (getOrdinal(source1) > getOrdinal(source2)) { +} else if (getOrdinal(source1, alternativeOrdinalKey) > getOrdinal(source2, alternativeOrdinalKey)) { return 1; } else { return source1.getClass().getName().compareTo(source2.getClass().getName()); @@ -68,35 +70,38 @@ public class PropertySourceComparator implements Comparator, Ser } public static int getOrdinal(PropertySource propertySource) { -//PropertyValue ordinalValue = propertySource.get(PropertySource.TAMAYA_ORDINAL); -//if(ordinalValue!=null){ -//try{ -//return Integer.parseInt(ordinalValue.getProperty().trim()); -//}catch(Exception e){ -//LOG.finest("Failed to parse ordinal from " + PropertySource.TAMAYA_ORDINAL + -//" in " + propertySource.getName()+": "+ordinalValue.getProperty()); -//} -//} -//try { -//Method method = propertySource.getClass().getMethod("getOrdinal"); -//if(int.class.equals(method.getReturnType())){ -//try { -//return (int)method.invoke(propertySource); -//} catch (Exception e) { -//LOG.log(Level.FINEST, "Error calling int getOrdinal() on " + propertySource.getName(), e); -//} -//} -//} catch (NoSuchMethodException e) { -//LOG.finest("No int getOrdinal() method found in " + propertySource.getName()); -//} -//Priority prio = propertySource.getClass().getAnnotation(Priority.class); -//if(prio!=null){ -//return prio.value(); -//} +return getOrdinal(propertySource, null); +} + +public static int getOrdinal(PropertySource propertySource, String alternativeOrdinalKey) { +if(alternativeOrdinalKey!=null) { +PropertyValue ordinalValue = propertySource.get(alternativeOrdinalKey); +if (ordinalValue != null) { +try { +return Integer.parseInt(ordinalValue.getValue().trim()); +} catch (Exception e) { +LOG.finest("Failed to parse ordinal from " + alternativeOrdinalKey + +" in " + propertySource.getName() + ": " + ordinalValue.getValue()); +} +} +} return propertySource.getOrdinal(); } + +/** + * Overrides/adds the key to evaluate/override a property sources ordina
[2/4] incubator-tamaya-sandbox git commit: TAMAYA-260: Implemented all basic microprofile features. Last 3 failres are to be discussed with MP folks.
hoo.de;>Mark Struberg + */ +public class TamayaConfigArchiveProcessor implements ApplicationArchiveProcessor { + +@Override +public void process(Archive applicationArchive, TestClass testClass) { +if (applicationArchive instanceof WebArchive) { +File[] coreLibs = Maven.resolver() + .loadPomFromFile("pom.xml").resolve("org.apache.tamaya:tamaya-core") +.withTransitivity().asFile(); +File[] apiLibs = Maven.resolver() + .loadPomFromFile("pom.xml").resolve("org.apache.tamaya:tamaya-api") +.withTransitivity().asFile(); +File[] functionsLib = Maven.resolver() + .loadPomFromFile("pom.xml").resolve("org.apache.tamaya.ext:tamaya-functions") +.withTransitivity().asFile(); + +JavaArchive configJar = ShrinkWrap +.create(JavaArchive.class, "tamaya-config-impl.jar") +.addPackage(MicroprofileAdapter.class.getPackage()) +.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") +.addAsServiceProvider(ConfigProviderResolver.class, MicroprofileConfigProviderResolver.class); +((WebArchive) applicationArchive).addAsLibraries( +configJar) +.addAsLibraries(apiLibs) +.addAsLibraries(coreLibs) +.addAsLibraries(functionsLib); +} +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1e2a184f/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java -- diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java new file mode 100644 index 000..9c0dfd3 --- /dev/null +++ b/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java @@ -0,0 +1,36 @@ +/* + * 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.microprofile.tck; + +import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; +import org.jboss.arquillian.core.spi.LoadableExtension; + +/** + * Arquillian extension to load Tamaya into Arquillian context. + * @author mailto:anat...@apache.org;>Anatole Tresch + */ +public class TamayaConfigExtension implements LoadableExtension { + +@Override +public void register(ExtensionBuilder extensionBuilder) { +extensionBuilder.service( +ApplicationArchiveProcessor.class, +TamayaConfigArchiveProcessor.class); +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1e2a184f/microprofile/src/test/resources/META-INF/microprofile-config.properties -- diff --git a/microprofile/src/test/resources/META-INF/microprofile-config.properties b/microprofile/src/test/resources/META-INF/microprofile-config.properties new file mode 100644 index 000..6895df3 --- /dev/null +++ b/microprofile/src/test/resources/META-INF/microprofile-config.properties @@ -0,0 +1,100 @@ +# +# Copyright (c) 2016-2017 Contributors to the Eclipse Foundation +# +# See the NOTICES file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# Licensed 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 limitation
[3/4] incubator-tamaya-extensions git commit: TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT
TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/1d1cf72e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/1d1cf72e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/1d1cf72e Branch: refs/heads/java8 Commit: 1d1cf72ef18e95980602807e6d4f1e939c90a7d2 Parents: 0d13b0e Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:21:01 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:21:01 2017 +0200 -- modules/events/pom.xml | 4 modules/features/pom.xml| 4 modules/filter/pom.xml | 4 modules/formats/base/pom.xml| 4 modules/formats/json/pom.xml| 4 modules/formats/yaml/pom.xml| 1 - modules/functions/pom.xml | 4 modules/injection/injection-api/pom.xml | 1 - modules/injection/standalone/pom.xml| 4 modules/jndi/pom.xml| 4 modules/mutable-config/pom.xml | 4 modules/optional/pom.xml| 4 modules/resolver/pom.xml| 4 modules/resources/pom.xml | 4 modules/spi-support/pom.xml | 4 pom.xml | 9 - 16 files changed, 4 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/events/pom.xml -- diff --git a/modules/events/pom.xml b/modules/events/pom.xml index a9fd9ac..3ef6ff7 100644 --- a/modules/events/pom.xml +++ b/modules/events/pom.xml @@ -32,10 +32,6 @@ under the License. Apache Tamaya Event and dynamic Update Extensions jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/features/pom.xml -- diff --git a/modules/features/pom.xml b/modules/features/pom.xml index ca1b8c3..6f15c0f 100644 --- a/modules/features/pom.xml +++ b/modules/features/pom.xml @@ -32,10 +32,6 @@ under the License. Apache Tamaya Feature Check jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/filter/pom.xml -- diff --git a/modules/filter/pom.xml b/modules/filter/pom.xml index bc8a4d6..4cf2bd6 100644 --- a/modules/filter/pom.xml +++ b/modules/filter/pom.xml @@ -32,10 +32,6 @@ under the License. Apache Tamaya Adaptive Configuration Filtering jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/formats/base/pom.xml -- diff --git a/modules/formats/base/pom.xml b/modules/formats/base/pom.xml index 8e5ff74..aa2c660 100644 --- a/modules/formats/base/pom.xml +++ b/modules/formats/base/pom.xml @@ -32,10 +32,6 @@ under the License. Apache Tamaya Modules Formats Common jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/formats/json/pom.xml -- diff --git a/modules/formats/json/pom.xml b/modules/formats/json/pom.xml index 0cacc56..5f807c5 100644 --- a/modules/formats/json/pom.xml +++ b/modules/formats/json/pom.xml @@ -34,10 +34,6 @@ under the License. jar 2015 - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/formats/yaml/pom.xml -- diff --git a/modules/formats/yaml/pom.xml b/modules/formats/yaml/pom.xml index 431c574..d5448f3 100644 --- a/modules/formats/yaml/pom.xml +++ b/modules/formats/yaml/pom.xml @@ -35,7 +35,6 @@ under the License. 2016 -1.7 1.17 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1d1cf72e/modules/functions/pom.xml -- diff --git a/modules/functions/pom.xml b/modules/functions/pom.xml index 5c90633..957f3a3 100644 --- a/modules/functions/pom.xml +++ b/modules/functions/pom.xml @@ -32,10 +3
[2/4] incubator-tamaya-extensions git commit: Added latency for change test (sometimes failing).
Added latency for change test (sometimes failing). Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/0d13b0ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/0d13b0ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/0d13b0ec Branch: refs/heads/java8 Commit: 0d13b0ec09527c0a5ffdc0580f11350b01ba6064 Parents: 70edbf9 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 21:46:22 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 21:46:22 2017 +0200 -- .../test/java/org/apache/tamaya/events/ConfigurationChangeTest.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/0d13b0ec/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java -- diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java index 4cedeab..60f40c2 100644 --- a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java +++ b/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java @@ -69,6 +69,7 @@ public class ConfigurationChangeTest { @Test public void testGetTimestamp() throws Exception { Configuration config = ConfigurationProvider.getConfiguration(); +Thread.sleep(10L); ConfigurationChange change = ConfigurationChangeBuilder.of(config).build(); assertTrue((System.currentTimeMillis() - change.getTimestamp()) > 0L); change = ConfigurationChangeBuilder.of(config).setTimestamp(10L).build();
[1/4] incubator-tamaya-extensions git commit: TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/java8 5cb0e696e -> 72c37c5c1 TAMAYA-274: Moved to Java 8, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/70edbf97 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/70edbf97 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/70edbf97 Branch: refs/heads/java8 Commit: 70edbf9727abc2f9dcd214fd47a3ee3dda33e411 Parents: 5cb0e69 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 21:44:52 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 21:44:52 2017 +0200 -- distribution/pom.xml| 2 +- examples/01-resources-example/pom.xml | 4 ++-- examples/02-resolver-example/pom.xml| 2 +- examples/03-injection-example/pom.xml | 4 ++-- examples/04-events-example/pom.xml | 2 +- examples/pom.xml| 4 ++-- modules/events/pom.xml | 2 +- modules/features/pom.xml| 2 +- modules/filter/pom.xml | 2 +- modules/formats/base/pom.xml| 2 +- modules/formats/json/pom.xml| 2 +- modules/formats/pom.xml | 2 +- modules/formats/yaml/pom.xml| 2 +- modules/functions/pom.xml | 2 +- modules/injection/cdi/pom.xml | 2 +- modules/injection/injection-api/pom.xml | 2 +- modules/injection/pom.xml | 2 +- modules/injection/standalone/pom.xml| 2 +- modules/jndi/pom.xml| 2 +- modules/mutable-config/pom.xml | 2 +- modules/optional/pom.xml| 2 +- modules/pom.xml | 2 +- modules/resolver/pom.xml| 2 +- modules/resources/pom.xml | 2 +- modules/spi-support/pom.xml | 2 +- modules/spring/pom.xml | 2 +- pom.xml | 2 +- 27 files changed, 30 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/70edbf97/distribution/pom.xml -- diff --git a/distribution/pom.xml b/distribution/pom.xml index a28bf93..61ecda0 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.tamaya.ext tamaya-extensions-all -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT .. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/70edbf97/examples/01-resources-example/pom.xml -- diff --git a/examples/01-resources-example/pom.xml b/examples/01-resources-example/pom.xml index f71d542..e8a269c 100644 --- a/examples/01-resources-example/pom.xml +++ b/examples/01-resources-example/pom.xml @@ -25,11 +25,11 @@ under the License. org.apache.tamaya.ext.examples examples -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT 01-resources-example -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT Apache Tamaya Resource Location Example This project contains a simple example using the resource location module. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/70edbf97/examples/02-resolver-example/pom.xml -- diff --git a/examples/02-resolver-example/pom.xml b/examples/02-resolver-example/pom.xml index b2bb703..fd97227 100644 --- a/examples/02-resolver-example/pom.xml +++ b/examples/02-resolver-example/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.tamaya.ext.examples examples -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT 02-resolver-example http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/70edbf97/examples/03-injection-example/pom.xml -- diff --git a/examples/03-injection-example/pom.xml b/examples/03-injection-example/pom.xml index 0fba95d..d647359 100644 --- a/examples/03-injection-example/pom.xml +++ b/examples/03-injection-example/pom.xml @@ -25,11 +25,11 @@ under the License. org.apache.tamaya.ext.examples examples -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT 03-injection-example -0.3-incubating-SNAPSHOT +0.4-incubating-SNAPSHOT Apache Tamaya Configuration Injection Example This project contains a simple illustrating how configuration values can be injected. http://git-wi
[4/4] incubator-tamaya-sandbox git commit: TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT
TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/f30884f9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/f30884f9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/f30884f9 Branch: refs/heads/java8 Commit: f30884f9e0ec2902567fe4e823f6f87ac2c29f98 Parents: 1e2a184 Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:20:09 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:20:09 2017 +0200 -- management/pom.xml| 4 metamodel/pom.xml | 4 .../apache/tamaya/osgi/InjectionKarafTest.java| 18 +- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 12 ++-- pom.xml | 15 --- remote/pom.xml| 4 server/pom.xml| 1 - tamaya-sandbox.iml| 2 +- ui/pom.xml| 3 --- usagetracker/pom.xml | 4 validation/pom.xml| 4 vertx/pom.xml | 3 --- 12 files changed, 24 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f30884f9/management/pom.xml -- diff --git a/management/pom.xml b/management/pom.xml index 1ac279a..81f64c9 100644 --- a/management/pom.xml +++ b/management/pom.xml @@ -30,10 +30,6 @@ under the License. Apache Tamaya Modules - JMX Support jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f30884f9/metamodel/pom.xml -- diff --git a/metamodel/pom.xml b/metamodel/pom.xml index 1f8ae92..b462590 100644 --- a/metamodel/pom.xml +++ b/metamodel/pom.xml @@ -33,10 +33,6 @@ jar - -1.7 - - org.apache.tamaya http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f30884f9/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java -- diff --git a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java index 14e83ed..d8a2366 100644 --- a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java +++ b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java @@ -70,7 +70,7 @@ public class InjectionKarafTest { .artifactId("tamaya-osgi-features") .type("xml") .classifier("features") -.version("0.3-incubating-SNAPSHOT"); +.version("0.4-incubating-SNAPSHOT"); return options( KarafDistributionOption.karafDistributionConfiguration() .frameworkUrl(CoreOptions.maven() @@ -94,16 +94,16 @@ public class InjectionKarafTest { "src/test/resources/org.ops4j.pax.logging.cfg")), mavenBundle("org.apache.geronimo.specs", "geronimo-annotation_1.2_spec", "1.0-alpha-1"), -mavenBundle("org.apache.tamaya", "tamaya-api", "0.3-incubating-SNAPSHOT"), -mavenBundle("org.apache.tamaya", "tamaya-core", "0.3-incubating-SNAPSHOT"), -mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.3-incubating-SNAPSHOT"), -mavenBundle("org.apache.tamaya.ext", "tamaya-functions", "0.3-incubating-SNAPSHOT"), -mavenBundle("org.apache.tamaya.ext", "tamaya-osgi", "0.3-incubating-SNAPSHOT"), +mavenBundle("org.apache.tamaya", "tamaya-api", "0.4-incubating-SNAPSHOT"), +mavenBundle("org.apache.tamaya", "tamaya-core", "0.4-incubating-SNAPSHOT"), +mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.4-incubating-SNAPSHOT"), +mavenBundle("org.apache.tamaya.ext", "tama
[3/4] incubator-tamaya git commit: TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT
TAMAYA-274: Simplified compiler settings, set version to 0.4-incubating-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/c32b45f4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/c32b45f4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/c32b45f4 Branch: refs/heads/java8 Commit: c32b45f41e13ff15edaa87d3e87c954522b3de7b Parents: fd6184b Author: anatole <anat...@apache.org> Authored: Wed Aug 9 00:22:29 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Wed Aug 9 00:22:29 2017 +0200 -- examples/11-distributed/pom.xml | 5 ++--- pom.xml | 11 +-- 2 files changed, 7 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c32b45f4/examples/11-distributed/pom.xml -- diff --git a/examples/11-distributed/pom.xml b/examples/11-distributed/pom.xml index 72e5ac1..0f0bfe9 100644 --- a/examples/11-distributed/pom.xml +++ b/examples/11-distributed/pom.xml @@ -31,9 +31,8 @@ jar -1.8 -${jdkVersion} -${jdkVersion} +1.8 +1.8 false true 0.3-incubating-SNAPSHOT http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c32b45f4/pom.xml -- diff --git a/pom.xml b/pom.xml index 337cb3b..8f79347 100644 --- a/pom.xml +++ b/pom.xml @@ -39,11 +39,10 @@ 2.5 false -1.8 5.0.0 ${osgi.version} -${jdkVersion} -${jdkVersion} +1.8 +1.8 false true false @@ -417,9 +416,9 @@ 3.6.0 true -${maven.compile.optimize} ${maven.compile.sourceLevel} ${maven.compile.targetLevel} +${maven.compile.optimize} ${project.build.sourceEncoding} ${maven.compile.deprecation} @@ -716,8 +715,8 @@ org.apache.maven.plugins maven-compiler-plugin -1.7 -1.7 +${maven.compile.sourceLevel} +${maven.compile.targetLevel}
incubator-tamaya-sandbox git commit: TAMAYA-260: Now implementing official MP config 1.0 release.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 e52a5a3ac -> b04b841bf TAMAYA-260: Now implementing official MP config 1.0 release. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/b04b841b Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/b04b841b Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/b04b841b Branch: refs/heads/java8 Commit: b04b841bfe84d3c4d0a9b8a5ff6833ed954b9cd5 Parents: e52a5a3 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 09:12:48 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 09:12:48 2017 +0200 -- microprofile/pom.xml| 65 +--- .../microprofile/MicroprofileAdapter.java | 38 +++-- .../microprofile/MicroprofileConfigBuilder.java | 11 ++ .../org/eclipse/microprofile/config/Config.java | 126 -- .../microprofile/config/ConfigProvider.java | 102 .../config/inject/ConfigProperty.java | 112 - .../config/inject/package-info.java | 40 - .../microprofile/config/package-info.java | 75 - .../microprofile/config/spi/ConfigBuilder.java | 83 -- .../config/spi/ConfigProviderResolver.java | 164 --- .../microprofile/config/spi/ConfigSource.java | 107 .../config/spi/ConfigSourceProvider.java| 58 --- .../microprofile/config/spi/Converter.java | 77 - .../microprofile/config/spi/package-info.java | 30 microprofile/src/test/resources/tck-suite.xml | 29 15 files changed, 102 insertions(+), 1015 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b04b841b/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index 1b5d808..123f7b8 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -38,24 +38,6 @@ under the License. 1.0 - - - -org.apache.maven.plugins -maven-compiler-plugin - -true -${maven.compile.optimize} -${maven.compile.sourceLevel} -${maven.compile.targetLevel} -${project.build.sourceEncoding} - ${maven.compile.deprecation} - - - - - - junit @@ -98,11 +80,48 @@ under the License. provided true - - - - - + +org.eclipse.microprofile.config +microprofile-config-api +1.0 + + +org.eclipse.microprofile.config +microprofile-config-tck +1.0 +test + + +org.testng +testng +6.9.9 +test + + + +tck + + +runTCK + + + + + +org.apache.maven.plugins +maven-surefire-plugin +2.19.1 + + +tck-suite.xml + + + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b04b841b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java index 29f563c..20d5af0 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java @@ -42,9 +42,9 @@ public final class MicroprofileAdapter{ private MicroprofileAdapter(){} /** - * Converts a Tamaya {@link Configuration} into a Microprofile.io {@Config}. + * Converts a Tamaya {@link Configuration} into a Microprofile.io {@link Config}. * @param config the Tamaya {@link Configuration} instance, not null. - * @return the corresponding Microprofile.io {@Config} instance, never null. + * @return the corresponding Microprofile.io {@link Config} instan
incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed basic TCK integration.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 b04b841bf -> a3e01813f TAMAYA-260: Fixed basic TCK integration. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/a3e01813 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/a3e01813 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/a3e01813 Branch: refs/heads/java8 Commit: a3e01813fdd47205ee5bd12353f94358ba633bae Parents: b04b841 Author: anatole <anat...@apache.org> Authored: Tue Aug 8 09:22:16 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Aug 8 09:22:16 2017 +0200 -- microprofile/src/test/resources/tck-suite.xml | 29 -- microprofile/tck-suite.xml| 29 ++ 2 files changed, 29 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/a3e01813/microprofile/src/test/resources/tck-suite.xml -- diff --git a/microprofile/src/test/resources/tck-suite.xml b/microprofile/src/test/resources/tck-suite.xml deleted file mode 100644 index 7efa750..000 --- a/microprofile/src/test/resources/tck-suite.xml +++ /dev/null @@ -1,29 +0,0 @@ -http://testng.org/testng-1.0.dtd; > - - - - - - - - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/a3e01813/microprofile/tck-suite.xml -- diff --git a/microprofile/tck-suite.xml b/microprofile/tck-suite.xml new file mode 100644 index 000..7efa750 --- /dev/null +++ b/microprofile/tck-suite.xml @@ -0,0 +1,29 @@ +http://testng.org/testng-1.0.dtd; > + + + + + + + + + + + \ No newline at end of file
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-260: Added missing artifacts.
TAMAYA-260: Added missing artifacts. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/41305de4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/41305de4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/41305de4 Branch: refs/heads/java8 Commit: 41305de4381b34b7f9d664ce10812d767cd3977d Parents: c9676a8 Author: anatole <anat...@apache.org> Authored: Thu Aug 10 01:00:03 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Thu Aug 10 01:00:03 2017 +0200 -- .../imported/CdiOptionalInjectionTest.java | 71 .../imported/base/AbstractTest.java | 42 .../src/test/resources/sampleconfig.yaml| 18 + 3 files changed, 131 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/41305de4/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java -- diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java new file mode 100644 index 000..ee6d158 --- /dev/null +++ b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * Licensed 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.microprofile.imported; + +import org.eclipse.microprofile.config.tck.OptionalValuesBean; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.testng.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.testng.Assert; +import org.testng.annotations.Test; + +import javax.inject.Inject; + +/** + * Verify injection of {@code Optional} fields. + * + * @author mailto:strub...@apache.org;>Mark Struberg + */ +public class CdiOptionalInjectionTest extends Arquillian{ + +private @Inject OptionalValuesBean optionalValuesBean; + +@Deployment +public static WebArchive deploy() { +JavaArchive testJar = ShrinkWrap +.create(JavaArchive.class, "cdiOptionalInjectionTest.jar") + .addClasses(org.eclipse.microprofile.config.tck.CdiOptionalInjectionTest.class, OptionalValuesBean.class) +.addAsManifestResource(new StringAsset("my.optional.int.property=1234\nmy.optional.string.property=hello"), +"microprofile-config.properties") +.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") +.as(JavaArchive.class); + +WebArchive war = ShrinkWrap +.create(WebArchive.class, "cdiOptionalInjectionTest.war") +.addAsLibrary(testJar); +return war; +} + + +@Test +public void testOptionalInjection() { +Assert.assertTrue(optionalValuesBean.getIntProperty().isPresent()); +Assert.assertEquals(optionalValuesBean.getIntProperty().get(), Integer.valueOf(1234)); + + Assert.assertFalse(optionalValuesBean.getNotexistingProperty().isPresent()); + +Assert.assertTrue(optionalValuesBean.getStringValue().isPresent()); +Assert.assertEquals(optionalValuesBean.getStringValue().get(), "hello"); +} +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/41305de4/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/base/AbstractTest.java -- diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/base/AbstractTest.java b/microprofile/src/test/java/org/apache/tamaya/mi
[1/2] incubator-tamaya-extensions git commit: TAMAYA-274: Moved to Java 8.
Repository: incubator-tamaya-extensions Updated Branches: refs/heads/java8 [created] 5cb0e696e TAMAYA-274: Moved to Java 8. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/6fdd34c7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/6fdd34c7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/6fdd34c7 Branch: refs/heads/java8 Commit: 6fdd34c759fb9dae915438b9fc9a75f93d131d1e Parents: 46beb9a Author: anatole <anat...@apache.org> Authored: Mon Aug 7 17:34:25 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 7 17:34:25 2017 +0200 -- .../org/apache/tamaya/events/ConfigEventListener.java | 1 + .../java/org/apache/tamaya/functions/KeyMapper.java| 2 +- .../java/org/apache/tamaya/functions/Predicate.java| 13 ++--- .../org/apache/tamaya/functions/PropertyMatcher.java | 2 +- .../java/org/apache/tamaya/functions/Supplier.java | 10 ++ .../tamaya/mutableconfig/ChangePropagationPolicy.java | 1 + .../java/org/apache/tamaya/optional/ValueProvider.java | 1 + .../org/apache/tamaya/resource/ResourceLocator.java| 1 + .../spisupport/DefaultConfigurationContextBuilder.java | 3 ++- pom.xml| 2 +- 10 files changed, 13 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/6fdd34c7/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventListener.java -- diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventListener.java b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventListener.java index 7fb32c8..fd08191 100644 --- a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventListener.java +++ b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventListener.java @@ -21,6 +21,7 @@ package org.apache.tamaya.events; /** * Interface to be implemented for listening on changes on {@link org.apache.tamaya.Configuration} instances. */ +@FunctionalInterface public interface ConfigEventListener { /** * Called if an event occurred. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/6fdd34c7/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java -- diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java b/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java index 2666c1b..bf6e6d3 100644 --- a/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java +++ b/modules/functions/src/main/java/org/apache/tamaya/functions/KeyMapper.java @@ -23,7 +23,7 @@ package org.apache.tamaya.functions; * if mapped to null). * */ -//@FunctionalInterface +@FunctionalInterface public interface KeyMapper { /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/6fdd34c7/modules/functions/src/main/java/org/apache/tamaya/functions/Predicate.java -- diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/Predicate.java b/modules/functions/src/main/java/org/apache/tamaya/functions/Predicate.java index 3061746..5c8869e 100644 --- a/modules/functions/src/main/java/org/apache/tamaya/functions/Predicate.java +++ b/modules/functions/src/main/java/org/apache/tamaya/functions/Predicate.java @@ -26,17 +26,8 @@ package org.apache.tamaya.functions; * * @param the type of the input to the predicate */ -//@FunctionalInterface -public interface Predicate { - -/** - * Evaluates this predicate on the given argument. - * - * @param t the input argument - * @return {@code true} if the input argument matches the predicate, - * otherwise {@code false} - */ -boolean test(T t); +@FunctionalInterface +public interface Predicate extends java.util.function.Predicate{ } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/6fdd34c7/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java -- diff --git a/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java index 45d44ee..cfb207e 100644 --- a/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java +++ b/modules/functions/src/main/java/org/apache/tamaya/functions/PropertyMatcher.java @@ -22,7 +22,
[2/2] incubator-tamaya-extensions git commit: TAMAYA-274: Moved to Java 8, fixed Javadoc issues.
TAMAYA-274: Moved to Java 8, fixed Javadoc issues. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/5cb0e696 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/5cb0e696 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/5cb0e696 Branch: refs/heads/java8 Commit: 5cb0e696ef63607f28600e129c8574293e7e1421 Parents: 6fdd34c Author: anatole <anat...@apache.org> Authored: Mon Aug 7 17:51:55 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 7 17:51:55 2017 +0200 -- .../apache/tamaya/events/FrozenConfiguration.java| 2 +- .../java/org/apache/tamaya/inject/api/Config.java| 15 --- .../apache/tamaya/inject/spi/BaseDynamicValue.java | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/5cb0e696/modules/events/src/main/java/org/apache/tamaya/events/FrozenConfiguration.java -- diff --git a/modules/events/src/main/java/org/apache/tamaya/events/FrozenConfiguration.java b/modules/events/src/main/java/org/apache/tamaya/events/FrozenConfiguration.java index 295a609..61e8abe 100644 --- a/modules/events/src/main/java/org/apache/tamaya/events/FrozenConfiguration.java +++ b/modules/events/src/main/java/org/apache/tamaya/events/FrozenConfiguration.java @@ -209,7 +209,7 @@ public final class FrozenConfiguration implements Configuration, Serializable { * * The time is taken from {@linkplain System#currentTimeMillis()} * - * @see {@linkplain System#currentTimeMillis()} + * @see System#currentTimeMillis() * @return the moment in time when this configruration has been created */ public long getFrozenAt() { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/5cb0e696/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java -- diff --git a/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java b/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java index 6ce55ed..67a3bfc 100644 --- a/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java +++ b/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/api/Config.java @@ -34,15 +34,12 @@ import java.lang.annotation.Target; * Simplest variant * Below the most simple variant of a configured class is given: * - * {@code * package a.b; * * public class ConfiguredItem { - * - * @Config + * Config * private String aValue; * } - * } * * Configuration resolution is implemented as follows: * @@ -57,14 +54,12 @@ import java.lang.annotation.Target; * Explicit annotations * In the next example we explicitly define the configuration keys to be used: * - * {@code - * @ConfigDefaultSections("section1") + * ConfigDefaultSections("section1") * public class ConfiguredItem { * - * @Config(value = {"b", "[a.b.deprecated.keys]", "a"}, defaultValue = "myDefaultValue") + * Config(value = {"b", "[a.b.deprecated.keys]", "a"}, defaultValue = "myDefaultValue") * private String aValue; * } - * } * * * Within this example we evaluate multiple possible keys: {@code section1.b, a.b.deprecated.keys, section1.a}. @@ -76,15 +71,13 @@ import java.lang.annotation.Target; * In the last example we explicitly define the configuration keys but omit the section part, letting the default * section names to be taken: * - * {@code * package a.b; * * public class ConfiguredItem { * - * @Config(value = {"b", "[a.b.deprecated.keys]", "a"}, defaultValue = "myDefaultValue") + * Config(value = {"b", "[a.b.deprecated.keys]", "a"}, defaultValue = "myDefaultValue") * private String aValue; * } - * } * * * Key resolution is similar to above, but now the default package names are used, resulting in http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/5cb0e696/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/spi/BaseDynamicValue.java -- diff --git a/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/spi/BaseDynamicValue.java b/modules/injection/injection-api/src/main/java/org/apache/tamaya/inject/spi/BaseDynamicValue.java index f9e2079..a23a85c
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-145: Fxed conversion issue and invalid config syntax.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 [created] 31b9c0e1d TAMAYA-145: Fxed conversion issue and invalid config syntax. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/1fec344c Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/1fec344c Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/1fec344c Branch: refs/heads/java8 Commit: 1fec344c1bf98eb8accea00fbb0c51968bb47685 Parents: 9731be7 Author: anatole <anat...@apache.org> Authored: Mon May 1 22:50:40 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon May 1 22:50:40 2017 +0200 -- .../apache/tamaya/metamodel/internal/ComponentConfigurator.java | 4 metamodel/src/test/resources/IntegrationTests/context-test.xml | 2 +- metamodel/src/test/resources/tamaya-config.xml | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1fec344c/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentConfigurator.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentConfigurator.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentConfigurator.java index 6e7ea75..30463d4 100644 --- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentConfigurator.java +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/ComponentConfigurator.java @@ -176,6 +176,10 @@ public final class ComponentConfigurator { case "Number": return Float.valueOf(value); default: +if(Enum.class.isAssignableFrom(targetType)){ +Method m = targetType.getDeclaredMethod("valueOf", String.class); +return m.invoke(null, value); +} Constructor c = targetType.getConstructor(String.class); if (!Modifier.isPublic(c.getModifiers())) { LOG.fine("Setting constructor as accessible: " + targetType.getSimpleName() + "#(String)"); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1fec344c/metamodel/src/test/resources/IntegrationTests/context-test.xml -- diff --git a/metamodel/src/test/resources/IntegrationTests/context-test.xml b/metamodel/src/test/resources/IntegrationTests/context-test.xml index e1073f7..2b7ffb4 100644 --- a/metamodel/src/test/resources/IntegrationTests/context-test.xml +++ b/metamodel/src/test/resources/IntegrationTests/context-test.xml @@ -22,7 +22,7 @@ ${properties:system:STAGE?default=DEV} ${properties:system:configdir?default=.} ${properties:system:APP?default=NONE} -${java:org.apache.tamaya.metamodel.MetaContext#id()} +${java:java.util.UUID.randomUUID()} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/1fec344c/metamodel/src/test/resources/tamaya-config.xml -- diff --git a/metamodel/src/test/resources/tamaya-config.xml b/metamodel/src/test/resources/tamaya-config.xml index bdb3269..d372249 100644 --- a/metamodel/src/test/resources/tamaya-config.xml +++ b/metamodel/src/test/resources/tamaya-config.xml @@ -64,7 +64,7 @@ - + @@ -74,7 +74,7 @@ "METACONTEXT: " + MetaContext.getInstance().getProperties() -"CONFIG : " + Configuration.getInstance().getProperties() +"CONFIG : " + config
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-145: Added meta logging feature.
TAMAYA-145: Added meta logging feature. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/31b9c0e1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/31b9c0e1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/31b9c0e1 Branch: refs/heads/java8 Commit: 31b9c0e1db95143e67dc945f25694f676d8cb00c Parents: 1fec344 Author: anatole <anat...@apache.org> Authored: Mon Aug 7 17:33:38 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 7 17:33:38 2017 +0200 -- .../internal/resolver/LoggingReader.java| 79 ...tamaya.metamodel.spi.MetaConfigurationReader | 19 + 2 files changed, 98 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/31b9c0e1/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java -- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java new file mode 100644 index 000..c0d67bc --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/internal/resolver/LoggingReader.java @@ -0,0 +1,79 @@ +/* + * 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.metamodel.internal.resolver; + +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.metamodel.MetaContext; +import org.apache.tamaya.metamodel.spi.MetaConfigurationReader; +import org.apache.tamaya.spi.ConfigurationContext; +import org.apache.tamaya.spi.ConfigurationContextBuilder; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.util.HashMap; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +/** + * Created by atsticks on 01.05.17. + */ +public class LoggingReader implements MetaConfigurationReader{ + +private static final JavaResolver resolver = new JavaResolver(); + +@Override +public void read(final Document document, ConfigurationContextBuilder contextBuilder) { +new Timer(true).schedule(new TimerTask() { +@Override +public void run() { +Map<String, Object> meta = new HashMap<>(); +meta.put("context", ConfigurationProvider.getConfiguration().getContext()); +meta.put("config", ConfigurationProvider.getConfiguration()); +NodeList nodeList = document.getDocumentElement().getElementsByTagName("context"); +for(int i=0;i<nodeList.getLength();i++){ +Node node = nodeList.item(i); +if(node.getNodeName().equals("log")){ +String expression = node.getTextContent(); +BufferedReader reader = new BufferedReader(new StringReader(expression)); +String line = null; +try { +line = reader.readLine(); +while(line!=null){ +Object res = resolver.evaluate(line); +if(res!=null) { +System.out.println(res); +} +line = reader.readLine(); +} +} catch (IOException e) { +e.printStackTrace(); +} +} +} +} +}, 1L); +} + +} http://git-wip-us.apache.org/repos/as
[incubator-tamaya] Git Push Summary
Repository: incubator-tamaya Updated Branches: refs/heads/java8 [created] 0402fd349
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-256: Added missing config file.
TAMAYA-256: Added missing config file. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/e52a5a3a Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/e52a5a3a Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/e52a5a3a Branch: refs/heads/java8 Commit: e52a5a3ac66d585e8b9dec7b4112b53ead367a89 Parents: 2eb290d Author: anatole <anat...@apache.org> Authored: Mon Aug 7 18:03:36 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 7 18:03:36 2017 +0200 -- .../META-INF/javaconfiguration.properties| 19 +++ 1 file changed, 19 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e52a5a3a/vertx/src/test/resources/META-INF/javaconfiguration.properties -- diff --git a/vertx/src/test/resources/META-INF/javaconfiguration.properties b/vertx/src/test/resources/META-INF/javaconfiguration.properties new file mode 100644 index 000..fbe9178 --- /dev/null +++ b/vertx/src/test/resources/META-INF/javaconfiguration.properties @@ -0,0 +1,19 @@ +# +# 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 current 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. +# +message=Good Bye from Apache Tamaya! \ No newline at end of file
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-274: Moved to Java 8, fixed Javadoc issues.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 31b9c0e1d -> e52a5a3ac TAMAYA-274: Moved to Java 8, fixed Javadoc issues. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/2eb290de Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/2eb290de Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/2eb290de Branch: refs/heads/java8 Commit: 2eb290dec00b49e5fab1a35965a62397caa1ce3f Parents: 31b9c0e Author: anatole <anat...@apache.org> Authored: Mon Aug 7 17:58:46 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Aug 7 17:58:46 2017 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/2eb290de/pom.xml -- diff --git a/pom.xml b/pom.xml index a788354..afc8a0e 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ under the License. 3.0-incubating-SNAPSHOT 2.5 false -1.7 +1.8 5.0.0 ${osgi.version} ${jdkVersion}
incubator-tamaya-sandbox git commit: TAMAYA-145: Using beanshell for expression evaluation.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 855230b79 -> 9731be7d5 TAMAYA-145: Using beanshell for expression evaluation. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/9731be7d Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/9731be7d Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/9731be7d Branch: refs/heads/master Commit: 9731be7d5cd6192ab4337da53c741601f7132362 Parents: 855230b Author: anatole <anat...@apache.org> Authored: Mon May 1 22:23:11 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon May 1 22:23:29 2017 +0200 -- metamodel/pom.xml | 5 + .../tamaya/metamodel/EnabledPropertySource.java | 23 +--- .../internal/resolver/JavaResolver.java | 124 --- .../internal/resolver/JavaResolverTest.java | 52 +--- metamodel/src/test/resources/tamaya-config.xml | 13 +- 5 files changed, 132 insertions(+), 85 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9731be7d/metamodel/pom.xml -- diff --git a/metamodel/pom.xml b/metamodel/pom.xml index 0cfc48d..bfffea8 100644 --- a/metamodel/pom.xml +++ b/metamodel/pom.xml @@ -78,6 +78,11 @@ provided true + +org.apache-extras.beanshell +bsh +2.0b6 + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9731be7d/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java index 7e04499..2dcf101 100644 --- a/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java +++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/EnabledPropertySource.java @@ -18,6 +18,7 @@ */ package org.apache.tamaya.metamodel; +import org.apache.tamaya.metamodel.internal.resolver.JavaResolver; import org.apache.tamaya.spi.PropertySource; import org.apache.tamaya.spi.PropertyValue; import org.apache.tamaya.spisupport.PropertySourceComparator; @@ -42,6 +43,7 @@ public final class EnabledPropertySource private String enabledExpression; private PropertySource wrapped; private boolean enabled; +private static final JavaResolver resolver = new JavaResolver(); public EnabledPropertySource(PropertySource wrapped, Map<String,String> context, String expression) { this.enabledExpression = Objects.requireNonNull(expression); @@ -51,25 +53,8 @@ public final class EnabledPropertySource protected boolean calculateEnabled(Map<String, String> context) { try { -ScriptEngineManager manager = new ScriptEngineManager(); -ScriptEngine engine = manager.getEngineByName("nashorn"); -if(engine==null){ -engine = manager.getEngineByName("rhino"); -} -// init script engine -for(Map.Entry<String,String> entry: context.entrySet()) { -engine.put(entry.getKey(), entry.getValue()); -} -Object o = engine.eval(enabledExpression); -if(!(o instanceof Boolean)){ -LOG.severe("Enabled expression must evaluate to Boolean: '" -+enabledExpression+"', but was " + o + -", property source will be disabled: " + -wrapped.getName()); -return false; -} -return (Boolean)o; -} catch (ScriptException e) { +return Boolean.TRUE.equals(resolver.evaluate(enabledExpression, context)); +} catch (Exception e) { LOG.severe("Invalid Boolean expression: '" +enabledExpression+"': " + e + ", property source will be disabled: " + wrapped.getName()); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/9731be7d/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java -- diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/resolver/JavaResolver.java index 22d8618..2739da9 10064
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-274: Implemented OSGI integration, tested in Karaf (using Karaf shell custom commands).
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 c345b5c2c -> 920538603 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java -- diff --git a/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java new file mode 100644 index 000..fc42c54 --- /dev/null +++ b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java @@ -0,0 +1,59 @@ +/* + * 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.karaf.shell; + +import org.apache.karaf.shell.api.action.Action; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; + +import java.io.IOException; + +@Command(scope = "tamaya", name = "propertysource", description="Show the current Tamaya entries of a propertysource.") +@Service +public class PropertySourceCommand implements Action{ + +@Argument(index = 0, name = "propertysource", description = "The target property source id.", +required = false, multiValued = false) +String propertysource = null; + +public Object execute() throws IOException { +Configuration config = ConfigurationProvider.getConfiguration(); +if(propertysource!=null){ +PropertySource ps = config.getContext().getPropertySource(propertysource); +if(ps==null){ +System.out.println("No such propertysource: " + propertysource); +}else { +System.out.println("ID: " + ps.getName()); +System.out.println("Ordinal: " + ps.getOrdinal()); +System.out.println("Class: " + ps.getClass().getName()); +System.out.println("Properties:"); +for(PropertyValue pv:ps.getProperties().values()) { +System.out.println(pv); +} +} +} +return null; +} + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java -- diff --git a/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java new file mode 100644 index 000..74c5985 --- /dev/null +++ b/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java @@ -0,0 +1,48 @@ +/* + * 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.karaf.shell; + +import org.apache.karaf.shell.api.action.Action; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.apache.tamaya.Configuration; +import
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-274: Implemented OSGI integration, tested in Karaf (using Karaf shell custom commands).
TAMAYA-274: Implemented OSGI integration, tested in Karaf (using Karaf shell custom commands). Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/92053860 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/92053860 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/92053860 Branch: refs/heads/java8 Commit: 920538603ef43802b16f60eb8ef41b55b96e6c15 Parents: c345b5c Author: anatole <anat...@apache.org> Authored: Mon Sep 18 17:15:43 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Mon Sep 18 17:15:43 2017 +0200 -- osgi/common/bnd.bnd | 7 +- osgi/common/pom.xml | 6 +- .../java/org/apache/tamaya/osgi/Activator.java | 49 +-- .../tamaya/osgi/DefaultOSGIConfigMapper.java| 45 +++ .../apache/tamaya/osgi/OSGIConfigMapper.java| 38 +++ .../tamaya/osgi/OSGIConfigRootMapper.java | 36 --- .../tamaya/osgi/TamayaConfigAdminImpl.java | 170 --- .../apache/tamaya/osgi/TamayaConfigPlugin.java | 295 +++ .../tamaya/osgi/TamayaOSGIConfiguration.java| 139 - .../apache/tamaya/osgi/attic/ConfigPrinter.java | 115 .../tamaya/osgi/attic/ConfigPrinterService.java | 28 ++ .../osgi/attic/TamayaConfigAdminImpl.java | 167 +++ .../osgi/attic/TamayaOSGIConfiguration.java | 139 + .../tamaya/osgi/TamayaConfigAdminImplTest.java | 75 - osgi/karaf-features/pom.xml | 60 +--- osgi/karaf-shell/bnd.bnd| 37 +++ osgi/karaf-shell/pom.xml| 71 + .../tamaya/karaf/shell/ConfigCommand.java | 50 .../karaf/shell/DefaultDisableCommand.java | 68 + .../karaf/shell/EvaluateCMConfigCommand.java| 63 .../tamaya/karaf/shell/GetPolicyCommand.java| 42 +++ .../apache/tamaya/karaf/shell/InfoCommand.java | 46 +++ .../tamaya/karaf/shell/PropertyCommand.java | 75 + .../karaf/shell/PropertySourceCommand.java | 59 .../karaf/shell/PropertySourcesCommand.java | 48 +++ .../tamaya/karaf/shell/SetPolicyCommand.java| 68 + .../org/apache/tamaya/karaf/shell/commands | 27 ++ osgi/pom.xml| 115 +--- 28 files changed, 1538 insertions(+), 600 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/common/bnd.bnd -- diff --git a/osgi/common/bnd.bnd b/osgi/common/bnd.bnd index 56e697f..22c802c 100644 --- a/osgi/common/bnd.bnd +++ b/osgi/common/bnd.bnd @@ -10,9 +10,9 @@ javac.source: 1.8 javac.target: 1.8 Bundle-Version: ${version}.${tstamp} -Bundle-Name: Apache Tamaya - OSGI ConfigAdmin +Bundle-Name: Apache Tamaya - OSGI ConfigurationPlugin Bundle-SymbolicName: org.apache.tamaya.osgi -Bundle-Description: Apacha Tamaya Configuration - OSGI ConfigAdmin +Bundle-Description: Apacha Tamaya Configuration - OSGI ConfigurationPlugin Bundle-Category: Implementation Bundle-Copyright: (C) Apache Foundation Bundle-License: Apache Licence version 2 @@ -29,4 +29,5 @@ Import-Package: \ org.apache.tamaya.spi,\ org.apache.tamaya.functions,\ org.apache.tamaya.spisupport -Export-Service: org.osgi.service.cm.ConfigurationAdmin +Export-Service: org.osgi.service.cm.ConfigurationPlugin,\ +org.apache.tamaya.osgi.TamayaConfigPlugin http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/common/pom.xml -- diff --git a/osgi/common/pom.xml b/osgi/common/pom.xml index e0a5411..9455104 100644 --- a/osgi/common/pom.xml +++ b/osgi/common/pom.xml @@ -29,14 +29,14 @@ tamaya-osgi_alpha jar -Apache Tamaya :: OSGi Integration :: ConfigAdmin -Tamaya Based OSGI Implementation of ConfigAdmin and Config Injection +Apache Tamaya :: OSGi Integration :: ConfigurationPlugin +Tamaya Based OSGI ConfigurationPlugin Implementation org.osgi org.osgi.core -test +provided org.osgi http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/92053860/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java -- diff --git a/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java b/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java index 83e1acf..d6c5726 100644 --- a/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java +++ b/osgi/common/src/main/java/org/apache
incubator-tamaya git commit: TAMAYA-274: Fixed basic service loading in OSGI. Added missing requirements.
Repository: incubator-tamaya Updated Branches: refs/heads/java8 23123bb72 -> 6010c606c TAMAYA-274: Fixed basic service loading in OSGI. Added missing requirements. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/6010c606 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/6010c606 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/6010c606 Branch: refs/heads/java8 Commit: 6010c606cdccd0121c064b7ba6a32a7ed71c9ab5 Parents: 23123bb Author: anatole <anat...@apache.org> Authored: Sun Sep 17 01:51:20 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sun Sep 17 01:51:20 2017 +0200 -- .../tamaya/core/internal/OSGIServiceLoader.java | 96 +--- .../examples/minimal/TestConfigProvider.java| 49 ++ 2 files changed, 110 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6010c606/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java -- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java b/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java index 4c12df9..0854b0d 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java @@ -48,6 +48,13 @@ public class OSGIServiceLoader implements BundleListener { public OSGIServiceLoader(BundleContext context){ this.context = Objects.requireNonNull(context); +// Check for matching bundles already installed... +for(Bundle bundle:context.getBundles()){ +switch(bundle.getState()){ +case Bundle.ACTIVE: +checkAndLoadBundle(bundle); +} +} } public BundleContext getBundleContext(){ @@ -62,38 +69,46 @@ public class OSGIServiceLoader implements BundleListener { @Override public void bundleChanged(BundleEvent bundleEvent) { -// Parse and create metadata on STARTING -if (bundleEvent.getType() == BundleEvent.STARTING) { +// Parse and create metadata when installed +if (bundleEvent.getType() == BundleEvent.STARTED) { Bundle bundle = bundleEvent.getBundle(); -if (bundle.getEntry(META_INF_SERVICES) == null) { -return; -} -synchronized (resourceBundles){ -resourceBundles.add(bundle); -log.info("Registered ServiceLoader bundle: " + bundle.getSymbolicName()); -} -Enumeration entryPaths = bundle.getEntryPaths("META-INF/services/"); -while (entryPaths.hasMoreElements()) { -String entryPath = entryPaths.nextElement(); -if(!entryPath.endsWith("/")) { -processEntryPath(bundle, entryPath); -} -} -} else if (bundleEvent.getType() == BundleEvent.STOPPING) { +checkAndLoadBundle(bundle); +} else if (bundleEvent.getType() == BundleEvent.STOPPED) { Bundle bundle = bundleEvent.getBundle(); -if (bundle.getEntry(META_INF_SERVICES) == null) { -return; -} -synchronized (resourceBundles) { -resourceBundles.remove(bundle); -log.finest("Unregistered ServiceLoader bundle: " + bundle.getSymbolicName()); +checkAndUnloadBundle(bundle); +} +} + +private void checkAndUnloadBundle(Bundle bundle) { +if (bundle.getEntry(META_INF_SERVICES) == null) { +return; +} +synchronized (resourceBundles) { +resourceBundles.remove(bundle); +log.fine("Unregistered ServiceLoader bundle: " + bundle.getSymbolicName()); +} +Enumeration entryPaths = bundle.getEntryPaths("META-INF/services/"); +while (entryPaths.hasMoreElements()) { +String entryPath = entryPaths.nextElement(); +if(!entryPath.endsWith("/")) { +removeEntryPath(bundle, entryPath); } -Enumeration entryPaths = bundle.getEntryPaths("META-INF/services/"); -while (entryPaths.hasMoreElements()) { -String entryPath = entryPaths.nextElement(); -if(!entryPath.endsWith("/")) { -removeEntryPath(bundle, entryPath); -} +} +} + +private void checkAndLoadBundle(Bundle bundle) { +if (bundle.getE
incubator-tamaya-sandbox git commit: TAMAYA-274: Fixed basic service loading in OSGI. Added missing requirements.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 5925c34d9 -> c345b5c2c TAMAYA-274: Fixed basic service loading in OSGI. Added missing requirements. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/c345b5c2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/c345b5c2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/c345b5c2 Branch: refs/heads/java8 Commit: c345b5c2c0c8541c13930585392c7e7c59be012f Parents: 5925c34 Author: anatole <anat...@apache.org> Authored: Sun Sep 17 01:51:20 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sun Sep 17 01:51:20 2017 +0200 -- consul/bnd.bnd | 4 +++- etcd/bnd.bnd | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c345b5c2/consul/bnd.bnd -- diff --git a/consul/bnd.bnd b/consul/bnd.bnd index 8c328f7..bb6123a 100644 --- a/consul/bnd.bnd +++ b/consul/bnd.bnd @@ -23,7 +23,9 @@ Export-Package: \ org.apache.tamaya.consul Import-Package: \ org.apache.tamaya,\ -org.apache.tamaya.spi +org.apache.tamaya.spi,\ +org.apache.tamaya.mutableconfig,\ +org.apache.tamaya.mutableconfig.spi Export-Service: \ org.apache.tamaya.spi.PropertySource \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c345b5c2/etcd/bnd.bnd -- diff --git a/etcd/bnd.bnd b/etcd/bnd.bnd index 792c69c..027e033 100644 --- a/etcd/bnd.bnd +++ b/etcd/bnd.bnd @@ -23,7 +23,9 @@ Export-Package: \ org.apache.tamaya.etcd Import-Package: \ org.apache.tamaya,\ -org.apache.tamaya.spi +org.apache.tamaya.spi,\ +org.apache.tamaya.mutableconfig\ +org.apache.tamaya.mutableconfig.spi Export-Service: \ org.apache.tamaya.spi.PropertySource \ No newline at end of file
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-297: Added OSGI Config trigger for Tamaya changes.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 54ff0e6f0 -> 99ce49ed3 TAMAYA-297: Added OSGI Config trigger for Tamaya changes. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/78554829 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/78554829 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/78554829 Branch: refs/heads/java8 Commit: 7855482984c81a11ecf40f2ee63a7c82c603e0c0 Parents: 54ff0e6 Author: anatole <anat...@apache.org> Authored: Tue Sep 19 21:00:32 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Sep 19 21:00:32 2017 +0200 -- osgi/common/bnd.bnd | 2 +- .../org/apache/tamaya/osgi/ConfigChanger.java | 20 ++- .../org/apache/tamaya/osgi/ConfigHistory.java | 39 - .../org/apache/tamaya/osgi/InitialState.java| 89 .../apache/tamaya/osgi/TamayaConfigPlugin.java | 29 +++- osgi/updater/bnd.bnd| 34 + osgi/updater/pom.xml| 145 +++ .../apache/tamaya/osgi/updater/Activator.java | 59 .../tamaya/osgi/updater/EventListener.java | 79 ++ 9 files changed, 481 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/78554829/osgi/common/bnd.bnd -- diff --git a/osgi/common/bnd.bnd b/osgi/common/bnd.bnd index 22c802c..51175cb 100644 --- a/osgi/common/bnd.bnd +++ b/osgi/common/bnd.bnd @@ -19,7 +19,7 @@ Bundle-License: Apache Licence version 2 Bundle-Vendor: Apache Software Foundation Bundle-ContactAddress: dev-tam...@incubator.apache.org Bundle-DocURL: http://tamaya.apache.org -Bundle-Activator: org.apache.tamaya.osgi.Activator +Bundle-Activator: org.apache.tamaya.osgi.updater.Activator Export-Package: \ org.apache.tamaya.osgi Import-Package: \ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/78554829/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java -- diff --git a/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java b/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java index 29c4720..1d48fad 100644 --- a/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java +++ b/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java @@ -55,12 +55,18 @@ final class ConfigChanger { public void configure(String pid, Bundle bundle, OperationMode defaultOpMode) { OperationMode opMode = Objects.requireNonNull(defaultOpMode); -String opVal = bundle.getHeaders().get("Tamaya-OperationMode"); -if(opVal!=null){ -opMode = OperationMode.valueOf(opVal.toUpperCase()); +if(bundle!=null) { +String opVal = bundle.getHeaders().get("Tamaya-OperationMode"); +if (opVal != null) { +opMode = OperationMode.valueOf(opVal.toUpperCase()); +} } LOG.finest("Evaluating Tamaya Config for PID: " + pid); -ConfigHistory.configuring(pid, "operationMode="+opMode); +if(bundle!=null) { +ConfigHistory.configuring(pid, "bundle=" + bundle.getSymbolicName() + ", bundle-id=" + bundle.getBundleId() + ", operationMode=" + opMode); +}else{ +ConfigHistory.configuring(pid, "trigger=Tamaya, operationMode=" + opMode); +} org.apache.tamaya.Configuration tamayaConfig = configMapper().getConfiguration(pid); if (tamayaConfig == null) { LOG.finest("No Tamaya configuration for PID: " + pid); @@ -68,11 +74,15 @@ final class ConfigChanger { } try { // TODO Check for Bundle.getLocation() usage here... -Configuration osgiConfig = cm.getConfiguration(pid, bundle.getLocation()); +Configuration osgiConfig = cm.getConfiguration(pid, bundle!=null?bundle.getLocation():null); if(osgiConfig!=null){ Dictionary<String, Object> dictionary = osgiConfig.getProperties(); if(dictionary==null){ dictionary = new Hashtable<>(); +}else{ +if(!InitialState.contains(pid)){ +InitialState.set(pid, dictionary); +} } modifyConfiguration(pid, tamayaConfig, dictionary, opMode); if(!dictionary.isEmpty()) { http://git-wip-us.apache.org
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-297: Added OSGI Config trigger for Tamaya changes.
TAMAYA-297: Added OSGI Config trigger for Tamaya changes. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/99ce49ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/99ce49ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/99ce49ed Branch: refs/heads/java8 Commit: 99ce49ed39e938e0d2fb019ef2f5a3270c2c7789 Parents: 7855482 Author: anatole <anat...@apache.org> Authored: Tue Sep 19 22:00:11 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Tue Sep 19 22:00:11 2017 +0200 -- osgi/common/bnd.bnd | 2 +- .../org/apache/tamaya/osgi/ConfigHistory.java | 62 + .../org/apache/tamaya/osgi/InitialState.java| 65 -- .../tamaya/karaf/shell/BackupCreateCommand.java | 68 ++ .../tamaya/karaf/shell/BackupDeleteCommand.java | 49 + .../tamaya/karaf/shell/BackupListCommand.java | 72 .../karaf/shell/HistorySizeGetCommand.java | 47 + .../karaf/shell/HistorySizeSetCommand.java | 56 +++ .../org/apache/tamaya/karaf/shell/commands | 5 ++ osgi/pom.xml| 1 + .../apache/tamaya/osgi/updater/Activator.java | 2 + 11 files changed, 379 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/99ce49ed/osgi/common/bnd.bnd -- diff --git a/osgi/common/bnd.bnd b/osgi/common/bnd.bnd index 51175cb..22c802c 100644 --- a/osgi/common/bnd.bnd +++ b/osgi/common/bnd.bnd @@ -19,7 +19,7 @@ Bundle-License: Apache Licence version 2 Bundle-Vendor: Apache Software Foundation Bundle-ContactAddress: dev-tam...@incubator.apache.org Bundle-DocURL: http://tamaya.apache.org -Bundle-Activator: org.apache.tamaya.osgi.updater.Activator +Bundle-Activator: org.apache.tamaya.osgi.Activator Export-Package: \ org.apache.tamaya.osgi Import-Package: \ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/99ce49ed/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java -- diff --git a/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java b/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java index 42ecca6..9a2e5a9 100644 --- a/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java +++ b/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java @@ -20,16 +20,19 @@ package org.apache.tamaya.osgi; import java.beans.XMLDecoder; import java.beans.XMLEncoder; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +import java.io.*; import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Class storing the history of changers done to the OSGI configuration by Tamaya. * This class can be used in the future to restore the previous state, if needed. */ -public final class ConfigHistory { +public final class ConfigHistory implements Serializable{ + +private static final long serialVersionUID = 1L; +private static final Logger LOG = Logger.getLogger(ConfigHistory.class.getName()); public enum TaskType{ PROPERTY, @@ -38,17 +41,7 @@ public final class ConfigHistory { } private static int maxHistory = 1; -private static List history = new LinkedList(){ - -@Override -public boolean add(ConfigHistory o) { -boolean val = super.add(o); -if(val && size() > maxHistory){ -remove(); -} -return val; -} -}; +private static List history = new LinkedList(); private long timestamp = System.currentTimeMillis(); @@ -68,6 +61,7 @@ public final class ConfigHistory { .setValue(info); synchronized (history){ history.add(h); +checkHistorySize(); } return h; } @@ -76,6 +70,7 @@ public final class ConfigHistory { .setValue(info); synchronized (history){ history.add(h); +checkHistorySize(); } return h; } @@ -86,6 +81,7 @@ public final class ConfigHistory { .setValue(value); synchronized (history){ history.add(h); +checkHistorySize(); } return h; } @@ -167,23 +163,29 @@ public final class ConfigHistory { } public static void save(TamayaConfigPlugin plugin){ -ByteArrayOutputStream bos = new ByteArrayOutputStream(); -
< 4 5 6 7 8 9 10 11 12 13 >