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/03/24 15:47:25 UTC
[3/4] incubator-tamaya git commit: Added examples using different
modules (still more needed)....
Added examples using different modules (still more needed)....
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/16bf44fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/16bf44fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/16bf44fd
Branch: refs/heads/master
Commit: 16bf44fd75420eab16f388be1648acddb45aa764
Parents: 199f69c
Author: anatole <an...@apache.org>
Authored: Tue Mar 24 14:22:44 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Tue Mar 24 15:46:21 2015 +0100
----------------------------------------------------------------------
.../tamaya/examples/minimal/ExampleMain.java | 53 -----------
.../tamaya/examples/resolver/ExampleMain.java | 53 +++++++++++
.../META-INF/javaconfiguration.properties | 20 +++-
.../src/main/java/ExampleMain.java | 33 -------
.../src/main/java/SimplePropertySource.java | 40 --------
.../main/java/SimplePropertySourceProvider.java | 33 -------
.../tamaya/examples/simple/ExampleMain.java | 58 ++++++++++++
.../examples/simple/SimplePropertySource.java | 60 ++++++++++++
.../simple/SimplePropertySourceProvider.java | 53 +++++++++++
.../META-INF/MyOtherConfigProperties.properties | 20 +++-
.../META-INF/javaconfiguration.properties | 20 +++-
.../org.apache.tamaya.spi.PropertySource | 22 ++++-
...org.apache.tamaya.spi.PropertySourceProvider | 20 +++-
.../src/main/resources/cfgOther/a.properties | 18 ++++
.../src/main/resources/cfgOther/b.properties | 18 ++++
.../src/main/resources/cfgOther/c.properties | 18 ++++
.../src/main/java/ExampleMain.java | 33 -------
.../java/SimplePropertySourceProvider2.java | 25 -----
.../tamaya/examples/resources/ExampleMain.java | 57 ++++++++++++
.../resources/MyPathPropertySourceProvider.java | 39 ++++++++
.../META-INF/MyOtherConfigProperties.properties | 20 +++-
.../META-INF/javaconfiguration.properties | 20 +++-
...org.apache.tamaya.spi.PropertySourceProvider | 20 +++-
.../main/resources/cfgOther/subs/a.properties | 18 ++++
.../main/resources/cfgOther/subs/b.properties | 18 ++++
.../main/resources/cfgOther/subs/c.properties | 18 ++++
examples/4-resolver-example/pom.xml | 49 ++++++++++
.../tamaya/examples/resolver/ExampleMain.java | 58 ++++++++++++
.../META-INF/javaconfiguration.properties | 32 +++++++
.../src/main/resources/buildata | 1 +
.../tamaya/examples/minimal/MinimalTests.java | 80 ++++++++++++++++
.../org/tamaya/examples/minimal/TestEnum.java | 8 ++
.../META-INF/javaconfiguration.properties | 25 +++++
examples/5-injection-example/pom.xml | 49 ++++++++++
.../tamaya/examples/injection/Example.java | 48 ++++++++++
.../tamaya/examples/injection/ExampleMain.java | 50 ++++++++++
.../examples/injection/ExampleTemplate.java | 39 ++++++++
.../META-INF/javaconfiguration.properties | 27 ++++++
.../tamaya/examples/minimal/MinimalTests.java | 98 ++++++++++++++++++++
.../org/tamaya/examples/minimal/TestEnum.java | 26 ++++++
.../META-INF/javaconfiguration.properties | 25 +++++
examples/6-fileobserver-example/pom.xml | 51 ++++++++++
.../src/data/test.properties | 21 +++++
.../examples/fileobserver/TestConfigView.java | 50 ++++++++++
.../fileobserver/TestObservingProvider.java | 36 +++++++
...org.apache.tamaya.spi.PropertySourceProvider | 19 ++++
.../fileobserver/ObservedConfigTest.java | 54 +++++++++++
.../tamaya/core/internal/ReflectionUtil.java | 42 ---------
.../PropertiesFilePropertySource.java | 47 ----------
49 files changed, 1422 insertions(+), 320 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/minimal/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/minimal/ExampleMain.java b/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/minimal/ExampleMain.java
deleted file mode 100644
index f994b83..0000000
--- a/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/minimal/ExampleMain.java
+++ /dev/null
@@ -1,53 +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.examples.minimal;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * Created by Anatole on 20.03.2015.
- */
-public class ExampleMain {
-
- public static void main(String... args){
- System.out.println("****************************************************");
- System.out.println("Minimal Example");
- System.out.println("****************************************************");
- System.out.println();
- Configuration cfg = ConfigurationProvider.getConfiguration();
- System.out.println("Example Metadata:");
- System.out.println(" Type : " + cfg.get("example.type"));
- System.out.println(" Name : " + cfg.get("example.name"));
- System.out.println(" Description : " + cfg.get("example.description"));
- System.out.println(" Version : " + cfg.get("example.version"));
- System.out.println(" Author : " + cfg.get("example.author"));
- System.out.println();
- System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
- }
-
- private static String dump(Map<String, String> properties) {
- StringBuilder b = new StringBuilder();
- new TreeMap<>(properties).forEach((k, v) -> b.append(" " + k + " = " + v + '\n'));
- return b.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java b/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
new file mode 100644
index 0000000..e0b094e
--- /dev/null
+++ b/examples/1-minimal-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
@@ -0,0 +1,53 @@
+/*
+ * 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.examples.resolver;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * This class shows a minimal example that uses Tamaya core only.
+ */
+public class ExampleMain {
+
+ public static void main(String... args){
+ System.out.println("****************************************************");
+ System.out.println("Minimal Example");
+ System.out.println("****************************************************");
+ System.out.println();
+ Configuration cfg = ConfigurationProvider.getConfiguration();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + cfg.get("example.type"));
+ System.out.println(" Name : " + cfg.get("example.name"));
+ System.out.println(" Description : " + cfg.get("example.description"));
+ System.out.println(" Version : " + cfg.get("example.version"));
+ System.out.println(" Author : " + cfg.get("example.author"));
+ System.out.println();
+ System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
+ }
+
+ private static String dump(Map<String, String> properties) {
+ StringBuilder b = new StringBuilder();
+ new TreeMap<>(properties).forEach((k, v) -> b.append(" " + k + " = " + v + '\n'));
+ return b.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/1-minimal-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/1-minimal-example/src/main/resources/META-INF/javaconfiguration.properties b/examples/1-minimal-example/src/main/resources/META-INF/javaconfiguration.properties
index 23bb5d1..a91437c 100644
--- a/examples/1-minimal-example/src/main/resources/META-INF/javaconfiguration.properties
+++ b/examples/1-minimal-example/src/main/resources/META-INF/javaconfiguration.properties
@@ -1,4 +1,21 @@
-# My Config Properties
+#
+# 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
@@ -6,6 +23,5 @@ example.description=A minimal example only using API and RI.
example.version=1
example.author=anatole@apache.org
-
example.number=350
example.testEnum=V2
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/ExampleMain.java b/examples/2-simple-propertysource-example/src/main/java/ExampleMain.java
deleted file mode 100644
index 7de71fb..0000000
--- a/examples/2-simple-propertysource-example/src/main/java/ExampleMain.java
+++ /dev/null
@@ -1,33 +0,0 @@
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-public class ExampleMain {
-
- public static void main(String... args){
- System.out.println("****************************************************");
- System.out.println("Minimal Example");
- System.out.println("****************************************************");
- System.out.println();
- Configuration cfg = ConfigurationProvider.getConfiguration();
- System.out.println("Example Metadata:");
- System.out.println(" Type : " + cfg.get("example.type"));
- System.out.println(" Name : " + cfg.get("example.name"));
- System.out.println(" Description : " + cfg.get("example.description"));
- System.out.println(" Version : " + cfg.get("example.version"));
- System.out.println(" Author : " + cfg.get("example.author"));
- System.out.println();
- System.out.println(" Path : " + cfg.get("Path"));
- System.out.println(" aProp : " + cfg.get("aProp"));
- System.out.println();
- System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
- }
-
- private static String dump(Map<String, String> properties) {
- StringBuilder b = new StringBuilder();
- new TreeMap<>(properties).forEach((k,v)->b.append(" " + k + " = " + v + '\n'));
- return b.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/SimplePropertySource.java b/examples/2-simple-propertysource-example/src/main/java/SimplePropertySource.java
deleted file mode 100644
index 6ef7413..0000000
--- a/examples/2-simple-propertysource-example/src/main/java/SimplePropertySource.java
+++ /dev/null
@@ -1,40 +0,0 @@
-import org.apache.tamaya.spi.PropertySource;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Created by Anatole on 20.03.2015.
- */
-public class SimplePropertySource implements PropertySource{
-
- private Map<String,String> props = new HashMap<>();
-
- public SimplePropertySource() throws IOException {
- URL url = ClassLoader.getSystemClassLoader().getResource("META-INF/MyOtherConfigProperties.properties");
- Properties properties = new Properties();
- try(InputStream is = url.openStream()){
- properties.load(is);
- }
- finally{
- properties.forEach((k,v) -> props.put(k.toString(), v.toString()));
- props = Collections.unmodifiableMap(props);
- }
- }
-
- @Override
- public String getName() {
- return "META-INF/MyOtherConfigProperties.properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
- return props;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/SimplePropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/SimplePropertySourceProvider.java b/examples/2-simple-propertysource-example/src/main/java/SimplePropertySourceProvider.java
deleted file mode 100644
index 72e346c..0000000
--- a/examples/2-simple-propertysource-example/src/main/java/SimplePropertySourceProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-import org.apache.tamaya.core.propertysource.SimplePropertiesPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Created by Anatole on 20.03.2015.
- */
-public class SimplePropertySourceProvider implements PropertySourceProvider {
-
- // @Override
-// public Collection<PropertySource> getPropertySources() {
-// return null;
-// }
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- List<PropertySource> propertySources = new ArrayList<>();
- String[] resources = new String[]{
- "cfgOther/a.properties", "cfgOther/b.properties", "cfgOther/c.properties"};
- for (String res : resources) {
- URL url = ClassLoader.getSystemClassLoader().getResource(res);
- propertySources.add(new SimplePropertiesPropertySource(url));
- }
- return Collections.unmodifiableList(propertySources);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/ExampleMain.java b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/ExampleMain.java
new file mode 100644
index 0000000..48af51d
--- /dev/null
+++ b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/ExampleMain.java
@@ -0,0 +1,58 @@
+/*
+ * 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.examples.simple;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * This is a small example that simply adds a self-written {@link org.apache.tamaya.spi.PropertySource}
+ * ({@link SimplePropertySource}) and a {@link org.apache.tamaya.spi.PropertySourceProvider}
+ * ({@link SimplePropertySourceProvider}).
+ */
+public class ExampleMain {
+
+ public static void main(String... args){
+ System.out.println("*****************************************************");
+ System.out.println("Simple Example (with a PropertySource and a Provider)");
+ System.out.println("*****************************************************");
+ System.out.println();
+ Configuration cfg = ConfigurationProvider.getConfiguration();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + cfg.get("example.type"));
+ System.out.println(" Name : " + cfg.get("example.name"));
+ System.out.println(" Description : " + cfg.get("example.description"));
+ System.out.println(" Version : " + cfg.get("example.version"));
+ System.out.println(" Author : " + cfg.get("example.author"));
+ System.out.println();
+ System.out.println(" Path : " + cfg.get("Path"));
+ System.out.println(" aProp : " + cfg.get("aProp"));
+ System.out.println();
+ System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
+ }
+
+ private static String dump(Map<String, String> properties) {
+ StringBuilder b = new StringBuilder();
+ new TreeMap<>(properties).forEach((k,v)->b.append(" " + k + " = " + v + '\n'));
+ return b.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySource.java b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySource.java
new file mode 100644
index 0000000..1bc151c
--- /dev/null
+++ b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySource.java
@@ -0,0 +1,60 @@
+/*
+ * 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.examples.simple;
+
+import org.apache.tamaya.spi.PropertySource;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class SimplePropertySource implements PropertySource{
+
+ private Map<String,String> props = new HashMap<>();
+
+ public SimplePropertySource() throws IOException {
+ URL url = ClassLoader.getSystemClassLoader().getResource("META-INF/MyOtherConfigProperties.properties");
+ Properties properties = new Properties();
+ try(InputStream is = url.openStream()){
+ properties.load(is);
+ }
+ finally{
+ properties.forEach((k,v) -> props.put(k.toString(), v.toString()));
+ props = Collections.unmodifiableMap(props);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "META-INF/MyOtherConfigProperties.properties";
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return props;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySourceProvider.java b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySourceProvider.java
new file mode 100644
index 0000000..055b0b2
--- /dev/null
+++ b/examples/2-simple-propertysource-example/src/main/java/org/apache/tamaya/examples/simple/SimplePropertySourceProvider.java
@@ -0,0 +1,53 @@
+/*
+ * 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.examples.simple;
+
+import org.apache.tamaya.core.propertysource.SimplePropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class SimplePropertySourceProvider implements PropertySourceProvider {
+
+ // @Override
+// public Collection<PropertySource> getPropertySources() {
+// return null;
+// }
+
+ @Override
+ public Collection<PropertySource> getPropertySources() {
+ List<PropertySource> propertySources = new ArrayList<>();
+ String[] resources = new String[]{
+ "cfgOther/a.properties", "cfgOther/b.properties", "cfgOther/c.properties"};
+ for (String res : resources) {
+ URL url = ClassLoader.getSystemClassLoader().getResource(res);
+ propertySources.add(new SimplePropertySource(url));
+ }
+ return Collections.unmodifiableList(propertySources);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/MyOtherConfigProperties.properties b/examples/2-simple-propertysource-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
index cb27902..408a6e9 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
@@ -1,5 +1,21 @@
-# My Config Properties
-
+#
+# 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.description=A simple example now also loading its own files...
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/javaconfiguration.properties b/examples/2-simple-propertysource-example/src/main/resources/META-INF/javaconfiguration.properties
index 8664a57..a846e52 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/javaconfiguration.properties
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/javaconfiguration.properties
@@ -1,5 +1,21 @@
-# My Config Properties
-
+#
+# 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=simple-propertysource
example.description=A minimal example using an self written property source.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
index 724093f..33988a7 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -1,2 +1,20 @@
-SimplePropertySource
-org.apache.tamaya.core.propertysource.EnvironmentPropertiesPropertySource
\ No newline at end of file
+#
+# 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.examples.simple.SimplePropertySource
+org.apache.tamaya.core.propertysource.EnvironmentPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
index c8e867b..f9ed0ab 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -1 +1,19 @@
-SimplePropertySourceProvider
\ No newline at end of file
+#
+# 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.examples.simple.SimplePropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/cfgOther/a.properties
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/a.properties b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/a.properties
index a3d9370..069f8f1 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/a.properties
+++ b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/a.properties
@@ -1 +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 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.
+#
a=found A!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/cfgOther/b.properties
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/b.properties b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/b.properties
index 9153744..9c2775b 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/b.properties
+++ b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/b.properties
@@ -1 +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 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.
+#
b=found B!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/2-simple-propertysource-example/src/main/resources/cfgOther/c.properties
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/c.properties b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/c.properties
index cdc13ce..7a2d8ee 100644
--- a/examples/2-simple-propertysource-example/src/main/resources/cfgOther/c.properties
+++ b/examples/2-simple-propertysource-example/src/main/resources/cfgOther/c.properties
@@ -1 +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 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.
+#
c=found C!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/java/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/java/ExampleMain.java b/examples/3-resources-example/src/main/java/ExampleMain.java
deleted file mode 100644
index 7de71fb..0000000
--- a/examples/3-resources-example/src/main/java/ExampleMain.java
+++ /dev/null
@@ -1,33 +0,0 @@
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-public class ExampleMain {
-
- public static void main(String... args){
- System.out.println("****************************************************");
- System.out.println("Minimal Example");
- System.out.println("****************************************************");
- System.out.println();
- Configuration cfg = ConfigurationProvider.getConfiguration();
- System.out.println("Example Metadata:");
- System.out.println(" Type : " + cfg.get("example.type"));
- System.out.println(" Name : " + cfg.get("example.name"));
- System.out.println(" Description : " + cfg.get("example.description"));
- System.out.println(" Version : " + cfg.get("example.version"));
- System.out.println(" Author : " + cfg.get("example.author"));
- System.out.println();
- System.out.println(" Path : " + cfg.get("Path"));
- System.out.println(" aProp : " + cfg.get("aProp"));
- System.out.println();
- System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
- }
-
- private static String dump(Map<String, String> properties) {
- StringBuilder b = new StringBuilder();
- new TreeMap<>(properties).forEach((k,v)->b.append(" " + k + " = " + v + '\n'));
- return b.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/java/SimplePropertySourceProvider2.java
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/java/SimplePropertySourceProvider2.java b/examples/3-resources-example/src/main/java/SimplePropertySourceProvider2.java
deleted file mode 100644
index 443d1f5..0000000
--- a/examples/3-resources-example/src/main/java/SimplePropertySourceProvider2.java
+++ /dev/null
@@ -1,25 +0,0 @@
-import org.apache.tamaya.core.propertysource.SimplePropertiesPropertySource;
-import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Created by Anatole on 20.03.2015.
- */
-public class SimplePropertySourceProvider2 extends AbstractPathPropertySourceProvider {
-
- public SimplePropertySourceProvider2(){
- super("cfgOther/**/*.properties", "META-INF/MyOtherConfigProperties.*");
- }
-
- @Override
- protected PropertySource getPropertySource(URL url) {
- return new SimplePropertiesPropertySource(url);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/ExampleMain.java b/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/ExampleMain.java
new file mode 100644
index 0000000..50543e9
--- /dev/null
+++ b/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/ExampleMain.java
@@ -0,0 +1,57 @@
+package org.apache.tamaya.examples.resources;/*
+ * 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.
+ */
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ *
+ */
+public class ExampleMain {
+
+ public static void main(String... args){
+ System.out.println("****************************************************");
+ System.out.println("Resources Example shows the implementation of path");
+ System.out.println("based {@link PropertySourceProvider} ");
+ System.out.println("({@link MyPathPropertySourceProvider}).");
+ System.out.println("****************************************************");
+ System.out.println();
+ Configuration cfg = ConfigurationProvider.getConfiguration();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + cfg.get("example.type"));
+ System.out.println(" Name : " + cfg.get("example.name"));
+ System.out.println(" Description : " + cfg.get("example.description"));
+ System.out.println(" Version : " + cfg.get("example.version"));
+ System.out.println(" Author : " + cfg.get("example.author"));
+ System.out.println();
+ System.out.println(" Path : " + cfg.get("Path"));
+ System.out.println(" aProp : " + cfg.get("aProp"));
+ System.out.println();
+ System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
+ }
+
+ private static String dump(Map<String, String> properties) {
+ StringBuilder b = new StringBuilder();
+ new TreeMap<>(properties).forEach((k,v)->b.append(" " + k + " = " + v + '\n'));
+ return b.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/MyPathPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/MyPathPropertySourceProvider.java b/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/MyPathPropertySourceProvider.java
new file mode 100644
index 0000000..2b4bda8
--- /dev/null
+++ b/examples/3-resources-example/src/main/java/org/apache/tamaya/examples/resources/MyPathPropertySourceProvider.java
@@ -0,0 +1,39 @@
+package org.apache.tamaya.examples.resources;/*
+ * 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.
+ */
+
+import org.apache.tamaya.core.propertysource.SimplePropertySource;
+import org.apache.tamaya.resource.AbstractPathPropertySourceProvider;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.net.URL;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class MyPathPropertySourceProvider extends AbstractPathPropertySourceProvider {
+
+ public MyPathPropertySourceProvider(){
+ super("cfgOther/**/*.properties", "META-INF/MyOtherConfigProperties.*");
+ }
+
+ @Override
+ protected PropertySource getPropertySource(URL url) {
+ return new SimplePropertySource(url);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/META-INF/MyOtherConfigProperties.properties b/examples/3-resources-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
index cb27902..408a6e9 100644
--- a/examples/3-resources-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
+++ b/examples/3-resources-example/src/main/resources/META-INF/MyOtherConfigProperties.properties
@@ -1,5 +1,21 @@
-# My Config Properties
-
+#
+# 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.description=A simple example now also loading its own files...
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/META-INF/javaconfiguration.properties b/examples/3-resources-example/src/main/resources/META-INF/javaconfiguration.properties
index 8664a57..a846e52 100644
--- a/examples/3-resources-example/src/main/resources/META-INF/javaconfiguration.properties
+++ b/examples/3-resources-example/src/main/resources/META-INF/javaconfiguration.properties
@@ -1,5 +1,21 @@
-# My Config Properties
-
+#
+# 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=simple-propertysource
example.description=A minimal example using an self written property source.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
index 248b9c7..d7e0511 100644
--- a/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ b/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -1 +1,19 @@
-SimplePropertySourceProvider2
\ No newline at end of file
+#
+# 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.examples.resources.MyPathPropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/cfgOther/subs/a.properties
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/cfgOther/subs/a.properties b/examples/3-resources-example/src/main/resources/cfgOther/subs/a.properties
index a3d9370..069f8f1 100644
--- a/examples/3-resources-example/src/main/resources/cfgOther/subs/a.properties
+++ b/examples/3-resources-example/src/main/resources/cfgOther/subs/a.properties
@@ -1 +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 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.
+#
a=found A!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/cfgOther/subs/b.properties
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/cfgOther/subs/b.properties b/examples/3-resources-example/src/main/resources/cfgOther/subs/b.properties
index 9153744..9c2775b 100644
--- a/examples/3-resources-example/src/main/resources/cfgOther/subs/b.properties
+++ b/examples/3-resources-example/src/main/resources/cfgOther/subs/b.properties
@@ -1 +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 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.
+#
b=found B!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/3-resources-example/src/main/resources/cfgOther/subs/c.properties
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/cfgOther/subs/c.properties b/examples/3-resources-example/src/main/resources/cfgOther/subs/c.properties
index cdc13ce..7a2d8ee 100644
--- a/examples/3-resources-example/src/main/resources/cfgOther/subs/c.properties
+++ b/examples/3-resources-example/src/main/resources/cfgOther/subs/c.properties
@@ -1 +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 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.
+#
c=found C!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/pom.xml
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/pom.xml b/examples/4-resolver-example/pom.xml
new file mode 100644
index 0000000..b1c342b
--- /dev/null
+++ b/examples/4-resolver-example/pom.xml
@@ -0,0 +1,49 @@
+<!--
+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>
+
+ <artifactId>tamaya-example-resolver</artifactId>
+ <groupId>org.apache.tamaya.examples</groupId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <name>Apache Tamaya Example: Value Resolution</name>
+ <description>This project contains a simple example using the resolver module.</description>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-resolver</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java b/examples/4-resolver-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
new file mode 100644
index 0000000..73f2f7f
--- /dev/null
+++ b/examples/4-resolver-example/src/main/java/org/apache/tamaya/examples/resolver/ExampleMain.java
@@ -0,0 +1,58 @@
+/*
+ * 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.examples.resolver;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Example illustrating the usage of value resolver expressions (placeholders).
+ */
+public class ExampleMain {
+
+ public static void main(String... args){
+ System.out.println("****************************************************");
+ System.out.println("Resolver Example");
+ System.out.println("****************************************************");
+ System.out.println();
+ Configuration cfg = ConfigurationProvider.getConfiguration();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + cfg.get("example.type"));
+ System.out.println(" Name : " + cfg.get("example.name"));
+ System.out.println(" Description : " + cfg.get("example.description"));
+ System.out.println(" Version : " + cfg.get("example.version"));
+ System.out.println(" Author : " + cfg.get("example.author"));
+ System.out.println();
+ System.out.println("Resolved Data:");
+ System.out.println(" FullName : " + cfg.get("example.fullName"));
+ System.out.println(" FullVersion : " + cfg.get("example.fullVersion"));
+ System.out.println();
+ System.out.println();
+ System.out.println("FULL DUMP:\n\n" + dump(cfg.getProperties()));
+ }
+
+ private static String dump(Map<String, String> properties) {
+ StringBuilder b = new StringBuilder();
+ new TreeMap<>(properties).forEach((k, v) -> b.append(" " + k + " = " + v + '\n'));
+ return b.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/main/resources/META-INF/javaconfiguration.properties b/examples/4-resolver-example/src/main/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..32c44f5
--- /dev/null
+++ b/examples/4-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
+example.author=anatole@apache.org
+
+
+example.number=350
+example.testEnum=V2
+
+# Resolved entries
+example.fullName=${conf:example.name}(${conf:example.type})
+example.fullVersion=${conf:example.fullName} - ${conf:example.version}, build ${resource:buildata}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/main/resources/buildata
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/main/resources/buildata b/examples/4-resolver-example/src/main/resources/buildata
new file mode 100644
index 0000000..286ceb0
--- /dev/null
+++ b/examples/4-resolver-example/src/main/resources/buildata
@@ -0,0 +1 @@
+Build 1234
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java b/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
new file mode 100644
index 0000000..990f77a
--- /dev/null
+++ b/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
@@ -0,0 +1,80 @@
+package org.tamaya.examples.minimal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.math.BigInteger;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class MinimalTests {
+
+ private static Configuration config;
+
+ @BeforeClass
+ public static void before() throws InterruptedException {
+ config = ConfigurationProvider.getConfiguration();
+ Thread.sleep(100L);
+ }
+
+ @Test
+ public void printMetaInfo() {
+ System.out.println("****************************************************");
+ System.out.println("Minimal Example");
+ System.out.println("****************************************************");
+ System.out.println();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + config.get("example.type"));
+ System.out.println(" Name : " + config.get("example.name"));
+ System.out.println(" Description : " + config.get("example.description"));
+ System.out.println(" Version : " + config.get("example.version"));
+ System.out.println(" Author : " + config.get("example.author"));
+ System.out.println();
+ }
+
+ @Test(expected = ConfigException.class)
+ public void getNumberValueTooLong() {
+ String value = config.get("example.number");
+ System.err.println("**** example.number(String)=" + value);
+ int number = config.getInteger("example.number").getAsInt();
+ System.out.println("----\n example.number(int)=" + number);
+ }
+
+ @Test
+ public void getNumberValueAsInt_BadCase() {
+ String value = config.get("example.numberAsHex");
+ int number = config.getInteger("example.numberAsHex").getAsInt();
+ print("example.numberAsHex", number);
+ }
+
+ @Test
+ public void getNumberValueAsBigInteger() {
+ String value = config.get("example.number");
+ BigInteger number = config.get("example.number", BigInteger.class);
+ print("example.number", number);
+ }
+
+ @Test(expected = ConfigException.class)
+ public void getNumberValueAsLongHex() {
+ String value = config.get("example.numberAsLongHex");
+ long number = config.getInteger("example.numberAsLongHex").getAsInt();
+ print("example.numberAsLongHex", number);
+ }
+
+ @Test
+ public void getEnum() {
+ String value = config.get("example.testEnum");
+ TestEnum en = config.get("example.testEnum", TestEnum.class);
+ print("example.testEnum", en);
+ }
+
+ protected void print(String key, Object value) {
+ System.out.println("----\n" +
+ " " + key + "(String)=" + config.get(key)
+ + "\n " + key + "(" + value.getClass().getSimpleName() + ")=" + value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java b/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
new file mode 100644
index 0000000..c595330
--- /dev/null
+++ b/examples/4-resolver-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
@@ -0,0 +1,8 @@
+package org.tamaya.examples.minimal;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public enum TestEnum {
+ V1,V2,V3
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/4-resolver-example/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/4-resolver-example/src/test/resources/META-INF/javaconfiguration.properties b/examples/4-resolver-example/src/test/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..acb9caf
--- /dev/null
+++ b/examples/4-resolver-example/src/test/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+tamaya.ordinal=-1
+example.description=A minimal example only using API and RI, now partially overridden!
+
+example.number=35333333333333333333333333333333333333333333333333333333333330
+example.numberAsHex=0xFA
+example.numberAsLongHex=0xFFFSFSFF
+example.testEnum=V1
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/pom.xml
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/pom.xml b/examples/5-injection-example/pom.xml
new file mode 100644
index 0000000..8839d5a
--- /dev/null
+++ b/examples/5-injection-example/pom.xml
@@ -0,0 +1,49 @@
+<!--
+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>
+
+ <artifactId>tamaya-example-injection</artifactId>
+ <groupId>org.apache.tamaya.examples</groupId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <name>Apache Tamaya Example: Configuration Injection</name>
+ <description>This project contains a simple illustrating how configuration values can be injected.</description>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-injection</artifactId>
+ <version>0.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/Example.java
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/Example.java b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/Example.java
new file mode 100644
index 0000000..2cc0396
--- /dev/null
+++ b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/Example.java
@@ -0,0 +1,48 @@
+/*
+ * 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.examples.injection;
+
+import org.apache.tamaya.inject.ConfigRoot;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultValue;
+
+/**
+ * Simple example bean, mapped by default names mostly.
+ */
+@ConfigRoot("example")
+public class Example {
+
+ private String type;
+ private String name;
+ @DefaultValue("No description available.")
+ private String description;
+ private int version;
+ @ConfiguredProperty(keys = "author")
+ private String exampleAuthor;
+
+ @Override
+ public String toString() {
+ return "Example Metadata:" +
+ "type='" + type + '\'' +
+ ", name='" + name + '\'' +
+ ", description='" + description + '\'' +
+ ", version=" + version +
+ ", exampleAuthor='" + exampleAuthor + '\'';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleMain.java
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleMain.java b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleMain.java
new file mode 100644
index 0000000..b3497c1
--- /dev/null
+++ b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleMain.java
@@ -0,0 +1,50 @@
+/*
+ * 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.examples.injection;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.inject.ConfigurationInjector;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Example illustrating the functionality of injecting configuration and defining configuration templates.
+ */
+public class ExampleMain {
+
+ public static void main(String... args){
+ System.out.println("****************************************************");
+ System.out.println("Injection and TemplatesExample");
+ System.out.println("****************************************************");
+ System.out.println();
+ Example example = new Example();
+ ConfigurationInjector.getInstance().configure(example);
+ System.out.println("Injected:");
+ System.out.println("---------");
+ System.out.println(example);
+ System.out.println("Template:");
+ System.out.println("---------");
+ ExampleTemplate template = ConfigurationInjector.getInstance().createTemplate(ExampleTemplate.class);
+ System.out.println(template);
+ System.out.println();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleTemplate.java
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleTemplate.java b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleTemplate.java
new file mode 100644
index 0000000..b9c24bc
--- /dev/null
+++ b/examples/5-injection-example/src/main/java/org/apache/tamaya/examples/injection/ExampleTemplate.java
@@ -0,0 +1,39 @@
+/*
+ * 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.examples.injection;
+
+import org.apache.tamaya.inject.ConfigRoot;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultValue;
+
+/**
+ * Simple example bean, mapped by default names mostly.
+ */
+@ConfigRoot("example")
+public interface ExampleTemplate {
+
+ public String getType();
+ public String getName();
+ @DefaultValue("No description available.")
+ public String getDescription();
+ public int getVersion();
+ @ConfiguredProperty(keys = "author")
+ public String getExampleAuthor();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/main/resources/META-INF/javaconfiguration.properties b/examples/5-injection-example/src/main/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..317a180
--- /dev/null
+++ b/examples/5-injection-example/src/main/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,27 @@
+#
+# 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=This example illustrates basic configuration injection mechanisms.
+example.version=1
+example.author=anatole@apache.org
+
+
+example.number=350
+example.testEnum=V2
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java b/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
new file mode 100644
index 0000000..fb4d55e
--- /dev/null
+++ b/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/MinimalTests.java
@@ -0,0 +1,98 @@
+/*
+ * 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.tamaya.examples.minimal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.math.BigInteger;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public class MinimalTests {
+
+ private static Configuration config;
+
+ @BeforeClass
+ public static void before() throws InterruptedException {
+ config = ConfigurationProvider.getConfiguration();
+ Thread.sleep(100L);
+ }
+
+ @Test
+ public void printMetaInfo() {
+ System.out.println("****************************************************");
+ System.out.println("Minimal Example");
+ System.out.println("****************************************************");
+ System.out.println();
+ System.out.println("Example Metadata:");
+ System.out.println(" Type : " + config.get("example.type"));
+ System.out.println(" Name : " + config.get("example.name"));
+ System.out.println(" Description : " + config.get("example.description"));
+ System.out.println(" Version : " + config.get("example.version"));
+ System.out.println(" Author : " + config.get("example.author"));
+ System.out.println();
+ }
+
+ @Test(expected = ConfigException.class)
+ public void getNumberValueTooLong() {
+ String value = config.get("example.number");
+ System.err.println("**** example.number(String)=" + value);
+ int number = config.getInteger("example.number").getAsInt();
+ System.out.println("----\n example.number(int)=" + number);
+ }
+
+ @Test
+ public void getNumberValueAsInt_BadCase() {
+ String value = config.get("example.numberAsHex");
+ int number = config.getInteger("example.numberAsHex").getAsInt();
+ print("example.numberAsHex", number);
+ }
+
+ @Test
+ public void getNumberValueAsBigInteger() {
+ String value = config.get("example.number");
+ BigInteger number = config.get("example.number", BigInteger.class);
+ print("example.number", number);
+ }
+
+ @Test(expected = ConfigException.class)
+ public void getNumberValueAsLongHex() {
+ String value = config.get("example.numberAsLongHex");
+ long number = config.getInteger("example.numberAsLongHex").getAsInt();
+ print("example.numberAsLongHex", number);
+ }
+
+ @Test
+ public void getEnum() {
+ String value = config.get("example.testEnum");
+ TestEnum en = config.get("example.testEnum", TestEnum.class);
+ print("example.testEnum", en);
+ }
+
+ protected void print(String key, Object value) {
+ System.out.println("----\n" +
+ " " + key + "(String)=" + config.get(key)
+ + "\n " + key + "(" + value.getClass().getSimpleName() + ")=" + value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java b/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
new file mode 100644
index 0000000..be83dd5
--- /dev/null
+++ b/examples/5-injection-example/src/test/java/org/tamaya/examples/minimal/TestEnum.java
@@ -0,0 +1,26 @@
+/*
+ * 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.tamaya.examples.minimal;
+
+/**
+ * Created by Anatole on 20.03.2015.
+ */
+public enum TestEnum {
+ V1,V2,V3
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/16bf44fd/examples/5-injection-example/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/5-injection-example/src/test/resources/META-INF/javaconfiguration.properties b/examples/5-injection-example/src/test/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..acb9caf
--- /dev/null
+++ b/examples/5-injection-example/src/test/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+tamaya.ordinal=-1
+example.description=A minimal example only using API and RI, now partially overridden!
+
+example.number=35333333333333333333333333333333333333333333333333333333333330
+example.numberAsHex=0xFA
+example.numberAsLongHex=0xFFFSFSFF
+example.testEnum=V1