Repository: incubator-tamaya-extensions
Updated Branches:
  refs/heads/master 5d867b007 -> 519532923


[TAMAYA-206] Re-added the example for the Resolver module to the examples of 
the extensions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/51953292
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/51953292
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/51953292

Branch: refs/heads/master
Commit: 519532923264472cdd095aa02d76e6cb519d0e41
Parents: 5d867b0
Author: Oliver B. Fischer <[email protected]>
Authored: Wed Jan 4 20:04:17 2017 +0100
Committer: Oliver B. Fischer <[email protected]>
Committed: Wed Jan 4 20:04:17 2017 +0100

----------------------------------------------------------------------
 examples/02-resolver-example/pom.xml            | 60 +++++++++++++++
 .../tamay/ext/examples/resolver/Main.java       | 78 ++++++++++++++++++++
 .../ext/examples/resolver/package-info.java     | 23 ++++++
 .../META-INF/javaconfiguration.properties       | 32 ++++++++
 .../src/main/resources/build.data               |  1 +
 examples/pom.xml                                |  1 +
 pom.xml                                         |  1 +
 7 files changed, 196 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/02-resolver-example/pom.xml
----------------------------------------------------------------------
diff --git a/examples/02-resolver-example/pom.xml 
b/examples/02-resolver-example/pom.xml
new file mode 100644
index 0000000..140114f
--- /dev/null
+++ b/examples/02-resolver-example/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext.examples</groupId>
+        <artifactId>examples</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.tamaya.ext.examples</groupId>
+    <artifactId>02-resolver-example</artifactId>
+    <name>Apache Tamaya Value Resolution Example</name>
+    <description>This project contains a simple example using the resolver 
module.</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-resolver</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/Main.java
----------------------------------------------------------------------
diff --git 
a/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/Main.java
 
b/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/Main.java
new file mode 100644
index 0000000..6b99c57
--- /dev/null
+++ 
b/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/Main.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tamay.ext.examples.resolver;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.io.PrintStream;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import static java.lang.String.format;
+
+/**
+ * Example illustrating the usage of value resolver expressions (placeholders).
+ */
+public class Main {
+    /*
+     * Turns off all logging.
+     */
+    static {
+        LogManager.getLogManager().reset();
+        Logger globalLogger = 
Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME);
+        globalLogger.setLevel(java.util.logging.Level.OFF);
+    }
+
+
+    private Main() {
+    }
+
+    public static void main(String[] args){
+        Configuration cfg = ConfigurationProvider.getConfiguration();
+
+        
System.out.println("****************************************************");
+        System.out.println("Resolver Example");
+        
System.out.println("****************************************************");
+        System.out.println();
+        System.out.println("Example Metadata:");
+        System.out.println("\tType        :  " + cfg.get("example.type"));
+        System.out.println("\tName        :  " + cfg.get("example.name"));
+        System.out.println("\tDescription :  " + 
cfg.get("example.description"));
+        System.out.println("\tVersion     :  " + cfg.get("example.version"));
+        System.out.println("\tAuthor      :  " + cfg.get("example.author"));
+        System.out.println();
+        System.out.println("Resolved Data:");
+        System.out.println("\tFullName     :  " + cfg.get("example.fullName"));
+        System.out.println("\tFullVersion  :  " + 
cfg.get("example.fullVersion"));
+        System.out.println();
+        
+        dump(cfg.getProperties(), System.out);
+    }
+
+    private static void dump(Map<String, String> properties, PrintStream 
stream) {
+        stream.println("FULL DUMP:\n\n");
+
+        for (Map.Entry<String, String> en : new 
TreeMap<>(properties).entrySet()) {
+            stream.println(format("\t%s = %s", en.getKey(), en.getValue()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/package-info.java
----------------------------------------------------------------------
diff --git 
a/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/package-info.java
 
b/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/package-info.java
new file mode 100644
index 0000000..9479876
--- /dev/null
+++ 
b/examples/02-resolver-example/src/main/java/org/apache/tamay/ext/examples/resolver/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+/**
+ * Example illustrating the usage of value resolver expressions (placeholders).
+ */
+package org.apache.tamay.ext.examples.resolver;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/02-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git 
a/examples/02-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
 
b/examples/02-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..b6dd396
--- /dev/null
+++ 
b/examples/02-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+example.type=standalone
+example.name=Minimal
+example.description=A minimal example only using API and RI.
+example.version=1
[email protected]
+
+
+example.number=350322222222222222222266666666666666666666622222222222222222
+example.testEnum=V2
+
+# Resolved entries
+example.fullName=${conf:example.name}(${conf:example.type})
+example.fullVersion=${conf:example.fullName} - ${conf:example.version}, build 
${resource:build.data}
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/02-resolver-example/src/main/resources/build.data
----------------------------------------------------------------------
diff --git a/examples/02-resolver-example/src/main/resources/build.data 
b/examples/02-resolver-example/src/main/resources/build.data
new file mode 100644
index 0000000..274c005
--- /dev/null
+++ b/examples/02-resolver-example/src/main/resources/build.data
@@ -0,0 +1 @@
+1234
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index d311f74..5e74986 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -38,6 +38,7 @@ under the License.
 
     <modules>
         <module>01-resources-example</module>
+        <module>02-resolver-example</module>
     </modules>
 
     

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/51953292/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ebf83b4..ab5c988 100644
--- a/pom.xml
+++ b/pom.xml
@@ -576,6 +576,7 @@ under the License.
                             <exclude>banner.txt</exclude>
                             <exclude>.git</exclude>
                             <exclude>derby.log</exclude>
+                            <exclude>**/build.data</exclude>
                             <exclude>**/bootstrap-*</exclude>
                             <exclude>**/js/jquery-*</exclude>
                             <!-- json can't get comments -->

Reply via email to