You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/11/24 20:21:11 UTC
[1/2] incubator-tamaya git commit: [TAMAYA-203] Re-added the minimal
example of Tamayas usage.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 4bce88abf -> cf12cc1bc
[TAMAYA-203] Re-added the minimal example of Tamayas usage.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/cf12cc1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/cf12cc1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/cf12cc1b
Branch: refs/heads/master
Commit: cf12cc1bcf10621912a4b0c97a2c552c48d29c49
Parents: dcd3e69
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Thu Nov 24 21:20:11 2016 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Thu Nov 24 21:20:57 2016 +0100
----------------------------------------------------------------------
examples/01-minimal/pom.xml | 54 +++++++++++++
.../apache/tamaya/examples/minimal/Main.java | 84 ++++++++++++++++++++
.../tamaya/examples/minimal/package-info.java | 24 ++++++
.../META-INF/javaconfiguration.properties | 26 ++++++
examples/pom.xml | 45 +++++++++++
pom.xml | 1 +
6 files changed, 234 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf12cc1b/examples/01-minimal/pom.xml
----------------------------------------------------------------------
diff --git a/examples/01-minimal/pom.xml b/examples/01-minimal/pom.xml
new file mode 100644
index 0000000..e137377
--- /dev/null
+++ b/examples/01-minimal/pom.xml
@@ -0,0 +1,54 @@
+<?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.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.tamaya.examples</groupId>
+ <artifactId>01-minimal</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+
+ <name>Apache Tamaya Minimal Examples</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</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>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf12cc1b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/Main.java
----------------------------------------------------------------------
diff --git a/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/Main.java b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/Main.java
new file mode 100644
index 0000000..b999cb9
--- /dev/null
+++ b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/Main.java
@@ -0,0 +1,84 @@
+/*
+ * 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.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;
+
+/**
+ * Minimal example showing how to use Tamaya in the simplest possible way.
+ *
+ * <p>
+ * Without any additional configuration Tamaya allows you access via
+ * {@link ConfigurationProvider#getConfiguration} all configuration values.
+ * Accessable are all system environment properties, all system properties,
+ * and all properties which are found in {@code /META-INF/javaconfiguration.properties}
+ * or {@code /META-INF/javaconfiguration.xml}.
+ * </p>
+ *
+ * @see org.apache.tamaya.core.propertysource.EnvironmentPropertySource
+ * @see org.apache.tamaya.core.propertysource.SystemPropertySource
+ */
+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("Minimal 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();
+
+ 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/blob/cf12cc1b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/package-info.java
----------------------------------------------------------------------
diff --git a/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/package-info.java b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/package-info.java
new file mode 100644
index 0000000..9e424cd
--- /dev/null
+++ b/examples/01-minimal/src/main/java/org/apache/tamaya/examples/minimal/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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 to show the simplest ways to use Tamaya with
+ * the standard configuration file.
+ */
+package org.apache.tamaya.examples.minimal;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf12cc1b/examples/01-minimal/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/examples/01-minimal/src/main/resources/META-INF/javaconfiguration.properties b/examples/01-minimal/src/main/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..361aebc
--- /dev/null
+++ b/examples/01-minimal/src/main/resources/META-INF/javaconfiguration.properties
@@ -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 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=350322222222222222222222222222222222222222222222222222222222222222222
+example.testEnum=V2
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf12cc1b/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
new file mode 100644
index 0000000..6c06676
--- /dev/null
+++ b/examples/pom.xml
@@ -0,0 +1,45 @@
+<?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</groupId>
+ <artifactId>tamaya-all</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </parent>
+
+
+ <groupId>org.apache.tamaya.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+
+ <name>Apache Tamaya Core Examples</name>
+
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>01-minimal</module>
+ </modules>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf12cc1b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e0765db..56eac1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -212,6 +212,7 @@ under the License.
<module>buildconfigurations</module>
<module>code</module>
<module>docs</module>
+ <module>examples</module>
<module>distribution</module>
</modules>
[2/2] incubator-tamaya git commit: [TAMAYA-164] All classes related
to the output of the banner are now only within the org.apache.tamaya package
available.
Posted by pl...@apache.org.
[TAMAYA-164] All classes related to the output of the banner are now only within the org.apache.tamaya package available.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/dcd3e69e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/dcd3e69e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/dcd3e69e
Branch: refs/heads/master
Commit: dcd3e69e302ef597c16fa2379c50ecaff6d4ff29
Parents: 4bce88a
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Sat Nov 19 21:25:32 2016 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Thu Nov 24 21:20:57 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/tamaya/BannerManager.java | 136 +++++++++++++++++++
.../java/org/apache/tamaya/BannerPrinter.java | 21 +++
.../apache/tamaya/ConfigurationProvider.java | 1 -
.../tamaya/banner/AbstractBannerPrinter.java | 59 --------
.../org/apache/tamaya/banner/BannerManager.java | 58 --------
.../org/apache/tamaya/banner/BannerPrinter.java | 31 -----
.../tamaya/banner/ConsoleBannerPrinter.java | 29 ----
.../tamaya/banner/LoggingBannerPrinter.java | 33 -----
.../tamaya/banner/SilentBannerPrinter.java | 28 ----
.../org/apache/tamaya/BannerManagerTest.java | 74 ++++++++++
.../apache/tamaya/banner/BannerManagerTest.java | 74 ----------
11 files changed, 231 insertions(+), 313 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/BannerManager.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/BannerManager.java b/code/api/src/main/java/org/apache/tamaya/BannerManager.java
new file mode 100644
index 0000000..9ae81bc
--- /dev/null
+++ b/code/api/src/main/java/org/apache/tamaya/BannerManager.java
@@ -0,0 +1,136 @@
+/*
+ * 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;
+
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+class BannerManager {
+ enum BannerTarget {
+ OFF, CONSOLE, LOGGER
+ }
+
+ private BannerTarget bannerTarget;
+
+ public BannerManager(String value) {
+ value = Objects.requireNonNull(value).toUpperCase(Locale.getDefault());
+
+ try {
+ bannerTarget = BannerTarget.valueOf(value);
+ } catch (NullPointerException | IllegalArgumentException e) {
+ bannerTarget = BannerTarget.OFF;
+ }
+ }
+
+ public void outputBanner() {
+ BannerPrinter bp = new SilentBannerPrinter();
+
+ switch (bannerTarget) {
+ case CONSOLE:
+ bp = new ConsoleBannerPrinter();
+ break;
+ case LOGGER:
+ bp = new LoggingBannerPrinter();
+ break;
+ case OFF:
+ default:
+ break;
+ }
+
+ bp.outputBanner();
+ }
+}
+
+abstract class AbstractBannerPrinter implements BannerPrinter {
+ private static final Logger log = Logger.getLogger(AbstractBannerPrinter.class.getName());
+
+ @Override
+ public void outputBanner() {
+ try {
+ URL url = ConfigurationProvider.class.getResource("/tamaya-banner.txt");
+
+ if (url != null) {
+ Path path = Paths.get(url.toURI());
+ List<String> content = Files.readAllLines(path, StandardCharsets.UTF_8);
+
+ for (String line : content) {
+ outputSingleLine(line);
+ }
+ }
+ } catch (Exception e) {
+ log.log(Level.FINE, "Failed to output the banner of tamaya.", e);
+ }
+ }
+
+ abstract void outputSingleLine(String line);
+}
+
+
+/**
+ * Outputs the Tamaya banner to an implementation specific output channel
+ * as STDOUT or the logging system.
+ */
+interface BannerPrinter {
+ /**
+ * Outputs the banner to the output channel
+ * used by the implementation.
+ */
+ void outputBanner();
+}
+
+/**
+ * Silent implementation of a {@link BannerPrinter}.
+ */
+class SilentBannerPrinter implements BannerPrinter {
+ @Override
+ public void outputBanner() {
+ }
+}
+
+/**
+ * Logs the banner via JUL at level {@link java.util.logging.Level#INFO}.
+ */
+class LoggingBannerPrinter extends AbstractBannerPrinter {
+ private static final Logger log = Logger.getLogger(LoggingBannerPrinter.class.getName());
+
+ @Override
+ void outputSingleLine(String line) {
+ log.log(Level.INFO, line);
+ }
+}
+
+/**
+ * Prints the banner to the console.
+ */
+class ConsoleBannerPrinter extends AbstractBannerPrinter {
+ @Override
+ void outputSingleLine(String line) {
+ System.out.println(line);
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/BannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/BannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/BannerPrinter.java
new file mode 100644
index 0000000..2f74836
--- /dev/null
+++ b/code/api/src/main/java/org/apache/tamaya/BannerPrinter.java
@@ -0,0 +1,21 @@
+/*
+ * 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;
+
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index 7c65da0..0c5d9b1 100644
--- a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -18,7 +18,6 @@
*/
package org.apache.tamaya;
-import org.apache.tamaya.banner.BannerManager;
import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.ConfigurationContextBuilder;
import org.apache.tamaya.spi.ConfigurationProviderSpi;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/AbstractBannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/AbstractBannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/banner/AbstractBannerPrinter.java
deleted file mode 100644
index 5ad975c..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/AbstractBannerPrinter.java
+++ /dev/null
@@ -1,59 +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.banner;
-
-import org.apache.tamaya.ConfigurationProvider;
-
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Abstract base class for an implementation of the
- * {@link BannerPrinter} providing the common functionality
- * of all implementations.
- */
-abstract class AbstractBannerPrinter implements BannerPrinter {
- private static final Logger log = Logger.getLogger(AbstractBannerPrinter.class.getName());
-
- @Override
- public void outputBanner() {
- try {
- URL url = ConfigurationProvider.class.getResource("/tamaya-banner.txt");
-
- if (url != null) {
- Path path = Paths.get(url.toURI());
- List<String> content = Files.readAllLines(path, StandardCharsets.UTF_8);
-
- for (String line : content) {
- outputSingleLine(line);
- }
- }
- } catch (Exception e) {
- log.log(Level.FINE, "Failed to output the banner of tamaya.", e);
- }
- }
-
- abstract void outputSingleLine(String line);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/BannerManager.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/BannerManager.java b/code/api/src/main/java/org/apache/tamaya/banner/BannerManager.java
deleted file mode 100644
index 79e3ce4..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/BannerManager.java
+++ /dev/null
@@ -1,58 +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.banner;
-
-import java.util.Locale;
-import java.util.Objects;
-
-public class BannerManager {
- enum BannerTarget {
- OFF, CONSOLE, LOGGER
- }
-
- private BannerTarget bannerTarget;
-
- public BannerManager(String value) {
- value = Objects.requireNonNull(value).toUpperCase(Locale.getDefault());
-
- try {
- bannerTarget = BannerTarget.valueOf(value);
- } catch (NullPointerException | IllegalArgumentException e) {
- bannerTarget = BannerTarget.OFF;
- }
- }
-
- public void outputBanner() {
- BannerPrinter bp = new SilentBannerPrinter();
-
- switch (bannerTarget) {
- case CONSOLE:
- bp = new ConsoleBannerPrinter();
- break;
- case LOGGER:
- bp = new LoggingBannerPrinter();
- break;
- case OFF:
- default:
- break;
- }
-
- bp.outputBanner();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/BannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/BannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/banner/BannerPrinter.java
deleted file mode 100644
index 96b2aad..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/BannerPrinter.java
+++ /dev/null
@@ -1,31 +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.banner;
-
-/**
- * Outputs the Tamaya banner to an implementation specific output channel
- * as STDOUT or the logging system.
- */
-public interface BannerPrinter {
- /**
- * Outputs the banner to the output channel
- * used by the implementation.
- */
- void outputBanner();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/ConsoleBannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/ConsoleBannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/banner/ConsoleBannerPrinter.java
deleted file mode 100644
index 37ee424..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/ConsoleBannerPrinter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.banner;
-
-/**
- * Prints the banner to the console.
- */
-public class ConsoleBannerPrinter extends AbstractBannerPrinter {
- @Override
- void outputSingleLine(String line) {
- System.out.println(line);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/LoggingBannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/LoggingBannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/banner/LoggingBannerPrinter.java
deleted file mode 100644
index 26cbbb2..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/LoggingBannerPrinter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.banner;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Logs the banner via JUL at level {@link java.util.logging.Level#INFO}.
- */
-public class LoggingBannerPrinter extends AbstractBannerPrinter {
- private static final Logger log = Logger.getLogger(LoggingBannerPrinter.class.getName());
- @Override
- void outputSingleLine(String line) {
- log.log(Level.INFO, line);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/main/java/org/apache/tamaya/banner/SilentBannerPrinter.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/banner/SilentBannerPrinter.java b/code/api/src/main/java/org/apache/tamaya/banner/SilentBannerPrinter.java
deleted file mode 100644
index 8669ad4..0000000
--- a/code/api/src/main/java/org/apache/tamaya/banner/SilentBannerPrinter.java
+++ /dev/null
@@ -1,28 +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.banner;
-
-/**
- * Silent implementation of a {@link BannerPrinter}.
- */
-public class SilentBannerPrinter implements BannerPrinter {
- @Override
- public void outputBanner() {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/test/java/org/apache/tamaya/BannerManagerTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/BannerManagerTest.java b/code/api/src/test/java/org/apache/tamaya/BannerManagerTest.java
new file mode 100644
index 0000000..3bec943
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/BannerManagerTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.PrintStream;
+import java.util.logging.Logger;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BannerManagerTest {
+
+ @Mock
+ private PrintStream printStream;
+
+ @Mock
+ private Logger logger;
+
+ @Test
+ public void valueConsoleSendsBannerToSystemOut() {
+ PrintStream standard = System.out;
+
+ System.setOut(printStream);
+
+ try {
+ BannerManager bm = new BannerManager("console");
+ bm.outputBanner();
+
+ } finally {
+ System.setOut(standard);
+ }
+
+ Mockito.verify(printStream, Mockito.atLeastOnce()).println(Mockito.anyString());
+ }
+
+ @Test
+ public void invalidValueAvoidsLoggingToConsonle() {
+
+ PrintStream standard = System.out;
+
+ System.setOut(printStream);
+
+ try {
+ BannerManager bm = new BannerManager("snafu");
+ bm.outputBanner();
+
+ } finally {
+ System.setOut(standard);
+ }
+
+ Mockito.verify(printStream, Mockito.never()).println(Mockito.anyString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/dcd3e69e/code/api/src/test/java/org/apache/tamaya/banner/BannerManagerTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/banner/BannerManagerTest.java b/code/api/src/test/java/org/apache/tamaya/banner/BannerManagerTest.java
deleted file mode 100644
index e5ba859..0000000
--- a/code/api/src/test/java/org/apache/tamaya/banner/BannerManagerTest.java
+++ /dev/null
@@ -1,74 +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.banner;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import java.io.PrintStream;
-import java.util.logging.Logger;
-
-@RunWith(MockitoJUnitRunner.class)
-public class BannerManagerTest {
-
- @Mock
- private PrintStream printStream;
-
- @Mock
- private Logger logger;
-
- @Test
- public void valueConsoleSendsBannerToSystemOut() {
- PrintStream standard = System.out;
-
- System.setOut(printStream);
-
- try {
- BannerManager bm = new BannerManager("console");
- bm.outputBanner();
-
- } finally {
- System.setOut(standard);
- }
-
- Mockito.verify(printStream, Mockito.atLeastOnce()).println(Mockito.anyString());
- }
-
- @Test
- public void invalidValueAvoidsLoggingToConsonle() {
-
- PrintStream standard = System.out;
-
- System.setOut(printStream);
-
- try {
- BannerManager bm = new BannerManager("snafu");
- bm.outputBanner();
-
- } finally {
- System.setOut(standard);
- }
-
- Mockito.verify(printStream, Mockito.never()).println(Mockito.anyString());
- }
-
-}