You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/06 17:18:33 UTC
[37/50] [abbrv] incubator-tamaya-sandbox git commit: Added Vaadin
based UI module.
Added Vaadin based UI module.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/c4c3d9b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/c4c3d9b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/c4c3d9b2
Branch: refs/heads/master
Commit: c4c3d9b215f0afdb9987010e3a06443b56c8eb72
Parents: 80df0be
Author: anatole <an...@apache.org>
Authored: Wed Mar 30 22:48:25 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Wed Mar 30 22:48:25 2016 +0200
----------------------------------------------------------------------
ui/jsf/pom.xml | 152 ------------
ui/jsf/src/main/webapp/index.jsf | 15 --
ui/pom.xml | 230 ++++++++++++++++++-
.../org/apache/tamaya/ui/ApplicationLayout.java | 81 +++++++
.../main/java/org/apache/tamaya/ui/Content.java | 34 +++
.../java/org/apache/tamaya/ui/CurrentUser.java | 23 ++
.../main/java/org/apache/tamaya/ui/Header.java | 44 ++++
ui/src/main/java/org/apache/tamaya/ui/MyUI.java | 102 ++++++++
.../main/java/org/apache/tamaya/ui/NavBar.java | 73 ++++++
.../java/org/apache/tamaya/ui/UIConstants.java | 22 ++
ui/src/main/java/org/apache/tamaya/ui/User.java | 34 +++
.../org/apache/tamaya/ui/VaadinApplication.java | 93 ++++++++
.../java/org/apache/tamaya/ui/VaadinBundle.java | 55 +++++
.../java/org/apache/tamaya/ui/ViewConfig.java | 20 ++
.../tamaya/ui/components/LazyProvider.java | 24 ++
.../tamaya/ui/components/PageTitleUpdater.java | 25 ++
.../ui/components/VerticalSpacedLayout.java | 14 ++
.../org/apache/tamaya/ui/event/EventBus.java | 34 +++
.../org/apache/tamaya/ui/event/LogoutEvent.java | 4 +
.../apache/tamaya/ui/event/NavigationEvent.java | 14 ++
.../apache/tamaya/ui/services/LoginService.java | 12 +
.../apache/tamaya/ui/views/ComponentView.java | 128 +++++++++++
.../org/apache/tamaya/ui/views/ConfigView.java | 113 +++++++++
.../org/apache/tamaya/ui/views/ErrorView.java | 21 ++
.../org/apache/tamaya/ui/views/HomeView.java | 34 +++
.../apache/tamaya/ui/views/login/LoginBox.java | 88 +++++++
.../tamaya/ui/views/login/LoginEvent.java | 15 ++
.../apache/tamaya/ui/views/login/LoginView.java | 13 ++
ui/src/main/resources/config/application.yml | 9 +
ui/src/test/resources/config/application.yml | 13 ++
30 files changed, 1367 insertions(+), 172 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/jsf/pom.xml
----------------------------------------------------------------------
diff --git a/ui/jsf/pom.xml b/ui/jsf/pom.xml
deleted file mode 100644
index aab6a64..0000000
--- a/ui/jsf/pom.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy current the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-ui</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- </parent>
-
- <artifactId>tamaya-ui-jsf</artifactId>
- <name>Apache Tamaya Modules UI - JSF</name>
- <packaging>war</packaging>
-
- <properties>
- <jsf.version>4.2.1.RELEASE</jsf.version>
- <primefaces.version>1.2.6.RELEASE</primefaces.version>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.ui.jsf
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.primefaces</groupId>
- <artifactId>primefaces</artifactId>
- <version>5.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-injection</artifactId>
- <version>${project.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>5.0.1.Final</version>
- </dependency>
-
- <!-- File Upload -->
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.2</version>
- </dependency>
-
- <!-- Themes -->
- <dependency>
- <groupId>org.primefaces.themes</groupId>
- <artifactId>all-themes</artifactId>
- <version>1.0.10</version>
- </dependency>
-
- <!-- GraphicImage -->
- <dependency>
- <groupId>net.sourceforge.barbecue</groupId>
- <artifactId>barbecue</artifactId>
- <version>1.5-beta1</version>
- </dependency>
- <dependency>
- <groupId>jfree</groupId>
- <artifactId>jfreechart</artifactId>
- <version>1.0.0</version>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/jsf/src/main/webapp/index.jsf
----------------------------------------------------------------------
diff --git a/ui/jsf/src/main/webapp/index.jsf b/ui/jsf/src/main/webapp/index.jsf
deleted file mode 100644
index 28018ae..0000000
--- a/ui/jsf/src/main/webapp/index.jsf
+++ /dev/null
@@ -1,15 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:p="http://primefaces.org/mobile">
-
-<h:head>
-
-</h:head>
-
-<h:body>
-
- <p:spinner />
-
-</h:body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/pom.xml
----------------------------------------------------------------------
diff --git a/ui/pom.xml b/ui/pom.xml
index b40563e..b3a3b95 100644
--- a/ui/pom.xml
+++ b/ui/pom.xml
@@ -23,17 +23,237 @@ under the License.
<parent>
<groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-integration-sandbox</artifactId>
+ <artifactId>tamaya-extensions</artifactId>
<version>0.2-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
</parent>
- <packaging>pom</packaging>
+ <packaging>war</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>tamaya-ui</artifactId>
<name>Apache Tamaya Modules - UI</name>
- <modules>
- <module>jsf</module>
- </modules>
+ <properties>
+ <vaadin.version>7.6.4</vaadin.version>
+ <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
+ <dropwizard.version>0.9.2</dropwizard.version>
+ <mainClass>org.apache.tamaya.ui.VaadinApplication</mainClass>
+ <jetty.plugin.version>9.2.3.v20140905</jetty.plugin.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <servlet.api.version>3.0.1</servlet.api.version>
+ </properties>
+
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-bom</artifactId>
+ <version>${vaadin.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>com.vaadin</groupId>-->
+ <!--<artifactId>vaadin-server</artifactId>-->
+ <!--<version>${vaadin.version}</version>-->
+ <!--</dependency>-->
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-assets</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-testing</artifactId>
+ <version>${dropwizard.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>javax.servlet</groupId>-->
+ <!--<artifactId>javax.servlet-api</artifactId>-->
+ <!--<version>${servlet.api.version}</version>-->
+ <!--</dependency>-->
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-push</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-assets</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-testing</artifactId>
+ </dependency>
+ <!--
+ Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
+
+ For widgetset compilation, vaadin-client-compiler is automatically added on the
+ compilation classpath by vaadin-maven-plugin so normally there is no need for an
+ explicit dependency.
+ -->
+ <!--
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/main/webapp/VAADIN/themes/mytheme/addons.scss</exclude>
+ <exclude>src/main/webapp/VAADIN/themes/mytheme/styles.css</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ <!-- Exclude some unnecessary files generated by the GWT compiler. -->
+ <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
+ WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
+ <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
+ <draftCompile>false</draftCompile>
+ <compileReport>false</compileReport>
+ <style>OBF</style>
+ <strict>true</strict>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-theme</goal>
+ <goal>update-widgetset</goal>
+ <goal>compile</goal>
+ <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
+ <goal>compile-theme</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <!--<version>2.6.1</version>-->
+ <!-- Clean up also any pre-compiled themes -->
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>src/main/webapp/VAADIN/themes</directory>
+ <includes>
+ <include>**/styles.css</include>
+ <include>**/styles.scss.cache</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>${mainClass}</mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <repositories>
+ <repository>
+ <id>vaadin-addons</id>
+ <url>http://maven.vaadin.com/vaadin-addons</url>
+ </repository>
+ <repository>
+ <id>vaadin-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
new file mode 100644
index 0000000..7d57362
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -0,0 +1,81 @@
+package org.apache.tamaya.ui;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Panel;
+import org.apache.tamaya.ui.components.LazyProvider;
+import org.apache.tamaya.ui.components.PageTitleUpdater;
+import org.apache.tamaya.ui.views.ComponentView;
+import org.apache.tamaya.ui.views.ConfigView;
+import org.apache.tamaya.ui.views.ErrorView;
+import org.apache.tamaya.ui.views.HomeView;
+
+public class ApplicationLayout extends HorizontalLayout {
+
+ private NavBar navBar;
+ private Panel content;
+ private Navigator navigator;
+
+ public ApplicationLayout() {
+ addStyleName(UIConstants.MAIN_LAYOUT);
+
+ setSizeFull();
+
+ initLayouts();
+ setupNavigator();
+ }
+
+ private void initLayouts() {
+ navBar = new NavBar();
+ // Use panel as main content container to allow it's content to scroll
+ content = new Panel();
+ content.setSizeFull();
+ content.addStyleName(UIConstants.PANEL_BORDERLESS);
+
+ addComponents(navBar, content);
+ setExpandRatio(content, 1);
+ }
+
+ private void setupNavigator() {
+ navigator = new Navigator(MyUI.getCurrent(), content);
+
+ registerViews();
+
+ // Add view change listeners so we can do things like select the correct menu item and update the page title
+ navigator.addViewChangeListener(navBar);
+ navigator.addViewChangeListener(new PageTitleUpdater());
+
+ navigator.navigateTo(navigator.getState());
+ }
+
+ private void registerViews() {
+ addView(HomeView.class);
+ addView(ConfigView.class);
+ addView(ComponentView.class);
+ navigator.setErrorView(ErrorView.class);
+ }
+
+ /**
+ * Registers av given view to the navigator and adds it to the NavBar
+ */
+ private void addView(Class<? extends View> viewClass) {
+ ViewConfig viewConfig = viewClass.getAnnotation(ViewConfig.class);
+
+ switch (viewConfig.createMode()) {
+ case CREATE:
+ navigator.addView(viewConfig.uri(), viewClass);
+ break;
+ case LAZY:
+ navigator.addProvider(new LazyProvider(viewConfig.uri(), viewClass));
+ break;
+ case EAGER:
+ try {
+ navigator.addView(viewConfig.uri(), viewClass.newInstance());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ navBar.addView(viewConfig.uri(), viewConfig.displayName());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/Content.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/Content.java b/ui/src/main/java/org/apache/tamaya/ui/Content.java
new file mode 100644
index 0000000..c03fdf1
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/Content.java
@@ -0,0 +1,34 @@
+/*
+ * 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.ui;
+
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Label;
+
+import java.io.Serializable;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public class Content extends HorizontalSplitPanel implements Serializable{
+
+ public Content(){
+ this.addComponents(new Label("Left"), new Label("Content"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
new file mode 100644
index 0000000..c894420
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
@@ -0,0 +1,23 @@
+package org.apache.tamaya.ui;
+
+import com.vaadin.server.VaadinSession;
+
+/**
+ * Convenience wrapper for storing and retreiving a user from the VaadinSession
+ */
+public class CurrentUser {
+
+ private static final String KEY = "currentser";
+
+ public static void set(User user) {
+ VaadinSession.getCurrent().setAttribute(KEY, user);
+ }
+
+ public static User get() {
+ return (User) VaadinSession.getCurrent().getAttribute(KEY);
+ }
+
+ public static boolean isLoggedIn() {
+ return get() != null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/Header.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/Header.java b/ui/src/main/java/org/apache/tamaya/ui/Header.java
new file mode 100644
index 0000000..3e92dac
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/Header.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ui;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Link;
+import sun.awt.HorizBagLayout;
+
+import java.io.Serializable;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public class Header extends HorizontalLayout implements Serializable{
+
+ private Label titleLabel = new Label("Apache Tamaya");
+ private HorizontalLayout buttonBar = new HorizontalLayout();
+ private Label iconLabel = new Label();
+
+ public Header(){
+ buttonBar.addComponents(new Button("About"), new Button("Konfiguration"), new Button("PluginManagement"));
+ addComponents(titleLabel, buttonBar, iconLabel);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/MyUI.java b/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
new file mode 100644
index 0000000..845c400
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
@@ -0,0 +1,102 @@
+/*
+ * 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.ui;
+
+import javax.servlet.annotation.WebServlet;
+
+import com.google.common.eventbus.Subscribe;
+import com.vaadin.annotations.Theme;
+import com.vaadin.annotations.Title;
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.ui.*;
+import org.apache.tamaya.ui.components.LazyProvider;
+import org.apache.tamaya.ui.components.PageTitleUpdater;
+import org.apache.tamaya.ui.event.LogoutEvent;
+import org.apache.tamaya.ui.event.NavigationEvent;
+import org.apache.tamaya.ui.views.ErrorView;
+import org.apache.tamaya.ui.views.login.LoginEvent;
+import org.apache.tamaya.ui.views.login.LoginView;
+
+/**
+ * This UI is the application entry point. A UI may either represent a browser window
+ * (or tab) or some part of a html page where a Vaadin application is embedded.
+ * <p>
+ * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be
+ * overridden to add component to the user interface and initialize non-component functionality.
+ */
+@Theme("valo")
+@Title("Tamaya")
+public class MyUI extends UI {
+
+ private Header header = new Header();
+ private Content content = new Content();
+ private Navigator navigator;
+
+ @Override
+ protected void init(VaadinRequest vaadinRequest) {
+ setupEventBus();
+
+ if (CurrentUser.isLoggedIn()) {
+ setContent(new ApplicationLayout());
+ } else {
+ setContent(new LoginView());
+ }
+ }
+
+ @Subscribe
+ public void userLoggedIn(
+ LoginEvent event) {
+ CurrentUser.set(event.getUser());
+ setContent(new ApplicationLayout());
+ }
+
+ @Subscribe
+ public void navigateTo(NavigationEvent view) {
+ getNavigator().navigateTo(view.getViewName());
+ }
+
+ public static MyUI getCurrent() {
+ return (MyUI) UI.getCurrent();
+ }
+
+ @Subscribe
+ public void logout(LogoutEvent logoutEvent) {
+ // Don't invalidate the underlying HTTP session if you are using it for something else
+ VaadinSession.getCurrent().getSession().invalidate();
+ VaadinSession.getCurrent().close();
+ Page.getCurrent().reload();
+
+ }
+
+ private void setupEventBus() {
+ org.apache.tamaya.ui.event.EventBus.register(this);
+ }
+
+
+ @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
+ @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
+ public static class MyUIServlet extends VaadinServlet {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
new file mode 100644
index 0000000..caed4cd
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
@@ -0,0 +1,73 @@
+package org.apache.tamaya.ui;
+
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.server.FontAwesome;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import org.apache.tamaya.ui.event.EventBus;
+import org.apache.tamaya.ui.event.LogoutEvent;
+import org.apache.tamaya.ui.event.NavigationEvent;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class NavBar extends CssLayout implements ViewChangeListener {
+
+ private Map<String, Button> buttonMap = new HashMap<>();
+
+ public NavBar() {
+ setHeight("100%");
+ addStyleName(UIConstants.MENU_ROOT);
+ addStyleName(UIConstants.NAVBAR);
+
+ Label logo = new Label("<strong>Apache Tamaya</strong>", ContentMode.HTML);
+ logo.addStyleName(UIConstants.MENU_TITLE);
+ addComponent(logo);
+
+ addLogoutButton();
+ }
+
+ private void addLogoutButton() {
+ Button logout = new Button("Log out", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ EventBus.post(new LogoutEvent());
+ }
+ });
+ addComponent(logout);
+
+ logout.addStyleName(UIConstants.BUTTON_LOGOUT);
+ logout.addStyleName(UIConstants.BUTTON_BORDERLESS);
+ logout.setIcon(FontAwesome.SIGN_OUT);
+ }
+
+ public void addView(final String uri, String displayName) {
+ Button viewButton = new Button(displayName, new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ EventBus.post(new NavigationEvent(uri));
+ }
+ });
+ viewButton.addStyleName(UIConstants.MENU_ITEM);
+ viewButton.addStyleName(UIConstants.BUTTON_BORDERLESS);
+ buttonMap.put(uri, viewButton);
+
+ addComponent(viewButton, components.size() - 1);
+ }
+
+ @Override
+ public boolean beforeViewChange(ViewChangeEvent event) {
+ return true; // false blocks navigation, always return true here
+ }
+
+ @Override
+ public void afterViewChange(ViewChangeEvent event) {
+ for(Button button: buttonMap.values()){
+ button.removeStyleName(UIConstants.SELECTED);
+ }
+ Button button = buttonMap.get(event.getViewName());
+ if (button != null) button.addStyleName(UIConstants.SELECTED);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java b/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
new file mode 100644
index 0000000..1631e0b
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
@@ -0,0 +1,22 @@
+package org.apache.tamaya.ui;
+
+import com.vaadin.ui.themes.ValoTheme;
+
+/**
+ * Helper for theme. Less typos in CSS style names and easier to find usages in project.
+ */
+public class UIConstants extends ValoTheme {
+
+ public static final String MAIN_LAYOUT = "main-layout";
+ public static final String NAVBAR = "navbar";
+ public static final String SELECTED = "selected";
+ public static final String LOGIN_BOX = "login-box";
+
+
+ public static final String BUTTON_LOGOUT = "logout";
+ public static final String ORDER_LAYOUT = "order-layout";
+ public static final String ORDER_ID = "order-id";
+ public static final String ORDER_TOTAL = "order-total";
+
+ public static final String LAYOUT_VIEW = "layout-view";
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/User.java b/ui/src/main/java/org/apache/tamaya/ui/User.java
new file mode 100644
index 0000000..bf01664
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/User.java
@@ -0,0 +1,34 @@
+package org.apache.tamaya.ui;
+
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public class User {
+
+ private String userID = "-";
+ private String fulLName = "<unknown>";
+ private Date logInDate = new Date();
+
+ public User(String userID, String fullName){
+ this.userID = Objects.requireNonNull(userID);
+ this.fulLName = fullName;
+ if(fullName==null){
+ this.fulLName = userID;
+ }
+ }
+
+ public String getUserID() {
+ return userID;
+ }
+
+ public String getFullName() {
+ return fulLName;
+ }
+
+ public String getLoginDate(){
+ return logInDate.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java b/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
new file mode 100644
index 0000000..7931a4b
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
@@ -0,0 +1,93 @@
+/*
+ * 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.ui;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.VaadinServlet;
+import io.dropwizard.Application;
+import io.dropwizard.configuration.ConfigurationSourceProvider;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.logging.Logger;
+
+public class VaadinApplication extends Application<VaadinApplication.Configuration> {
+
+ private static final Logger LOG = Logger.getLogger(VaadinApplication.class.getName());
+
+ @Override
+ public void run(Configuration configuration, Environment environment) throws Exception {
+ // empty
+ }
+
+ @Override
+ public void initialize(Bootstrap<Configuration> bootstrap) {
+ bootstrap.setConfigurationSourceProvider(new AdaptiveConfigurationsourceProvider());
+ bootstrap.addBundle(new VaadinBundle(MyUI.MyUIServlet.class, "/tamaya/*"));
+ }
+
+ /**
+ * Configuration source provider that reads from a file (similar to the default), but if not present/resovable also
+ * tries to resolve the path as URL or classpath resource.
+ */
+ private static class AdaptiveConfigurationsourceProvider implements ConfigurationSourceProvider{
+
+ @Override
+ public InputStream open(String path) throws IOException {
+ File file = new File(path);
+ if (file.exists()) {
+ LOG.info("Reading configuration from file: " + path);
+ return new FileInputStream(file);
+ }
+ try {
+ URL url = new URL(path);
+ LOG.info("Reading configuration from url: " + path);
+ return url.openStream();
+
+ } catch (Exception e) {
+ // continue
+ }
+ URL url = getClass().getClassLoader().getResource(path);
+ if (url != null) {
+ LOG.info("Reading configuration from classpath: " + path);
+ return url.openStream();
+ }
+ // try default
+ url = getClass().getClassLoader().getResource("/config/application.yml");
+ if (url != null) {
+ LOG.info("Reading configuration from classpath: /config/application.yml");
+ return url.openStream();
+ }
+ return null;
+ }
+ }
+
+ public static class Configuration extends io.dropwizard.Configuration {
+ public String name;
+ }
+
+ public static void main(String... args) throws Exception {
+ new VaadinApplication().run(args);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java b/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
new file mode 100644
index 0000000..dcdce66
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
@@ -0,0 +1,55 @@
+/*
+ * 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.ui;
+
+import com.google.common.collect.Maps;
+import io.dropwizard.Bundle;
+import io.dropwizard.assets.AssetsBundle;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+import org.eclipse.jetty.server.session.SessionHandler;
+
+import javax.servlet.Servlet;
+import java.util.Map;
+
+public class VaadinBundle implements Bundle {
+
+ private final Map<String, Class<? extends Servlet>> servlets = Maps.newLinkedHashMap();
+
+ private final SessionHandler sessionHandler;
+
+
+ public VaadinBundle(Class<? extends Servlet> servlet, String pathSpec) {
+ this.sessionHandler = new SessionHandler();
+ servlets.put(pathSpec, servlet);
+ }
+
+ @Override
+ public void initialize(Bootstrap<?> bootstrap) {
+ bootstrap.addBundle(new AssetsBundle("/VAADIN", "/VAADIN", null, "vaadin"));
+ }
+
+ @Override
+ public void run(Environment environment) {
+ environment.servlets().setSessionHandler(sessionHandler);
+ for (Map.Entry<String, Class<? extends Servlet>> servlet : servlets.entrySet()) {
+ environment.getApplicationContext().addServlet(servlet.getValue(), servlet.getKey());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java b/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
new file mode 100644
index 0000000..0ab0c66
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
@@ -0,0 +1,20 @@
+package org.apache.tamaya.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for easily collecting View meta info.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ViewConfig {
+
+ enum CreateMode {CREATE, LAZY, EAGER}
+
+ String uri();
+ String displayName();
+ CreateMode createMode() default CreateMode.CREATE;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
new file mode 100644
index 0000000..ca36a21
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
@@ -0,0 +1,24 @@
+package org.apache.tamaya.ui.components;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+
+/**
+ * Lazily initializes a view when it's first accessed, then always returns the
+ * same instance on subsequent calls.
+ */
+public class LazyProvider extends Navigator.ClassBasedViewProvider {
+ private View view;
+
+ public LazyProvider(String viewName, Class<? extends View> viewClass) {
+ super(viewName, viewClass);
+ }
+
+ @Override
+ public View getView(String viewName) {
+ if (view == null) {
+ view = super.getView(viewName);
+ }
+ return view;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
new file mode 100644
index 0000000..37a6e8f
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
@@ -0,0 +1,25 @@
+package org.apache.tamaya.ui.components;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.server.Page;
+import org.apache.tamaya.ui.ViewConfig;
+
+public class PageTitleUpdater implements ViewChangeListener {
+ @Override
+ public boolean beforeViewChange(ViewChangeEvent event) {
+ return true;
+ }
+
+ @Override
+ public void afterViewChange(ViewChangeEvent event) {
+
+ View view = event.getNewView();
+ ViewConfig viewConfig = view.getClass().getAnnotation(ViewConfig.class);
+
+ if (viewConfig != null) {
+ Page.getCurrent().setTitle(viewConfig.displayName());
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java b/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
new file mode 100644
index 0000000..52fe525
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
@@ -0,0 +1,14 @@
+package org.apache.tamaya.ui.components;
+
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Vertical layout with spacing and margin on by default
+ */
+public class VerticalSpacedLayout extends VerticalLayout {
+
+ public VerticalSpacedLayout() {
+ setMargin(true);
+ setSpacing(true);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java b/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
new file mode 100644
index 0000000..d269dc3
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
@@ -0,0 +1,34 @@
+package org.apache.tamaya.ui.event;
+
+
+import com.google.common.eventbus.SubscriberExceptionContext;
+import com.google.common.eventbus.SubscriberExceptionHandler;
+
+/**
+ * Convenience class for accessing the _UI Scoped_ EventBus. If you are using something like the CDI event
+ * bus, you don't need a class like this.
+ */
+public final class EventBus {
+
+ private static final com.google.common.eventbus.EventBus EVENT_BUS =
+ new com.google.common.eventbus.EventBus(new SubscriberExceptionHandler(){
+ @Override
+ public void handleException(Throwable throwable, SubscriberExceptionContext subscriberExceptionContext) {
+ throwable.printStackTrace();
+ }
+ });
+
+ private EventBus(){}
+
+ public static void register(final Object listener) {
+ EVENT_BUS.register(listener);
+ }
+
+ public static void unregister(final Object listener) {
+ EVENT_BUS.unregister(listener);
+ }
+
+ public static void post(final Object event) {
+ EVENT_BUS.post(event);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
new file mode 100644
index 0000000..3168a76
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
@@ -0,0 +1,4 @@
+package org.apache.tamaya.ui.event;
+
+public class LogoutEvent {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
new file mode 100644
index 0000000..0ec1ec5
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
@@ -0,0 +1,14 @@
+package org.apache.tamaya.ui.event;
+
+
+public class NavigationEvent {
+ private String viewName;
+
+ public NavigationEvent(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java b/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
new file mode 100644
index 0000000..ceb4cc0
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
@@ -0,0 +1,12 @@
+package org.apache.tamaya.ui.services;
+
+import org.apache.tamaya.ui.User;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public interface LoginService {
+
+ User login(String userId, String credentials);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
new file mode 100644
index 0000000..abfdb11
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
@@ -0,0 +1,128 @@
+package org.apache.tamaya.ui.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.*;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.*;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+
+@ViewConfig(uri = "/components", displayName = "Components")
+public class ComponentView extends VerticalSpacedLayout implements View {
+
+ private Tree configTree = new Tree("Components");
+
+
+ public ComponentView() {
+ Label caption = new Label("Components");
+ Label description = new Label(
+ "This view shows the components currently active. This information may be useful when checking if an" +
+ "configuration extension is loaded and for inspection of the configuration and property sources" +
+ "invovlved.",
+ ContentMode.HTML);
+
+ fillComponentTree();
+
+ addComponents(caption, description, configTree);
+
+ caption.addStyleName(UIConstants.LABEL_HUGE);
+ description.addStyleName(UIConstants.LABEL_LARGE);
+
+ }
+
+ private void fillComponentTree() {
+ configTree.removeAllItems();
+ Configuration config = ConfigurationProvider.getConfiguration();
+
+ String currentParent = "General";
+ configTree.addItem(currentParent);
+ configTree.addItem("Configuration.class");
+ configTree.setItemCaption("Configuration.class", "Configuration class = " + config.getClass().getName());
+ configTree.setParent("Configuration.class", currentParent);
+ configTree.setChildrenAllowed("Configuration.class", false);
+
+ configTree.addItem("ConfigurationContext.class");
+ configTree.setItemCaption("ConfigurationContext.class", "ConfigurationContext class = " + config.getContext().getClass().getName());
+ configTree.setParent("ConfigurationContext.class", currentParent);
+ configTree.setChildrenAllowed("ConfigurationContext.class", false);
+
+ configTree.addItem("PropertyValueCombinationPolicy.class");
+ configTree.setItemCaption("PropertyValueCombinationPolicy.class", PropertyValueCombinationPolicy.class.getSimpleName() + " class = " + config.getContext().getPropertyValueCombinationPolicy().getClass().getName());
+ configTree.setParent("PropertyValueCombinationPolicy.class", currentParent);
+ configTree.setChildrenAllowed("PropertyValueCombinationPolicy.class", false);
+
+ configTree.addItem("ConfigurationContext.types");
+ configTree.setItemCaption("ConfigurationContext.types", "Configurable types");
+ configTree.setParent("ConfigurationContext.types", currentParent);
+ for(Map.Entry<TypeLiteral<?>,List<PropertyConverter<?>>> en:config.getContext().getPropertyConverters().entrySet()){
+ configTree.addItem(en.getKey());
+ configTree.setItemCaption(en.getKey(), "Type = " + en.getKey().toString());
+ configTree.setParent(en.getKey(), "ConfigurationContext.types");
+ for(PropertyConverter conv: en.getValue()){
+ configTree.addItem(conv);
+ configTree.setItemCaption(conv, conv.getClass().getName());
+ configTree.setChildrenAllowed(conv, false);
+ configTree.setParent(conv, en.getKey());
+ }
+ }
+ configTree.addItem("ConfigurationContext.filters");
+ configTree.setItemCaption("ConfigurationContext.filters", "Property Filters");
+ for(PropertyFilter filter: config.getContext().getPropertyFilters()){
+ configTree.addItem(filter);
+ configTree.setItemCaption(filter, filter.getClass().getName());
+ configTree.setChildrenAllowed(filter, false);
+ configTree.setParent(filter, "ConfigurationContext.filters");
+ }
+ configTree.addItem("ConfigurationContext.sources");
+ configTree.setItemCaption("ConfigurationContext.sources", "Property Sources");
+ for(PropertySource source: config.getContext().getPropertySources()){
+ configTree.addItem(source);
+ configTree.setItemCaption(source, "name = "+source.getName());
+ configTree.setParent(source, "ConfigurationContext.sources");
+
+ configTree.addItem(source.toString() + ".ordinal");
+ configTree.setItemCaption(source.toString() + ".ordinal", "ordinal = "+source.getOrdinal());
+ configTree.setParent(source.toString() + ".ordinal", source);
+ configTree.setChildrenAllowed(source.toString() + ".ordinal", false);
+ configTree.addItem(source.toString() + ".class");
+ configTree.setItemCaption(source.toString() + ".class", "class = "+source.getClass().getName());
+ configTree.setChildrenAllowed(source.toString() + ".class", false);
+ configTree.setParent(source.toString() + ".class", source);
+ Map<String,String> props = source.getProperties();
+ configTree.addItem(props);
+ configTree.setItemCaption(props, "properties:");
+ configTree.setParent(props, source);
+ for(Map.Entry propEn:props.entrySet()){
+ String entryKey = props.hashCode() + propEn.getKey().toString();
+ configTree.addItem(entryKey);
+ configTree.setChildrenAllowed(entryKey, false);
+ configTree.setItemCaption(entryKey, propEn.getKey() + "=" + propEn.getValue());
+ configTree.setParent(entryKey, props);
+ }
+ }
+ }
+
+ private String getCaption(String key, String value) {
+ int index = key.lastIndexOf('.');
+ if(index<0){
+ return key + " = " + value;
+ }else{
+ return key.substring(index+1) + " = " + value;
+ }
+ }
+
+ @Override
+ public void enter(ViewChangeListener.ViewChangeEvent event) {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
new file mode 100644
index 0000000..c3828f9
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
@@ -0,0 +1,113 @@
+package org.apache.tamaya.ui.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.*;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.ui.CurrentUser;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+
+import java.util.Map;
+
+
+@ViewConfig(uri = "/config", displayName = "Configuration")
+public class ConfigView extends VerticalSpacedLayout implements View {
+
+ private TextField keyFilter = new TextField("Key filter");
+ private TextField valueFilter = new TextField("Value filter");
+ private Tree tree = new Tree("Current Configuration");
+
+ public ConfigView() {
+ Label caption = new Label("Raw Configuration");
+ Label description = new Label(
+ "This view shows the overall <b>raw</b> configuration tree. Dependening on your access rights you" +
+ "may see partial or masked data. Similarly configuration can be <i>read-only</i> or <i>mutable</i>.",
+ ContentMode.HTML);
+ HorizontalLayout filters = new HorizontalLayout();
+
+ Button filterButton = new Button("Filter", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ fillTree();
+ }
+ });
+ filters.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
+ filters.addComponents(keyFilter, valueFilter, filterButton);
+
+ fillTree();
+
+ addComponents(caption, description, filters, tree);
+
+ caption.addStyleName(UIConstants.LABEL_HUGE);
+ description.addStyleName(UIConstants.LABEL_LARGE);
+
+ }
+
+ private void fillTree() {
+ String keyFilterExp = this.keyFilter.getValue();
+ if(keyFilterExp.isEmpty()){
+ keyFilterExp = null;
+ }
+ String valueFilterExp = this.valueFilter.getValue();
+ if(valueFilterExp.isEmpty()){
+ valueFilterExp = null;
+ }
+ tree.removeAllItems();
+ for(Map.Entry<String,String> entry: ConfigurationProvider.getConfiguration().getProperties().entrySet()){
+ String key = entry.getKey();
+ if(keyFilterExp!=null && !key.matches(keyFilterExp)){
+ continue;
+ }
+ if(valueFilterExp!=null && !entry.getValue().matches(valueFilterExp)){
+ continue;
+ }
+ tree.addItem(key);
+ tree.setItemCaption(key, getCaption(key, entry.getValue()));
+ tree.setChildrenAllowed(key, false);
+ String parent = null;
+ int start = 0;
+ int index = key.indexOf('.', start);
+ while(index>0){
+ String subItem = key.substring(0,index);
+ String caption = key.substring(start, index);
+ tree.addItem(subItem);
+ tree.setItemCaption(subItem, caption);
+ if(parent!=null){
+ tree.setParent(subItem, parent);
+ }
+ parent = subItem;
+ start = index+1;
+ index = key.indexOf('.', start);
+ }
+ String lastItem = key.substring(start);
+ if(!lastItem.equals(key)){
+ if(parent!=null){
+ tree.setParent(key, parent);
+ }else{
+ // should not happen
+ }
+ }else{ // singl root entry
+ if(parent!=null) {
+ tree.setParent(key, parent);
+ }
+ }
+ }
+ }
+
+ private String getCaption(String key, String value) {
+ int index = key.lastIndexOf('.');
+ if(index<0){
+ return key + " = " + value;
+ }else{
+ return key.substring(index+1) + " = " + value;
+ }
+ }
+
+ @Override
+ public void enter(ViewChangeListener.ViewChangeEvent event) {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java b/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
new file mode 100644
index 0000000..ba16bf2
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
@@ -0,0 +1,21 @@
+package org.apache.tamaya.ui.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+import org.apache.tamaya.ui.UIConstants;
+
+public class ErrorView extends VerticalLayout implements View {
+ @Override
+ public void enter(ViewChangeListener.ViewChangeEvent event) {
+ setSizeFull();
+ setMargin(true);
+ Label label = new Label("Could not find a view with that name. You are most likely doing it wrong.");
+ label.addStyleName(UIConstants.LABEL_FAILURE);
+
+ addComponent(label);
+ setComponentAlignment(label, Alignment.MIDDLE_CENTER);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
new file mode 100644
index 0000000..c656389
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
@@ -0,0 +1,34 @@
+package org.apache.tamaya.ui.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Label;
+import org.apache.tamaya.ui.CurrentUser;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+
+
+@ViewConfig(uri = "", displayName = "Home")
+public class HomeView extends VerticalSpacedLayout implements View {
+
+ public HomeView() {
+ Label caption = new Label("Welcome, " + CurrentUser.get().getUserID());
+ Label description = new Label(
+ "<b>Apache Tamaya</b> is an API and extendable framework for accessing and managing configuration.<br/> \n" +
+ "Please check the project's home page <a href='http://tamaya.incubator.apache.org'>http://tamaya.incubator.apache.org</a>.",
+ ContentMode.HTML);
+
+ addComponents(caption, description);
+
+ caption.addStyleName(UIConstants.LABEL_HUGE);
+ description.addStyleName(UIConstants.LABEL_LARGE);
+
+ }
+
+ @Override
+ public void enter(ViewChangeListener.ViewChangeEvent event) {
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
new file mode 100644
index 0000000..83d6b20
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
@@ -0,0 +1,88 @@
+package org.apache.tamaya.ui.views.login;
+
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.ui.*;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.User;
+import org.apache.tamaya.ui.event.EventBus;
+import org.apache.tamaya.ui.services.LoginService;
+
+
+public class LoginBox extends VerticalLayout {
+
+ private LoginService loginService = new LoginService() {
+ @Override
+ public User login(String userId, String credentials) {
+ if("admin".equals(userId)){
+ return new User("admin", "Administrator");
+ }
+ return null;
+ }
+ }; // TODO Load
+ private TextField username;
+ private PasswordField password;
+
+ public LoginBox() {
+ setWidth("400px");
+ addStyleName(UIConstants.LOGIN_BOX);
+ setSpacing(true);
+ setMargin(true);
+
+ addCaption();
+ addForm();
+ addButtons();
+ }
+
+ private void addCaption() {
+ Label caption = new Label("Login to system");
+ addComponent(caption);
+
+ caption.addStyleName(UIConstants.LABEL_H1);
+ }
+
+ private void addForm() {
+ FormLayout loginForm = new FormLayout();
+ username = new TextField("Username");
+ password = new PasswordField("Password");
+ loginForm.addComponents(username, password);
+ addComponent(loginForm);
+ loginForm.setSpacing(true);
+ for(Component component:loginForm){
+ component.setWidth("100%");
+ }
+ username.focus();
+ }
+
+ private void addButtons() {
+ HorizontalLayout buttonsLayout = new HorizontalLayout();
+ Button forgotButton = new Button("Forgot", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ Notification.show("Not implemented", Notification.Type.TRAY_NOTIFICATION);
+ }
+ });
+ Button loginButton = new Button("Login", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ login();
+ }
+ });
+ buttonsLayout.addComponents(forgotButton, loginButton);
+ addComponent(buttonsLayout);
+ buttonsLayout.setSpacing(true);
+ forgotButton.addStyleName(UIConstants.BUTTON_LINK);
+ loginButton.addStyleName(UIConstants.BUTTON_PRIMARY);
+ loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
+ setComponentAlignment(buttonsLayout, Alignment.BOTTOM_RIGHT);
+ }
+
+ private void login() {
+ User user = loginService.login(username.getValue(), password.getValue());
+ if(user!=null){
+ EventBus.post(new LoginEvent(user));
+ }else{
+ Notification.show("Login failed.", "Hint: use any non-empty strings", Notification.Type.WARNING_MESSAGE);
+ username.focus();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
new file mode 100644
index 0000000..b6ba2b4
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
@@ -0,0 +1,15 @@
+package org.apache.tamaya.ui.views.login;
+
+import org.apache.tamaya.ui.User;
+
+public class LoginEvent {
+ private User user;
+
+ public LoginEvent(User user) {
+ this.user = user;
+ }
+
+ public User getUser() {
+ return user;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
----------------------------------------------------------------------
diff --git a/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
new file mode 100644
index 0000000..e1181d1
--- /dev/null
+++ b/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
@@ -0,0 +1,13 @@
+package org.apache.tamaya.ui.views.login;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.VerticalLayout;
+
+public class LoginView extends VerticalLayout {
+
+ public LoginView() {
+ setSizeFull();
+ setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
+ addComponent(new LoginBox());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/main/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/ui/src/main/resources/config/application.yml b/ui/src/main/resources/config/application.yml
new file mode 100644
index 0000000..a0a6fad
--- /dev/null
+++ b/ui/src/main/resources/config/application.yml
@@ -0,0 +1,9 @@
+server:
+ type: default
+ maxThreads: 1024
+ applicationConnectors:
+ - type: http
+ port: 8090
+ adminConnectors:
+ - type: http
+ port: 8091
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/c4c3d9b2/ui/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/ui/src/test/resources/config/application.yml b/ui/src/test/resources/config/application.yml
new file mode 100644
index 0000000..9ec8d5b
--- /dev/null
+++ b/ui/src/test/resources/config/application.yml
@@ -0,0 +1,13 @@
+server:
+ type: default
+ maxThreads: 1024
+ applicationConnectors:
+ - type: http
+ port: 8090
+ - type: https
+ port: 8453
+ adminConnectors:
+ - type: http
+ port: 8091
+ - type: https
+ port: 8453
\ No newline at end of file