http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java ---------------------------------------------------------------------- diff --git a/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java b/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java new file mode 100644 index 0000000..3c91f12 --- /dev/null +++ b/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java @@ -0,0 +1,204 @@ +/* + * 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.base.services; + +import org.apache.tamaya.base.PriorityServiceComparator; +import org.apache.tamaya.spi.ServiceContext; + +import javax.annotation.Priority; +import java.io.IOException; +import java.net.URL; +import java.text.MessageFormat; +import java.util.*; +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. + */ +public final class DefaultServiceContext implements ServiceContext { + private static final Logger LOG = Logger.getLogger(DefaultServiceContext.class.getName()); + /** + * List current services loaded, per class. + */ + private final ConcurrentHashMap<Class<?>, List<Object>> servicesLoaded = new ConcurrentHashMap<>(); + /** + * Singletons. + */ + private final Map<Class<?>, Object> singletons = new ConcurrentHashMap<>(); + @SuppressWarnings("rawtypes") + private Map<Class, Class> factoryTypes = new ConcurrentHashMap<>(); + + @Override + public <T> T getService(Class<T> serviceType, ClassLoader cl) { + Object cached = singletons.get(serviceType); + if (cached == null) { + cached = create(serviceType); + if(cached!=null) { + singletons.put(serviceType, cached); + } + } + return serviceType.cast(cached); + } + + @Override + public <T> T create(Class<T> serviceType, ClassLoader cl) { + @SuppressWarnings("unchecked") + Class<? extends T> implType = factoryTypes.get(serviceType); + if(implType==null) { + Collection<T> services = getServices(serviceType); + if (services.isEmpty()) { + return null; + } else { + return getServiceWithHighestPriority(services, serviceType); + } + } + try { + return implType.newInstance(); + } catch (Exception e) { + LOG.log(Level.SEVERE, "Failed to create instance of " + implType.getName(), e); + return null; + } + } + + /** + * Loads and registers services. + * + * @param <T> the concrete type. + * @param serviceType The service type. + * @return the items found, never {@code null}. + */ + @Override + public <T> List<T> getServices(final Class<T> serviceType, ClassLoader cl) { + @SuppressWarnings("unchecked") + List<T> found = (List<T>) servicesLoaded.get(serviceType); + if (found != null) { + return found; + } + List<T> services = new ArrayList<>(); + try { + for (T t : ServiceLoader.load(serviceType)) { + services.add(t); + } + if(services.isEmpty()) { + for (T t : ServiceLoader.load(serviceType, serviceType.getClassLoader())) { + services.add(t); + } + } + Collections.sort(services, PriorityServiceComparator.getInstance()); + services = Collections.unmodifiableList(services); + } catch (ServiceConfigurationError e) { + LOG.log(Level.WARNING, + "Error loading services current type " + serviceType, e); + if(services==null){ + services = Collections.emptyList(); + } + } + @SuppressWarnings("unchecked") + final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>) services)); + return previousServices != null ? previousServices : services; + } + + /** + * Checks the given instance for a @Priority annotation. If present the annotation's value is evaluated. If no such + * annotation is present, a default priority of {@code 1} is returned. + * @param o the instance, not {@code null}. + * @return a priority, by default 1. + */ + public static int getPriority(Object o){ + int prio = 1; //X TODO discuss default priority + Priority priority = o.getClass().getAnnotation(Priority.class); + if (priority != null) { + prio = priority.value(); + } + return prio; + } + + /** + * @param services to scan + * @param <T> type of the service + * + * @return the service with the highest {@link Priority#value()} + * + * @throws IllegalStateException if there are multiple service implementations with the maximum priority + */ + private <T> T getServiceWithHighestPriority(Collection<T> services, Class<T> serviceType) { + T highestService = null; + // we do not need the priority stuff if the list contains only one element + if (services.size() == 1) { + highestService = services.iterator().next(); + this.factoryTypes.put(serviceType, highestService.getClass()); + return highestService; + } + + Integer highestPriority = null; + int highestPriorityServiceCount = 0; + + for (T service : services) { + int prio = getPriority(service); + if (highestPriority == null || highestPriority < prio) { + highestService = service; + highestPriorityServiceCount = 1; + highestPriority = prio; + } else if (highestPriority == prio) { + highestPriorityServiceCount++; + } + } + + if (highestPriorityServiceCount > 1) { + throw new IllegalStateException(MessageFormat.format("Found {0} implementations for Service {1} with Priority {2}: {3}", + highestPriorityServiceCount, + serviceType.getName(), + highestPriority, + services)); + } + this.factoryTypes.put(serviceType, highestService.getClass()); + return highestService; + } + + @Override + public int ordinal() { + return 1; + } + + @Override + public Enumeration<URL> 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); + } + +}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java ---------------------------------------------------------------------- diff --git a/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java b/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java new file mode 100644 index 0000000..f43cfa1 --- /dev/null +++ b/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java @@ -0,0 +1,75 @@ +/* + * 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.filter; + +import org.apache.tamaya.base.filter.FilterComparator; +import org.apache.tamaya.spi.ConfigValue; +import org.apache.tamaya.spi.Filter; +import org.junit.Test; + +import javax.annotation.Priority; + +import java.util.Comparator; + +import static org.assertj.core.api.Assertions.assertThat; + +public class FilterComparatorTest { + + @Test + public void comparationOfFiltersWithSamePriorityIsCorrect() { + Comparator<Filter> comparator = FilterComparator.getInstance(); + + int result = comparator.compare(new FilterA(), new FilterA()); + + assertThat(result).isEqualTo(0); + } + + @Test + public void comparationOfFiltersFirstHigherThenSecondWorksCorrectly() { + Comparator<Filter> comparator = FilterComparator.getInstance(); + + int result = comparator.compare(new FilterB(), new FilterA()); + + assertThat(result).isGreaterThan(0); + } + + @Test + public void comparationOfFiltersSecondHigherThenFirstWorksCorrectly() { + Comparator<Filter> comparator = FilterComparator.getInstance(); + + int result = comparator.compare(new FilterA(), new FilterB()); + + assertThat(result).isLessThan(0); + } + + + @Priority(1) + private static class FilterA implements Filter { + public ConfigValue filterProperty(ConfigValue value) { + throw new RuntimeException("Not implemented or look at me!"); + } + } + + @Priority(2) + private static class FilterB implements Filter { + public ConfigValue filterProperty(ConfigValue value) { + throw new RuntimeException("Not implemented or look at me!"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/javaconfig.properties ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/javaconfig.properties b/code/base/src/test/resources/META-INF/javaconfig.properties new file mode 100644 index 0000000..33beabb --- /dev/null +++ b/code/base/src/test/resources/META-INF/javaconfig.properties @@ -0,0 +1,22 @@ +# 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. + +confkey1=javaconf-value1 +confkey2=javaconf-value2 +confkey3=javaconf-value3 +confkey4=javaconf-value4 +confkey5=javaconf-value5 http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/javaconfig.xml ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/javaconfig.xml b/code/base/src/test/resources/META-INF/javaconfig.xml new file mode 100644 index 0000000..f6cdc97 --- /dev/null +++ b/code/base/src/test/resources/META-INF/javaconfig.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> + +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> + <entry key="aaeehh">ä</entry> + <entry key="ö">o</entry> +</properties> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/services/javax.config.spi.ConfigProviderResolver ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/services/javax.config.spi.ConfigProviderResolver b/code/base/src/test/resources/META-INF/services/javax.config.spi.ConfigProviderResolver new file mode 100644 index 0000000..e5ee483 --- /dev/null +++ b/code/base/src/test/resources/META-INF/services/javax.config.spi.ConfigProviderResolver @@ -0,0 +1,18 @@ +# 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. + +org.apache.tamaya.base.TestConfigurationProvider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/services/javax.config.spi.Converter ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/services/javax.config.spi.Converter b/code/base/src/test/resources/META-INF/services/javax.config.spi.Converter new file mode 100644 index 0000000..30fb5d6 --- /dev/null +++ b/code/base/src/test/resources/META-INF/services/javax.config.spi.Converter @@ -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. +# +org.apache.tamaya.base.convert.CTestConverter \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityInterface ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityInterface b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityInterface new file mode 100644 index 0000000..56f57a6 --- /dev/null +++ b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityInterface @@ -0,0 +1,18 @@ +# 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. +org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityImpl1 +org.apache.tamaya.base.DefaultServiceContextTest$InvalidPriorityImpl2 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$MultiImplsInterface ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$MultiImplsInterface b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$MultiImplsInterface new file mode 100644 index 0000000..e9ee034 --- /dev/null +++ b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.DefaultServiceContextTest$MultiImplsInterface @@ -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 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. + +org.apache.tamaya.base.DefaultServiceContextTest$MultiImpl1 +org.apache.tamaya.base.DefaultServiceContextTest$MultiImpl2 +org.apache.tamaya.base.DefaultServiceContextTest$MultiImpl3 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext new file mode 100644 index 0000000..7b8a81d --- /dev/null +++ b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext @@ -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. +# +org.apache.tamaya.base.DefaultServiceContext \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/invalid-properties.xml ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/invalid-properties.xml b/code/base/src/test/resources/invalid-properties.xml new file mode 100644 index 0000000..d8b10b7 --- /dev/null +++ b/code/base/src/test/resources/invalid-properties.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> + +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> + <entry key="a"> + <entry key="b">1</entry> +</properties> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/non-xml-properties.xml ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/non-xml-properties.xml b/code/base/src/test/resources/non-xml-properties.xml new file mode 100644 index 0000000..8de819a --- /dev/null +++ b/code/base/src/test/resources/non-xml-properties.xml @@ -0,0 +1,18 @@ +<!-- +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. +--> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/overrideOrdinal.properties ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/overrideOrdinal.properties b/code/base/src/test/resources/overrideOrdinal.properties new file mode 100644 index 0000000..1d02488 --- /dev/null +++ b/code/base/src/test/resources/overrideOrdinal.properties @@ -0,0 +1,25 @@ +# 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. + +#overrideValue ordinal +config_ordinal=16784 + +mykey1=myval1 +mykey2=myval2 +mykey3=myval3 +mykey4=myval4 +mykey5=myval5 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/testfile.properties ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/testfile.properties b/code/base/src/test/resources/testfile.properties new file mode 100644 index 0000000..abd7ee8 --- /dev/null +++ b/code/base/src/test/resources/testfile.properties @@ -0,0 +1,22 @@ +# 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. + +key1=val1 +key2=val2 +key3=val3 +key4=val4 +key5=val5 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/code/base/src/test/resources/valid-properties.xml ---------------------------------------------------------------------- diff --git a/code/base/src/test/resources/valid-properties.xml b/code/base/src/test/resources/valid-properties.xml new file mode 100644 index 0000000..7eb51d9 --- /dev/null +++ b/code/base/src/test/resources/valid-properties.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> + +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> + <entry key="a">b</entry> + <entry key="b">1</entry> +</properties> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/Main.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/Main.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/Main.java new file mode 100644 index 0000000..0c865cb --- /dev/null +++ b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/Main.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.examples.customconfigsource; + +import javax.config.Config; +import javax.config.ConfigProvider; +import java.io.PrintStream; +import java.util.logging.LogManager; +import java.util.logging.Logger; + +import static java.lang.String.format; + +/** + * Small example demonstrating the usage of a self-written {@link javax.config.spi.ConfigSource} + * and {@link javax.config.spi.ConfigSourceProvider}. + * + * <p> + * {@link org.apache.tamaya.base.configsource.SimpleConfigSource} is a custom implementation of a + * {@link javax.config.spi.ConfigSource}. It reads its properties from a + * flexibly configurable location. As it is an implementation + * of {@code PropertySource} and it is listed as service implementation + * in {@code META-INF/services/javax.config.spi.ConfigSource} Tamaya is able + * to find and to use it through the Service Provider Interface service of Java. + * </p> + * + * <p> + * The same applies to {@link SimpleConfigSourceProvider} which is an implementation + * of {@link javax.config.spi.ConfigSourceProvider}. Tamaya finds implementations + * of a {@link javax.config.spi.ConfigSourceProvider} also through the + * Service Provider Interface service of Java. Therefore it is listed in + * {@code META-INF/services/javax.config.spi.ConfigSourceProvider} file. + * </p> + */ +public class Main { + /* + * Turns off all logging. + */ + static { + LogManager.getLogManager().reset(); + Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + globalLogger.setLevel(java.util.logging.Level.OFF); + } + + private Main() { + } + + public static void main(String[] args) { + Config cfg = ConfigProvider.getConfig(); + + System.out.println("*****************************************************"); + System.out.println("Simple Example (with a PropertySource and a Provider)"); + System.out.println("*****************************************************"); + System.out.println(); + System.out.println("Example Metadata:"); + System.out.println("\tType : " + cfg.getValue("example.type", String.class)); + System.out.println("\tName : " + cfg.getValue("example.name", String.class)); + System.out.println("\tDescription : " + cfg.getValue("example.description", String.class)); + System.out.println("\tVersion : " + cfg.getValue("example.version", String.class)); + System.out.println("\tAuthor : " + cfg.getValue("example.author", String.class)); + System.out.println(); + System.out.println("\tPath : " + cfg.getValue("Path", String.class)); + System.out.println("\taProp : " + cfg.getValue("aProp", String.class)); + System.out.println(); + + dump(cfg.getPropertyNames(), System.out, cfg); + } + + private static void dump(Iterable<String> properties, PrintStream stream, Config config) { + stream.println("FULL DUMP:\n\n"); + + for (String en : properties) { + stream.println(format("\t%s = %s", en, config.getValue(en, String.class))); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSource.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSource.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSource.java new file mode 100644 index 0000000..0ae96e7 --- /dev/null +++ b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSource.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.examples.customconfigsource; + +import org.apache.tamaya.base.configsource.BaseConfigSource; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +public class SimpleConfigSource extends BaseConfigSource { + + public static final String CONFIG_PROPERTIES_LOCATION = "META-INF/MyOtherConfigProperties.properties"; + private Map<String,String> props = new HashMap<>(); + + public SimpleConfigSource() throws IOException { + this(ClassLoader.getSystemClassLoader().getResource(CONFIG_PROPERTIES_LOCATION)); + } + + public SimpleConfigSource(URL url) throws IOException { + Properties properties = new Properties(); + + try(InputStream is = url.openStream()){ + properties.load(is); + + for(Map.Entry en: properties.entrySet()){ + props.put(en.getKey().toString(), + en.getValue().toString()); + } + } + finally{ + props = Collections.unmodifiableMap(props); + } + } + + @Override + public String getName() { + return CONFIG_PROPERTIES_LOCATION; + } + + @Override + public Map<String, String> getProperties() { + return props; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSourceProvider.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSourceProvider.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSourceProvider.java new file mode 100644 index 0000000..8a565f2 --- /dev/null +++ b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/SimpleConfigSourceProvider.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.examples.customconfigsource; + +import javax.config.spi.ConfigSource; +import javax.config.spi.ConfigSourceProvider; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class SimpleConfigSourceProvider implements ConfigSourceProvider { + private static final String[] RESOURCES = { + "cfgOther/a.properties", "cfgOther/b.properties", "cfgOther/c.properties" + }; + + @Override + public Collection<ConfigSource> getConfigSources(ClassLoader cl) { + List<ConfigSource> propertySources = new ArrayList<>(); + + for (String res : RESOURCES) { + URL url = ClassLoader.getSystemClassLoader().getResource(res); + try { + propertySources.add(new SimpleConfigSource(url)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return propertySources; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/package-info.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/package-info.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/package-info.java new file mode 100644 index 0000000..edc3ea8 --- /dev/null +++ b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/customconfigsource/package-info.java @@ -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 of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tamaya.examples.customconfigsource; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/Main.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/Main.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/Main.java deleted file mode 100644 index 1c285b2..0000000 --- a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/Main.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.examples.custompropertysource; - -import javax.config.Config; -import javax.config.ConfigProvider; -import java.io.PrintStream; -import java.util.logging.LogManager; -import java.util.logging.Logger; - -import static java.lang.String.format; - -/** - * Small example demonstrating the usage of a self-written {@link javax.config.spi.ConfigSource} - * and {@link javax.config.spi.ConfigSourceProvider}. - * - * <p> - * {@link org.apache.tamaya.base.configsource.SimpleConfigSource} is a custom implementation of a - * {@link javax.config.spi.ConfigSource}. It reads its properties from a - * flexibly configurable location. As it is an implementation - * of {@code PropertySource} and it is listed as service implementation - * in {@code META-INF/services/org.apache.tamaya.spi.PropertySource} Tamaya is able - * to find and to use it through the Service Provider Interface service of Java. - * </p> - * - * <p> - * The same applies to {@link SimplePropertySourceProvider} which is an implementation - * of {@link javax.config.spi.ConfigSourceProvider}. Tamaya finds implementations - * of a {@link javax.config.spi.ConfigSourceProvider} also through the - * Service Provider Interface service of Java. Therefore it is listed in - * {@code META-INF/services/org.apache.tamaya.spi.PropertySourceProvider} file. - * </p> - */ -public class Main { - /* - * Turns off all logging. - */ - static { - LogManager.getLogManager().reset(); - Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); - globalLogger.setLevel(java.util.logging.Level.OFF); - } - - private Main() { - } - - public static void main(String[] args) { - Config cfg = ConfigProvider.getConfig(); - - System.out.println("*****************************************************"); - System.out.println("Simple Example (with a PropertySource and a Provider)"); - System.out.println("*****************************************************"); - System.out.println(); - System.out.println("Example Metadata:"); - System.out.println("\tType : " + cfg.getValue("example.type", String.class)); - System.out.println("\tName : " + cfg.getValue("example.name", String.class)); - System.out.println("\tDescription : " + cfg.getValue("example.description", String.class)); - System.out.println("\tVersion : " + cfg.getValue("example.version", String.class)); - System.out.println("\tAuthor : " + cfg.getValue("example.author", String.class)); - System.out.println(); - System.out.println("\tPath : " + cfg.getValue("Path", String.class)); - System.out.println("\taProp : " + cfg.getValue("aProp", String.class)); - System.out.println(); - - dump(cfg.getPropertyNames(), System.out, cfg); - } - - private static void dump(Iterable<String> properties, PrintStream stream, Config config) { - stream.println("FULL DUMP:\n\n"); - - for (String en : properties) { - stream.println(format("\t%s = %s", en, config.getValue(en, String.class))); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimpleConfigSource.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimpleConfigSource.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimpleConfigSource.java deleted file mode 100644 index 5aede5f..0000000 --- a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimpleConfigSource.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.examples.custompropertysource; - -import org.apache.tamaya.base.configsource.BaseConfigSource; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -public class SimpleConfigSource extends BaseConfigSource { - - public static final String CONFIG_PROPERTIES_LOCATION = "META-INF/MyOtherConfigProperties.properties"; - private Map<String,String> props = new HashMap<>(); - - public SimpleConfigSource() throws IOException { - this(ClassLoader.getSystemClassLoader().getResource(CONFIG_PROPERTIES_LOCATION)); - } - public SimpleConfigSource(URL url) throws IOException { - Properties properties = new Properties(); - - try(InputStream is = url.openStream()){ - properties.load(is); - - for(Map.Entry en: properties.entrySet()){ - props.put(en.getKey().toString(), - en.getValue().toString()); - } - } - finally{ - props = Collections.unmodifiableMap(props); - } - } - - @Override - public String getName() { - return CONFIG_PROPERTIES_LOCATION; - } - - @Override - public Map<String, String> getProperties() { - return props; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimplePropertySourceProvider.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimplePropertySourceProvider.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimplePropertySourceProvider.java deleted file mode 100644 index 26a1ac8..0000000 --- a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/SimplePropertySourceProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.examples.custompropertysource; - -import javax.config.spi.ConfigSource; -import javax.config.spi.ConfigSourceProvider; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class SimplePropertySourceProvider implements ConfigSourceProvider { - private static final String[] RESOURCES = { - "cfgOther/a.properties", "cfgOther/b.properties", "cfgOther/c.properties" - }; - - @Override - public Collection<ConfigSource> getConfigSources(ClassLoader cl) { - List<ConfigSource> propertySources = new ArrayList<>(); - - for (String res : RESOURCES) { - URL url = ClassLoader.getSystemClassLoader().getResource(res); - try { - propertySources.add(new SimpleConfigSource(url)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - return propertySources; - } -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/package-info.java ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/package-info.java b/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/package-info.java deleted file mode 100644 index 089f69c..0000000 --- a/examples/02-custom-property-source/src/main/java/org/apache/tamaya/examples/custompropertysource/package-info.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.examples.custompropertysource; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSource ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSource b/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSource new file mode 100644 index 0000000..1fd14e0 --- /dev/null +++ b/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSource @@ -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. +# +org.apache.tamaya.examples.customconfigsource.SimpleConfigSource \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSourceProvider ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSourceProvider b/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSourceProvider new file mode 100644 index 0000000..67b910b --- /dev/null +++ b/examples/02-custom-property-source/src/main/resources/META-INF/services/javax.config.spi.ConfigSourceProvider @@ -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. +# +org.apache.tamaya.examples.customconfigsource.SimpleConfigSourceProvider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource deleted file mode 100644 index 219275b..0000000 --- a/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource +++ /dev/null @@ -1,19 +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. -# -org.apache.tamaya.examples.custompropertysource.SimplePropertySource \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/063f8ada/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider ---------------------------------------------------------------------- diff --git a/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider deleted file mode 100644 index 453126f..0000000 --- a/examples/02-custom-property-source/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider +++ /dev/null @@ -1,19 +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. -# -org.apache.tamaya.examples.custompropertysource.SimplePropertySourceProvider \ No newline at end of file