You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/01/05 10:13:59 UTC
[1/2] incubator-tamaya git commit: TAMAYA-45: Streamlined code. Added
PropertyChangeSet, simplified it.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 5bd97c9c2 -> 4b0015048
TAMAYA-45: Streamlined code. Added PropertyChangeSet, simplified it.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/3a0bf176
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/3a0bf176
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/3a0bf176
Branch: refs/heads/master
Commit: 3a0bf1762e9d6c365c3bf85a2fffefb3dabf0bfc
Parents: ed3f706
Author: anatole <an...@apache.org>
Authored: Mon Jan 5 10:13:38 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Mon Jan 5 10:13:38 2015 +0100
----------------------------------------------------------------------
.../src/main/java/old/PropertyChangeSet.java | 169 ---------
.../main/java/old/PropertyChangeSetBuilder.java | 347 -------------------
.../org/apache/tamaya/core/internal/Utils.java | 126 -------
.../tamaya/inject/ConfiguredProperty.java | 3 +-
.../apache/tamaya/inject/PropertyChangeSet.java | 125 +++++++
.../tamaya/inject/PropertyChangeSetBuilder.java | 154 ++++++++
.../tamaya/inject/WithPropertyConverter.java | 2 +-
.../internal/ConfigChangeCallbackMethod.java | 18 +-
.../ConfigTemplateInvocationHandler.java | 2 +-
.../inject/internal/ConfigurationInjector.java | 6 +-
.../inject/internal/ConfiguredSetterMethod.java | 21 +-
.../tamaya/inject/internal/ConfiguredType.java | 23 +-
.../tamaya/inject/internal/InjectionUtils.java | 145 ++++----
.../apache/tamaya/inject/internal/Utils.java | 126 +++++++
.../internal/WeakConfigListenerManager.java | 2 +-
.../test/java/annottext/AnnotatedConfig.java | 8 +-
.../java/annottext/AnnotatedFullConfig.java | 8 +-
.../tamaya/TestConfigServiceSingletonSpi.java | 90 -----
.../TestPropertyAdaptersSingletonSpi.java | 99 ------
.../org.apache.tamaya.spi.ConfigurationSpi | 19 -
.../org.apache.tamaya.spi.PropertyAdapterSpi | 19 -
21 files changed, 510 insertions(+), 1002 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/dormant/core/src/main/java/old/PropertyChangeSet.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/old/PropertyChangeSet.java b/dormant/core/src/main/java/old/PropertyChangeSet.java
deleted file mode 100644
index 3cf6b31..0000000
--- a/dormant/core/src/main/java/old/PropertyChangeSet.java
+++ /dev/null
@@ -1,169 +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.core.properties;
-
-import org.apache.tamaya.PropertySource;
-
-import java.beans.PropertyChangeEvent;
-import java.io.Serializable;
-import java.util.*;
-
-/**
- * Event that contains a set current changes that were applied or could be applied.
- * This class is immutable and thread-safe. To create instances use
- * {@link PropertyChangeSetBuilder}.
- *
- * Created by Anatole on 22.10.2014.
- */
-public final class PropertyChangeSet implements Serializable{
-
- private static final long serialVersionUID = 1l;
- /** The base property provider/configuration. */
- private PropertySource propertySource;
- /** The base version, usable for optimistic locking. */
- private String baseVersion;
- /** The recorded changes. */
- private Map<String,PropertyChangeEvent> changes = new HashMap<>();
-
- /**
- * Get an empty change set for the given provider.
- * @param propertyProvider The base property provider/configuration, not null.
- * @return an empty ConfigChangeSet instance.
- */
- public static PropertyChangeSet emptyChangeSet(PropertySource propertyProvider){
- return new PropertyChangeSet(propertyProvider, Collections.emptySet());
- }
-
- /**
- * Constructor used by {@link PropertyChangeSetBuilder}.
- * @param propertySource The base property provider/configuration, not null.
- * @param changes The recorded changes, not null.
- */
- PropertyChangeSet(PropertySource propertySource, Collection<PropertyChangeEvent> changes) {
- this.propertySource = Objects.requireNonNull(propertySource);
- changes.forEach((c) -> this.changes.put(c.getPropertyName(), c));
- }
-
- /**
- * Get the underlying property provider/configuration.
- * @return the underlying property provider/configuration, never null.
- */
- public PropertySource getPropertySource(){
- return this.propertySource;
- }
-
- /**
- * Get the base version, usable for optimistic locking.
- * @return the base version.
- */
- public String getBaseVersion(){
- return baseVersion;
- }
-
- /**
- * Get the changes recorded.
- * @return the recorded changes, never null.
- */
- public Collection<PropertyChangeEvent> getEvents(){
- return Collections.unmodifiableCollection(this.changes.values());
- }
-
- /**
- * Access the number current removed entries.
- * @return the number current removed entries.
- */
- public int getRemovedSize() {
- return (int) this.changes.values().stream().filter((e) -> e.getNewValue() == null).count();
- }
-
- /**
- * Access the number current added entries.
- * @return the number current added entries.
- */
- public int getAddedSize() {
- return (int) this.changes.values().stream().filter((e) -> e.getOldValue() == null).count();
- }
-
- /**
- * Access the number current updated entries.
- * @return the number current updated entries.
- */
- public int getUpdatedSize() {
- return (int) this.changes.values().stream().filter((e) -> e.getOldValue()!=null && e.getNewValue()!=null).count();
- }
-
-
- /**
- * Checks if the given key was removed.
- * @param key the target key, not null.
- * @return true, if the given key was removed.
- */
- public boolean isRemoved(String key) {
- PropertyChangeEvent change = this.changes.get(key);
- return change != null && change.getNewValue() == null;
- }
-
- /**
- * Checks if the given key was added.
- * @param key the target key, not null.
- * @return true, if the given key was added.
- */
- public boolean isAdded(String key) {
- PropertyChangeEvent change = this.changes.get(key);
- return change != null && change.getOldValue() == null;
- }
-
- /**
- * Checks if the given key was updated.
- * @param key the target key, not null.
- * @return true, if the given key was updated.
- */
- public boolean isUpdated(String key) {
- PropertyChangeEvent change = this.changes.get(key);
- return change != null && change.getOldValue() != null && change.getNewValue() != null;
- }
-
- /**
- * Checks if the given key is added, or updated AND NOT removed.
- * @param key the target key, not null.
- * @return true, if the given key was added, or updated BUT NOT removed.
- */
- public boolean containsKey(String key) {
- PropertyChangeEvent change = this.changes.get(key);
- return change != null && change.getNewValue() != null;
- }
-
- /**
- * CHecks if the current change set does not contain any changes.
- * @return tru, if the change set is empty.
- */
- public boolean isEmpty(){
- return this.changes.isEmpty();
- }
-
-
- @Override
- public String toString() {
- return "ConfigChangeSet{" +
- "properties=" + propertySource +
- ", baseVersion=" + baseVersion +
- ", changes=" + changes +
- '}';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/dormant/core/src/main/java/old/PropertyChangeSetBuilder.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/old/PropertyChangeSetBuilder.java b/dormant/core/src/main/java/old/PropertyChangeSetBuilder.java
deleted file mode 100644
index b6e22f8..0000000
--- a/dormant/core/src/main/java/old/PropertyChangeSetBuilder.java
+++ /dev/null
@@ -1,347 +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.core.properties;
-
-import org.apache.tamaya.PropertySource;
-
-import java.beans.PropertyChangeEvent;
-import java.util.*;
-import java.util.function.Function;
-
-/**
- * Models a set current changes to be applied to a configuration/property provider. Such a set can be applied
- * to any {@link org.apache.tamaya.PropertySource} instance. If the provider is mutable it may check the
- * version given and applyChanges the changes to the provider/configuration, including triggering current regarding
- * change events.
- * <p>
- * For appropriate conversion a {@code Function<String, Codec>} can be applied, which performs correct conversion,
- * when changed values are set. This function enables connecting e.g. setters on a configuration template with
- * the corresponding conversion logic, so the template calls are correctly converted back.
- */
-public final class PropertyChangeSetBuilder {
- /**
- * The recorded changes.
- */
- final SortedMap<String, PropertyChangeEvent> delta = new TreeMap<>();
- /**
- * The underlying configuration/provider.
- */
- PropertySource source;
-
- /**
- * Constructor.
- *
- * @param source the underlying configuration/provider, not null.
- */
- private PropertyChangeSetBuilder(PropertySource source) {
- this.source = Objects.requireNonNull(source);
- }
-
- /**
- * Creates a new instance current this builder.
- *
- * @param source the underlying property provider/configuration, not null.
- * @return the builder for chaining.
- */
- public static PropertyChangeSetBuilder of(PropertySource source) {
- return new PropertyChangeSetBuilder(source);
- }
-
- /**
- * This method records all changes to be applied to the base property provider/configuration to
- * achieve the given target state.
- *
- * @param newState the new target state, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder addChanges(PropertySource newState) {
- compare(newState, this.source).forEach((c) -> this.delta.put(c.getPropertyName(), c));
- return this;
- }
-
- /**
- * Get the current values, also considering any changes recorded within this change set.
- *
- * @param key the key current the entry, not null.
- * @return the keys, or null.
- */
- public String get(String key) {
- PropertyChangeEvent change = this.delta.get(key);
- if (change != null && !(change.getNewValue() == null)) {
- return (String) change.getNewValue();
- }
- return null;
- }
-
- /**
- * Marks the given key(s) fromMap the configuration/properties to be removed.
- *
- * @param key the key current the entry, not null.
- * @param otherKeys additional keys to be removed (convenience), not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder remove(String key, String... otherKeys) {
- String oldValue = this.source.get(key).orElse(null);
- if (oldValue == null) {
- this.delta.remove(key);
- }
- this.delta.put(key, new PropertyChangeEvent(this.source, key, oldValue, null));
- for (String addKey : otherKeys) {
- oldValue = this.source.get(addKey).orElse(null);
- if (oldValue == null) {
- this.delta.remove(addKey);
- }
- this.delta.put(addKey, new PropertyChangeEvent(this.source, addKey, oldValue, null));
- }
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, boolean value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- s* Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, byte value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, char value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, short value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, int value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, long value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, float value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, double value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder put(String key, String value) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), String.valueOf(value)));
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @return the builder for chaining.
- * @throws org.apache.tamaya.ConfigException if no matching Codec could be found.
- */
- public <T> PropertyChangeSetBuilder put(String key, Class<T> type, T value) {
- put(key, type, value, null);
- return this;
- }
-
- /**
- * Applies the given keys.
- *
- * @param key the key current the entry, not null.
- * @param value the keys to be applied, not null.
- * @param adapter the codec to be used, if set overrides any other codecs that may apply. If null an appropriate
- * codec is tried to be evaluated as needed.
- * @return the builder for chaining.
- * @throws org.apache.tamaya.ConfigException if no matching Codec could be found.
- */
- public <T> PropertyChangeSetBuilder put(String key, Class<T> type, T value, Function<T,String> adapter) {
- this.delta.put(key, new PropertyChangeEvent(this.source, key, this.source.get(key).orElse(null), adapter.apply(Objects.requireNonNull(value))));
- return this;
- }
-
-
- /**
- * Apply all the given values to the base configuration/properties.
- * Note that all values passed must be convertible to String, either
- * <ul>
- * <li>the registered codecs provider provides codecs for the corresponding keys, or </li>
- * <li>default codecs are present for the given type, or</li>
- * <li>the value is an instanceof String</li>
- * </ul>
- *
- * @param changes the changes to be applied, not null.
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder putAll(Map<String, String> changes) {
- changes.putAll(changes);
- return this;
- }
-
- /**
- * This method will create a change set that clears all entries fromMap the given base configuration/properties.
- *
- * @return the builder for chaining.
- */
- public PropertyChangeSetBuilder deleteAll() {
- this.delta.clear();
- this.source.getProperties().forEach((k, v) ->
- this.delta.put(k, new PropertyChangeEvent(this.source, k, v, null)));
- return this;
- }
-
- /**
- * Checks if the change set is empty, i.e. does not contain any changes.
- *
- * @return true, if the set is empty.
- */
- public boolean isEmpty() {
- return this.delta.isEmpty();
- }
-
- /**
- * Resets this change set instance. This will clear all changes done to this builder, so the
- * set will be empty.
- */
- public void reset() {
- this.delta.clear();
- }
-
- /**
- * Builds the corresponding change set.
- *
- * @return the new change set, never null.
- */
- public PropertyChangeSet build() {
- return new PropertyChangeSet(this.source, Collections.unmodifiableCollection(this.delta.values()));
- }
-
- /**
- * Compares the two property config/configurations and creates a collection current all changes
- * that must be appied to render {@code map1} into {@code map2}.
- *
- * @param map1 the source map, not null.
- * @param map2 the target map, not null.
- * @return a collection current change events, never null.
- */
- public static Collection<PropertyChangeEvent> compare(PropertySource map1, PropertySource map2) {
- List<PropertyChangeEvent> changes = new ArrayList<>();
- for (Map.Entry<String, String> en : map1.getProperties().entrySet()) {
- Optional<String> val = map2.get(en.getKey());
- if (!val.isPresent()) {
- changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue()));
- } else if (!val.get().equals(en.getValue())) {
- changes.add(new PropertyChangeEvent(map1, en.getKey(), val.get(), en.getValue()));
- }
- }
- for (Map.Entry<String, String> en : map2.getProperties().entrySet()) {
- Optional<String> val = map1.get(en.getKey());
- if (!val.isPresent()) {
- changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue()));
- } else if (!val.equals(Optional.ofNullable(en.getValue()))) {
- changes.add(new PropertyChangeEvent(map1, en.getKey(), val.get(), en.getValue()));
- }
- }
- return changes;
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "PropertyChangeEventBuilder [source=" + source + ", " +
- ", delta=" + delta + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/dormant/core/src/main/java/org/apache/tamaya/core/internal/Utils.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/internal/Utils.java b/dormant/core/src/main/java/org/apache/tamaya/core/internal/Utils.java
deleted file mode 100644
index fd490ce..0000000
--- a/dormant/core/src/main/java/org/apache/tamaya/core/internal/Utils.java
+++ /dev/null
@@ -1,126 +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.core.internal;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Utility class simplifying some implementation aspects.
- * Created by Anatole on 11.11.2014.
- */
-@SuppressWarnings("unchecked")
-public final class Utils {
-
- private static final Logger LOG = Logger.getLogger(Utils.class.getName());
-
- private Utils(){}
-
- /**
- * Utility method to read out repeatable annotations.
- * @param annotated the annotated instance.
- * @param repeatableAnnotation the repeatable annotation type
- * @param annotationContainer the container annotation type
- * @param <T> the repeatable annotation type
- * @param <R> the repeatable container annotation type
- * @return a list with the annotations found (could be empty, but never null).
- */
- public static <T extends Annotation, R extends Annotation> Collection<T>
- getAnnotations(AnnotatedElement annotated,
- Class<T> repeatableAnnotation,
- Class<R> annotationContainer){
- List<T> result = new ArrayList<>();
- R containerAnnot = annotated.getAnnotation(annotationContainer);
- if(containerAnnot!=null){
- Method valueMethod;
- try {
- valueMethod = annotationContainer.getMethod("keys");
- result.addAll(Arrays.asList((T[])valueMethod.invoke(containerAnnot)));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to evaluate repeatable annotation.", e);
- }
- }
- else{
- T annot = annotated.getAnnotation(repeatableAnnotation);
- if(annot!=null){
- result.add(annot);
- }
- }
- return result;
- }
-
- /**
- * Utility method to read out repeatable annotations.
- * @param annotated the annotated instance.
- * @param repeatableAnnotation the repeatable annotation type
- * @param annotationContainer the container annotation type
- * @param <T> the repeatable annotation type
- * @param <R> the repeatable container annotation type
- * @return a list with the annotations found (could be empty, but never null).
- */
- public static <T extends Annotation, R extends Annotation> Collection<T>
- getAnnotations(AccessibleObject annotated,
- Class<T> repeatableAnnotation,
- Class<R> annotationContainer){
- List<T> result = new ArrayList<>();
- R containerAnnot = annotated.getAnnotation(annotationContainer);
- if(containerAnnot!=null){
- Method valueMethod;
- try {
- valueMethod = annotationContainer.getMethod("keys");
- result.addAll(Arrays.asList((T[])valueMethod.invoke(containerAnnot)));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to evaluate repeatable annotation.", e);
- }
- }
- else{
- T annot = annotated.getAnnotation(repeatableAnnotation);
- if(annot!=null){
- result.add(annot);
- }
- }
- return result;
- }
-
- /**
- * Utility method to read out repeatable annotations.
- * @param annotationType the annotation type.
- * @param objects the accessible objects to be looked up
- * @param <T> the repeatable annotation type
- * @return a list with the annotations found (could be empty, but never null).
- */
- public static <T extends Annotation> T getAnnotation(
- Class<T> annotationType, AnnotatedElement... objects){
- for(AnnotatedElement obj:objects){
- T annot = obj.getAnnotation(annotationType);
- if(annot!=null){
- return annot;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
index 65db051..72c6541 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
@@ -60,8 +60,7 @@ import java.lang.annotation.*;
* resolved. Hereby the ordering current the annotations define the ordering current resolution, so in the example above
* resolution equals to {@code "aValue", "a.b.keys", "a.b.deprecated.keys"}. If no keys could be read
* fromMap the configuration, it uses the keys fromMap the {@code DefaultValue} annotation. Interesting here
- * is that this keys is not static, it is evaluated by calling
- * {@link org.apache.tamaya.Configuration#evaluateValue(String, org.apache.tamaya.Configuration...)}.
+ * is that this keys is not static, it is evaluated.
*/
@Repeatable(ConfiguredProperties.class)
@Retention(RetentionPolicy.RUNTIME)
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSet.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSet.java b/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSet.java
new file mode 100644
index 0000000..57f4d19
--- /dev/null
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSet.java
@@ -0,0 +1,125 @@
+/*
+ * 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.inject;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * Event that contains a set of changed keys of a {@link org.apache.tamaya.spi.PropertySource}. Any values must
+ * be obtained by calling the {@link org.apache.tamaya.Configuration} due to security reasons. This event can be used
+ * by the {@link org.apache.tamaya.spi.PropertySource} implementation to cleanup caches as needed.
+ * This class is immutable and thread-safe. To create instances use
+ * {@link PropertyChangeSetBuilder}.
+ */
+public final class PropertyChangeSet implements Serializable{
+ /** The serialVersionUID. */
+ private static final long serialVersionUID = 1l;
+ /** The base property source name. */
+ private String propertySourceName;
+ /** The timestamp of the change. */
+ private long timestamp = System.currentTimeMillis();
+ /**
+ * The recorded keys added.
+ */
+ final SortedSet<String> addedKeys = new TreeSet<>();
+
+ /**
+ * The recorded keys updated.
+ */
+ final SortedSet<String> updatedKeys = new TreeSet<>();
+
+ /**
+ * The recorded keys removed.
+ */
+ final SortedSet<String> removedKeys = new TreeSet<>();
+
+
+ /**
+ * Constructor used by {@link PropertyChangeSetBuilder}.
+ * @param builder The builder instance, not null.
+ */
+ PropertyChangeSet(PropertyChangeSetBuilder builder) {
+ this.propertySourceName = Objects.requireNonNull(builder.propertySourceName);
+ this.addedKeys.addAll(builder.addedKeys);
+ this.removedKeys.addAll(builder.removedKeys);
+ this.updatedKeys.addAll(builder.updatedKeys);
+ }
+
+ /**
+ * Get the underlying property provider/configuration.
+ * @return the underlying property provider/configuration, never null.
+ */
+ public String getPropertySourceName(){
+ return this.propertySourceName;
+ }
+
+ /**
+ * Get the timestamp of this changeset. This allows to track, if a ChangeSet was already applied.
+ * @return the timestamp
+ */
+ public long getTimestamp(){
+ return timestamp;
+ }
+
+ /**
+ * Get the keys added.
+ * @return the added keys, never null.
+ */
+ public Collection<String> getKeysAdded(){
+ return Collections.unmodifiableCollection(this.addedKeys);
+ }
+
+ /**
+ * Get the keys removed.
+ * @return the removed keys, never null.
+ */
+ public Collection<String> getKeysRemoved(){
+ return Collections.unmodifiableCollection(this.removedKeys);
+ }
+
+ /**
+ * Get the updated keys.
+ * @return the updated keys, never null.
+ */
+ public Collection<String> getKeysUpdated(){
+ return Collections.unmodifiableCollection(this.addedKeys);
+ }
+
+
+ /**
+ * CHecks if the current change set does not contain any changes.
+ * @return tru, if the change set is empty.
+ */
+ public boolean isEmpty(){
+ return this.addedKeys.isEmpty() && this.updatedKeys.isEmpty() && this.removedKeys.isEmpty();
+ }
+
+
+ @Override
+ public String toString() {
+ return "ConfigChangeSet{" +
+ "propertySourceName=" + propertySourceName +
+ ", timestamp=" + timestamp +
+ ", addedKeys=" + addedKeys +
+ ", updatedKeys=" + updatedKeys +
+ ", removedKeys=" + removedKeys +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSetBuilder.java b/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSetBuilder.java
new file mode 100644
index 0000000..be37f7d
--- /dev/null
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/PropertyChangeSetBuilder.java
@@ -0,0 +1,154 @@
+/*
+ * 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.inject;
+
+import org.apache.tamaya.spi.PropertySource;
+
+import java.beans.PropertyChangeEvent;
+import java.util.*;
+
+/**
+ * Models a set current changes to be applied to a configuration/property provider. Such a set can be applied
+ * to any {@link PropertySource} instance. If the provider is mutable it may check the
+ * version given and applyChanges the changes to the provider/configuration, including triggering current regarding
+ * change events.
+ * <p>
+ * For appropriate conversion a {@code Function<String, Codec>} can be applied, which performs correct conversion,
+ * when changed values are set. This function enables connecting e.g. setters on a configuration template with
+ * the corresponding conversion logic, so the template calls are correctly converted back.
+ */
+public final class PropertyChangeSetBuilder {
+ /**
+ * The recorded changes.
+ */
+ final SortedSet<String> addedKeys = new TreeSet<>();
+
+ /**
+ * The recorded changes.
+ */
+ final SortedSet<String> updatedKeys = new TreeSet<>();
+
+ /**
+ * The recorded changes.
+ */
+ final SortedSet<String> removedKeys = new TreeSet<>();
+
+ /**
+ * The underlying configuration/provider.
+ */
+ String propertySourceName;
+
+ /**
+ * Constructor.
+ *
+ * @param source the underlying configuration/provider, not null.
+ */
+ private PropertyChangeSetBuilder(PropertySource source) {
+ this.propertySourceName = Objects.requireNonNull(source).getName();
+ }
+
+ /**
+ * Creates a new instance current this builder.
+ *
+ * @param source the underlying property provider/configuration, not null.
+ * @return the builder for chaining.
+ */
+ public static PropertyChangeSetBuilder of(PropertySource source) {
+ return new PropertyChangeSetBuilder(source);
+ }
+
+
+ /**
+ * Marks the given key(s) as removed.
+ *
+ * @param keys the keys removed
+ * @return the builder for chaining.
+ */
+ public PropertyChangeSetBuilder remove(String... keys) {
+ for (String removeKey : keys) {
+ this.removedKeys.add(removeKey);
+ }
+ return this;
+ }
+
+ /**
+ * Marks the given key(s) as added.
+ *
+ * @param keys the keys added
+ * @return the builder for chaining.
+ */
+ public PropertyChangeSetBuilder add(String... keys) {
+ for (String addKey : keys) {
+ this.addedKeys.add(addKey);
+ }
+ return this;
+ }
+
+ /**
+ * Marks the given key(s) as updaed.
+ *
+ * @param keys the keys updated
+ * @return the builder for chaining.
+ */
+ public PropertyChangeSetBuilder update(String... keys) {
+ for (String uptKey : keys) {
+ this.updatedKeys.add(uptKey);
+ }
+ return this;
+ }
+
+
+ /**
+ * Compares the two property maps and adds the corresponding updated/aded/removed keys to the builder.
+ *
+ * @param map1 the source map, not null.
+ * @param map2 the target map, not null.
+ * @return the builder for chaining.
+ */
+ public PropertyChangeSetBuilder addChanges(Map<String,String> map1, Map<String,String> map2) {
+ List<PropertyChangeEvent> changes = new ArrayList<>();
+ for (Map.Entry<String, String> en : map1.entrySet()) {
+ String val = map2.get(en.getKey());
+ if (val==null) {
+ remove(en.getKey());
+ } else if (!val.equals(en.getValue())) {
+ update(en.getKey());
+ }
+ }
+ for (Map.Entry<String, String> en : map2.entrySet()) {
+ String val = map1.get(en.getKey());
+ if (val==null) {
+ add(en.getKey());
+ }
+ // update case already handled before!
+ }
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "PropertyChangeEventBuilder [propertySourceName=" + propertySourceName + ", " +
+ ", added=" + addedKeys + ", updated=" + updatedKeys + ", removed=" + removedKeys +"]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
index ac20cb9..acc0cab 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
@@ -41,6 +41,6 @@ public @interface WithPropertyConverter {
* registered, it is handled as a deployment error.
*/
@SuppressWarnings("rawtypes")
- Class<? extends PropertyConverter> value();
+ Class<? extends PropertyConverter<?>> value();
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
index 18d67ac..0d517c7 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
@@ -18,8 +18,8 @@
*/
package org.apache.tamaya.inject.internal;
-import org.apache.tamaya.core.properties.PropertyChangeSet;
import org.apache.tamaya.Configuration;
+import org.apache.tamaya.inject.PropertyChangeSet;
import java.lang.reflect.Method;
import java.util.Optional;
@@ -38,20 +38,14 @@ public final class ConfigChangeCallbackMethod {
private Method callbackMethod;
public ConfigChangeCallbackMethod(Method callbackMethod) {
-// this.callbackMethod = Optional.of(callbackMethod).filter(
-// (m) -> void.class.equals(m.getReturnType()) &&
-// m.getParameterCount() == 1 &&
-// m.getParameterTypes()[0].equals(PropertyChangeSet.class)).get();
+ this.callbackMethod = Optional.of(callbackMethod).filter(
+ (m) -> void.class.equals(m.getReturnType()) &&
+ m.getParameterCount() == 1 &&
+ m.getParameterTypes()[0].equals(PropertyChangeSet.class)).get();
}
- public Consumer<PropertyChangeSet> createConsumer(Object instance, Configuration... configurations){
- // TODO consider also environment !
+ public Consumer<PropertyChangeSet> createConsumer(Object instance){
return event -> {
- for(Configuration cfg:configurations){
- if(event.getPropertySource().getName().equals(cfg.getName())){
- return;
- }
- }
call(instance, event);
};
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
index 323816f..51ab03e 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
@@ -68,7 +68,7 @@ public final class ConfigTemplateInvocationHandler implements InvocationHandler
if ("toString".equals(method.getName())) {
return "Configured Proxy -> " + this.type.getType().getName();
}
- String configValue = InjectionUtils.getConfigValue(method, configurations);
+ String configValue = InjectionUtils.getConfigValue(method);
return InjectionUtils.adaptValue(method, method.getReturnType(), configValue);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
index 106d775..3377e63 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
@@ -47,13 +47,11 @@ public final class ConfigurationInjector {
* Configured the current instance and reigsterd necessary listener to forward config change events as
* defined by the current annotations in place.
* @param instance the instance to be configured
- * @param configurations Configuration instances that replace configuration served by services. This allows
- * more easily testing and adaption.
*/
- public static void configure(Object instance, Configuration... configurations){
+ public static void configure(Object instance){
Class type = Objects.requireNonNull(instance).getClass();
ConfiguredType configuredType = registerType(type);
- Objects.requireNonNull(configuredType).configure(instance, configurations);
+ Objects.requireNonNull(configuredType).configure(instance);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
index dd8b0e2..8f49f14 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
@@ -30,6 +30,7 @@ import org.apache.tamaya.Configuration;
import org.apache.tamaya.inject.ConfiguredProperties;
import org.apache.tamaya.inject.ConfiguredProperty;
import org.apache.tamaya.inject.DefaultAreas;
+import org.apache.tamaya.inject.PropertyChangeSet;
//import org.apache.tamaya.core.internal.Utils;
/**
@@ -55,19 +56,13 @@ public class ConfiguredSetterMethod {
m.getParameterCount() == 1).get();
}
-// public Consumer<PropertyChangeSet> createConsumer(Object instance, Configuration... configurations){
-// // TODO consider environment as well
-// return event -> {
-// for(Configuration cfg:configurations){
-// if(event.getPropertySource().getName().equals(cfg.getName())){
-// // ignore these changes, since this config is overridden.
-// return;
-// }
-// }
-// String configValue = InjectionUtils.getConfigValue(setterMethod, configurations);
-// applyValue(instance,configValue, false, configurations);
-// };
-// }
+ public Consumer<PropertyChangeSet> createConsumer(Object instance){
+ // TODO consider environment as well
+ return event -> {
+ String configValue = InjectionUtils.getConfigValue(setterMethod);
+ applyValue(instance,configValue, false);
+ };
+ }
/**
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
index a3d1284..777430b 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
@@ -22,12 +22,15 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
-import org.apache.tamaya.core.properties.PropertyChangeSet;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertySource;
-import org.apache.tamaya.annotation.*;
-import org.apache.tamaya.core.internal.Utils;
+import org.apache.tamaya.inject.ConfiguredProperties;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultAreas;
+import org.apache.tamaya.inject.NoConfig;
+import org.apache.tamaya.inject.ObservesConfigChange;
+import org.apache.tamaya.inject.PropertyChangeSet;
+import org.apache.tamaya.spi.PropertySource;
/**
* Structure that contains and manages configuration related things for a configured type registered.
@@ -153,21 +156,19 @@ public class ConfiguredType {
* Method called to configure an instance.
*
* @param instance The instance to be configured.
- * @param configurations Configuration instances that replace configuration served by services. This allows
- * more easily testing and adaption.
*/
- public void configure(Object instance, Configuration... configurations) {
+ public void configure(Object instance) {
for (ConfiguredField field : configuredFields) {
- field.applyInitialValue(instance, configurations);
+ field.applyInitialValue(instance);
}
for (ConfiguredSetterMethod method : configuredSetterMethods) {
- method.applyInitialValue(instance, configurations);
+ method.applyInitialValue(instance);
// TODO, if method should be recalled on changes, corresponding callbacks could be registered here
- WeakConfigListenerManager.of().registerConsumer(instance, method.createConsumer(instance, configurations));
+ WeakConfigListenerManager.of().registerConsumer(instance, method.createConsumer(instance));
}
// Register callbacks for this intance (weakly)
for (ConfigChangeCallbackMethod callback : callbackMethods) {
- WeakConfigListenerManager.of().registerConsumer(instance, callback.createConsumer(instance, configurations));
+ WeakConfigListenerManager.of().registerConsumer(instance, callback.createConsumer(instance));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
index 7675abf..3d905d8 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
@@ -27,6 +27,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
@@ -36,41 +38,48 @@ import org.apache.tamaya.inject.DefaultAreas;
import org.apache.tamaya.inject.DefaultValue;
import org.apache.tamaya.inject.WithLoadPolicy;
import org.apache.tamaya.inject.WithPropertyConverter;
+import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
+import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.PropertyConverter;
import org.apache.tamaya.spi.ServiceContext;
+
/**
* Created by Anatole on 19.12.2014.
*/
@SuppressWarnings("unchecked")
final class InjectionUtils {
+ private static final Logger LOG = Logger.getLogger(InjectionUtils.class.getName());
+
private static final boolean resolutionModuleLoaded = checkResolutionModuleLoaded();
private static boolean checkResolutionModuleLoaded() {
- try{
+ try {
Class.forName("org.apache.tamaya.resolver.internal.DefaultExpressionEvaluator");
return true;
- }
- catch(ClassNotFoundException e){
+ } catch (ClassNotFoundException e) {
return false;
}
}
- private InjectionUtils(){}
+ private InjectionUtils() {
+ }
/**
* Evaluates all absolute configuration key based on the annotations found on a class.
*
- * @param areasAnnot the (optional) annotation definining areas to be looked up.
- * @param propertyAnnotation the annotation on field/method level that may defined one or
- * several keys to be looked up (in absolute or relative form).
+ * @param areasAnnot the (optional) annotation definining areas to be looked up.
+ * @param propertyAnnotation the annotation on field/method level that may defined one or
+ * several keys to be looked up (in absolute or relative form).
* @return the list current keys in order how they should be processed/looked up.
*/
public static List<String> evaluateKeys(Member member, DefaultAreas areasAnnot, ConfiguredProperty propertyAnnotation) {
List<String> keys = new ArrayList<>(Arrays.asList(propertyAnnotation.keys()));
if (keys.isEmpty()) //noinspection UnusedAssignment
+ {
keys.add(member.getName());
+ }
ListIterator<String> iterator = keys.listIterator();
while (iterator.hasNext()) {
String next = iterator.next();
@@ -94,30 +103,28 @@ final class InjectionUtils {
/**
* Evaluates all absolute configuration key based on the member name found.
*
- * @param areasAnnot the (optional) annotation definining areas to be looked up.
+ * @param areasAnnot the (optional) annotation definining areas to be looked up.
* @return the list current keys in order how they should be processed/looked up.
*/
public static List<String> evaluateKeys(Member member, DefaultAreas areasAnnot) {
List<String> keys = new ArrayList<>();
String name = member.getName();
String mainKey;
- if(name.startsWith("get") || name.startsWith("set")){
+ if (name.startsWith("get") || name.startsWith("set")) {
mainKey = Character.toLowerCase(name.charAt(3)) + name.substring(4);
- }
- else{
+ } else {
mainKey = Character.toLowerCase(name.charAt(0)) + name.substring(1);
}
keys.add(mainKey);
if (areasAnnot != null) {
// Add prefixed entries, including absolute (root) entry for "" area keys.
for (String area : areasAnnot.value()) {
- if(!area.isEmpty()) {
+ if (!area.isEmpty()) {
keys.add(area + '.' + mainKey);
}
}
- }
- else{ // add package name
- keys.add(member.getDeclaringClass().getName()+'.'+mainKey);
+ } else { // add package name
+ keys.add(member.getDeclaringClass().getName() + '.' + mainKey);
}
return keys;
}
@@ -127,10 +134,10 @@ final class InjectionUtils {
*
* @return the keys to be returned, or null.
*/
- public static String getConfigValue(Method method, Configuration... configurations) {
+ public static String getConfigValue(Method method) {
DefaultAreas areasAnnot = method.getDeclaringClass().getAnnotation(DefaultAreas.class);
WithLoadPolicy loadPolicy = Utils.getAnnotation(WithLoadPolicy.class, method, method.getDeclaringClass());
- return getConfigValueInternal(method, areasAnnot, loadPolicy, configurations);
+ return getConfigValueInternal(method, areasAnnot, loadPolicy);
}
@@ -139,10 +146,10 @@ final class InjectionUtils {
*
* @return the keys to be returned, or null.
*/
- public static String getConfigValue(Field field, Configuration... configurations) {
+ public static String getConfigValue(Field field) {
DefaultAreas areasAnnot = field.getDeclaringClass().getAnnotation(DefaultAreas.class);
WithLoadPolicy loadPolicy = Utils.getAnnotation(WithLoadPolicy.class, field, field.getDeclaringClass());
- return getConfigValueInternal(field, areasAnnot, loadPolicy, configurations);
+ return getConfigValueInternal(field, areasAnnot, loadPolicy);
}
/**
@@ -150,21 +157,18 @@ final class InjectionUtils {
*
* @return the keys to be returned, or null.
*/
- private static String getConfigValueInternal(AnnotatedElement element, DefaultAreas areasAnnot, WithLoadPolicy loadPolicy, Configuration... configurations) {
+ private static String getConfigValueInternal(AnnotatedElement element, DefaultAreas areasAnnot, WithLoadPolicy loadPolicy) {
Collection<ConfiguredProperty> configuredProperties = Utils.getAnnotations(
element, ConfiguredProperty.class, ConfiguredProperties.class);
DefaultValue defaultAnnot = element.getAnnotation(DefaultValue.class);
String configValue = null;
- if(configuredProperties.isEmpty()){
- List<String> keys = InjectionUtils.evaluateKeys((Member)element, areasAnnot);
- Configuration config = InjectionUtils.getConfiguration("default", configurations);
- configValue = evaluteConfigValue(configValue, keys, config);
- }
- else {
+ if (configuredProperties.isEmpty()) {
+ List<String> keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot);
+ configValue = evaluteConfigValue(configValue, keys);
+ } else {
for (ConfiguredProperty prop : configuredProperties) {
List<String> keys = InjectionUtils.evaluateKeys((Member) element, areasAnnot, prop);
- Configuration config = InjectionUtils.getConfiguration(prop, configurations);
- configValue = evaluteConfigValue(configValue, keys, config);
+ configValue = evaluteConfigValue(configValue, keys);
}
}
if (configValue == null && defaultAnnot != null) {
@@ -173,83 +177,64 @@ final class InjectionUtils {
return configValue;
}
- private static String evaluteConfigValue(String configValue, List<String> keys, Configuration config) {
+ private static String evaluteConfigValue(String configValue, List<String> keys) {
for (String key : keys) {
- configValue = config.get(key).orElse(null);
+ configValue = Configuration.current().get(key).orElse(null);
if (configValue != null) {
break;
}
}
- if (configValue != null) {
- // net step perform expression resolution, if any
- configValue = Configuration.evaluateValue(configValue, config);
- }
return configValue;
}
@SuppressWarnings("rawtypes")
- public static <T> T adaptValue(AnnotatedElement element, Class<T> targetType, String configValue){
- try {
- // Check for adapter/filter
-// T adaptedValue = null;
- WithPropertyConverter codecAnnot = element.getAnnotation(WithPropertyConverter.class);
- Class<? extends WithPropertyConverter> codecType;
- if (codecAnnot != null) {
- codecType = codecAnnot.value();
- if (!codecType.equals(WithPropertyConverter.class)) {
+ public static <T> T adaptValue(AnnotatedElement element, Class<T> targetType, String configValue) {
+ // Check for adapter/filter
+ T adaptedValue = null;
+ WithPropertyConverter converterAnnot = element.getAnnotation(WithPropertyConverter.class);
+ Class<? extends PropertyConverter<T>> converterType;
+ if (converterAnnot != null) {
+ converterType = (Class<? extends PropertyConverter<T>>) converterAnnot.value();
+ if (!converterType.equals(WithPropertyConverter.class)) {
+ try {
// TODO cache here...
-// Codec<String> codec = codecType.newInstance();
-// adaptedValue = (T) codec.adapt(configValue);
- }
- }
- if (String.class.equals(targetType)) {
- return (T)configValue;
- } else {
- PropertyConverter<?> adapter = PropertyConverter.getInstance(targetType);
- return (T)adapter.convert(configValue);
- }
- } catch (Exception e) {
- throw new ConfigException("Failed to annotate configured member: " + element, e);
- }
- }
-
- /**
- * This method evaluates the {@link Configuration} that currently is valid for the given target field/method.
- * @param configurations Configuration instances that replace configuration served by services. This allows
- * more easily testing and adaption.
- * @return the {@link Configuration} instance to be used, never null.
- */
- public static Configuration getConfiguration(String name, Configuration... configurations) {
- if(name!=null) {
- for(Configuration conf: configurations){
- if(name.equals(conf.getName())){
- return conf;
+ PropertyConverter<T> codec = PropertyConverter.class.cast(converterType.newInstance());
+ adaptedValue = (T) codec.convert(configValue);
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to convert using explicit PropertyConverter on " + element + ", trying default conversion.", e);
}
}
- return Configuration.current(name);
}
- else{
- for(Configuration conf: configurations){
- if("default".equals(conf.getName())){
- return conf;
+ if (adaptedValue != null) {
+ return adaptedValue;
+ }
+ if (String.class.equals(targetType)) {
+ return (T) configValue;
+ } else {
+ List<PropertyConverter<T>> converters = ServiceContext.getInstance().getService(ConfigurationContext.class).get()
+ .getPropertyConverters(targetType);
+ for (PropertyConverter<T> converter : converters) {
+ adaptedValue = (T) converter.convert(configValue);
+ if (adaptedValue != null) {
+ return adaptedValue;
}
}
+ throw new ConfigException("Non convertible property type: " + element);
}
- return Configuration.current();
}
- public static boolean isResolutionModuleLoaded(){
+ public static boolean isResolutionModuleLoaded() {
return resolutionModuleLoaded;
}
- public static String evaluateValue(String value){
- if(!resolutionModuleLoaded){
+ public static String evaluateValue(String value) {
+ if (!resolutionModuleLoaded) {
return value;
}
ExpressionEvaluator evaluator = ServiceContext.getInstance().getService(ExpressionEvaluator.class).orElse(null);
- if(evaluator!=null){
- return evaluator.filterProperty("<injection>", value, (k) -> Configuration.current().get(k)){
+ if (evaluator != null) {
+ return evaluator.filterProperty("<injection>", value, (k) -> Configuration.current().get(k).orElse(null));
}
return value;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/Utils.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/Utils.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/Utils.java
new file mode 100644
index 0000000..47eec95
--- /dev/null
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/Utils.java
@@ -0,0 +1,126 @@
+/*
+ * 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.inject.internal;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Utility class simplifying some implementation aspects.
+ * Created by Anatole on 11.11.2014.
+ */
+@SuppressWarnings("unchecked")
+public final class Utils {
+
+ private static final Logger LOG = Logger.getLogger(Utils.class.getName());
+
+ private Utils(){}
+
+ /**
+ * Utility method to read out repeatable annotations.
+ * @param annotated the annotated instance.
+ * @param repeatableAnnotation the repeatable annotation type
+ * @param annotationContainer the container annotation type
+ * @param <T> the repeatable annotation type
+ * @param <R> the repeatable container annotation type
+ * @return a list with the annotations found (could be empty, but never null).
+ */
+ public static <T extends Annotation, R extends Annotation> Collection<T>
+ getAnnotations(AnnotatedElement annotated,
+ Class<T> repeatableAnnotation,
+ Class<R> annotationContainer){
+ List<T> result = new ArrayList<>();
+ R containerAnnot = annotated.getAnnotation(annotationContainer);
+ if(containerAnnot!=null){
+ Method valueMethod;
+ try {
+ valueMethod = annotationContainer.getMethod("keys");
+ result.addAll(Arrays.asList((T[])valueMethod.invoke(containerAnnot)));
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to evaluate repeatable annotation.", e);
+ }
+ }
+ else{
+ T annot = annotated.getAnnotation(repeatableAnnotation);
+ if(annot!=null){
+ result.add(annot);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Utility method to read out repeatable annotations.
+ * @param annotated the annotated instance.
+ * @param repeatableAnnotation the repeatable annotation type
+ * @param annotationContainer the container annotation type
+ * @param <T> the repeatable annotation type
+ * @param <R> the repeatable container annotation type
+ * @return a list with the annotations found (could be empty, but never null).
+ */
+ public static <T extends Annotation, R extends Annotation> Collection<T>
+ getAnnotations(AccessibleObject annotated,
+ Class<T> repeatableAnnotation,
+ Class<R> annotationContainer){
+ List<T> result = new ArrayList<>();
+ R containerAnnot = annotated.getAnnotation(annotationContainer);
+ if(containerAnnot!=null){
+ Method valueMethod;
+ try {
+ valueMethod = annotationContainer.getMethod("keys");
+ result.addAll(Arrays.asList((T[])valueMethod.invoke(containerAnnot)));
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to evaluate repeatable annotation.", e);
+ }
+ }
+ else{
+ T annot = annotated.getAnnotation(repeatableAnnotation);
+ if(annot!=null){
+ result.add(annot);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Utility method to read out repeatable annotations.
+ * @param annotationType the annotation type.
+ * @param objects the accessible objects to be looked up
+ * @param <T> the repeatable annotation type
+ * @return a list with the annotations found (could be empty, but never null).
+ */
+ public static <T extends Annotation> T getAnnotation(
+ Class<T> annotationType, AnnotatedElement... objects){
+ for(AnnotatedElement obj:objects){
+ T annot = obj.getAnnotation(annotationType);
+ if(annot!=null){
+ return annot;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
index 4935b30..cf8f9ae 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.inject.internal;
-import org.apache.tamaya.core.properties.PropertyChangeSet;
+import org.apache.tamaya.inject.PropertyChangeSet;
import java.util.Map;
import java.util.WeakHashMap;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/test/java/annottext/AnnotatedConfig.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/annottext/AnnotatedConfig.java b/modules/injection/src/test/java/annottext/AnnotatedConfig.java
index b9160e3..782c5c7 100644
--- a/modules/injection/src/test/java/annottext/AnnotatedConfig.java
+++ b/modules/injection/src/test/java/annottext/AnnotatedConfig.java
@@ -18,10 +18,10 @@
*/
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;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultValue;
+import org.apache.tamaya.inject.LoadPolicy;
+import org.apache.tamaya.inject.WithLoadPolicy;
/**
* An example showing some basic annotations, using an interface to be proxied by the
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/test/java/annottext/AnnotatedFullConfig.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/annottext/AnnotatedFullConfig.java b/modules/injection/src/test/java/annottext/AnnotatedFullConfig.java
index c59fb82..92e71b3 100644
--- a/modules/injection/src/test/java/annottext/AnnotatedFullConfig.java
+++ b/modules/injection/src/test/java/annottext/AnnotatedFullConfig.java
@@ -19,10 +19,10 @@
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;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultValue;
+import org.apache.tamaya.inject.LoadPolicy;
+import org.apache.tamaya.inject.WithLoadPolicy;
/**
* An example showing some basic annotations, using an interface to be proxied by the
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/3a0bf176/modules/injection/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java b/modules/injection/src/test/java/org/apache/tamaya/TestConfigServiceSingletonSpi.java
deleted file mode 100644
index 3245877..0000000
--- a/modules/injection/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("testdata", new MapConfiguration(MetaInfoBuilder.current().setName("testdata").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/3a0bf176/modules/injection/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java b/modules/injection/src/test/java/org/apache/tamaya/TestPropertyAdaptersSingletonSpi.java
deleted file mode 100644
index 65e6c1d..0000000
--- a/modules/injection/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/3a0bf176/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi b/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
deleted file mode 100644
index 1b0cdd4..0000000
--- a/modules/injection/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/3a0bf176/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi b/modules/injection/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
deleted file mode 100644
index e9b04b4..0000000
--- a/modules/injection/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
[2/2] incubator-tamaya git commit: Merge remote-tracking branch
'origin/master'
Posted by an...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/4b001504
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/4b001504
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/4b001504
Branch: refs/heads/master
Commit: 4b0015048f519b6111586c415a93cceb95157d27
Parents: 3a0bf17 5bd97c9
Author: anatole <an...@apache.org>
Authored: Mon Jan 5 10:13:51 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Mon Jan 5 10:13:51 2015 +0100
----------------------------------------------------------------------
.../org/apache/tamaya/core/internal/PropertyConverterManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------