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:22 UTC
[05/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/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
deleted file mode 100644
index 85fe845..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
+++ /dev/null
@@ -1,260 +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.resolver.spi.ExpressionEvaluator;
-import org.apache.tamaya.resolver.spi.ExpressionResolver;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.annotation.Priority;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Default expression evaluator that manages several instances of {@link org.apache.tamaya.resolver.spi.ExpressionResolver}.
- * Each resolver is identified by a resolver id. Each expression passed has the form resolverId:resolverExpression, which
- * has the advantage that different resolvers can be active in parallel.
- */
-@Priority(10000)
-public class DefaultExpressionEvaluator implements ExpressionEvaluator {
-
- private static final Logger LOG = Logger.getLogger(DefaultExpressionEvaluator.class.getName());
-
- private final List<ExpressionResolver> resolvers = new ArrayList<>();
-
- /**
- * Comparator used (not needed with Java8).
- */
- private static final Comparator<ExpressionResolver> RESOLVER_COMPARATOR = new Comparator<ExpressionResolver>() {
- @Override
- public int compare(ExpressionResolver o1, ExpressionResolver o2) {
- return compareExpressionResolver(o1, o2);
- }
- };
-
- /**
- * Default constructor.
- */
- public DefaultExpressionEvaluator() {
- for (ExpressionResolver resolver : ServiceContextManager.getServiceContext().getServices(ExpressionResolver.class)) {
- resolvers.add(resolver);
- }
- Collections.sort(resolvers, RESOLVER_COMPARATOR);
- }
-
- /**
- * Order ExpressionResolver reversely, the most important come first.
- *
- * @param res1 the first ExpressionResolver
- * @param res2 the second ExpressionResolver
- * @return the comparison result.
- */
- private static int compareExpressionResolver(ExpressionResolver res1, ExpressionResolver res2) {
- Priority prio1 = res1.getClass().getAnnotation(Priority.class);
- Priority prio2 = res2.getClass().getAnnotation(Priority.class);
- int ord1 = prio1 != null ? prio1.value() : 0;
- int ord2 = prio2 != null ? prio2.value() : 0;
- if (ord1 < ord2) {
- return -1;
- } else if (ord1 > ord2) {
- return 1;
- } else {
- return res1.getClass().getName().compareTo(res2.getClass().getName());
- }
- }
-
- /**
- * Resolves an expression in the form current <code>${resolverId:expression}</code> or
- * <code>${<prefix>expression}</code>. The expression can be
- * part current any type current literal text. Also multiple expressions with mixed matching resolvers are
- * supported.
- * All control characters (${}\) can be escaped using '\'.<br>
- * So all the following are valid expressions:
- * <ul>
- * <li><code>${expression}</code></li>
- * <li><code>bla bla ${expression}</code></li>
- * <li><code>${expression} bla bla</code></li>
- * <li><code>bla bla ${expression} bla bla</code></li>
- * <li><code>${expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${expression} bar ${resolverId2:expression2}</code></li>
- * <li><code>${expression}foo${resolverId2:expression2}bar</code></li>
- * <li><code>foor${expression}bar${resolverId2:expression2}more</code></li>
- * <li><code>\${expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
- * </ul>
- * Given {@code resolverId:} is a valid prefix targeting a {@link java.beans.Expression} explicitly, also the
- * following expressions are valid:
- * <ul>
- * <li><code>${resolverId:expression}</code></li>
- * <li><code>bla bla ${resolverId:expression}</code></li>
- * <li><code>${resolverId:expression} bla bla</code></li>
- * <li><code>bla bla ${resolverId:expression} bla bla</code></li>
- * <li><code>${resolverId:expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${resolverId:expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${resolverId:expression} bar ${resolverId2:expression2}</code></li>
- * <li><code>${resolverId:expression}foo${resolverId2:expression2}bar</code></li>
- * <li><code>foor${resolverId:expression}bar${resolverId2:expression2}more</code></li>
- * <li><code>\${resolverId:expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
- * </ul>
- *
- * @param key the key to be filtered
- * @param value value to be analyzed for expressions
- * @param maskUnresolved if true, not found expression parts will be replaced by surrounding with [].
- * Setting to false will replace the value with an empty String.
- * @return the resolved value, or the input in case where no expression was detected.
- */
- @Override
- public String evaluateExpression(String key, String value, boolean maskUnresolved){
- if(value ==null){
- return null;
- }
- StringTokenizer tokenizer = new StringTokenizer(value, "${}", true);
- StringBuilder resolvedValue = new StringBuilder();
- StringBuilder current = new StringBuilder();
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- switch (token) {
- case "$":
- String nextToken = tokenizer.hasMoreTokens()?tokenizer.nextToken():"";
- if (!"{".equals(nextToken)) {
- current.append(token);
- current.append(nextToken);
- break;
- }
- if(value.indexOf('}')<=0){
- current.append(token);
- current.append(nextToken);
- break;
- }
- String subExpression = parseSubExpression(tokenizer, value);
- String res = evaluateInternal(subExpression, maskUnresolved);
- if(res!=null) {
- current.append(res);
- }
- break;
- default:
- current.append(token);
- }
- }
- if (current.length() > 0) {
- resolvedValue.append(current);
- }
- return resolvedValue.toString();
- }
-
- @Override
- public Collection<ExpressionResolver> getResolvers() {
- return new ArrayList<>(this.resolvers);
- }
-
- /**
- * Parses subexpression from tokenizer, hereby counting all open and closed brackets, but ignoring any
- * meta characters.
- * @param tokenizer the current tokenizer instance
- * @param valueToBeFiltered subexpression to be filtered for
- * @return the parsed sub expression
- */
- private String parseSubExpression(StringTokenizer tokenizer, String valueToBeFiltered) {
- StringBuilder expression = new StringBuilder();
- boolean escaped = false;
- while(tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- switch (token) {
- case "\\":
- if(!escaped) {
- escaped = true;
-
- } else {
- expression.append(token);
- escaped = false;
- }
- break;
- case "{":
- if(!escaped) {
- LOG.warning("Ignoring not escaped '{' in : " + valueToBeFiltered);
- }
- expression.append(token);
- escaped = false;
- break;
- case "$":
- if(!escaped) {
- LOG.warning("Ignoring not escaped '$' in : " + valueToBeFiltered);
- }
- expression.append(token);
- escaped = false;
- break;
- case "}":
- if(escaped) {
- expression.append(token);
- escaped = false;
- } else{
- return expression.toString();
- }
- break;
- default:
- expression.append(token);
- escaped = false;
- break;
- }
- }
- LOG.warning("Invalid expression syntax in: " + valueToBeFiltered + ", expression does not close!");
- return valueToBeFiltered;
- }
-
- /**
- * Evaluates the expression parsed, hereby checking for prefixes and trying otherwise all available resolvers,
- * based on priority.
- * @param unresolvedExpression the parsed, but unresolved expression
- * @param maskUnresolved if true, not found expression parts will be replaced by surrounding with [].
- * Setting to false will replace the value with an empty String.
- * @return the resolved expression, or null.
- */
- private String evaluateInternal(String unresolvedExpression, boolean maskUnresolved) {
- String value = null;
- // 1 check for explicit prefix
- for(ExpressionResolver resolver:resolvers){
- if(unresolvedExpression.startsWith(resolver.getResolverPrefix())){
- value = resolver.evaluate(unresolvedExpression.substring(resolver.getResolverPrefix().length()));
- break;
- }
- }
- if(value==null){
- for(ExpressionResolver resolver:resolvers){
- try{
- value = resolver.evaluate(unresolvedExpression);
- if(value!=null){
- return value;
- }
- }catch(Exception e){
- LOG.log(Level.FINEST, "Error during expression resolution from " + resolver, e);
- }
- }
- }
- if(value==null){
- LOG.log(Level.WARNING, "Unresolvable expression encountered " + unresolvedExpression);
- if(maskUnresolved){
- value = "?{" + unresolvedExpression + '}';
- }
- }
- return value;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
deleted file mode 100644
index efe0788..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.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.resolver.internal;
-
-import org.apache.tamaya.resolver.spi.ExpressionResolver;
-
-import javax.annotation.Priority;
-
-/**
- * Property resolver implementation that interprets the resolver expressions as environment properties. It can be
- * explicitly addressed by prefixing {@code env:}, e.g. {@code ${env:MACHINE_NAME}}.
- */
-@Priority(0)
-public final class EnvironmentPropertyResolver implements ExpressionResolver{
-
- @Override
- public String getResolverPrefix() {
- return "env:";
- }
-
- @Override
- public String evaluate(String expression){
- return System.getenv(expression);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java
deleted file mode 100644
index 20e2c7a..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java
+++ /dev/null
@@ -1,86 +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.resolver.spi.ExpressionEvaluator;
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.annotation.Priority;
-import java.util.logging.Logger;
-
-/**
- * Default expression evaluator that manages several instances of {@link org.apache.tamaya.resolver.spi.ExpressionResolver}.
- * Each resolver is identified by a resolver id. Each expression passed has the form resolverId:resolverExpression, which
- * has the advantage that different resolvers can be active in parallel.
- */
-@Priority(10000)
-public class ExpressionResolutionFilter implements PropertyFilter {
-
- private static final Logger LOG = Logger.getLogger(ExpressionResolutionFilter.class.getName());
-
- private final ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext().getService(ExpressionEvaluator.class);
-
- /**
- * Resolves an expression in the form current <code>${resolverId:expression}</code> or
- * <code>${<prefix>expression}</code>. The expression can be
- * part current any type current literal text. Also multiple expressions with mixed matching resolvers are
- * supported.
- * All control characters (${}\) can be escaped using '\'.<br>
- * So all the following are valid expressions:
- * <ul>
- * <li><code>${expression}</code></li>
- * <li><code>bla bla ${expression}</code></li>
- * <li><code>${expression} bla bla</code></li>
- * <li><code>bla bla ${expression} bla bla</code></li>
- * <li><code>${expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${expression} bar ${resolverId2:expression2}</code></li>
- * <li><code>${expression}foo${resolverId2:expression2}bar</code></li>
- * <li><code>foor${expression}bar${resolverId2:expression2}more</code></li>
- * <li><code>\${expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
- * </ul>
- * Given {@code resolverId:} is a valid prefix targeting a {@link java.beans.Expression} explicitly, also the
- * following expressions are valid:
- * <ul>
- * <li><code>${resolverId:expression}</code></li>
- * <li><code>bla bla ${resolverId:expression}</code></li>
- * <li><code>${resolverId:expression} bla bla</code></li>
- * <li><code>bla bla ${resolverId:expression} bla bla</code></li>
- * <li><code>${resolverId:expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${resolverId:expression}${resolverId2:expression2}</code></li>
- * <li><code>foo ${resolverId:expression} bar ${resolverId2:expression2}</code></li>
- * <li><code>${resolverId:expression}foo${resolverId2:expression2}bar</code></li>
- * <li><code>foor${resolverId:expression}bar${resolverId2:expression2}more</code></li>
- * <li><code>\${resolverId:expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
- * </ul>
- *
- * @param context the filter context
- * @param valueToBeFiltered value to be analyzed for expressions
- * @return the resolved value, or the input in case where no expression was detected.
- */
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context){
- LOG.finest("Resolving " + valueToBeFiltered + "(key=" + context.getKey() + ")");
- return evaluator.evaluateExpression(context.getKey(), valueToBeFiltered, true);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/FileResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/FileResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/FileResolver.java
deleted file mode 100644
index 6050ac2..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/FileResolver.java
+++ /dev/null
@@ -1,120 +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.resolver.spi.ExpressionResolver;
-import org.apache.tamaya.resource.ResourceResolver;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.annotation.Priority;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * <p>Property resolver implementation that tries to load the given resource from the current file system.</p>
- *
- * <p>If the {@code Resources} module is available this module is used for resolving the expression. It can be
- * explicitly addressed by prefixing {@code file:}, e.g. {@code ${file:c:/temp/mytext.txt}}.</p>
- */
-@Priority(400)
-public final class FileResolver implements ExpressionResolver {
- /**
- * The looger used.
- */
- private final Logger LOG = Logger.getLogger(FileResolver.class.getName());
-
- /**
- * Flag that controls if the Tamaya Resource loader is available.
- */
- private static final boolean IS_RESOURCE_MODULE_AVAILABLE = checkResourceModule();
-
- /**
- * Checks if the Tamaya ResourceLoader can be loaded from the classpath.
- *
- * @return true, if the module is available.
- */
- private static boolean checkResourceModule() {
- try {
- Class.forName("org.apache.tamaya.resource.ResourceResolver.", false, FileResolver.class.getClassLoader());
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- @Override
- public String getResolverPrefix() {
- return "file:";
- }
-
- @Override
- public String evaluate(String expression) {
- URL url = getUrl(expression);
- if(url==null){
- return null;
- }
- try (InputStreamReader streamReader = new InputStreamReader(url.openStream(), UTF_8);
- BufferedReader bufferedReader = new BufferedReader(streamReader)) {
- StringBuilder builder = new StringBuilder();
- String inputLine;
-
- while ((inputLine = bufferedReader.readLine()) != null) {
- builder.append(inputLine).append("\n");
- }
-
- return builder.toString();
- } catch (Exception e) {
- LOG.log(Level.FINEST, "Could not resolve URL: " + expression, e);
- return null;
- }
- }
-
- private URL getUrl(String expression) {
- if (IS_RESOURCE_MODULE_AVAILABLE) {
- ResourceResolver resolver = ServiceContextManager.getServiceContext().getService(ResourceResolver.class);
- Collection<URL> resources = resolver.getResources("file:" + expression);
- if (!resources.isEmpty()) {
- if (resources.size() != 1) {
- LOG.log(Level.WARNING, "Unresolvable expression (ambiguous resource): " + expression);
- return null;
- }
- return resources.iterator().next();
- }
- } else {
- File file = new File(expression);
- if (file.exists()) {
- try {
- return file.toURI().toURL();
- } catch (MalformedURLException e) {
- LOG.log(Level.WARNING, "Unresolvable expression (cannot convert file to URL): " + expression, e);
- }
- }
- }
- return null; // no such resource found
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java
deleted file mode 100644
index 270459c..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java
+++ /dev/null
@@ -1,151 +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.resolver.spi.ExpressionResolver;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.annotation.Priority;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * <p>Property resolver implementation that tries to load the given resource from the current classpath using the
- * Thread Context classloader, and as fallback from the classloader that loaded this module and system classloader.
- * It can be explicitly addressed by prefixing {@code resource:}, e.g. {@code ${resource:META-INF/VERSION}}.</p>
- *
- * <p>If the {@code Resources} module is available this module is used for resolving the expression.</p>
- */
-@Priority(300)
-public final class ResourceResolver implements ExpressionResolver {
- /**
- * The looger used.
- */
- private final Logger LOG = Logger.getLogger(ResourceResolver.class.getName());
-
- /**
- * Flag that controls if the Tamaya Resource loader is available.
- */
- private static final boolean IS_RESOURCE_MODULE_AVAILABLE = checkResourceModule();
-
- /**
- * Checks if the Tamaya ResourceLoader can be loaded from the classpath.
- *
- * @return true, if the module is available.
- */
- private static boolean checkResourceModule() {
- try {
- Class.forName("org.apache.tamaya.resource.ResourceResolver", false, ResourceResolver.class.getClassLoader());
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- @Override
- public String getResolverPrefix() {
- return "resource:";
- }
-
- @Override
- public String evaluate(String expression) {
- List<ClassLoader> classLoaders = new ArrayList<>();
- for (ClassLoader cl : new ClassLoader[]{Thread.currentThread().getContextClassLoader(), getClass().getClassLoader(), ClassLoader.getSystemClassLoader()}) {
- if (!classLoaders.contains(cl)) {
- classLoaders.add(cl);
- }
- }
- return readURL(expression, classLoaders);
- }
-
- private String readURL(String expression, List<ClassLoader> classLoaders) {
- URL url = getUrl(expression, classLoaders);
- if(url==null){
- return null;
- }
- try (InputStreamReader streamReader = new InputStreamReader(url.openStream(), UTF_8);
- BufferedReader bufferedReader = new BufferedReader(streamReader)){
-
- StringBuilder builder = new StringBuilder();
- String inputLine;
-
- while ((inputLine = bufferedReader.readLine()) != null) {
- builder.append(inputLine).append("\n");
- }
-
- return builder.toString();
- } catch (Exception e) {
- LOG.log(Level.FINEST, "Could not resolve URL: " + expression, e);
- return null;
- }
- }
-
- private URL getUrl(String expression, List<ClassLoader> classLoaders) {
- if (IS_RESOURCE_MODULE_AVAILABLE) {
- org.apache.tamaya.resource.ResourceResolver resolver = ServiceContextManager.getServiceContext()
- .getService(org.apache.tamaya.resource.ResourceResolver.class);
- for (ClassLoader cl : classLoaders) {
- Collection<URL> resources = resolver.getResources(cl, expression);
- if (!resources.isEmpty()) {
- if (resources.size() != 1) {
- LOG.log(Level.WARNING, "Unresolvable expression (ambiguous resource): " + expression);
- return null;
- }
- return resources.iterator().next();
- }
- }
- } else {
- for (ClassLoader cl : classLoaders) {
- List<URL> resources = new ArrayList<>();
- Enumeration<URL> found;
- try {
- found = cl.getResources(expression);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Error resolving expression: " + expression, e);
- continue;
- }
- while (found.hasMoreElements()) {
- resources.add(found.nextElement());
- }
- if (!resources.isEmpty()) {
- if (resources.size() != 1) {
- LOG.log(Level.WARNING, "Unresolvable expression (ambiguous resource): " + expression);
- return null;
- }
- return resources.get(0);
- }
- }
- if (expression.contains("*") || expression.contains("?")) {
- LOG.warning("Rouse not found: " + expression + "(Hint: expression contains expression" +
- " placeholders, but resource module is not loaded.");
- }
- }
- return null; // no such resource found
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
deleted file mode 100644
index 9b04a4f..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.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.resolver.internal;
-
-import org.apache.tamaya.resolver.spi.ExpressionResolver;
-
-import javax.annotation.Priority;
-
-/**
- * Property resolver implementation that interprets the resolver expression as system property name.
- * It can be explicitly addressed by prefixing {@code sys:}, e.g. {@code ${sys:mySystemProperty}}.
- */
-@Priority(100)
-public final class SystemPropertyResolver implements ExpressionResolver{
-
- @Override
- public String getResolverPrefix() {
- return "sys:";
- }
-
- @Override
- public String evaluate(String expression){
- return System.getProperty(expression);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/URLResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/URLResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/URLResolver.java
deleted file mode 100644
index 32195f8..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/URLResolver.java
+++ /dev/null
@@ -1,66 +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.resolver.spi.ExpressionResolver;
-
-import javax.annotation.Priority;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * Property resolver implementation that interprets the resolver expression as an URL to be resolved.
- * It can be explicitly addressed by prefixing {@code url:}, e.g. {@code ${url:http//www.oracle.com}}.
- */
-@Priority(500)
-public final class URLResolver implements ExpressionResolver {
-
- private final Logger LOG = Logger.getLogger(URLResolver.class.getName());
-
- @Override
- public String getResolverPrefix() {
- return "url:";
- }
-
- @Override
- public String evaluate(String expression) {
- try {
- URL url = new URL(expression);
- try (InputStreamReader inputStreamReader = new InputStreamReader(url.openStream(), UTF_8);
- BufferedReader bufferedReader = new BufferedReader(inputStreamReader))
- {
- StringBuilder builder = new StringBuilder();
- String inputLine;
- while ((inputLine = bufferedReader.readLine()) != null) {
- builder.append(inputLine).append("\n");
- }
- return builder.toString();
- }
- } catch (Exception e) {
- LOG.log(Level.FINEST, "Could not resolve URL: " + expression, e);
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/package-info.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/package-info.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/package-info.java
deleted file mode 100644
index e858854..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * This package contains the default implementation for file, classpath and URL resolution, as well as resolution of
- * configuration cross references.
- */
-package org.apache.tamaya.resolver.internal;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/package-info.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/package-info.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/package-info.java
deleted file mode 100644
index 15ebe22..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * This package contains the API of the resolver module.
- */
-package org.apache.tamaya.resolver;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
deleted file mode 100644
index 96dbb66..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
+++ /dev/null
@@ -1,66 +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.spi;
-
-
-import java.util.Collection;
-
-/**
- * Interface that provides an SPI that can be accessed from the current {@link org.apache.tamaya.spi.ServiceContext},
- * which allows to pass expression that contain placeholders and variable expressions. Expressions passed hereby
- * use UNIX styled variable syntax as follows:
- * <pre>
- * ${expression}
- * My name is ${expression}.
- * Also multiple expressions are support, e.g. ${expression1}, ${expression2}.
- * </pre>
- *
- * By default all registered instances of {@link org.apache.tamaya.resolver.spi.ExpressionResolver} are called to
- * evaluate an expression, depending on the annotatated {@link javax.annotation.Priority} on the resolver classes.
- * Nevertheless with {@link ExpressionResolver#getResolverPrefix()} each resolver instance defines a unique id, by
- * which a resolver can be explicitly addressed as follows:
- * <pre>
- * ${env:MACHINE_NAME}
- * My name is ${sys:instance.name}.
- * Also multiple expressions are supported, e.g. ${resource:META-INF/version.conf}, ${file:C:/temp/version.txt},
- * ${url:http://configserver/name}.
- * </pre>
- * Basically this service is consumed by an instance of {@link org.apache.tamaya.spi.PropertyFilter}, which
- * takes the configuration values found and passes them to this evaluator, when expressions are detected. This
- * also done iteratively, so also multi-stepped references (references, which themselves must be evaluated as well)
- * are supported.
- */
-public interface ExpressionEvaluator {
- /**
- * Evaluates the current expression.
- * @param key the key, not null.
- * @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.
- */
- String evaluateExpression(String key, String value, boolean maskNotFound);
-
- /**
- * Access a collection with the currently registered {@link org.apache.tamaya.resolver.internal.ConfigResolver} instances.
- * @return the resolvers currently known, never null.
- */
- Collection<ExpressionResolver> getResolvers();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
deleted file mode 100644
index d07fe05..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
+++ /dev/null
@@ -1,48 +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.spi;
-
-
-/**
- * This interfaces provides a model for expression evaluation. This enables transparently plugin expression languages
- * as needed. In a Java EE context full fledged EL may be used, whereas in ME only simple replacement mechanisms
- * are better suited to the runtime requirements.
- */
-public interface ExpressionResolver {
-
- /**
- * Get the unique resolver prefix. This allows to address a resolver explicitly, in case of conflicts. By
- * default all registered resolvers are called in order as defined by the {@link javax.annotation.Priority}
- * annotation.
- *
- * @return the prefix that identifies this resolver instance, e.g. 'config:'. The ':' hereby is not required as a
- * separator, but it is recommended to use it, because it fits well, with the other existing resolvers and
- * is easy to read.
- */
- String getResolverPrefix();
-
- /**
- * Evaluates the given expression.
- *
- * @param expression the expression to be evaluated, not null. If a resolver was addressed explicitly,
- * the prefix is removed prior to calling this method.
- * @return the evaluated expression, or null, if the evaluator is not able to resolve the expression.
- */
- String evaluate(String expression);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/package-info.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/package-info.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/package-info.java
deleted file mode 100644
index ef4a2b8..0000000
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * This package contains the SPI of the resolver module, allowing overriding/adding of resolution mechanisms
- * as well as the overall evaluation mechanism.
- */
-package org.apache.tamaya.resolver.spi;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator b/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
deleted file mode 100644
index aa766b6..0000000
--- a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
+++ /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.resolver.internal.DefaultExpressionEvaluator
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionResolver
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionResolver b/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionResolver
deleted file mode 100644
index cb7ced0..0000000
--- a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionResolver
+++ /dev/null
@@ -1,24 +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.resolver.internal.SystemPropertyResolver
-org.apache.tamaya.resolver.internal.EnvironmentPropertyResolver
-org.apache.tamaya.resolver.internal.ResourceResolver
-org.apache.tamaya.resolver.internal.ConfigResolver
-org.apache.tamaya.resolver.internal.FileResolver
-org.apache.tamaya.resolver.internal.URLResolver
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter b/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
deleted file mode 100644
index c8788b5..0000000
--- a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
+++ /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.resolver.internal.ExpressionResolutionFilter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java
deleted file mode 100644
index f795ee1..0000000
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java
+++ /dev/null
@@ -1,121 +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.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class that test resolution of different values as configured within
- * {@link org.apache.tamaya.resolver.MyTestPropertySource} and on test resource path.
- */
-public class ConfigResolutionTest {
-
- @Test
- public void test_Prefix_Resolution() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Before Text (prefixed)"), "My Java version is " + System.getProperty("java.version"));
- }
-
- @Test
- public void test_Midfix_Resolution() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Before and After Text (prefixed)"), "My Java version is " + System.getProperty("java.version") + ".");
- }
-
- @Test
- public void test_Prefix_Resolution_BadSyntax1() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Will fail1."), "V$java.version");
- }
-
- @Test
- public void test_Prefix_Resolution_BadSyntax2() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Will fail2."), "V$java.version}");
- }
-
- @Test
- public void test_Prefix_Resolution_BadSyntax31() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Will not fail3."), "V${java.version");
- }
-
- @Test
- public void test_Prefix_Resolution_Escaped1() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Will not fail1."), "V$\\{java.version");
- }
-
- @Test
- public void test_Prefix_Resolution_Escaped2() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Will not fail2."), "V\\${java.version");
- }
-
- @Test
- public void test_Prefix_Resolution_EnvKeys() {
- assertEquals(ConfigurationProvider.getConfiguration().get("env.keys"), System.getProperty("java.version") + " plus $java.version");
- }
-
- @Test
- public void test_Prefix_ExpressionOnly_Resolution() {
- assertEquals(ConfigurationProvider.getConfiguration().get("Expression Only"), System.getProperty("java.version"));
- }
-
- @Test
- public void testConfig_Refs() {
- assertEquals(ConfigurationProvider.getConfiguration().get("config-ref"), "Expression Only -> " + System.getProperty("java.version"));
- assertEquals(ConfigurationProvider.getConfiguration().get("config-ref3"), "Config Ref 3 -> Ref 2: Config Ref 2 -> Ref 1: Expression Only -> " + System.getProperty("java.version"));
- assertEquals(ConfigurationProvider.getConfiguration().get("config-ref2"), "Config Ref 2 -> Ref 1: Expression Only -> " + System.getProperty("java.version"));
- }
-
- @Test
- public void testClasspath_Refs() {
- String value = ConfigurationProvider.getConfiguration().get("cp-ref");
- assertNotNull(value);
- assertTrue(value.contains("This content comes from Testresource.txt!"));
- }
-
- @Test
- public void testResource_Refs() {
- String value = ConfigurationProvider.getConfiguration().get("res-ref");
- assertNotNull(value);
- assertTrue(value.contains("This content comes from Testresource.txt!"));
- }
-
- @Test
- public void testFile_Refs() {
- String value = ConfigurationProvider.getConfiguration().get("file-ref");
- assertNotNull(value);
- assertTrue(value.contains("This content comes from Testresource2.txt!"));
- }
-
- @Test
- public void testURL_Refs() {
- String value = ConfigurationProvider.getConfiguration().get("url-ref");
- assertNotNull(value);
- assertTrue(value.contains("doctype html") || "[http://www.google.com]".equals(value));
- }
-
- @Test
- public void testEscaping(){
- assertEquals(ConfigurationProvider.getConfiguration().get("escaped"),
- "Config Ref 3 -> Ref 2: \\${conf:config-ref2 will not be evaluated and will not contain\\t tabs \\n " +
- "newlines or \\r returns...YEP!");
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
deleted file mode 100644
index 7d99cbc..0000000
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
+++ /dev/null
@@ -1,102 +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.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by Anatole on 04.01.2015.
- */
-public class MyTestPropertySource implements PropertySource{
-
- private final Map<String,String> properties = new HashMap<>();
-
- public MyTestPropertySource(){
- properties.put("Expression Only", "${java.version}");
- properties.put("Expression Only (prefixed)", "${sys:java.version}");
- properties.put("Before Text", "My Java version is ${java.version}");
- properties.put("Before Text (prefixed)", "My Java version is ${sys:java.version}");
- properties.put("Before and After Text", "My Java version is ${java.version}.");
- properties.put("Before and After Text (prefixed)", "My Java version is ${sys:java.version}.");
- properties.put("Multi-expression", "Java version ${sys:java.version} and line.separator ${line.separator}.");
-
- properties.put("cp-ref", "${resource:Testresource.txt}");
- properties.put("file-ref", "${file:"+getFileRefAsString()+"}");
- properties.put("res-ref", "${resource:Test?es*ce.txt}");
- properties.put("url-ref", "${url:http://www.google.com}");
- properties.put("config-ref", "Expression Only -> ${conf:Expression Only}");
- properties.put("config-ref2", "Config Ref 2 -> Ref 1: ${conf:config-ref}");
- properties.put("config-ref3", "Config Ref 3 -> Ref 2: ${conf:config-ref2}");
-
- properties.put("Will fail1.", "V$java.version");
- properties.put("Will fail2.", "V$java.version}");
- properties.put("Will not fail3.", "V${java.version");
- properties.put("Will not fail1.", "V$\\{java.version");
- properties.put("Will not fail2.", "V\\${java.version");
-
- properties.put("env.keys", "${java.version} plus $java.version");
-
- properties.put("escaped", "Config Ref 3 -> Ref 2: \\${conf:config-ref2 will not be evaluated and will not contain\\t tabs \\n " +
- "newlines or \\r returns...YEP!");
- }
-
- private String getFileRefAsString() {
- try {
- URL res = getClass().getClassLoader().getResource("Testresource2.txt");
- if(res==null){
- return null;
- }
- return new File(res.toURI()).getAbsolutePath().replaceAll("\\\\","/");
- } catch (URISyntaxException e) {
- return "Failed to evaluate file: Testresource2.txt";
- }
- }
-
- @Override
- public int getOrdinal() {
- return 0;
- }
-
- @Override
- public String getName() {
- return "test";
- }
-
- @Override
- public PropertyValue get(String key) {
- return PropertyValue.of(key, properties.get(key), getName());
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public boolean isScannable() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java
deleted file mode 100644
index 74c9d84..0000000
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java
+++ /dev/null
@@ -1,41 +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.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link org.apache.tamaya.resolver.Resolver}.
- */
-public class ResolverTest {
-
- @Test
- public void testEvaluateExpression() throws Exception {
- assertEquals(Resolver.evaluateExpression("myKey", "Version ${java.version}"),
- "Version " + System.getProperty("java.version"));
- }
-
- @Test
- public void testEvaluateExpression1() throws Exception {
- assertEquals(Resolver.evaluateExpression("Version ${java.version}"),
- "Version " + System.getProperty("java.version"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/modules/resolver/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 088aca9..0000000
--- a/modules/resolver/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.resolver.MyTestPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/resources/Testresource.txt
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/resources/Testresource.txt b/modules/resolver/src/test/resources/Testresource.txt
deleted file mode 100644
index 9731609..0000000
--- a/modules/resolver/src/test/resources/Testresource.txt
+++ /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.
-#
-This content comes from Testresource.txt!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resolver/src/test/resources/Testresource2.txt
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/resources/Testresource2.txt b/modules/resolver/src/test/resources/Testresource2.txt
deleted file mode 100644
index a43bf62..0000000
--- a/modules/resolver/src/test/resources/Testresource2.txt
+++ /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.
-#
-This content comes from Testresource2.txt!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resources/README.md
----------------------------------------------------------------------
diff --git a/modules/resources/README.md b/modules/resources/README.md
deleted file mode 100644
index 96afaa3..0000000
--- a/modules/resources/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
-Apache Tamaya Resources Module
-------------------------------
-
-The Apache Tamaya resources module provides an additional service called 'ResourceLoader', which is accessible
-from the ServiceContext. The new service allows resolution of resources (modelled as URL) using Ant styled
-patterns:
-
-* ? may represent any character (but there must be one)
-* * may represent any character in the path (can be none or multiple)
-* ** may be used to let the pattern matcher go down the hierarchy of files od resources in the current locations.
-
-The resolver supports by default resolving paths in the file system and within the classpath, e.g.
-
- resources_testRoot/**/*.file
- c:\temp\**\*
-
-In case of a conflict the resolver mechanism can also be explicitly addressed by adding the regarding prefix, so
-the above expressions above are equivalent to
-
- classpath:resources_testRoot/**/*.file
- file:c:\temp\**\*
-
-Most benefits are created, when also using the formats module, which provides an implementation of a
-PropertySourceProvider taking a set of paths to be resolved and a number of supported formats.
-
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resources/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resources/pom.xml b/modules/resources/pom.xml
deleted file mode 100644
index 1ba7dbe..0000000
--- a/modules/resources/pom.xml
+++ /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 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-resources</artifactId>
- <name>Apache Tamaya Modules - Resource 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.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.resource
- </Export-Package>
- <Private-Package>
- org.apache.tamaya.resource.internal
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java b/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java
deleted file mode 100644
index 1b62c65..0000000
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java
+++ /dev/null
@@ -1,193 +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.resource;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.PropertyValue;
-
-/**
- * Abstract base class that uses a descriptive resource path to define the locations of configuration files to be
- * included into the configuration. This is especially useful, when the current configuration policy in place
- * does not define the exact file names, but the file locations, where configuration can be provided.
- */
-public abstract class AbstractPathPropertySourceProvider implements PropertySourceProvider{
- /** The log used. */
- private static final Logger LOG = Logger.getLogger(AbstractPathPropertySourceProvider.class.getName());
- /** The resource paths. */
- private String[] resourcePaths;
-
-
- /**
- * Creates a new instance using the given resource paths.
- * @param resourcePaths the resource paths, not null, not empty.
- */
- public AbstractPathPropertySourceProvider(String... resourcePaths){
- if(resourcePaths.length==0){
- throw new IllegalArgumentException("At least one resource path should be configured.");
- }
- this.resourcePaths = resourcePaths.clone();
- }
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- List<PropertySource> propertySources = new ArrayList<>();
- for(String resource:resourcePaths) {
- try {
- Collection<URL> resources = ConfigResources.getResourceResolver().getResources(resource);
- for (URL url : resources) {
- try {
- Collection<PropertySource> propertySourcesToInclude = getPropertySources(url);
- if(propertySourcesToInclude!=null){
- propertySources.addAll(propertySourcesToInclude);
- }
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to read configuration from " + url, e);
- }
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Invalid resource path: " + resource, e);
- }
- }
- return propertySources;
- }
-
- /**
- * Factory method that creates a {@link org.apache.tamaya.spi.PropertySource} based on the URL found by
- * the resource locator.
- * @param url the URL, not null.
- * @return the {@link org.apache.tamaya.spi.PropertySource}s to be included into the current provider's sources
- * list. It is safe to return {@code null} here, in case the content of the URL has shown to be not relevant
- * as configuration input. In case the input is not valid or accessible an exception can be thrown or logged.
- */
- protected abstract Collection<PropertySource> getPropertySources(URL url);
-
- /**
- * Utility method that reads a .properties file from the given url and creates a corresponding
- * {@link org.apache.tamaya.spi.PropertySource}.
- * @param url the url to read, not null.
- * @return the corresponding PropertySource, or null.
- */
- public static PropertySource createPropertiesPropertySource(URL url) {
- Properties props = new Properties();
- try(InputStream is = url.openStream()){
- props.load(is);
- return new PropertiesBasedPropertySource(url.toString(), props);
- }
- catch(Exception e){
- LOG.log(Level.WARNING, "Failed to read properties from " + url, e);
- return null;
- }
- }
-
- /**
- * Minimal {@link PropertySource} implementation based on {@link Properties} or
- * {@link Map}.
- */
- private final static class PropertiesBasedPropertySource implements PropertySource{
- /** The property source's name. */
- private final String name;
- /** The properties. */
- private final Map<String,String> properties = new HashMap<>();
-
- /**
- * Constructor for a simple properties configuration.
- * @param name the source's name, not null
- * @param props the properties, not null
- */
- public PropertiesBasedPropertySource(String name, Properties props) {
- this.name = name;
- for (Entry<Object, Object> en : props.entrySet()) {
- this.properties.put(en.getKey().toString(), String.valueOf(en.getValue()));
- }
- }
-
- /**
- * Constructor for a simple properties configuration.
- * @param name the source's name, not null
- * @param props the properties, not null
- */
- public PropertiesBasedPropertySource(String name, Map<String,String> props) {
- this.name = Objects.requireNonNull(name);
- this.properties.putAll(props);
- }
-
- @Override
- public int getOrdinal() {
- PropertyValue configuredOrdinal = get(TAMAYA_ORDINAL);
- if (configuredOrdinal != null) {
- try {
- return Integer.parseInt(configuredOrdinal.getValue());
- } catch (Exception e) {
- Logger.getLogger(getClass().getName()).log(Level.WARNING,
- "Configured Ordinal is not an int number: " + configuredOrdinal, e);
- }
- }
- return getDefaultOrdinal();
- }
-
- /**
- * Returns the default ordinal used, when no ordinal is set, or the ordinal was not parseable to an int value.
- *
- * @return the default ordinal used, by default 0.
- */
- public int getDefaultOrdinal() {
- return 0;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public PropertyValue get(String key) {
- return PropertyValue.of(key, getProperties().get(key), getName());
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public boolean isScannable() {
- return false;
- }
-
- @Override
- public String toString(){
- return "PropertiesBasedPropertySource["+name+']';
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java b/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java
deleted file mode 100644
index cb8c1f5..0000000
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java
+++ /dev/null
@@ -1,111 +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.resource;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * Interface to be implemented by modules. It supports loading of files or classpath resources either directly or by
- * defining a Ant-styled resource pattern:
- * <ul>
- * <li>'*' is a placeholder for any character (0..n)</li>
- * <li>'**' is a placeholder for any number of subdirectories going down a directory structure recursively.</li>
- * <li>'?' is a placeholder for exact one character</li>
- * </ul>
- * Given that the following expressions are valid expressions:
- * <pre>
- * classpath:javax/annotations/*
- * javax?/annotations/**/*.class
- * org/apache/tamaya/**/tamayaconfig.properties
- * file:C:/temp/*.txt
- * file:C:\**\*.ini
- * C:\Programs\**/*.ini
- * /user/home/A*b101_?.pid
- * /var/logs/**/*.log
- * </pre>
- */
-public abstract class BaseResourceResolver implements ResourceResolver {
-
- /**
- * Resolves resource expressions to a list of {@link URL}s. Hereby
- * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that
- * there is no determined ordering of format located within a classloader.
- *
- * @param expressions the expressions to be resolved, not empty.
- * @return the corresponding collection of current {@link URL}s found, never
- * null.
- * .
- */
- @Override
- public Collection<URL> getResources(Collection<String> expressions) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- cl = getClass().getClassLoader();
- }
- return getResources(cl, expressions);
- }
-
- /**
- * Resolves resource expressions to a list of {@link URL}s. Hereby
- * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that
- * there is no determined ordering of format located within a classloader.
- *
- * @param expressions the expressions to be resolved, not empty.
- * @return the corresponding collection of current {@link URL}s found, never
- * null.
- * .
- */
- @Override
- public Collection<URL> getResources(String... expressions) {
- return getResources(Arrays.asList(expressions));
- }
-
- /**
- * Resolves resource expressions to a list of {@link URL}s, considerubg
- * the given classloader for classloader dependent format. Hereby
- * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that
- * there is no determined ordering of format located within a classloader.
- *
- * @param expressions the expressions to be resolved, not empty.
- * @return the corresponding collection of current {@link URL}s found, never
- * null.
- * .
- */
- @Override
- public Collection<URL> getResources(ClassLoader classLoader, String... expressions) {
- return getResources(classLoader, Arrays.asList(expressions));
- }
-
- /**
- * Resolves resource expressions to a list of {@link URL}s, considerubg
- * the given classloader for classloader dependent format. Hereby
- * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that
- * there is no determined ordering of format located within a classloader.
- *
- * @param expressions the expressions to be resolved, not empty.
- * @return the corresponding collection of current {@link URL}s found, never
- * null.
- * .
- */
- @Override
- public abstract Collection<URL> getResources(ClassLoader classLoader, Collection<String> expressions);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java b/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java
deleted file mode 100644
index ae08148..0000000
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.resource;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-
-/**
- * Singleton Accessor for accessing the current {@link org.apache.tamaya.resource.ResourceResolver} instance.
- */
-public final class ConfigResources {
-
- /**
- * Singleton constructor.
- */
- private ConfigResources(){}
-
- /**
- * <p>Access the current ResourceResolver.</p>
- *
- * @throws ConfigException if no ResourceResolver is available (should not happen).
- *
- * @return the current ResourceResolver instance, never null.
- */
- public static ResourceResolver getResourceResolver() throws ConfigException {
- ResourceResolver resolver = ServiceContextManager.getServiceContext().getService(ResourceResolver.class);
- if (resolver == null) {
- throw new ConfigException("ResourceResolver not available.");
- }
- return resolver;
- }
-
-
-}
\ No newline at end of file