You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/15 17:26:23 UTC
[06/24] incubator-tamaya git commit: Removed all modules from the
main repository. They will be reborn in separate ASF repository.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfiguration.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfiguration.java
deleted file mode 100644
index ad272ef..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfiguration.java
+++ /dev/null
@@ -1,170 +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.mutableconfig.internal;
-
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.ConfigQuery;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.mutableconfig.ChangePropagationPolicy;
-import org.apache.tamaya.mutableconfig.MutableConfiguration;
-import org.apache.tamaya.mutableconfig.spi.ConfigChangeRequest;
-import org.apache.tamaya.mutableconfig.spi.MutablePropertySource;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.logging.Logger;
-
-
-/**
- * Default implementation of a {@link MutableConfiguration}.
- */
-public class DefaultMutableConfiguration implements MutableConfiguration {
- private static final Logger LOG = Logger.getLogger(DefaultMutableConfiguration.class.getName());
- private ConfigChangeRequest changeRequest = new ConfigChangeRequest(UUID.randomUUID().toString());
- private final Configuration config;
- private ChangePropagationPolicy changePropagationPolicy;
-
- public DefaultMutableConfiguration(Configuration config, ChangePropagationPolicy changePropagationPolicy){
- this.config = Objects.requireNonNull(config);
- this.changePropagationPolicy = Objects.requireNonNull(changePropagationPolicy);
- }
-
- @Override
- public ChangePropagationPolicy getChangePropagationPolicy(){
- return changePropagationPolicy;
- }
-
- @Override
- public ConfigChangeRequest getConfigChangeRequest(){
- return changeRequest;
- }
-
- protected List<MutablePropertySource> getMutablePropertySources() {
- List<MutablePropertySource> result = new ArrayList<>();
- for(PropertySource propertySource:this.config.getContext().getPropertySources()) {
- if(propertySource instanceof MutablePropertySource){
- result.add((MutablePropertySource)propertySource);
- }
- }
- return result;
- }
-
-
- @Override
- public MutableConfiguration put(String key, String value) {
- changeRequest.put(key, value);
- return this;
- }
-
- @Override
- public MutableConfiguration putAll(Map<String, String> properties) {
- changeRequest.putAll(properties);
- return this;
- }
-
- @Override
- public MutableConfiguration remove(String... keys) {
- changeRequest.removeAll(Arrays.asList(keys));
- return this;
- }
-
-
- @Override
- public void store() {
- this.changePropagationPolicy.applyChange(changeRequest, config.getContext().getPropertySources());
- }
-
- @Override
- public MutableConfiguration remove(Collection<String> keys) {
- for(MutablePropertySource target:getMutablePropertySources()) {
- changeRequest.removeAll(keys);
- }
- return this;
- }
-
- @Override
- public String get(String key) {
- return this.config.get(key);
- }
-
- @Override
- public String getOrDefault(String key, String defaultValue) {
- return this.config.getOrDefault(key, defaultValue);
- }
-
- @Override
- public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
- return this.config.getOrDefault(key, type, defaultValue);
- }
-
- @Override
- public <T> T get(String key, Class<T> type) {
- return this.config.get(key, type);
- }
-
- @Override
- public <T> T get(String key, TypeLiteral<T> type) {
- return this.config.get(key, type);
- }
-
- @Override
- public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
- return this.config.getOrDefault(key, type, defaultValue);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return this.config.getProperties();
- }
-
- @Override
- public Configuration with(ConfigOperator operator) {
- return operator.operate(this);
- }
-
- @Override
- public <T> T query(ConfigQuery<T> query) {
- return query.query(this);
- }
-
- @Override
- public ConfigurationContext getContext() {
- return config.getContext();
- }
-
- private Collection<PropertySource> getPropertySources() {
- return this.config.getContext().getPropertySources();
- }
-
- @Override
- public String toString() {
- return "DefaultMutableConfiguration{" +
- "config=" + config +
- '}';
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfigurationSpi.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfigurationSpi.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfigurationSpi.java
deleted file mode 100644
index a47cd0e..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/DefaultMutableConfigurationSpi.java
+++ /dev/null
@@ -1,38 +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.mutableconfig.internal;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.mutableconfig.ChangePropagationPolicy;
-import org.apache.tamaya.mutableconfig.MutableConfiguration;
-import org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi;
-
-
-/**
- * SPI implementation that creates instances of {@link DefaultMutableConfiguration}, hereby for
- * each instance of {@link Configuration} a new instance has to be returned.
- */
-public class DefaultMutableConfigurationSpi implements MutableConfigurationProviderSpi {
-
- @Override
- public MutableConfiguration createMutableConfiguration(Configuration configuration,
- ChangePropagationPolicy propagationPolicy){
- return new DefaultMutableConfiguration(configuration, propagationPolicy);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java
deleted file mode 100644
index af9bed4..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java
+++ /dev/null
@@ -1,196 +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.mutableconfig.propertysources;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.mutableconfig.spi.ConfigChangeRequest;
-import org.apache.tamaya.mutableconfig.spi.MutablePropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spi.PropertyValueBuilder;
-import org.apache.tamaya.spisupport.BasePropertySource;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple implementation of a mutable {@link org.apache.tamaya.spi.PropertySource} for .properties files.
- */
-public class MutablePropertiesPropertySource extends BasePropertySource
-implements MutablePropertySource{
-
- /**
- * The logger.
- */
- private static final Logger LOG = Logger.getLogger(MutablePropertiesPropertySource.class.getName());
-
- /**
- * Default update interval is 1 minute.
- */
- private static final long DEFAULT_UPDATE_INTERVAL = 60000L;
-
- /**
- * The property source name.
- */
- private String name;
-
- /**
- * The configuration resource's URL.
- */
- private File file;
-
- /**
- * Timestamp of last read.
- */
- private long lastRead;
-
- /**
- * Interval, when the resource should try to update its contents.
- */
- private long updateInterval = DEFAULT_UPDATE_INTERVAL;
- /**
- * The current properties.
- */
- private Map<String, String> properties = new HashMap<>();
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- *
- * @param propertiesLocation the URL encoded location, not null.
- * @param defaultOrdinal the default ordinal to be used, when no ordinal is provided with the property
- * source's properties.
- */
- public MutablePropertiesPropertySource(File propertiesLocation, int defaultOrdinal) {
- super(defaultOrdinal);
- this.name = propertiesLocation.toString();
- try {
- this.file = propertiesLocation;
- load();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Cannot convert file to URL: " + propertiesLocation, e);
- }
- }
-
- @Override
- public PropertyValue get(String key) {
- Map<String,String> properties = getProperties();
- String val = properties.get(key);
- if(val==null){
- return null;
- }
- PropertyValueBuilder b = new PropertyValueBuilder(key, val, getName());
- String metaKeyStart = "_" + key + ".";
- for(Map.Entry<String,String> en:properties.entrySet()) {
- if(en.getKey().startsWith(metaKeyStart)){
- b.addContextData(en.getKey().substring(metaKeyStart.length()), en.getValue());
- }
- }
- return b.build();
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Map<String, String> getProperties() {
- checkLoad();
- return Collections.unmodifiableMap(this.properties);
- }
-
-
- private void checkLoad() {
- if(file!=null && (lastRead+updateInterval)<System.currentTimeMillis()){
- load();
- }
- }
-
- /**
- * loads the Properties from the given URL
- *
- * @throws IllegalStateException in case of an error while reading properties-file
- */
- private void load() {
- try (InputStream stream = new FileInputStream(file)) {
- Map<String, String> properties = new HashMap<>();
- Properties props = new Properties();
- props.load(stream);
- for (String key : props.stringPropertyNames()) {
- properties.put(key, props.getProperty(key));
- }
- this.lastRead = System.currentTimeMillis();
- LOG.log(Level.FINEST, "Loaded properties from " + file);
- this.properties = properties;
- } catch (IOException e) {
- LOG.log(Level.FINEST, "Cannot load properties from " + file, e);
- }
- }
-
- @Override
- public void applyChange(ConfigChangeRequest change) {
- if(change.isEmpty()){
- LOG.info("Nothing to commit for transaction: " + change.getTransactionID());
- return;
- }
- if(!file.exists()){
- try {
- if(!file.createNewFile()){
- throw new ConfigException("Failed to create config file " + file);
- }
- } catch (IOException e) {
- throw new ConfigException("Failed to create config file " + file, e);
- }
- }
- for(Map.Entry<String,String> en:change.getAddedProperties().entrySet()){
- int index = en.getKey().indexOf('?');
- if(index>0){
- this.properties.put(en.getKey().substring(0, index), en.getValue());
- }else{
- this.properties.put(en.getKey(), en.getValue());
- }
- }
- for(String rmKey:change.getRemovedProperties()){
- this.properties.remove(rmKey);
- }
- try(BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))){
- Properties props = new Properties();
- for (Map.Entry<String,String> en : this.properties.entrySet()) {
- props.setProperty(en.getKey(), en.getValue());
- }
- props.store(bos, "Properties written from Tamaya on " + new Date());
- bos.flush();
- }
- catch(Exception e){
- throw new ConfigException("Failed to write config to " + file, e);
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java
deleted file mode 100644
index 514ed1d..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java
+++ /dev/null
@@ -1,198 +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.mutableconfig.propertysources;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.mutableconfig.spi.ConfigChangeRequest;
-import org.apache.tamaya.mutableconfig.spi.MutablePropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spi.PropertyValueBuilder;
-import org.apache.tamaya.spisupport.BasePropertySource;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple implementation of a mutable {@link org.apache.tamaya.spi.PropertySource} for .xml properties files.
- */
-public class MutableXmlPropertiesPropertySource extends BasePropertySource
-implements MutablePropertySource{
-
- /**
- * The logger.
- */
- private static final Logger LOG = Logger.getLogger(MutableXmlPropertiesPropertySource.class.getName());
- /**
- * Default update interval is 1 minute.
- */
- private static final long DEFAULT_UPDATE_INTERVAL = 60000L;
-
- /**
- * The property source name.
- */
- private String name;
-
- /**
- * The configuration resource's URL.
- */
- private File file;
-
- /**
- * Timestamp of last read.
- */
- private long lastRead;
-
- /**
- * Interval, when the resource should try to update its contents.
- */
- private long updateInterval = DEFAULT_UPDATE_INTERVAL;
- /**
- * The current properties.
- */
- private Map<String, String> properties = new HashMap<>();
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- *
- * @param propertiesLocation the URL encoded location, not null.
- * @param defaultOrdinal the default ordinal to be used, when no ordinal is provided with the property
- * source's properties.
- */
- public MutableXmlPropertiesPropertySource(File propertiesLocation, int defaultOrdinal) {
- super(defaultOrdinal);
- this.name = propertiesLocation.toString();
- try {
- this.file = propertiesLocation;
- load();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Cannot convert file to URL: " + propertiesLocation, e);
- }
- }
-
-
-
- @Override
- public PropertyValue get(String key) {
- Map<String,String> properties = getProperties();
- String val = properties.get(key);
- if(val==null){
- return null;
- }
- PropertyValueBuilder b = new PropertyValueBuilder(key, val, getName());
- String metaKeyStart = "_" + key + ".";
- for(Map.Entry<String,String> en:properties.entrySet()) {
- if(en.getKey().startsWith(metaKeyStart)){
- b.addContextData(en.getKey().substring(metaKeyStart.length()), en.getValue());
- }
- }
- return b.build();
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Map<String, String> getProperties() {
- checkLoad();
- return Collections.unmodifiableMap(this.properties);
- }
-
-
- private void checkLoad() {
- if(file!=null && (lastRead+updateInterval)<System.currentTimeMillis()){
- load();
- }
- }
-
- /**
- * loads the Properties from the given URL
- *
- * @throws IllegalStateException in case of an error while reading properties-file
- */
- private void load() {
- try (InputStream stream = new FileInputStream(file)) {
- Map<String, String> properties = new HashMap<>();
- Properties props = new Properties();
- props.loadFromXML(stream);
- for (String key : props.stringPropertyNames()) {
- properties.put(key, props.getProperty(key));
- }
- this.lastRead = System.currentTimeMillis();
- this.properties = properties;
- LOG.log(Level.FINEST, "Loaded properties from " + file);
- this.properties = properties;
- } catch (IOException e) {
- LOG.log(Level.FINEST, "Cannot load properties from " + file, e);
- }
- }
-
- @Override
- public void applyChange(ConfigChangeRequest configChange) {
- if(configChange.isEmpty()){
- LOG.info("Nothing to commit for transaction: " + configChange.getTransactionID());
- return;
- }
- if(!file.exists()){
- try {
- if(!file.createNewFile()){
- throw new ConfigException("Failed to create config file " + file);
- }
- } catch (IOException e) {
- throw new ConfigException("Failed to create config file " + file, e);
- }
- }
- for(Map.Entry<String,String> en:configChange.getAddedProperties().entrySet()){
- int index = en.getKey().indexOf('?');
- if(index>0){
- this.properties.put(en.getKey().substring(0, index), en.getValue());
- }else{
- this.properties.put(en.getKey(), en.getValue());
- }
- }
- for(String rmKey:configChange.getRemovedProperties()){
- this.properties.remove(rmKey);
- }
- try(BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))){
- Properties props = new Properties();
- for (Map.Entry<String,String> en : this.properties.entrySet()) {
- props.setProperty(en.getKey(), en.getValue());
- }
- props.storeToXML(bos, "Properties written from Tamaya on " + new Date());
- bos.flush();
- }
- catch(Exception e){
- throw new ConfigException("Failed to write config to " + file, e);
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeRequest.java
deleted file mode 100644
index 2349ad1..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeRequest.java
+++ /dev/null
@@ -1,176 +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.mutableconfig.spi;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * Change context used for managing configuration changes within an
- * {@link org.apache.tamaya.mutableconfig.spi.MutablePropertySource}.
- */
-public final class ConfigChangeRequest {
- /**
- * The transaction id.
- */
- private String transactionId;
- /**
- * The starting point.
- */
- private long startedAt = System.currentTimeMillis();
- /**
- * The Properties.
- */
- private final Map<String,String> addedProperties = new HashMap<>();
- /**
- * The Removed.
- */
- private final Set<String> removedProperties = new HashSet<>();
-
- /**
- * Creates a new instance bound to the given transaction.
- * @param transactionID the transaction ID, not null.
- */
- public ConfigChangeRequest(String transactionID){
- this.transactionId = Objects.requireNonNull(transactionID);
- }
-
- /**
- * Sets the started at value. By default {@link #startedAt} is already set on instance creation to
- * {@code System.currentTimeMillis()}.
- * @param startedAt the new UTC POSIX timestamp in millis.
- */
- public void setStartedAt(long startedAt) {
- this.startedAt = startedAt;
- }
-
- /**
- * Get the corresppnding transaction ID of this instance.
- * @return the transaction ID, never null.
- */
- public String getTransactionID(){
- return transactionId;
- }
-
- /**
- * Timestamp in UTC millis, when this transaction (context) was created.
- * @return the timestamp in millis.
- */
- public long getStartedAt(){
- return startedAt;
- }
-
- /**
- * Get an unmodifiable key/value map of properties added or updated.
- * @return an unmodifiable key/value map of properties added or updated, never null.
- */
- public Map<String,String> getAddedProperties(){
- return Collections.unmodifiableMap(addedProperties);
- }
-
- /**
- * Get an unmodifiable key set of properties removed.
- * @return an unmodifiable key set of properties removed, never null.
- */
- public Set<String> getRemovedProperties(){
- return Collections.unmodifiableSet(removedProperties);
- }
-
- /**
- * Adds/updates a new key/value pair.
- * @param key the key, not null.
- * @param value the value, not null.
- */
- public void put(String key, String value) {
- this.addedProperties.put(key, value);
- this.removedProperties.remove(key);
- }
-
- /**
- * Add/updated multiple key/values.
- * @param properties the keys and values to be added/updated, not null.
- */
- public void putAll(Map<String, String> properties) {
- this.addedProperties.putAll(properties);
- this.removedProperties.removeAll(properties.keySet());
- }
-
- /**
- * Remove all the given keys, ir present.
- * @param key the key to be removed, not null.
- */
- public void remove(String key) {
- this.removedProperties.add(key);
- this.addedProperties.remove(key);
- }
-
- /**
- * Remove all the given keys, ir present.
- * @param keys the keys to be removed, not null.
- */
- public void removeAll(Collection<String> keys) {
- this.removedProperties.addAll(keys);
- for(String k:keys) {
- this.addedProperties.remove(k);
- }
- }
-
- /**
- * Allows easily to check if no additions/changes an no removals are present in the current transaction.
- * @return true, if not actions have to be committed.
- */
- public boolean isEmpty() {
- return this.addedProperties.isEmpty() && this.removedProperties.isEmpty();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ConfigChangeRequest)) {
- return false;
- }
- ConfigChangeRequest that = (ConfigChangeRequest) o;
- return transactionId.equals(that.transactionId);
-
- }
-
- @Override
- public int hashCode() {
- return transactionId.hashCode();
- }
-
- @Override
- public String toString() {
- return "ConfigChangeRequest{" +
- "transactionId=" + transactionId +
- ", startedAt=" + startedAt +
- ", addedProperties=" + addedProperties +
- ", removedProperties=" + removedProperties +
- '}';
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java
deleted file mode 100644
index 4412085..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java
+++ /dev/null
@@ -1,42 +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.mutableconfig.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.mutableconfig.ChangePropagationPolicy;
-import org.apache.tamaya.mutableconfig.MutableConfiguration;
-
-
-/**
- * Provider SPI used by {@link org.apache.tamaya.mutableconfig.MutableConfigurationProvider}. Providers may override
- * other providers registering with a higher {@link javax.annotation.Priority} value annotated.
- */
-public interface MutableConfigurationProviderSpi {
-
- /**
- * Creates a new {@link MutableConfiguration} with {@code autoCommit = false} as default.
- *
- * @param configuration the configuration, not null.
- * @param propagationPolicy policy that defines how changes are published to the property
- * sources.
- * @return a new mutable configuration instance.
- */
- MutableConfiguration createMutableConfiguration(Configuration configuration,
- ChangePropagationPolicy propagationPolicy);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutablePropertySource.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutablePropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutablePropertySource.java
deleted file mode 100644
index b648341..0000000
--- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutablePropertySource.java
+++ /dev/null
@@ -1,47 +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.mutableconfig.spi;
-
-import org.apache.tamaya.spi.PropertySource;
-
-
-/**
- * This interface models a writable backend for configuration data.
- *
- * As a consequence clients should first check, using the corresponding methods, if entries are to edited or removedProperties
- * actually are eligible for change/creation or removal.
- */
-public interface MutablePropertySource extends PropertySource {
-
- /**
- * Puts all given configuration entries. This method should check that all given properties are
- * basically removable, as defined by #isWritable. If any of the passed keys is not writable during this initial
- * check, the operation should not perform any configuration changes and throw a {@link org.apache.tamaya.ConfigException}. If errors
- * occur afterwards, when the properties are effectively written back to the backends, the errors should be
- * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
- * remove all entries as far as possible and abort the writing operation.
- *
- * @param configChange the {@link ConfigChangeRequest}, containing the transactionId used to isolate
- * the change, the properties to be added/overridden and the property keys
- * being removed.
- * @throws org.apache.tamaya.ConfigException if any of the given properties could not be written, or the request is read-only.
- */
- void applyChange(ConfigChangeRequest configChange);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi b/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi
deleted file mode 100644
index eb366fc..0000000
--- a/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi
+++ /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.mutableconfig.internal.DefaultMutableConfigurationSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
deleted file mode 100644
index 814f3ce..0000000
--- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
+++ /dev/null
@@ -1,187 +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.mutableconfig;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.mutableconfig.internal.WritablePropertiesSource;
-import org.apache.tamaya.mutableconfig.internal.WritableXmlPropertiesSource;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link MutableConfiguration}.
- */
-public class MutableConfigurationTest {
-
- /**
- * Test create change request.
- *
- * @throws Exception the exception
- */
- @Test
- public void testCreateMutableConfiguration() throws Exception {
- File f = File.createTempFile("ConfigChangeRequest",".properties");
- MutableConfiguration cfg1 = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration(),
- MutableConfigurationProvider.getApplyAllChangePolicy());
- assertNotNull(cfg1);
- assertNotNull(cfg1.getConfigChangeRequest());
- MutableConfiguration cfg2 = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration());
- assertNotNull(cfg2);
- assertNotNull(cfg2.getConfigChangeRequest());
- assertTrue(cfg1!=cfg2);
- assertTrue(cfg1.getConfigChangeRequest()!=cfg2.getConfigChangeRequest());
- }
-
- /**
- * Test null create change request.
- *
- * @throws Exception the exception
- */
- @Test(expected=NullPointerException.class)
- public void testNullCreateMutableConfiguration1() throws Exception {
- MutableConfigurationProvider.createMutableConfiguration(
- (Configuration) null);
- }
-
- /**
- * Test null create change request.
- *
- * @throws Exception the exception
- */
- @Test(expected=NullPointerException.class)
- public void testNullCreateMutableConfiguration2() throws Exception {
- MutableConfigurationProvider.createMutableConfiguration(
- (ChangePropagationPolicy) null);
- }
-
- /**
- * Test read write properties with rollback.
- *
- * @throws IOException the io exception
- */
- @Test
- public void testReadWriteProperties_WithCancel() throws IOException {
- WritablePropertiesSource.target.delete();
- MutableConfiguration mutConfig = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration()
- );
- mutConfig.put("key1", "value1");
- Map<String,String> cm = new HashMap<>();
- cm.put("key2", "value2");
- cm.put("key3", "value3");
- }
-
- /**
- * Test read write properties with commit.
- *
- * @throws IOException the io exception
- */
- @Test
- public void testReadWriteProperties_WithCommit() throws IOException {
- WritablePropertiesSource.target.delete();
- MutableConfiguration mutConfig = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration()
- );
- mutConfig.put("key1", "value1");
- Map<String,String> cm = new HashMap<>();
- cm.put("key2", "value2");
- cm.put("key3", "value3");
- mutConfig.putAll(cm);
- mutConfig.store();
- assertTrue(WritablePropertiesSource.target.exists());
- MutableConfiguration mmutConfig2 = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration()
- );
- mmutConfig2.remove("foo");
- mmutConfig2.remove("key3");
- mmutConfig2.put("key1", "value1.2");
- mmutConfig2.put("key4", "value4");
- mmutConfig2.store();
- Properties props = new Properties();
- props.load(WritablePropertiesSource.target.toURL().openStream());
- assertEquals(3, props.size());
- assertEquals("value1.2", props.getProperty("key1"));
- assertEquals("value2", props.getProperty("key2"));
- assertEquals("value4", props.getProperty("key4"));
- }
-
- /**
- * Test read write xml properties with commit.
- *
- * @throws IOException the io exception
- */
- @Test
- public void testReadWriteXmlProperties_WithCommit() throws IOException {
- WritableXmlPropertiesSource.target.delete();
- MutableConfiguration cfg = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration(), MutableConfigurationProvider.getApplyAllChangePolicy());
- cfg.put("key1", "value1");
- Map<String,String> cm = new HashMap<>();
- cm.put("key2", "value2");
- cm.put("key3", "value3");
- cfg.putAll(cm);
- cfg.store();
- assertTrue(WritableXmlPropertiesSource.target.exists());
- MutableConfiguration cfg2 = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration());
- assertTrue(cfg != cfg2);
- cfg2.remove("foo");
- cfg2.remove("key3");
- cfg2.put("key1", "value1.2");
- cfg2.put("key4", "value4");
- cfg2.store();
- Properties props = new Properties();
- props.loadFromXML( WritableXmlPropertiesSource.target.toURL().openStream());
- assertEquals(3, props.size());
- assertEquals("value1", props.getProperty("key1"));
- assertEquals("value2", props.getProperty("key2"));
- }
-
- /**
- * Test read write xml properties with commit.
- *
- * @throws IOException the io exception
- */
- @Test
- public void testWriteWithNoChangePolicy() throws IOException {
- WritableXmlPropertiesSource.target.delete();
- MutableConfiguration cfg = MutableConfigurationProvider.createMutableConfiguration(
- ConfigurationProvider.getConfiguration(),
- MutableConfigurationProvider.getApplyNonePolicy());
- cfg.put("key1", "value1");
- Map<String,String> cm = new HashMap<>();
- cm.put("key2", "value2");
- cm.put("key3", "value3");
- cfg.putAll(cm);
- cfg.store();
- assertFalse(WritableXmlPropertiesSource.target.exists());
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigBackendTest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigBackendTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigBackendTest.java
deleted file mode 100644
index e6c79f5..0000000
--- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigBackendTest.java
+++ /dev/null
@@ -1,29 +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.mutableconfig.internal;
-
-import org.apache.tamaya.mutableconfig.propertysources.MutablePropertiesPropertySource;
-
-
-/**
- * Tests for {@link MutablePropertiesPropertySource}.
- */
-public class PropertiesFileConfigBackendTest {
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritablePropertiesSource.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritablePropertiesSource.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritablePropertiesSource.java
deleted file mode 100644
index 5257c8b..0000000
--- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritablePropertiesSource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.mutableconfig.internal;
-
-import org.apache.tamaya.mutableconfig.propertysources.MutablePropertiesPropertySource;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Writable test property source based on the {@link MutablePropertiesPropertySource}.
- */
-public class WritablePropertiesSource extends MutablePropertiesPropertySource {
-
- public static File target = createFile();
-
- private static File createFile() {
- try {
- return File.createTempFile("writableProps",".properties");
- } catch (IOException e) {
- e.printStackTrace();
- throw new IllegalStateException("Cannot init test.", e);
- }
- }
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- */
- public WritablePropertiesSource() throws IOException {
- super(target, 100);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritableXmlPropertiesSource.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritableXmlPropertiesSource.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritableXmlPropertiesSource.java
deleted file mode 100644
index d6aa7ec..0000000
--- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/WritableXmlPropertiesSource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.mutableconfig.internal;
-
-import org.apache.tamaya.mutableconfig.propertysources.MutableXmlPropertiesPropertySource;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Writable test property source based on the {@link MutableXmlPropertiesPropertySource}.
- */
-public class WritableXmlPropertiesSource extends MutableXmlPropertiesPropertySource {
-
- public static File target = createFile();
-
- private static File createFile() {
- try {
- return File.createTempFile("writableProps",".xml");
- } catch (IOException e) {
- e.printStackTrace();
- throw new IllegalStateException("Cannot init test.", e);
- }
- }
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- */
- public WritableXmlPropertiesSource() throws IOException {
- super(target, 200);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/mutable-config/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/modules/mutable-config/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 609b9fe..0000000
--- a/modules/mutable-config/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding 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.mutableconfig.internal.WritablePropertiesSource
-org.apache.tamaya.mutableconfig.internal.WritableXmlPropertiesSource
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/optional/pom.xml
----------------------------------------------------------------------
diff --git a/modules/optional/pom.xml b/modules/optional/pom.xml
deleted file mode 100644
index 622c3f7..0000000
--- a/modules/optional/pom.xml
+++ /dev/null
@@ -1,81 +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.ext</groupId>
- <artifactId>tamaya-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-optional</artifactId>
- <name>Apache Tamaya Modules - Optional Configuration Backend</name>
- <description>This module provides a simple class that can be used as a single dependency for evaluating
- configuration. It runs basically without Tamaya being on the classpath, but if available it
- considers/uses Tamaya functionality.</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.optional
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java
----------------------------------------------------------------------
diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java b/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java
deleted file mode 100644
index 86df274..0000000
--- a/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java
+++ /dev/null
@@ -1,33 +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.optional;
-
-/**
- * Evaluation policy that determines if local configuration or Tamaya configuration values override.
- */
-public enum EvaluationPolicy {
- /** Values from Tamaya (if available) always override values from the default provider. */
- TAMAYA_OVERRIDES_OTHER,
- /** Values from value provider always override values from Tamaya (if available). */
- OTHER_OVERRIDES_TAMAYA,
- /** No overrides are allowed. If both the value provider and Tamaya return values not equal a RuntimeException
- * is thrown.
- */
- THROWS_EXCEPTION
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java b/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java
deleted file mode 100644
index 4868bc1..0000000
--- a/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java
+++ /dev/null
@@ -1,214 +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.optional;
-
-
-import java.util.Objects;
-
-import org.apache.tamaya.ConfigurationProvider;
-
-/**
- * Simplified configuration API, that can be used by code that only wants Tamaya to optionally enhance its configuration
- * mechanism, but by default uses its own configuration by default.
- */
-public final class OptionalConfiguration {
-
- /**
- * Flag only true, if Tamaya is on the classpath.
- */
- private static final boolean TAMAYA_LOADED = initTamayaLoaded();
-
- /**
- * Configuration API to be loaded.
- */
- private static final String TAMAYA_CONFIGURATION = "org.apache.tamaya.Configuration";
-
- /**
- * Tries to load the Tamaya Configuration interface from the classpath.
- *
- * @return true, if the interface is available.
- */
- private static boolean initTamayaLoaded() {
- try {
- Class.forName(TAMAYA_CONFIGURATION);
- return true;
- } catch (final Exception e) {
- return false;
- }
- }
-
- /**
- * Default value provider returning Strings from system properties and the system environment.
- * In all other cases {@code null} is returned.
- */
- public static final ValueProvider DEFAULT_PROVIDER = new ValueProvider() {
- @SuppressWarnings("unchecked")
- @Override
- public <T> T get(String key, Class<T> type) {
- if (String.class == type) {
- String value = System.getProperty(key);
- if (value == null) {
- value = System.getenv(key);
- }
- return (T) value;
- }
- return null;
- }
- };
-
- /**
- * Default value provider that always returns {@code null}.
- */
- public static final ValueProvider NULLPROVIDER = new ValueProvider() {
- @Override
- public <T> T get(String key, Class<T> type) {
- return null;
- }
- };
-
- /**
- * Delegating value getter used to evaluate values, depending on the fallback policy.
- */
- private final ValueProvider provider;
-
- /**
- * Evaluation policy that determines if local configuration or Tamaya configuration values override.
- */
- private final EvaluationPolicy policy;
-
- /**
- * Creates a new instance.
- *
- * @param policy the policy how a value should be evaluated depending if Tamaya is available or not.
- * @param provider the non Tamaya-based provider to be used to evaluate values.
- */
- private OptionalConfiguration(EvaluationPolicy policy, ValueProvider provider) {
- this.provider = Objects.requireNonNull(provider);
- this.policy = Objects.requireNonNull(policy);
- }
-
- /**
- * Returns an instance of OptionalConfiguration, which uses the given provider and policy for evaluating the values.
- *
- * @param policy the policy how a value should be evaluated depending if Tamaya is available or not.
- * @param provider the non Tamaya-based provider to be used to evaluate values.
- * @return a default OptionalConfiguration instance, never null.
- */
- public static OptionalConfiguration of(EvaluationPolicy policy, ValueProvider provider) {
- return new OptionalConfiguration(policy, provider);
- }
-
- /**
- * Returns a default instance, which uses a default provider returning values from system properties and environment
- * only.
- *
- * @param policy the policy how a value should be evaluated depending if Tamaya is available or not.
- * @return a default OptionalConfiguration instance, never null.
- */
- public static OptionalConfiguration of(EvaluationPolicy policy) {
- return new OptionalConfiguration(policy, DEFAULT_PROVIDER);
- }
-
- /**
- * Access a String value.
- *
- * @param key the key, not null.
- * @return the value found, or null.
- */
- public String get(String key) {
- return get(key, String.class);
- }
-
- /**
- * Access a String value.
- *
- * @param key the key, not null.
- * @param defaultValue the default value, returned if no such key is found in the configuration.
- * @return the value found, or null.
- */
- public String getOrDefault(String key, String defaultValue) {
- final String value = get(key, String.class);
- if (value == null) {
- return defaultValue;
- }
- return value;
- }
-
- /**
- * Method that returns the corresponding value, depending on the availability of Tamaya, the
- * registered provider and evaluation policy.
- *
- * @param key the key, not null.
- * @param type the target type, not null.
- * @param <T> the type param.
- * @return the value, or null.
- */
- public <T> T get(String key, Class<T> type) {
- final T value = provider.get(key, type);
- final T tamayaValue = getTamaya(key, type);
- switch (policy) {
- case OTHER_OVERRIDES_TAMAYA:
- return value != null ? value : tamayaValue;
- case TAMAYA_OVERRIDES_OTHER:
- return tamayaValue != null ? tamayaValue : value;
- case THROWS_EXCEPTION:
- if (tamayaValue != value) {
- if ((tamayaValue != null && !tamayaValue.equals(value)) ||
- (value != null && TAMAYA_LOADED && !value.equals(tamayaValue))) {
- throw new IllegalStateException("Incompatible configuration values: key=" + key +
- "=" + value + "(provider)/" + tamayaValue + "(Tamaya");
- }
- }
- default:
- }
- return value;
- }
-
- /**
- * Access a String value.
- *
- * @param key the key, not null.
- * @param type the target type, not null.
- * @param <T> the type param.
- * @param defaultValue the default value, returned if no such key is found in the configuration.
- * @return the value found, or null.
- */
- public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
- final T value = get(key, type);
- if (value == null) {
- return defaultValue;
- }
- return value;
- }
-
- /**
- * Internal method that evaluates a value from Tamaya, when Tamaya is loaded.
- *
- * @param key the key, not null.
- * @param type the target type, not null.
- * @param <T> The type param
- * @return the corresponding value from Tamaya, or null.
- */
- private <T> T getTamaya(String key, Class<T> type) {
- if (TAMAYA_LOADED) {
- return ConfigurationProvider.getConfiguration().get(key, type);
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java
----------------------------------------------------------------------
diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java b/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java
deleted file mode 100644
index 4ca88b0..0000000
--- a/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java
+++ /dev/null
@@ -1,40 +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.optional;
-
-/**
- * Simple (functional) interface, compatible with Java 7 that models a component that provides values.
- * It is the {@link EvaluationPolicy} that also must be passed, when creating an {@link OptionalConfiguration},
- * which is defining if values from this provider are overriding values from Tamaya (if available) or vice
- * versa. This provider interface must be implemented by the client that wants to optionally enhance its
- * code with optional Tamaya configuration support to create a bridge between his code and the values optionally
- * returned by Tamaya.
- */
-public interface ValueProvider {
-
- /**
- * Access a typed value given a (non empty) key.
- * @param key the key, not null.
- * @param type the type, not null.
- * @param <T> the type
- * @return the value found, or null.
- */
- <T> T get(String key, Class<T> type);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/optional/src/test/java/org/apache/tamaya/optional/OptionalConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/optional/src/test/java/org/apache/tamaya/optional/OptionalConfigurationTest.java b/modules/optional/src/test/java/org/apache/tamaya/optional/OptionalConfigurationTest.java
deleted file mode 100644
index d91f260..0000000
--- a/modules/optional/src/test/java/org/apache/tamaya/optional/OptionalConfigurationTest.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.optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by Anatole on 07.09.2015.
- */
-public class OptionalConfigurationTest {
-
- @org.junit.Test
- public void testOf_OTHER_OVERRIDES_TAMAYA() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.OTHER_OVERRIDES_TAMAYA, new ValueProvider() {
- @Override
- public <T> T get(String key, Class<T> type) {
- return (T)"result";
- }
- });
- assertNotNull(cfg);
- assertEquals(cfg.get("sdkjsdkjsdkjhskjdh"), "result");
- assertEquals(cfg.get("sdkjsdkjsdsdsdkjhskjdh", String.class), "result");
- assertEquals(cfg.get("java.version", String.class), "result");
- }
-
- @org.junit.Test
- public void testOf_TAMAYA_OVERRIDES_OTHER() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.TAMAYA_OVERRIDES_OTHER, new ValueProvider() {
- @Override
- public <T> T get(String key, Class<T> type) {
- return (T)"result";
- }
- });
- assertNotNull(cfg);
- assertEquals(cfg.get("sdkjsdkjsdkjhskjdh"), "result");
- assertEquals(cfg.get("sdkjsdkjsdsdsdkjhskjdh", String.class), "result");
- assertEquals(cfg.get("java.version", String.class), System.getProperty("java.version"));
- }
-
- @org.junit.Test(expected = IllegalStateException.class)
- public void testOf_THROWS_EXCEPTION() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.THROWS_EXCEPTION, new ValueProvider() {
- @Override
- public <T> T get(String key, Class<T> type) {
- if("java.version".equals(key)){
- return (T)System.getProperty(key);
- }
- return (T)"result";
- }
- });
- assertNotNull(cfg);
- assertEquals(cfg.get("sdkjsdkjsdkjhskjdh"), "result");
- assertEquals(cfg.get("sdkjsdkjsdsdsdkjhskjdh", String.class), "result");
- assertEquals(cfg.get("java.version", String.class), System.getProperty("java.version"));
- assertEquals(cfg.get("java.version", String.class), "dfdf");
- }
-
- @org.junit.Test
- public void testOf_NOPROV_THROWS_EXCEPTION() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.THROWS_EXCEPTION);
- assertNotNull(cfg);
- assertNull(cfg.get("sdkjsdkjsdkjhskjdh"));
- assertEquals(cfg.get("java.version"), System.getProperty("java.version"));
- assertEquals(cfg.get("java.version", String.class), System.getProperty("java.version"));
- }
-
- @org.junit.Test
- public void testOf_NOPROV_TAMAYA_OVERRIDES_OTHER() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.TAMAYA_OVERRIDES_OTHER);
- assertNotNull(cfg);
- assertNull(cfg.get("sdkjsdkjsdkjhskjdh"));
- assertEquals(cfg.get("java.version"), System.getProperty("java.version"));
- assertEquals(cfg.get("java.version", String.class), System.getProperty("java.version"));
- }
-
- @org.junit.Test
- public void testOf_NOPROV_OTHER_OVERRIDES_TAMAYA() throws Exception {
- OptionalConfiguration cfg = OptionalConfiguration.of(EvaluationPolicy.OTHER_OVERRIDES_TAMAYA);
- assertNotNull(cfg);
- assertNull(cfg.get("sdkjsdkjsdkjhskjdh"));
- assertEquals(cfg.get("java.version"), System.getProperty("java.version"));
- assertEquals(cfg.get("java.version", String.class), System.getProperty("java.version"));
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
deleted file mode 100644
index e32b92f..0000000
--- a/modules/pom.xml
+++ /dev/null
@@ -1,119 +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.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-extensions</artifactId>
- <groupId>org.apache.tamaya.ext</groupId>
- <name>Apache Tamaya Extension Modules - all</name>
- <description>This project contains the several extensions that can be used with Tamaya.</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>builder</module>
- <module>classloader-support</module>
- <module>collections</module>
- <module>events</module>
- <module>filter</module>
- <module>formats</module>
- <module>functions</module>
- <module>injection</module>
- <module>injection-api</module>
-
- <module>integration</module>
-
- <module>json</module>
- <module>management</module>
- <module>model</module>
- <module>mutable-config</module>
- <module>optional</module>
- <module>resolver</module>
- <module>resources</module>
- <module>server</module>
- <module>spi-support</module>
- <module>yaml</module>
- </modules>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <logViolationsToConsole>true</logViolationsToConsole>
- <configLocation>checkstyle/style.xml</configLocation>
- </configuration>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>buildconfigurations</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-versions</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireJavaVersion>
- <version>[1.7,)</version>
- </requireJavaVersion>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <failOnError>false</failOnError>
- <excludeFilterFile>findbugs/findbugs-exclude.xml</excludeFilterFile>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>buildconfigurations</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
- </plugins>
- </build>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml
deleted file mode 100644
index 596abb7..0000000
--- a/modules/resolver/pom.xml
+++ /dev/null
@@ -1,85 +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.ext</groupId>
- <artifactId>tamaya-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>tamaya-resolver</artifactId>
- <name>Apache Tamaya Modules - Resolver Services</name>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-resources</artifactId>
- <version>${project.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.resolver,
- org.apache.tamaya.resolver.spi
- </Export-Package>
- <Private-Package>
- org.apache.tamaya.resolver.internal
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java
deleted file mode 100644
index eadb547..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java
+++ /dev/null
@@ -1,77 +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.resolver;
-
-import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
-import org.apache.tamaya.resolver.spi.ExpressionResolver;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import java.util.Collection;
-
-/**
- * Resolver singleton.
- */
-public final class Resolver {
-
- /**
- * Singleton constructor.
- */
- private Resolver(){}
-
- /**
- * Evaluates the current expression.
- * @param key the key, not null.
- * @param value the value to be filtered/evaluated.
- * @return the filtered/evaluated value, including null.
- */
- public static String evaluateExpression(String key, String value){
- return ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class)
- .evaluateExpression(key, value, true);
- }
-
- /**
- * Evaluates the current expression.
- * @param value the value to be filtered/evaluated.
- * @return the filtered/evaluated value, including null.
- */
- public static String evaluateExpression(String value){
- return evaluateExpression(value, true);
- }
-
- /**
- * Evaluates the current expression.
- * @param value the value to be filtered/evaluated.
- * @param maskNotFound if true, not found expression parts will be replaced vy surrounding with [].
- * Setting to false will replace the value with an empty String.
- * @return the filtered/evaluated value, including null.
- */
- public static String evaluateExpression(String value, boolean maskNotFound){
- return ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class)
- .evaluateExpression(null, value, maskNotFound);
- }
-
- /**
- * Access a collection with the currently registered {@link ExpressionResolver} instances.
- * @return the resolvers currently known, never null.
- */
- public static Collection<ExpressionResolver> getResolvers(){
- return ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class)
- .getResolvers();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java
deleted file mode 100644
index 4708a39..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java
+++ /dev/null
@@ -1,43 +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.resolver.internal;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.resolver.spi.ExpressionResolver;
-
-import javax.annotation.Priority;
-
-/**
- * Property resolver implementation that interprets the resolver expression as a reference to another configuration
- * entry. It can be explicitly addressed by prefixing {@code conf:}, e.g. {@code ${conf:my.other.config.value}}.
- */
-@Priority(200)
-public final class ConfigResolver implements ExpressionResolver{
-
- @Override
- public String getResolverPrefix() {
- return "conf:";
- }
-
- @Override
- public String evaluate(String expression){
- return ConfigurationProvider.getConfiguration().get(expression);
- }
-
-}