You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by st...@apache.org on 2014/12/27 14:58:12 UTC
[28/34] incubator-tamaya git commit: first step: move all sources to
a 'dormant' directory
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/main/java/org/apache/tamaya/spi/DefaultServiceContextProvider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/DefaultServiceContextProvider.java b/api/src/main/java/org/apache/tamaya/spi/DefaultServiceContextProvider.java
deleted file mode 100644
index e1d1740..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/DefaultServiceContextProvider.java
+++ /dev/null
@@ -1,101 +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.spi;
-
-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 java.util.ServiceLoader} to load the services required.
- */
-@SuppressWarnings({"rawtypes", "unchecked"})
-class DefaultServiceContextProvider implements ServiceContext {
- /** List current services loaded, per class. */
- private final ConcurrentHashMap<Class, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
- /** Singletons. */
- private final ConcurrentHashMap<Class, Optional<?>> singletons = new ConcurrentHashMap<>();
-
- @Override
- public <T> Optional<T> getService(Class<T> serviceType) {
- Optional<T> cached = (Optional<T>)singletons.get(serviceType);
- if(cached==null) {
- List<? extends T> services = getServices(serviceType, Collections.emptyList());
- if (services.isEmpty()) {
- cached = Optional.empty();
- }
- else{
- cached = Optional.of(services.get(0));
- }
- singletons.put(serviceType, cached);
- }
- return cached;
- }
-
- /**
- * Loads and registers services.
- *
- * @param serviceType
- * The service type.
- * @param <T>
- * the concrete type.
- * @param defaultList
- * the list current items returned, if no services were found.
- * @return the items found, never {@code null}.
- */
- @Override
- public <T> List<? extends T> getServices(final Class<T> serviceType, final List<? extends T> defaultList) {
- List<T> found = (List<T>) servicesLoaded.get(serviceType);
- if (found != null) {
- return found;
- }
- return loadServices(serviceType, defaultList);
- }
-
- /**
- * Loads and registers services.
- *
- * @param serviceType The service type.
- * @param <T> the concrete type.
- * @param defaultList the list current items returned, if no services were found.
- *
- * @return the items found, never {@code null}.
- */
- private <T> List<? extends T> loadServices(final Class<T> serviceType, final List<? extends T> defaultList) {
- try {
- List<T> services = new ArrayList<>();
- for (T t : ServiceLoader.load(serviceType)) {
- services.add(t);
- }
- if(services.isEmpty()){
- services.addAll(defaultList);
- }
- services = Collections.unmodifiableList(services);
- final List<T> previousServices = (List<T>) servicesLoaded.putIfAbsent(serviceType, (List<Object>)services);
- return previousServices != null ? previousServices : services;
- } catch (Exception e) {
- Logger.getLogger(DefaultServiceContextProvider.class.getName()).log(Level.WARNING,
- "Error loading services current type " + serviceType, e);
- return defaultList;
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/main/java/org/apache/tamaya/spi/PropertyAdapterSpi.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyAdapterSpi.java b/api/src/main/java/org/apache/tamaya/spi/PropertyAdapterSpi.java
deleted file mode 100644
index a1222a4..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyAdapterSpi.java
+++ /dev/null
@@ -1,72 +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.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertyAdapter;
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-
-
-/**
- * Manager for {@link org.apache.tamaya.Configuration} instances. Implementations must register an instance
- * using the {@link org.apache.tamaya.spi.ServiceContextManager} mechanism in place (by default this is based on the {@link java.util.ServiceLoader}.
- * The {@link org.apache.tamaya.Configuration} Singleton in the API delegates its corresponding calls to the
- * instance returned by the current bootstrap service in place.
- *
- * @see org.apache.tamaya.Configuration
- * @see org.apache.tamaya.spi.ServiceContextManager
- */
-public interface PropertyAdapterSpi {
-
-
- /**
- * Registers a new PropertyAdapter for the given target type, hereby replacing any existing adapter for
- * this type.
- * @param targetType The target class, not null.
- * @param adapter The adapter, not null.
- * @param <T> The target type
- * @return any adapter replaced with the new adapter, or null.
- */
- <T> PropertyAdapter<T> register(Class<T> targetType, PropertyAdapter<T> adapter);
-
- /**
- * Get an adapter converting to the given target type.
- * @param targetType the target type class
- * @return true, if the given target type is supported.
- */
- default <T> PropertyAdapter<T> getAdapter(Class<T> targetType){
- return getPropertyAdapter(targetType, null);
- }
-
- /**
- * Get an adapter converting to the given target type.
- * @param targetType the target type class
- * @param <T> the target type
- * @return the corresponding adapter, never null.
- * @throws org.apache.tamaya.ConfigException if the target type is not supported.
- */
- <T> PropertyAdapter<T> getPropertyAdapter(Class<T> targetType, WithPropertyAdapter annotation);
-
- /**
- * Checks if the given target type is supported, i.e. a adapter is registered and accessible.
- * @param targetType the target type class
- * @return true, if the given target type is supported.
- */
- boolean isTargetTypeSupported(Class<?> targetType);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
deleted file mode 100644
index a2e127e..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
+++ /dev/null
@@ -1,109 +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.spi;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-/**
- * This class models the component that is managing the lifecycle current the
- * services used by the Configuration API.
- */
-public interface ServiceContext {
-
- /**
- * Delegate method for {@link ServiceContext#getService(Class)}.
- *
- * @param serviceType the service type.
- * @return the service found, never {@code null}.
- * @see ServiceContext#getService(Class)
- */
- default <T> T getSingleton(Class<T> serviceType) {
- return getService(serviceType)
- .orElseThrow(() -> new IllegalStateException("Singleton missing: " + serviceType.getName()));
- }
-
- /**
- * Delegate method for {@link ServiceContext#getService(Class)}.
- *
- * @param serviceType the service type.
- * @return the service found, never {@code null}.
- * @see ServiceContext#getService(Class)
- */
- default <T> T getSingleton(Class<T> serviceType, Supplier<T> defaultSupplier) {
- return getService(serviceType)
- .orElse((defaultSupplier.get()));
- }
-
- /**
- * Access a singleton, given its type.
- *
- * @param serviceType
- * the service type.
- * @return The instance to be used, never {@code null}
- */
- <T> Optional<T> getService(Class<T> 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.
- *
- * @param serviceType
- * the service type.
- * @param defaultList
- * the lis returned, if no services could be found.
- * @return The instance to be used, never {@code null}
- */
- <T> List<? extends T> getServices(Class<T> serviceType, List<? extends T> defaultList);
-
- /**
- * 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.
- *
- * @param serviceType
- * the service type.
- * @return The instance to be used, never {@code null}
- */
- default <T> List<? extends T> getServices(Class<T> serviceType){
- return getServices(serviceType, Collections.emptyList());
- }
-
- /**
- * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
- *
- * @return the {@link ServiceContext} to be used.
- */
- public static ServiceContext getInstance(){
- return ServiceContextManager.getServiceContext();
- }
-
- /**
- * Replace the current {@link ServiceContext} in use.
- *
- * @param serviceContext the new {@link ServiceContext}, not null.
- */
- public static ServiceContext set(ServiceContext serviceContext){
- return ServiceContextManager.set(Objects.requireNonNull(serviceContext));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
deleted file mode 100644
index 63e4d70..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ /dev/null
@@ -1,100 +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.spi;
-
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This singleton provides access to the services available in the current {@link ServiceContext}. The
- * behaviour can be adapted, by calling {@link ServiceContextManager#set(ServiceContext)} before accessing any
- * services.
- */
-final class ServiceContextManager {
- /**
- * The ServiceProvider used.
- */
- private static volatile ServiceContext serviceContextProviderDelegate;
- /**
- * The shared lock instance user.
- */
- private static final Object LOCK = new Object();
-
- /**
- * Private singletons constructor.
- */
- private ServiceContextManager() {
- }
-
- /**
- * Load the {@link ServiceContext} to be used.
- *
- * @return {@link ServiceContext} to be used for loading the services.
- */
- private static ServiceContext loadDefaultServiceProvider() {
- try {
- for (ServiceContext sp : ServiceLoader.load(ServiceContext.class)) {
- return sp;
- }
- } catch (Exception e) {
- Logger.getLogger(ServiceContextManager.class.getName()).log(Level.INFO, "Using default ServiceProvider.");
- }
- return new DefaultServiceContextProvider();
- }
-
- /**
- * Replace the current {@link ServiceContext} in use.
- *
- * @param serviceContextProvider the new {@link ServiceContext}, not null.
- */
- public static ServiceContext set(ServiceContext serviceContextProvider) {
- ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
- Objects.requireNonNull(serviceContextProvider);
- synchronized (LOCK) {
- if (ServiceContextManager.serviceContextProviderDelegate == null) {
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- Logger.getLogger(ServiceContextManager.class.getName())
- .log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
- } else {
- Logger.getLogger(ServiceContextManager.class.getName())
- .log(Level.WARNING, "Replacing ServiceProvider " + ServiceContextManager.serviceContextProviderDelegate.getClass().getName() + " with: " + serviceContextProvider.getClass().getName());
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- }
- }
- return currentContext;
- }
-
- /**
- * Ge {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
- *
- * @return the {@link ServiceContext} used.
- */
- public static ServiceContext getServiceContext() {
- if (serviceContextProviderDelegate == null) {
- synchronized (LOCK) {
- if (serviceContextProviderDelegate == null) {
- serviceContextProviderDelegate = loadDefaultServiceProvider();
- }
- }
- }
- return serviceContextProviderDelegate;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/java/annottext/AnnotatedConfig.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/annottext/AnnotatedConfig.java b/api/src/test/java/annottext/AnnotatedConfig.java
deleted file mode 100644
index 20b135f..0000000
--- a/api/src/test/java/annottext/AnnotatedConfig.java
+++ /dev/null
@@ -1,51 +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 annottext;
-
-import org.apache.tamaya.annotation.ConfiguredProperty;
-import org.apache.tamaya.annotation.WithLoadPolicy;
-import org.apache.tamaya.annotation.DefaultValue;
-import org.apache.tamaya.annotation.LoadPolicy;
-
-/**
- * An example showing some basic annotations, using an interface to be proxied by the
- * configuration system.
- * Created by Anatole on 15.02.14.
- */
-@WithLoadPolicy(LoadPolicy.INITIAL)
-public interface AnnotatedConfig {
-
- @ConfiguredProperty(keys = "foo.bar.myprop")
- @ConfiguredProperty(keys = "mp")
- @ConfiguredProperty(keys = "common.test.myProperty")
- @DefaultValue("myValue_$[env.stage]")
- // @ConfigLoadPolicy(listener = MyListener.class)
- String myParameter();
-
- @ConfiguredProperty(keys = "simple_value")
- @WithLoadPolicy(LoadPolicy.LAZY)
- String simpleValue();
-
- @ConfiguredProperty
- String simplestValue();
-
- @ConfiguredProperty(keys = "env.host.name")
- String hostName();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/java/annottext/AnnotatedFullConfig.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/annottext/AnnotatedFullConfig.java b/api/src/test/java/annottext/AnnotatedFullConfig.java
deleted file mode 100644
index df39d12..0000000
--- a/api/src/test/java/annottext/AnnotatedFullConfig.java
+++ /dev/null
@@ -1,52 +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 annottext;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.annotation.ConfiguredProperty;
-import org.apache.tamaya.annotation.WithLoadPolicy;
-import org.apache.tamaya.annotation.DefaultValue;
-import org.apache.tamaya.annotation.LoadPolicy;
-
-/**
- * An example showing some basic annotations, using an interface to be proxied by the
- * configuration system, nevertheless extending the overall Configuration interface.
- * Created by Anatole on 15.02.14.
- */
-@WithLoadPolicy(LoadPolicy.INITIAL)
-public interface AnnotatedFullConfig extends Configuration{
-
- @ConfiguredProperty(keys = "foo.bar.myprop")
- @ConfiguredProperty(keys = "mp")
- @ConfiguredProperty(keys = "common.test.myProperty")
- @DefaultValue("myValue_$[env.stage]")
- // @ConfigLoadPolicy(listener = MyListener.class)
- String myParameter();
-
- @ConfiguredProperty(keys = "simple_value")
- @WithLoadPolicy(LoadPolicy.LAZY)
- String simpleValue();
-
- @ConfiguredProperty
- String simplestValue();
-
- @ConfiguredProperty(keys = "env.host.name")
- String hostName();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java b/api/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
deleted file mode 100644
index 858786d..0000000
--- a/api/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
+++ /dev/null
@@ -1,90 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Consumer;
-
-import org.apache.tamaya.spi.ConfigurationSpi;
-
-/**
- * Created by Anatole on 09.09.2014.
- */
-public class TestConfigServiceSingletonSpi implements ConfigurationSpi {
-
-
- private Map<String, Configuration> configs = new ConcurrentHashMap<>();
-
- public TestConfigServiceSingletonSpi(){
- Map<String,String> config = new HashMap<>();
- 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("booleanT", "true");
- config.put("double1", "1234.5678");
- config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789");
- config.put("testProperty", "keys current testProperty");
- config.put("runtimeVersion", "${java.version}");
- // configs.put("test", new MapConfiguration(MetaInfoBuilder.current().setName("test").build(), config));
- }
-
-
-
- @Override
- public boolean isConfigurationAvailable(String name){
- return configs.containsKey(name);
- }
-
- @Override
- public Configuration getConfiguration(String name) {
- // TODO
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public <T> T createTemplate(Class<T> type, Configuration... configurations) {
- // TODO
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public void configure(Object instance, Configuration... configurations) {
- // TODO
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public String evaluateValue(String expression, Configuration... configurations) {
- // TODO improve this ugly implementation...
- for (Configuration config : configurations) {
- for (Map.Entry<String, String> en : config.getProperties().entrySet()) {
- expression = expression.replaceAll("\\$\\{" + en.getKey() + "\\}", en.getValue());
- }
- }
- return expression;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java b/api/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
deleted file mode 100644
index 65e6c1d..0000000
--- a/api/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
+++ /dev/null
@@ -1,99 +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;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.util.Currency;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-import org.apache.tamaya.spi.PropertyAdapterSpi;
-
-/**
- * Test implementation current {@link org.apache.tamaya.spi.PropertyAdapterSpi}, which provides propertyAdapters
- * for some basic types.
- */
-@SuppressWarnings({"unchecked", "rawtypes"})
-public final class TestPropertyAdaptersSingletonSpi implements PropertyAdapterSpi {
-
- private Map<Class, PropertyAdapter<?>> propertyAdapters = new ConcurrentHashMap<>();
-
- private TestPropertyAdaptersSingletonSpi(){
- register(char.class, (s) -> s.charAt(0));
- register(int.class, Integer::parseInt);
- register(byte.class, Byte::parseByte);
- register(short.class, Short::parseShort);
- register(boolean.class, Boolean::parseBoolean);
- register(float.class, Float::parseFloat);
- register(double.class, Double::parseDouble);
-
- register(Character.class, (s) -> s.charAt(0));
- register(Integer.class, Integer::valueOf);
- register(Byte.class, Byte::valueOf);
- register(Short.class, Short::valueOf);
- register(Boolean.class, Boolean::valueOf);
- register(Float.class, Float::valueOf);
- register(Double.class, Double::valueOf);
- register(BigDecimal.class, BigDecimal::new);
- register(BigInteger.class, BigInteger::new);
-
- register(Currency.class, Currency::getInstance);
-
- register(LocalDate.class, LocalDate::parse);
- register(LocalTime.class, LocalTime::parse);
- register(LocalDateTime.class, LocalDateTime::parse);
- register(ZoneId.class, ZoneId::of);
- }
-
-
- @Override
- public <T> PropertyAdapter<T> register(Class<T> targetType, PropertyAdapter<T> codec){
- Objects.requireNonNull(targetType);
- Objects.requireNonNull(codec);
- return (PropertyAdapter<T>) propertyAdapters.put(targetType, codec);
- }
-
- @Override
- public <T> PropertyAdapter<T> getPropertyAdapter(Class<T> targetType, WithPropertyAdapter annotation){
- if(annotation!=null){
- Class<?> adapterType = annotation.value();
- if(!adapterType.equals(PropertyAdapter.class)){
- try{
- return (PropertyAdapter<T>)adapterType.newInstance();
- }
- catch(Exception e){
- throw new ConfigException("Failed to load PropertyAdapter: " + adapterType, e);
- }
- }
- }
- return (PropertyAdapter<T>) propertyAdapters.get(targetType);
- }
-
- @Override
- public boolean isTargetTypeSupported(Class<?> targetType){
- return propertyAdapters.containsKey(targetType);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/api/src/test/resources/META-INF/beans.xml b/api/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index 5207c9a..0000000
--- a/api/src/test/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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 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.
--->
-<beans xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
----------------------------------------------------------------------
diff --git a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
deleted file mode 100644
index 1b0cdd4..0000000
--- a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
+++ /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.TestConfigServiceSingletonSpi
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
----------------------------------------------------------------------
diff --git a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
deleted file mode 100644
index e9b04b4..0000000
--- a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
+++ /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.TestPropertyAdaptersSingletonSpi
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/buildtools/pom.xml
----------------------------------------------------------------------
diff --git a/buildtools/pom.xml b/buildtools/pom.xml
deleted file mode 100644
index 434563e..0000000
--- a/buildtools/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-<project xmlns="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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-all</artifactId>
- <version>0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>buildtools</artifactId>
- <name>Apache Tamaya - Build Tools</name>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/buildtools/src/main/resources/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/buildtools/src/main/resources/findbugs-exclude.xml b/buildtools/src/main/resources/findbugs-exclude.xml
deleted file mode 100644
index 8a29761..0000000
--- a/buildtools/src/main/resources/findbugs-exclude.xml
+++ /dev/null
@@ -1,22 +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.
--->
-<?xml version="1.0" encoding="UTF-8"?>
-<FindBugsFilter>
-
-</FindBugsFilter>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/core/.gitignore
----------------------------------------------------------------------
diff --git a/core/.gitignore b/core/.gitignore
deleted file mode 100644
index 3b54384..0000000
--- a/core/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-target/
-/doc
-target
-*.iml
-*.iws
-*.ipr
-.project
-.classpath
-.settings
-.metadata
-.idea
-.checkstyle
-atlassian-ide-plugin.xml
-.sonar-ide.properties
-*.patch
-*.log
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
deleted file mode 100644
index 85ef679..0000000
--- a/core/pom.xml
+++ /dev/null
@@ -1,114 +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.
--->
-<project xmlns="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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-all</artifactId>
- <version>0.1-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>tamaya-core</artifactId>
- <name>Apache Tamaya - Core Implementation Library</name>
- <packaging>jar</packaging>
-
- <properties>
- <slf4j.version>1.7.2</slf4j.version>
- <log4j.version>1.2.17</log4j.version>
- <log4j2.version>2.1</log4j2.version>
- </properties>
-
- <build>
- <plugins>
- <!-- ======================================================= -->
- <!-- Packaging (OSGi bundle) -->
- <!-- =======================================================
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-package>org.apache.tamaya.*</Import-package>
- <Import-package>org.apache.tamaya.spi.*</Import-package>
- <Import-package>org.apache.tamaya.injectt.*</Import-package>
- <Export-Package>org.apache.tamaya.core.cdi.*</Export-Package>
- <Export-Package>org.apache.tamaya.core.config.*</Export-Package>
- <Export-Package>org.apache.tamaya.core.env.*</Export-Package>
- <Export-Package>org.apache.tamaya.core.properties.*</Export-Package>
- <Export-Package>org.apache.tamaya.core.spi.*</Export-Package>
- <Private-Package>!*</Private-Package>
- </instructions>
- </configuration>
- </plugin>
- -->
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <version>${log4j2.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>