You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/01/11 10:58:07 UTC
[1/3] incubator-tamaya git commit: TAMAYA-47: Added additional
resolvers.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 9869d0d09 -> f97e294c3
TAMAYA-47: Added additional resolvers.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/c9537d2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/c9537d2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/c9537d2d
Branch: refs/heads/master
Commit: c9537d2dc8cfd94c0ee14c1a4c6bb0e44e5aa780
Parents: 9869d0d
Author: anatole <an...@apache.org>
Authored: Sun Jan 11 10:30:32 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Sun Jan 11 10:30:32 2015 +0100
----------------------------------------------------------------------
modules/resolver/pom.xml | 8 +-
.../resolver/internal/ClasspathResolver.java | 141 +++++++++++++++++++
.../resolver/internal/ConfigResolver.java | 43 ++++++
.../internal/DefaultExpressionEvaluator.java | 22 +--
.../internal/EnvironmentPropertyResolver.java | 2 +
.../internal/ExpressionResolutionFilter.java | 4 +-
.../tamaya/resolver/internal/FileResolver.java | 115 +++++++++++++++
.../internal/SystemPropertyResolver.java | 3 +
.../tamaya/resolver/internal/URLResolver.java | 63 +++++++++
.../tamaya/resolver/spi/ExpressionResolver.java | 8 +-
...ache.tamaya.resolver.spi.ExpressionEvaluator | 2 +-
...pache.tamaya.resolver.spi.ExpressionResolver | 8 +-
.../org.apache.tamaya.spi.PropertyFilter | 2 +-
.../tamaya/resolver/MyTestPropertySource.java | 20 +++
.../org.apache.tamaya.spi.PropertySource | 2 +-
.../src/test/resources/Testresource.txt | 19 +++
.../src/test/resources/Testresource2.txt | 19 +++
17 files changed, 461 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/modules/resolver/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml
index 48b91c2..2f181b2 100644
--- a/modules/resolver/pom.xml
+++ b/modules/resolver/pom.xml
@@ -5,7 +5,7 @@ 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
+with the License. You may obtain aa_a copy current the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -43,6 +43,12 @@ under the License.
<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>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ClasspathResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ClasspathResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ClasspathResolver.java
new file mode 100644
index 0000000..b0cbe9c
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ClasspathResolver.java
@@ -0,0 +1,141 @@
+/*
+ * 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.ServiceContext;
+
+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;
+
+/**
+ * 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.
+ * <br/>
+ * If the {@code Resources} module is available this module is used for resolving the expression.
+ */
+@Priority(300)
+public final class ClasspathResolver implements ExpressionResolver {
+ /**
+ * The looger used.
+ */
+ private final Logger LOG = Logger.getLogger(ClasspathResolver.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, ClasspathResolver.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);
+ BufferedReader in;
+ try {
+ in = new BufferedReader(
+ new InputStreamReader(url.openStream()));
+ StringBuilder builder = new StringBuilder();
+ String inputLine;
+ while ((inputLine = in.readLine()) != null) {
+ builder.append(inputLine).append("\n");
+ }
+ in.close();
+ 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) {
+ ResourceResolver resolver = ServiceContext.getInstance().getService(ResourceResolver.class).get();
+ 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);
+ }
+ }
+ }
+ return null; // no such resource found
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
new file mode 100644
index 0000000..fc2df8c
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java
@@ -0,0 +1,43 @@
+/*
+ * 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.Configuration;
+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.
+ */
+@Priority(200)
+public final class ConfigResolver implements ExpressionResolver{
+
+ @Override
+ public String getResolverPrefix() {
+ return "conf:";
+ }
+
+ @Override
+ public String evaluate(String expression){
+ return Configuration.current().get(expression);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index e08d257..c81bc14 100644
--- 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
@@ -32,7 +32,7 @@ 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
+ * Each resolver is identified by aa_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)
@@ -89,7 +89,7 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator {
* <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
+ * Given {@code resolverId:} is aa_a valid prefix targeting aa_a {@link java.beans.Expression} explicitly, also the
* following expressions are valid:
* <ul>
* <li><code>${resolverId:expression}</code></li>
@@ -165,19 +165,25 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator {
return resolvedValue.toString();
}
- private String evaluateInternal(String subExpression) {
+ /**
+ * Evalutes the expression parsed, hereby checking for prefixes and trying otherwise all available resolvers,
+ * based on priority.
+ * @param unresolvedExpression the parsed, but unresolved expression
+ * @return the resolved expression, or null.
+ */
+ private String evaluateInternal(String unresolvedExpression) {
String value = null;
// 1 check for explicit prefix
for(ExpressionResolver resolver:resolvers){
- if(subExpression.startsWith(resolver.getResolverPrefix())){
- value = resolver.evaluate(subExpression.substring(resolver.getResolverPrefix().length()));
+ 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(subExpression);
+ value = resolver.evaluate(unresolvedExpression);
if(value!=null){
return value;
}
@@ -187,8 +193,8 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator {
}
}
if(value==null){
- LOG.log(Level.WARNING, "Unresolvable expression encountered " + subExpression);
- value = '[' + subExpression + ']';
+ LOG.log(Level.WARNING, "Unresolvable expression encountered " + unresolvedExpression);
+ value = "?{" + unresolvedExpression + '}';
}
return value;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index de71b58..b89160a 100644
--- 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
@@ -20,11 +20,13 @@ package org.apache.tamaya.resolver.internal;
import org.apache.tamaya.resolver.spi.ExpressionResolver;
+import javax.annotation.Priority;
import java.util.Optional;
/**
* Property resolver implementation that interprets the resolver expressions as environment properties.
*/
+@Priority(0)
public final class EnvironmentPropertyResolver implements ExpressionResolver{
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index fb4c122..63e4575 100644
--- 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
@@ -27,7 +27,7 @@ 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
+ * Each resolver is identified by aa_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)
@@ -56,7 +56,7 @@ public class ExpressionResolutionFilter implements PropertyFilter {
* <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
+ * Given {@code resolverId:} is aa_a valid prefix targeting aa_a {@link java.beans.Expression} explicitly, also the
* following expressions are valid:
* <ul>
* <li><code>${resolverId:expression}</code></li>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
new file mode 100644
index 0000000..3459608
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/FileResolver.java
@@ -0,0 +1,115 @@
+/*
+ * 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.ServiceContext;
+
+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;
+
+/**
+ * Property resolver implementation that tries to load the given resource from the current file system.
+ * <br/>
+ * If the {@code Resources} module is available this module is used for resolving the expression.
+ */
+@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 "resource:";
+ }
+
+ @Override
+ public String evaluate(String expression) {
+ URL url = getUrl(expression);
+ BufferedReader in;
+ try {
+ in = new BufferedReader(
+ new InputStreamReader(url.openStream()));
+ StringBuilder builder = new StringBuilder();
+ String inputLine;
+ while ((inputLine = in.readLine()) != null) {
+ builder.append(inputLine).append("\n");
+ }
+ in.close();
+ 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 = ServiceContext.getInstance().getService(ResourceResolver.class).get();
+ 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/c9537d2d/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
index 866126c..5c86db1 100644
--- 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
@@ -22,9 +22,12 @@ import java.util.Optional;
import org.apache.tamaya.resolver.spi.ExpressionResolver;
+import javax.annotation.Priority;
+
/**
* Property resolver implementation that interprets the resolver expression as system property name.
*/
+@Priority(100)
public final class SystemPropertyResolver implements ExpressionResolver{
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
new file mode 100644
index 0000000..49eb3c0
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/URLResolver.java
@@ -0,0 +1,63 @@
+/*
+ * 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;
+
+/**
+ * Property resolver implementation that interprets the resolver expression as an URL to be resolved.
+ */
+@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) {
+ BufferedReader in = null;
+ try {
+ URL url = new URL(expression);
+ in = new BufferedReader(
+ new InputStreamReader(url.openStream()));
+ StringBuilder builder = new StringBuilder();
+ String inputLine;
+ while ((inputLine = in.readLine()) != null) {
+ builder.append(inputLine).append("\n");
+ }
+ in.close();
+ 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/c9537d2d/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
index 4691f29..20daea3 100644
--- 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
@@ -20,14 +20,14 @@ 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
+ * This interfaces provides aa_a model for expression evaluation. This enables transparently plugin expression languages
+ * as needed. In aa_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
+ * Get the unique resolver prefix. This allows to address aa_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.
*
@@ -38,7 +38,7 @@ public interface ExpressionResolver {
/**
* Evaluates the given expression.
*
- * @param expression the expression to be evaluated, not null. If a resolver was addressed explicitly,
+ * @param expression the expression to be evaluated, not null. If aa_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.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index aa766b6..00c91d2 100644
--- 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
@@ -5,7 +5,7 @@
# 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
+# with the License. You may obtain aa_a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index 5c26b65..95efd7c 100644
--- 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
@@ -5,7 +5,7 @@
# 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
+# with the License. You may obtain aa_a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -17,4 +17,8 @@
# under the License.
#
org.apache.tamaya.resolver.internal.SystemPropertyResolver
-org.apache.tamaya.resolver.internal.EnvironmentPropertyResolver
\ No newline at end of file
+org.apache.tamaya.resolver.internal.EnvironmentPropertyResolver
+org.apache.tamaya.resolver.internal.ClasspathResolver
+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/c9537d2d/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
index c8788b5..c822b66 100644
--- 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
@@ -5,7 +5,7 @@
# 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
+# with the License. You may obtain aa_a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index 750ca8d..00d92f8 100644
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
+++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
@@ -20,6 +20,9 @@ package org.apache.tamaya.resolver;
import org.apache.tamaya.spi.PropertySource;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -38,6 +41,23 @@ public class MyTestPropertySource implements PropertySource{
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", "${classpath: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 -> ${config:Expression Only}");
+ properties.put("config-ref2", "Config Ref 2 -> Ref 1: ${config:config-ref}");
+ properties.put("config-ref3", "Config Ref 3 -> Ref 2: ${config:config-ref2}");
+ }
+
+ private String getFileRefAsString() {
+ URL res = getClass().getResource("/TestResource2.txt");
+ try {
+ return new File(res.toURI()).getAbsolutePath();
+ } catch (URISyntaxException e) {
+ return "Failed to evaluate file: TestResource2.txt";
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
index 088aca9..b48b26d 100644
--- 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
@@ -5,7 +5,7 @@
# 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
+# with the License. You may obtain aa_a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c9537d2d/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
new file mode 100644
index 0000000..efd92ab
--- /dev/null
+++ b/modules/resolver/src/test/resources/Testresource.txt
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain aa_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/c9537d2d/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
new file mode 100644
index 0000000..27c9152
--- /dev/null
+++ b/modules/resolver/src/test/resources/Testresource2.txt
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain aa_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
[2/3] incubator-tamaya git commit: TAMAYA-43: Removed System.outs.
Posted by an...@apache.org.
TAMAYA-43: Removed System.outs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/8b15907f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8b15907f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8b15907f
Branch: refs/heads/master
Commit: 8b15907fd1d12aa9756e2a5bc8e2317b22d210fc
Parents: c9537d2
Author: anatole <an...@apache.org>
Authored: Sun Jan 11 10:37:27 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Sun Jan 11 10:37:27 2015 +0100
----------------------------------------------------------------------
.../tamaya/resource/internal/ClasspathCollectorTest.java | 6 ------
.../tamaya/resource/internal/DefaultResourceResolverTest.java | 2 --
.../org/apache/tamaya/resource/internal/FileCollectorTest.java | 3 ---
3 files changed, 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8b15907f/modules/resources/src/test/java/org/apache/tamaya/resource/internal/ClasspathCollectorTest.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/ClasspathCollectorTest.java b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/ClasspathCollectorTest.java
index 5827d6b..1527684 100644
--- a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/ClasspathCollectorTest.java
+++ b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/ClasspathCollectorTest.java
@@ -34,7 +34,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:javax/annotation/*.class");
assertEquals(8, found.size()); // 7 ordinary, 1 inner class.
- System.out.println("classpath:javax/annotation/*.class: " + found);
Collection<URL> found2 = cpc.collectFiles("javax/annotation/*.class");
assertEquals(found, found2);
}
@@ -44,7 +43,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:javax/**/sql/*.class");
assertEquals(2, found.size());
- System.out.println("classpath:javax/**/sql/*.class: " + found);
Collection<URL> found2 = cpc.collectFiles("javax/**/sql/*.class");
assertEquals(found, found2);
}
@@ -54,7 +52,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:javax/annotation/**/R*.class");
assertEquals(2, found.size());
- System.out.println("classpath:javax/annotation/**/A*.class: " + found);
Collection<URL> found2 = cpc.collectFiles("javax/annotation/**/R*.class");
assertEquals(found, found2);
}
@@ -64,7 +61,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:javax/annotation/R?so*.class");
assertEquals(3, found.size());
- System.out.println("classpath:javax/annotation/R?so*.class: " + found);
Collection<URL> found2 = cpc.collectFiles("javax/annotation/R?so*.class");
assertEquals(found, found2);
}
@@ -74,7 +70,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:META-INF/maven/org.apache.geronimo.specs/**/*");
assertEquals(3, found.size());
- System.out.println("classpath:META-INF/maven/org.apache.geronimo.specs/**/*: " + found);
Collection<URL> found2 = cpc.collectFiles("META-INF/maven/org.apache.geronimo.specs/**/*");
assertEquals(found, found2);
}
@@ -84,7 +79,6 @@ public class ClasspathCollectorTest {
ClasspathCollector cpc = new ClasspathCollector(ClassLoader.getSystemClassLoader());
Collection<URL> found = cpc.collectFiles("classpath:resources_testRoot/**/*.file");
assertEquals(7, found.size());
- System.out.println("classpath:resources_testRoot/**/*.file: " + found);
Collection<URL> found2 = cpc.collectFiles("resources_testRoot/**/*.file");
assertEquals(found, found2);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8b15907f/modules/resources/src/test/java/org/apache/tamaya/resource/internal/DefaultResourceResolverTest.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/DefaultResourceResolverTest.java b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/DefaultResourceResolverTest.java
index 66e3246..610c52e 100644
--- a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/DefaultResourceResolverTest.java
+++ b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/DefaultResourceResolverTest.java
@@ -40,7 +40,6 @@ public class DefaultResourceResolverTest {
public void testGetResources_CP() throws Exception {
Collection<URL> found = resolver.getResources("classpath:resources_testRoot/**/*.file");
assertEquals(7, found.size());
- System.out.println("classpath:resources_testRoot/**/*.file: " + found);
Collection<URL> found2 = resolver.getResources("resources_testRoot/**/*.file");
assertEquals(found, found2);
}
@@ -50,7 +49,6 @@ public class DefaultResourceResolverTest {
String resDir = getResourceDir();
Collection<URL> found = resolver.getResources("file:" + resDir + "/resources_testroot/aa?a/*.file");
assertEquals(5, found.size());
- System.out.println("file:" + resDir + "/resources_testroot/aa?a/*.file: " + found);
Collection<URL> found2 = resolver.getResources(resDir + "/resources_testroot/aa?a/*.file");
assertEquals(found, found2);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8b15907f/modules/resources/src/test/java/org/apache/tamaya/resource/internal/FileCollectorTest.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/FileCollectorTest.java b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/FileCollectorTest.java
index f7f5772..89c1543 100644
--- a/modules/resources/src/test/java/org/apache/tamaya/resource/internal/FileCollectorTest.java
+++ b/modules/resources/src/test/java/org/apache/tamaya/resource/internal/FileCollectorTest.java
@@ -42,7 +42,6 @@ public class FileCollectorTest {
String resDir = getResourceDir();
Collection<URL> found = FileCollector.collectFiles("file:" + resDir + "/**/*.file");
assertEquals(7, found.size());
- System.out.println("file:" + resDir + "/**/*.file: " + found);
Collection<URL> found2 = FileCollector.collectFiles(resDir + "/**/*.file");
assertEquals(found, found2);
}
@@ -52,7 +51,6 @@ public class FileCollectorTest {
String resDir = getResourceDir();
Collection<URL> found = FileCollector.collectFiles("file:" + resDir + "/resources_testroot/aa?a/*.file");
assertEquals(5, found.size());
- System.out.println("file:" + resDir + "/resources_testroot/aa?a/*.file: " + found);
Collection<URL> found2 = FileCollector.collectFiles(resDir + "/resources_testroot/aa?a/*.file");
assertEquals(found, found2);
}
@@ -62,7 +60,6 @@ public class FileCollectorTest {
String resDir = getResourceDir();
Collection<URL> found = FileCollector.collectFiles("file:" + resDir + "/resources_testroot/b*/b?/*.file");
assertEquals(1, found.size());
- System.out.println("file:" + resDir + "/resources_testroot/b*/b?/*.file: " + found);
Collection<URL> found2 = FileCollector.collectFiles(resDir + "/resources_testroot/b*/b?/*.file");
assertEquals(found, found2);
}
[3/3] incubator-tamaya git commit: Added commons-config to format
module (experimental). Fixed invalid replacements aa_a -> a
Posted by an...@apache.org.
Added commons-config to format module (experimental).
Fixed invalid replacements aa_a -> a
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/f97e294c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/f97e294c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/f97e294c
Branch: refs/heads/master
Commit: f97e294c3f0a00ba948592e8afa7a6f88e997287
Parents: 8b15907
Author: anatole <an...@apache.org>
Authored: Sun Jan 11 10:57:55 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Sun Jan 11 10:57:55 2015 +0100
----------------------------------------------------------------------
modules/formats/pom.xml | 5 ++
.../format/CommonsConfigPropertySource.java | 79 ++++++++++++++++++++
.../tamaya/format/ConfigurationFormat.java | 15 +++-
.../tamaya/format/IniConfigurationFormat.java | 72 ++++++++++++++++++
modules/resolver/pom.xml | 2 +-
.../internal/DefaultExpressionEvaluator.java | 4 +-
.../internal/ExpressionResolutionFilter.java | 4 +-
.../tamaya/resolver/spi/ExpressionResolver.java | 8 +-
...ache.tamaya.resolver.spi.ExpressionEvaluator | 2 +-
...pache.tamaya.resolver.spi.ExpressionResolver | 2 +-
.../org.apache.tamaya.spi.PropertyFilter | 2 +-
.../org.apache.tamaya.spi.PropertySource | 2 +-
.../src/test/resources/Testresource.txt | 2 +-
.../src/test/resources/Testresource2.txt | 2 +-
modules/resources/pom.xml | 2 +-
.../tamaya/resource/ResourceResolver.java | 24 +++---
.../resource/internal/ClasspathCollector.java | 12 +--
.../internal/DefaultResourceResolver.java | 2 +-
.../tamaya/resource/internal/FileCollector.java | 6 +-
.../tamaya/resource/internal/Locator.java | 8 +-
20 files changed, 210 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/formats/pom.xml
----------------------------------------------------------------------
diff --git a/modules/formats/pom.xml b/modules/formats/pom.xml
index 65b40f4..d39c845 100644
--- a/modules/formats/pom.xml
+++ b/modules/formats/pom.xml
@@ -41,5 +41,10 @@ under the License.
<artifactId>tamaya-resources</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.10</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/formats/src/main/java/org/apache/tamaya/format/CommonsConfigPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/CommonsConfigPropertySource.java b/modules/formats/src/main/java/org/apache/tamaya/format/CommonsConfigPropertySource.java
new file mode 100644
index 0000000..31b2b83
--- /dev/null
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/CommonsConfigPropertySource.java
@@ -0,0 +1,79 @@
+/*
+ * 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.format;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * PropertySource that wraps {@link org.apache.commons.configuration.Configuration}.
+ */
+public class CommonsConfigPropertySource implements PropertySource {
+
+ private Configuration commonsConfig;
+ private Integer ordinal;
+ private String name;
+
+ public CommonsConfigPropertySource(int ordinal, String name, Configuration commonsConfig) {
+ this.commonsConfig = Objects.requireNonNull(commonsConfig);
+ this.ordinal = ordinal;
+ this.name = Objects.requireNonNull(name);
+ }
+
+ public CommonsConfigPropertySource(String name, Configuration commonsConfig) {
+ this.commonsConfig = Objects.requireNonNull(commonsConfig);
+ this.name = Objects.requireNonNull(name);
+ try {
+ this.ordinal = commonsConfig.getInt(PropertySource.TAMAYA_ORDINAL);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public int getOrdinal() {
+ return ordinal == null ? 0 : ordinal.intValue();
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String get(String key) {
+ return commonsConfig.getString(key);
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ Map<String, String> config = new HashMap<>();
+ Iterator<String> keyIter = commonsConfig.getKeys();
+ while (keyIter.hasNext()) {
+ String key = keyIter.next();
+ config.put(key, commonsConfig.getString(key));
+ }
+ return config;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java b/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
index 2e43c17..c455d11 100644
--- a/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
@@ -18,8 +18,9 @@
*/
package org.apache.tamaya.format;
-import java.io.IOException;
import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -37,6 +38,14 @@ public interface ConfigurationFormat {
* The default entry type returned if a format implementation does not support any explicit entry types.
*/
public static final String DEFAULT_ENTRY_TYPE = "default";
+ public static final Set<String> DEFAULT_ENTRY_TYPE_SET = initDefaultSet();
+ public static final String DYNAMIC_ENTRY_TYPE = "<dynamic>";
+
+ static Set<String> initDefaultSet(){
+ Set<String> set = new HashSet<>();
+ set.add(DEFAULT_ENTRY_TYPE);
+ return Collections.unmodifiableSet(set);
+ };
/**
* Access the different entry types a format supports. Entries of the same entry type hereby share the same
@@ -71,8 +80,8 @@ public interface ConfigurationFormat {
* resource or something else.
* @return the corresponding {@link java.util.Map} instances of properties read, never {@code null}. Each
* {@link java.util.Map} instance hereby is provided using a type key.
+ * @throws org.apache.tamaya.ConfigException if parsing of the input fails.
*/
- Map<String, Map<String,String>> readConfiguration(URL url)
- throws IOException;
+ Map<String, Map<String,String>> readConfiguration(URL url);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/formats/src/main/java/org/apache/tamaya/format/IniConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/IniConfigurationFormat.java b/modules/formats/src/main/java/org/apache/tamaya/format/IniConfigurationFormat.java
new file mode 100644
index 0000000..cb73c1e
--- /dev/null
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/IniConfigurationFormat.java
@@ -0,0 +1,72 @@
+/*
+ * 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.format;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalINIConfiguration;
+import org.apache.commons.configuration.SubnodeConfiguration;
+import org.apache.tamaya.ConfigException;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Implements a ini file format based on the APache Commons
+ * {@link org.apache.commons.configuration.HierarchicalINIConfiguration}.
+ */
+public class IniConfigurationFormat implements ConfigurationFormat{
+
+ private Set<String> entryTypes = new HashSet<>();
+
+ public IniConfigurationFormat(){
+ entryTypes.add(ConfigurationFormat.DYNAMIC_ENTRY_TYPE);
+ entryTypes = Collections.unmodifiableSet(entryTypes);
+ }
+
+ @Override
+ public Set<String> getEntryTypes() {
+ return entryTypes;
+ }
+
+ @Override
+ public Map<String, Map<String, String>> readConfiguration(URL url) {
+ Map<String, Map<String, String>> result = new HashMap<>();
+ try {
+ HierarchicalINIConfiguration commonIniConfiguration = new HierarchicalINIConfiguration(url);
+ for(String section:commonIniConfiguration.getSections()){
+ SubnodeConfiguration sectionConfig = commonIniConfiguration.getSection(section);
+ Map<String, String> properties = new HashMap<>();
+ Iterator<String> keyIter = sectionConfig.getKeys();
+ while(keyIter.hasNext()){
+ String key = keyIter.next();
+ properties.put(key, sectionConfig.getString(key));
+ }
+ result.put(section, properties);
+ }
+ return result;
+ } catch (ConfigurationException e) {
+ throw new ConfigException("Failed to parse ini-file format from " + url, e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resolver/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml
index 2f181b2..3a354c6 100644
--- a/modules/resolver/pom.xml
+++ b/modules/resolver/pom.xml
@@ -5,7 +5,7 @@ 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 aa_a copy current the License at
+with the License. You may obtain a copy current the License at
http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index c81bc14..0d51753 100644
--- 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
@@ -32,7 +32,7 @@ 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 aa_a resolver id. Each expression passed has the form resolverId:resolverExpression, which
+ * 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)
@@ -89,7 +89,7 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator {
* <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 aa_a valid prefix targeting aa_a {@link java.beans.Expression} explicitly, also the
+ * 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>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index 63e4575..fb4c122 100644
--- 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
@@ -27,7 +27,7 @@ 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 aa_a resolver id. Each expression passed has the form resolverId:resolverExpression, which
+ * 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)
@@ -56,7 +56,7 @@ public class ExpressionResolutionFilter implements PropertyFilter {
* <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 aa_a valid prefix targeting aa_a {@link java.beans.Expression} explicitly, also the
+ * 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>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index 20daea3..4691f29 100644
--- 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
@@ -20,14 +20,14 @@ package org.apache.tamaya.resolver.spi;
/**
- * This interfaces provides aa_a model for expression evaluation. This enables transparently plugin expression languages
- * as needed. In aa_a Java EE context full fledged EL may be used, whereas in ME only simple replacement mechanisms
+ * 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 aa_a resolver explicitly, in case of conflicts. By
+ * 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.
*
@@ -38,7 +38,7 @@ public interface ExpressionResolver {
/**
* Evaluates the given expression.
*
- * @param expression the expression to be evaluated, not null. If aa_a resolver was addressed explicitly,
+ * @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.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index 00c91d2..aa766b6 100644
--- 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
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index 95efd7c..ddfbb09 100644
--- 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
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index c822b66..c8788b5 100644
--- 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
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index b48b26d..088aca9 100644
--- 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
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index efd92ab..9731609 100644
--- a/modules/resolver/src/test/resources/Testresource.txt
+++ b/modules/resolver/src/test/resources/Testresource.txt
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/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
index 27c9152..a43bf62 100644
--- a/modules/resolver/src/test/resources/Testresource2.txt
+++ b/modules/resolver/src/test/resources/Testresource2.txt
@@ -5,7 +5,7 @@
# 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 aa_a copy current the License at
+# with the License. You may obtain a copy current the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resources/pom.xml b/modules/resources/pom.xml
index cdb1030..b395336 100644
--- a/modules/resources/pom.xml
+++ b/modules/resources/pom.xml
@@ -5,7 +5,7 @@ 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 aa_a copy current the License at
+with the License. You may obtain a copy current the License at
http://www.apache.org/licenses/LICENSE-2.0
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceResolver.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceResolver.java b/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceResolver.java
index 167a5e1..3dcf6fa 100644
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceResolver.java
+++ b/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceResolver.java
@@ -24,11 +24,11 @@ import java.util.Collection;
/**
* Interface to be implemented by modules. It supports loading of files or classpath resources either directly or by
- * defining aa_a Ant-styled resource pattern:
+ * defining a Ant-styled resource pattern:
* <ul>
- * <li>'*' is aa_a placeholder for any character (0..n)</li>
- * <li>'**' is aa_a placeholder for any number of subdirectories going down aa_a directory structure recursively.</li>
- * <li>'?' is aa_a placeholder for exact one character</li>
+ * <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>
@@ -45,9 +45,9 @@ import java.util.Collection;
public interface ResourceResolver {
/**
- * Resolves resource expressions to aa_a list of {@link URL}s. Hereby
+ * 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 aa_a classloader.
+ * 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
@@ -63,9 +63,9 @@ public interface ResourceResolver {
}
/**
- * Resolves resource expressions to aa_a list of {@link URL}s. Hereby
+ * 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 aa_a classloader.
+ * 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
@@ -77,10 +77,10 @@ public interface ResourceResolver {
}
/**
- * Resolves resource expressions to aa_a list of {@link URL}s, considerubg
+ * 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 aa_a classloader.
+ * 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
@@ -92,10 +92,10 @@ public interface ResourceResolver {
}
/**
- * Resolves resource expressions to aa_a list of {@link URL}s, considerubg
+ * 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 aa_a classloader.
+ * 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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/src/main/java/org/apache/tamaya/resource/internal/ClasspathCollector.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/ClasspathCollector.java b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/ClasspathCollector.java
index bbab3fc..8688ce8 100644
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/ClasspathCollector.java
+++ b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/ClasspathCollector.java
@@ -61,7 +61,7 @@ public class ClasspathCollector {
private static final String PROTOCOL_ZIP = "zip";
/**
- * ZIP protocol for aa_a JBoss jar file entry: "vfszip".
+ * ZIP protocol for a JBoss jar file entry: "vfszip".
*/
private static final String PROTOCOL_VFSZIP = "vfszip";
@@ -91,7 +91,7 @@ public class ClasspathCollector {
private ClassLoader classLoader;
/**
- * Creates aa_a new instance.
+ * Creates a new instance.
*
* @param classLoader the class loader to be used, not null.
*/
@@ -213,7 +213,7 @@ public class ClasspathCollector {
}
/**
- * Creates aa_a new URL based on the given root path and the relative path to be added.
+ * Creates a new URL based on the given root path and the relative path to be added.
*
* @param url the root, not null
* @param relativePath the relative path to be added, not null
@@ -234,7 +234,7 @@ public class ClasspathCollector {
/**
- * Small check if aa_a given URL is aa_a jar file URL.
+ * Small check if a given URL is a jar file URL.
*
* @param url the URL to check, not null.
* @return true if the URL has one of the following protocols: jar, zip, vfszip, wsjar, code-source.
@@ -249,10 +249,10 @@ public class ClasspathCollector {
}
/**
- * Creates aa_a file from an URL.
+ * Creates a file from an URL.
*
* @param resourceUrl the url, not null.
- * @return aa_a new file instance. The instance still may not exist. if the url's protocol is not 'file', {@code null}
+ * @return a new file instance. The instance still may not exist. if the url's protocol is not 'file', {@code null}
* is returned.
*/
private File getFile(URL resourceUrl) {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/src/main/java/org/apache/tamaya/resource/internal/DefaultResourceResolver.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/DefaultResourceResolver.java b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/DefaultResourceResolver.java
index f5cbefd..c90e53a 100644
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/DefaultResourceResolver.java
+++ b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/DefaultResourceResolver.java
@@ -94,7 +94,7 @@ public class DefaultResourceResolver implements ResourceResolver {
}
/**
- * Tries to evaluate the location passed by lokking up aa_a file.
+ * Tries to evaluate the location passed by lokking up a file.
* @param expression the path expression
* @param resources the resources for adding the results
* @return true, if the expression could be resolved.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/src/main/java/org/apache/tamaya/resource/internal/FileCollector.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/FileCollector.java b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/FileCollector.java
index ef26e76..6d85a92 100644
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/FileCollector.java
+++ b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/FileCollector.java
@@ -134,7 +134,7 @@ public class FileCollector {
}
/**
- * Simple matcher method for aa_a single token.
+ * Simple matcher method for a single token.
* @param childFile the file to match
* @param subTokens the subtoken list
* @param tokenIndex the index where to start
@@ -151,7 +151,7 @@ public class FileCollector {
}
/**
- * Get an URL from aa_a file.
+ * Get an URL from a file.
*
* @param file the file, not null.
* @return the URL, never null.
@@ -167,7 +167,7 @@ public class FileCollector {
}
/**
- * Constructs aa_a sub expression, using the tokens from {@code subTokens} starting at index {@code startIndex}.
+ * Constructs a sub expression, using the tokens from {@code subTokens} starting at index {@code startIndex}.
*
* @param subTokens the token list, not null
* @param startIndex the start index from where tokens should be taken to produce the path.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f97e294c/modules/resources/src/main/java/org/apache/tamaya/resource/internal/Locator.java
----------------------------------------------------------------------
diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/Locator.java b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/Locator.java
index 8e40fc6..acab285 100644
--- a/modules/resources/src/main/java/org/apache/tamaya/resource/internal/Locator.java
+++ b/modules/resources/src/main/java/org/apache/tamaya/resource/internal/Locator.java
@@ -25,7 +25,7 @@ import java.util.StringJoiner;
import java.util.stream.Collectors;
/**
- * Small helper class that manages the path parts of aa_a location expression.
+ * Small helper class that manages the path parts of a location expression.
*/
final class Locator {
/**
@@ -34,7 +34,7 @@ final class Locator {
private List<String> tokens;
/**
- * Creates aa_a new instances based on the tokenized expression.
+ * Creates a new instances based on the tokenized expression.
*
* @param tokens the tokenized expression, not null.
*/
@@ -43,7 +43,7 @@ final class Locator {
}
/**
- * Creates aa_a new instance of the corresponding expression.
+ * Creates a new instance of the corresponding expression.
*
* @param expression the location expression, not null.
* @return the tokenized instance.
@@ -72,7 +72,7 @@ final class Locator {
}
/**
- * Return the sub expression path, which contains the second part of the expression, starting with aa_a placeholder
+ * Return the sub expression path, which contains the second part of the expression, starting with a placeholder
* or wildcard token.
*
* @return the sub expression part, never null.