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:32:20 UTC
[3/5] incubator-tamaya git commit: Moved all modules in the sandbox
to their own repository.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/metamodels/staged/src/test/java/org/apache/tamaya/dsl/ProfileManagerTest.java
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/staged/src/test/java/org/apache/tamaya/dsl/ProfileManagerTest.java b/sandbox/metamodels/staged/src/test/java/org/apache/tamaya/dsl/ProfileManagerTest.java
deleted file mode 100644
index 9692d47..0000000
--- a/sandbox/metamodels/staged/src/test/java/org/apache/tamaya/dsl/ProfileManagerTest.java
+++ /dev/null
@@ -1,78 +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.dsl;
-
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
-/**
- * Created by atsticks on 05.05.16.
- */
-public class ProfileManagerTest {
-
- private ProfileManager profileManager = ProfileManager.getInstance();
-
- @org.junit.Test
- public void isProfileActive() throws Exception {
- assertTrue(profileManager.isProfileActive("DEV"));
- assertTrue(profileManager.isProfileActive("DEFAULT"));
- assertFalse(profileManager.isProfileActive("PROD"));
- }
-
- @org.junit.Test
- public void isProfileDefined() throws Exception {
- assertTrue(profileManager.isProfileDefined("DEV"));
- assertTrue(profileManager.isProfileDefined("DEFAULT"));
- assertFalse(profileManager.isProfileDefined("foo"));
- }
-
- @org.junit.Test
- public void isProfileDefault() throws Exception {
- assertFalse(profileManager.isProfileDefault("DEV"));
- assertTrue(profileManager.isProfileDefault("DEFAULT"));
- }
-
- @org.junit.Test
- public void getActiveProfiles() throws Exception {
- List<String> profiles = profileManager.getActiveProfiles();
- assertTrue(profiles.contains("DEV"));
- assertTrue(profiles.contains("DEFAULT"));
- assertFalse(profiles.contains("TEST"));
- assertFalse(profiles.contains("PROD"));
- }
-
- @org.junit.Test
- public void getDefaultProfiles() throws Exception {
- List<String> profiles = profileManager.getDefaultProfiles();
- assertTrue(profiles.contains("DEFAULT"));
- assertFalse(profiles.contains("TEST"));
- }
-
- @org.junit.Test
- public void getAllProfiles() throws Exception {
- Set<String> profiles = profileManager.getAllProfiles();
- assertTrue(profiles.contains("DEFAULT"));
- assertTrue(profiles.contains("DEV"));
- assertTrue(profiles.contains("TEST"));
- assertTrue(profiles.contains("PROD"));
- assertFalse(profiles.contains("foo"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/metamodels/staged/src/test/resources/GLOBAL.properties
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/staged/src/test/resources/GLOBAL.properties b/sandbox/metamodels/staged/src/test/resources/GLOBAL.properties
deleted file mode 100644
index 9f39f75..0000000
--- a/sandbox/metamodels/staged/src/test/resources/GLOBAL.properties
+++ /dev/null
@@ -1,19 +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.
-#
-aKey=aValue.GLOBAL
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/metamodels/staged/src/test/resources/TEST.properties
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/staged/src/test/resources/TEST.properties b/sandbox/metamodels/staged/src/test/resources/TEST.properties
deleted file mode 100644
index 2b31cb3..0000000
--- a/sandbox/metamodels/staged/src/test/resources/TEST.properties
+++ /dev/null
@@ -1,19 +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.
-#
-aKey=aValue.TEST
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/metamodels/staged/src/test/resources/tamaya-TEST.yaml
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/staged/src/test/resources/tamaya-TEST.yaml b/sandbox/metamodels/staged/src/test/resources/tamaya-TEST.yaml
deleted file mode 100644
index 3e56656..0000000
--- a/sandbox/metamodels/staged/src/test/resources/tamaya-TEST.yaml
+++ /dev/null
@@ -1,27 +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.
-#
-tamaya-configuration:
- includes:
- tamaya-DEFAULT.yaml
-
- property-sources:
- - class: org.apache.tamaya.resources.ResourceProvider
- resource: classpath:META-INF/config/test/**/*.*"
- - class: org.apache.tamaya.resources.ResourceProvider
- resource: classpath://META-INF/config/test/**/*.*"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/metamodels/staged/src/test/resources/tamaya-config.yaml
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/staged/src/test/resources/tamaya-config.yaml b/sandbox/metamodels/staged/src/test/resources/tamaya-config.yaml
deleted file mode 100644
index a2980f6..0000000
--- a/sandbox/metamodels/staged/src/test/resources/tamaya-config.yaml
+++ /dev/null
@@ -1,37 +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.
-#
-tamaya-config:
- source-selectors:
- - DEFAULT:
- source: tamaya-DEFAULT.yml
- labels: env=TEST env=PTA env=PROD
- - TEST:
- source: tamaya-TEST.yml
- labels: env=TEST
- - PTA:
- source: tamaya-PTA.yml
- labels: env=PTA
- - PROD:
- source: tamaya-PROD.yml
- labels: env=PROD
-
- default-labels: env=DEV
-
- expressions:
- - env: ${sys-property:ENV}, ${env-property:ENV}, "DEV"
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
deleted file mode 100644
index 2f01840..0000000
--- a/sandbox/pom.xml
+++ /dev/null
@@ -1,46 +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</groupId>
- <artifactId>tamaya-all</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- </parent>
-
- <artifactId>tamaya-sandbox</artifactId>
- <groupId>org.apache.tamaya.ext</groupId>
-
- <name>Apache Tamaya Sandbox</name>
- <description>This project contains the several extensions that can be used with Tamaya, but are not (yet) ready for
- a release.</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>integration</module>
- <module>metamodels</module>
- <module>jodatime</module>
- <module>sysprops</module>
- <module>remote</module>
- <module>ui</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/remote/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/remote/pom.xml b/sandbox/remote/pom.xml
deleted file mode 100644
index c8917f4..0000000
--- a/sandbox/remote/pom.xml
+++ /dev/null
@@ -1,76 +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-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-remote</artifactId>
- <name>Apache Tamaya Modules - Remote PropertySource</name>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>tamaya-json</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.remote
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/remote/src/main/java/org/apache/tamaya/remote/BaseRemotePropertySource.java
----------------------------------------------------------------------
diff --git a/sandbox/remote/src/main/java/org/apache/tamaya/remote/BaseRemotePropertySource.java b/sandbox/remote/src/main/java/org/apache/tamaya/remote/BaseRemotePropertySource.java
deleted file mode 100644
index 0fd1c67..0000000
--- a/sandbox/remote/src/main/java/org/apache/tamaya/remote/BaseRemotePropertySource.java
+++ /dev/null
@@ -1,149 +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.remote;
-
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationFormat;
-import org.apache.tamaya.json.JSONFormat;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Abstract base class for implementing a PropertySource that reads configuration data from a remote resource. It uses
- * by default the JSON format as defined by the JSON module.
- */
-public abstract class BaseRemotePropertySource implements PropertySource{
-
- private static final ConfigurationFormat DEFAULT_FORMAT = new JSONFormat();
-
- private Map<String,String> properties = new HashMap<>();
-
- protected BaseRemotePropertySource(){
- reload();
- }
-
- @Override
- public String getName() {
- return getClass().getSimpleName();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- /**
- * Reloads the remote configuration. If reloads fails to whatever reasons the already loaded configuration will
- * stay untouched.
- */
- public void reload(){
- ConfigurationFormat format = getConfigurationFormat();
- for(URL url:getAccessURLs()) {
- try(InputStream is = url.openStream()) {
- ConfigurationData data = format.readConfiguration(url.toExternalForm(), is);
- if(data!=null){
- Map<String,String> newProperties = mapConfigurationData(data);
- // the configs served by the tamaya server module has a 'data' root section containing the
- // config entries. if not present, we assume an alternate format, which is sued as is...
- if(!newProperties.isEmpty()){
- this.properties = newProperties;
- Logger.getLogger(getClass().getName()).info(
- "Reloaded remote config from: " + url + ", entries read: " + this.properties.size());
- }
- }
- }
- catch(Exception e){
- Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Failed to load config from url: " + url, e);
- }
- }
- }
-
- protected abstract Collection<URL> getAccessURLs();
-
- protected ConfigurationFormat getConfigurationFormat(){
- return DEFAULT_FORMAT;
- }
-
- protected Map<String,String> mapConfigurationData(ConfigurationData data){
- Map<String,String> readProperties;
- if(data!=null){
- readProperties = data.getCombinedProperties();
- if(readProperties!=null){
- Map<String,String> newProperties = new HashMap<>();
- for(Map.Entry<String,String> en:readProperties.entrySet()){
- // filter data entries
- newProperties.put(en.getKey(), en.getValue());
- }
- // the configs served by the tamaya server module has a 'data' root section containing the
- // config entries. if not present, we assume an alternate format, which is sued as is...
- if(newProperties.isEmpty()){
- Logger.getLogger(getClass().getName()).info(
- "Loaded remote config from: " + data.getResource() + ", does not have a data section, using as is...");
- newProperties = readProperties;
- }
- Logger.getLogger(getClass().getName()).info(
- "Reloaded remote config from: " + data.getResource() + ", entriea read: " + this.properties.size());
- return newProperties;
- }
- }
- return Collections.emptyMap();
- }
-
- @Override
- public boolean isScannable(){
- return true;
- }
-
- @Override
- public PropertyValue get(String key) {
- return PropertyValue.of(key,getProperties().get(key),getName());
- }
-
- @Override
- public int getOrdinal(){
- PropertyValue configuredOrdinal = get(TAMAYA_ORDINAL);
- if(configuredOrdinal!=null){
- try{
- return Integer.parseInt(configuredOrdinal.getValue());
- } catch(Exception e){
- Logger.getLogger(getClass().getName()).log(Level.WARNING,
- "Configured Ordinal is not an int number: " + configuredOrdinal, e);
- }
- }
- return getDefaultOrdinal();
- }
-
- /**
- * Returns the default ordinal used, when no ordinal is set, or the ordinal was not parseable to an int value.
- * @return the default ordinal used, by default 0.
- */
- public int getDefaultOrdinal(){
- return 0;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/sysprops/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/sysprops/pom.xml b/sandbox/sysprops/pom.xml
deleted file mode 100644
index c40f4ea..0000000
--- a/sandbox/sysprops/pom.xml
+++ /dev/null
@@ -1,89 +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-sandbox</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>tamaya-sysprops</artifactId>
- <name>Apache Tamaya Modules - Configured Java SE System Properties</name>
- <packaging>bundle</packaging>
-
- <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>
- <Import-Package>
- org.apache.tamaya,
- org.apache.tamaya.spi,
- org.apache.tamaya.resources,
- org.apache.tamaya.spisupport,
- org.apache.tamaya.functions,
- javax.annotation,
- *
- </Import-Package>
- <Export-Package>
- org.apache.tamaya.integration.se
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/sysprops/src/main/java/org/apache/tamaya/integration/se/ConfiguredSystemProperties.java
----------------------------------------------------------------------
diff --git a/sandbox/sysprops/src/main/java/org/apache/tamaya/integration/se/ConfiguredSystemProperties.java b/sandbox/sysprops/src/main/java/org/apache/tamaya/integration/se/ConfiguredSystemProperties.java
deleted file mode 100644
index cdef5be..0000000
--- a/sandbox/sysprops/src/main/java/org/apache/tamaya/integration/se/ConfiguredSystemProperties.java
+++ /dev/null
@@ -1,353 +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.integration.se;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.BiConsumer;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.logging.Logger;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.Environment;
-
-/**
- * Properties implementation class that can be applied as current System properties by calling
- * {@link ConfiguredSystemProperties#install()}. The system properties will
- * then behave contextually depending on the current runtime configuration active.
- */
-public class ConfiguredSystemProperties extends Properties {
-
- private static final long serialVersionUID = 2152870929299226804L;
-
- private static final Logger LOG = Logger.getLogger(ConfiguredSystemProperties.class.getName());
- private Properties initialProperties;
- private static volatile Map<String, Properties> contextualProperties = new ConcurrentHashMap<>();
- private static volatile Supplier<String> contextProvider = () ->
- Environment.current().get("context.id").orElse("<system>");
-
-
- private final Object LOCK = new Object();
-
-
- private ConfiguredSystemProperties(Properties initialProperties) {
- super(initialProperties);
- this.initialProperties = initialProperties;
- }
-
- public static void install() {
- Properties props = System.getProperties();
- if (props instanceof ConfiguredSystemProperties) {
- return;
- }
- ConfiguredSystemProperties systemProps = new ConfiguredSystemProperties(props);
- LOG.finest("Installing enhanced system properties...");
- System.setProperties(systemProps);
- LOG.info("Installed enhanced system properties successfully.");
- }
-
- public static void uninstall() {
- Properties props = System.getProperties();
- if (props instanceof ConfiguredSystemProperties) {
- Properties initialProperties = ((ConfiguredSystemProperties) props).initialProperties;
- LOG.finest("Uninstalling enhanced system properties...");
- System.setProperties(initialProperties);
- LOG.info("Uninstalled enhanced system properties successfully.");
- }
- }
-
- @Override
- public String getProperty(String key) {
- return getContextualProperties().getProperty(key);
- }
-
- @Override
- public String getProperty(String key, String defaultValue) {
- return getContextualProperties().getProperty(key, defaultValue);
- }
-
- @Override
- public Enumeration<?> propertyNames() {
- return getContextualProperties().propertyNames();
- }
-
- @Override
- public Set<String> stringPropertyNames() {
- return getContextualProperties().stringPropertyNames();
- }
-
- @Override
- public synchronized int size() {
- return getContextualProperties().size();
- }
-
- @Override
- public synchronized Enumeration<Object> keys() {
- return getContextualProperties().keys();
- }
-
- @Override
- public synchronized Enumeration<Object> elements() {
- return getContextualProperties().elements();
- }
-
- @Override
- public synchronized boolean contains(Object value) {
- return getContextualProperties().contains(value);
- }
-
- @Override
- public boolean containsValue(Object value) {
- return getContextualProperties().containsValue(value);
- }
-
- @Override
- public synchronized boolean containsKey(Object key) {
- return getContextualProperties().containsKey(key);
- }
-
- @Override
- public synchronized Object get(Object key) {
- return getContextualProperties().get(key);
- }
-
- @Override
- public synchronized Object clone() {
- return getContextualProperties().clone();
- }
-
- @Override
- public Set<Object> keySet() {
- return getContextualProperties().keySet();
- }
-
- @Override
- public Set<Map.Entry<Object, Object>> entrySet() {
- return getContextualProperties().entrySet();
- }
-
- @Override
- public Collection<Object> values() {
- return getContextualProperties().values();
- }
-
-
- @Override
- public Object getOrDefault(Object key, Object defaultValue) {
- return getContextualProperties().getOrDefault(key, defaultValue);
- }
-
- @Override
- public void forEach(BiConsumer<? super Object, ? super Object> action) {
- getContextualProperties().forEach(action);
- }
-
-
- @Override
- public Object computeIfAbsent(Object key, Function<? super Object, ?> mappingFunction) {
- return getContextualProperties().computeIfAbsent(key, mappingFunction);
- }
-
- @Override
- public synchronized Object computeIfPresent(Object key, BiFunction<? super Object, ? super Object, ?> remappingFunction) {
- return getContextualProperties().computeIfPresent(key, remappingFunction);
- }
-
- @Override
- public synchronized Object compute(Object key, BiFunction<? super Object, ? super Object, ?> remappingFunction) {
- return getContextualProperties().compute(key, remappingFunction);
- }
-
- @Override
- public String toString() {
- return getContextualProperties().toString();
- }
-
- @Override
- public synchronized Object setProperty(String key, String value) {
- return getContextualProperties().setProperty(key, value);
- }
-
- @Override
- public synchronized void load(Reader reader) throws IOException {
- getContextualProperties().load(reader);
- }
-
- @Override
- public synchronized void load(InputStream inStream) throws IOException {
- getContextualProperties().load(inStream);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void save(OutputStream out, String comments) {
- super.save(out, comments);
- }
-
- @Override
- public void store(Writer writer, String comments) throws IOException {
- getContextualProperties().store(writer, comments);
- }
-
- @Override
- public void store(OutputStream out, String comments) throws IOException {
- getContextualProperties().store(out, comments);
- }
-
- @Override
- public void loadFromXML(InputStream in) throws IOException {
- getContextualProperties().loadFromXML(in);
- }
-
- @Override
- public void storeToXML(OutputStream os, String comment) throws IOException {
- getContextualProperties().storeToXML(os, comment);
- }
-
- @Override
- public void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
- getContextualProperties().storeToXML(os, comment, encoding);
- }
-
- @Override
- public void list(PrintStream out) {
- getContextualProperties().list(out);
- }
-
- @Override
- public void list(PrintWriter out) {
- getContextualProperties().list(out);
- }
-
- @Override
- public boolean isEmpty() {
- return getContextualProperties().isEmpty();
- }
-
- @Override
- public Object put(Object key, Object value) {
- return getContextualProperties().put(key, value);
- }
-
- @Override
- public Object remove(Object key) {
- return getContextualProperties().remove(key);
- }
-
- @Override
- public void putAll(Map<?, ?> t) {
- getContextualProperties().putAll(t);
- }
-
- @Override
- public void clear() {
- getContextualProperties().clear();
- }
-
- @Override
- public boolean equals(Object o) {
- return getContextualProperties().equals(o);
- }
-
- @Override
- public int hashCode() {
- return getContextualProperties().hashCode();
- }
-
- @Override
- public void replaceAll(BiFunction<? super Object, ? super Object, ?> function) {
- getContextualProperties().replaceAll(function);
- }
-
- @Override
- public Object putIfAbsent(Object key, Object value) {
- return getContextualProperties().putIfAbsent(key, value);
- }
-
- @Override
- public boolean remove(Object key, Object value) {
- return getContextualProperties().remove(key, value);
- }
-
- @Override
- public boolean replace(Object key, Object oldValue, Object newValue) {
- return getContextualProperties().replace(key, oldValue, newValue);
- }
-
- @Override
- public Object replace(Object key, Object value) {
- return getContextualProperties().replace(key, value);
- }
-
- @Override
- public Object merge(Object key, Object value, BiFunction<? super Object, ? super Object, ?> remappingFunction) {
- return getContextualProperties().merge(key, value, remappingFunction);
- }
-
- public Properties getInitialProperties() {
- return initialProperties;
- }
-
- /**
- * Uninstalls the contextual system properties for the current context, as determined by the current
- * context provider active.
- */
- public static void resetProperties() {
- String contextId = contextProvider == null ? "" : contextProvider.get();
- contextualProperties.remove(contextId);
- }
-
- protected Properties getContextualProperties() {
- String contextId = contextProvider == null ? "" : contextProvider.get();
- Properties props = ConfiguredSystemProperties.contextualProperties.get(contextId);
- if (props == null) {
- synchronized (LOCK) {
- props = ConfiguredSystemProperties.contextualProperties.get(contextId);
- if (props == null) {
- props = createNewProperties();
- contextualProperties.put(contextId, props);
- }
- }
- }
- return props;
- }
-
- protected Properties createNewProperties() {
- Properties props = new Properties(initialProperties);
- Configuration config = Configuration.current();
- Map<String, String> configMap = config.getProperties();
- for (Map.Entry<String, String> en : configMap.entrySet()) {
- props.put(en.getKey(), en.getValue());
- }
- return props;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/pom.xml b/sandbox/ui/base/pom.xml
deleted file mode 100644
index 588e8b9..0000000
--- a/sandbox/ui/base/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?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 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">
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-ui</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <packaging>jar</packaging>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tamaya-ui-base</artifactId>
- <name>Apache Tamaya Modules - UI (Base)</name>
-
- <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>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.4.1</version>
- <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>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
deleted file mode 100644
index 20190be..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ /dev/null
@@ -1,72 +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.ui;
-
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.UI;
-import org.apache.tamaya.ui.components.PageTitleUpdater;
-import org.apache.tamaya.ui.views.ErrorView;
-
-
-/**
- * UI main layout.
- */
-public class ApplicationLayout extends HorizontalLayout {
-
- private NavBar navBar;
- private Panel content;
- private NavigationBar navigator;
-
- public ApplicationLayout(UI ui) {
- addStyleName(UIConstants.MAIN_LAYOUT);
- setSizeFull();
- initLayouts();
- setupNavigator(ui);
- }
-
- public NavigationBar getNavigationBar(){
- return navigator;
- }
-
- private void initLayouts() {
- navBar = new NavBar(this);
- // 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(UI ui) {
- navigator = new NavigationBar(ui, content, navBar);
-
- // 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("/home");
- navigator.setErrorView(ErrorView.class);
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/CurrentUser.java
deleted file mode 100644
index 09fcf57..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/CurrentUser.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.ui;
-
-import com.vaadin.server.VaadinSession;
-
-/**
- * Convenience wrapper for storing and retrieving a user from the VaadinSession
- */
-public final class CurrentUser {
- /** The key used. */
- private static final String KEY = "currentUser";
-
- /**
- * Singleton constructor.
- */
- private CurrentUser(){}
-
- /**
- * Set the current users.
- * @param user the current user, not null.
- */
- public static void set(User user) {
- VaadinSession.getCurrent().setAttribute(KEY, user);
- }
-
- /**
- * Get the current user.
- * @return the current user, or null.
- */
- public static User get() {
- return (User) VaadinSession.getCurrent().getAttribute(KEY);
- }
-
- /**
- * Checks if the current user is present and logged in.
- * @return {@code true} if user is present and logged in.
- */
- public static boolean isLoggedIn() {
- return get() != null && get().isLoggedin();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java
deleted file mode 100644
index 9020cd8..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java
+++ /dev/null
@@ -1,127 +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.ui;
-
-import com.vaadin.navigator.ViewChangeListener;
-import com.vaadin.server.FontAwesome;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.VerticalLayout;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.event.EventBus;
-import org.apache.tamaya.ui.event.LogoutEvent;
-import org.apache.tamaya.ui.event.NavigationEvent;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Left side navigation bar.
- */
-public class NavBar extends VerticalLayout implements ViewChangeListener {
-
- private Map<String, Button> buttonMap = new HashMap<>();
-
- public NavBar(ApplicationLayout appLayout) {
- // setHeight("100%");
- setWidth(200, Unit.PIXELS);
- addStyleName(UIConstants.MENU_ROOT);
- addStyleName(UIConstants.NAVBAR);
- setDefaultComponentAlignment(Alignment.TOP_LEFT);
- MessageProvider messages = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
- Label logo = new Label("<strong>"+ messages.getMessage("project.name")+"</strong>", ContentMode.HTML);
- logo.addStyleName(UIConstants.MENU_TITLE);
- addComponent(logo);
- addLogoutAndSettingsButton(appLayout);
- }
-
-
- private void addLogoutAndSettingsButton(final ApplicationLayout appLayout) {
- MessageProvider messages = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
- Button logout = new Button(messages.getMessage("default.label.logout"), new Button.ClickListener() {
- @Override
- public void buttonClick(Button.ClickEvent clickEvent) {
- User user = CurrentUser.get();
- if(user!=null){
- user.logout();
- EventBus.post(new LogoutEvent(user));
- }
- CurrentUser.set(null);
- }
- });
- logout.addStyleName(UIConstants.BUTTON_LOGOUT);
- logout.addStyleName(UIConstants.BUTTON_BORDERLESS);
- logout.setIcon(FontAwesome.SIGN_OUT);
- Button settings = new Button("...", new Button.ClickListener() {
- @Override
- public void buttonClick(Button.ClickEvent clickEvent) {
- UISettingsDialog dlog = new UISettingsDialog(appLayout.getNavigationBar());
- dlog.show();
- }
- });
- settings.addStyleName(UIConstants.BUTTON_SETTINGS);
- settings.addStyleName(UIConstants.BUTTON_BORDERLESS);
- VerticalLayout buttons = new VerticalLayout(logout, settings);
- addComponent(buttons);
- }
-
- public void addViewButton(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.BUTTON_LOGOUT);
- // viewButton.addStyleName(UIConstants.MENU_ITEM);
- viewButton.addStyleName(UIConstants.BUTTON_BORDERLESS);
- addComponent(viewButton, components.size() - 1);
- viewButton.setHeight(20, Unit.PIXELS);
-
- buttonMap.put(uri, viewButton);
- }
-
- public void removeViewButton(String uri) {
- Button button = buttonMap.remove(uri);
- if(button!=null) {
- removeComponent(button);
- }
- }
-
- @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/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java
deleted file mode 100644
index f446d6f..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java
+++ /dev/null
@@ -1,77 +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.ui;
-
-import com.vaadin.server.VaadinServlet;
-import org.apache.catalina.Context;
-import org.apache.catalina.Wrapper;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-import java.io.File;
-import java.util.logging.Logger;
-
-/**
- * Tamaya UI Main class.
- */
-public class TamayaUI {
-
- private static final Logger LOG = Logger.getLogger(TamayaUI.class.getName());
-
- /**
- * Not an instantiable class.
- */
- private TamayaUI(){}
-
- /**
- * The main entry point, use configuration as follows:
- * <pre>
- * tamaya.server.contextPath: the context path, default=/tamaya
- * tamaya.server.port: the port, default=8090
- * tamaya.server.productionMode: vadiin production mode setting, default=false.
- * </pre>
- * @param args the args
- * @throws Exception if startup fails.
- */
- public static void main(String[] args) throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- String contextPath = config.getOrDefault("tamaya.server.contextPath", "/tamaya");
- String appBase = ".";
- Tomcat tomcat = new Tomcat();
- tomcat.setPort(Integer.valueOf(config.getOrDefault("tamaya.server.port", Integer.class, 8090) ));
-
- // Define a web application context.
- Context context = tomcat.addWebapp(contextPath, new File(
- appBase).getAbsolutePath());
- // Add Vadiin servlet
- Wrapper wrapper = tomcat.addServlet(context, "vadiin-servlet",
- VaadinServlet.class.getName());
- wrapper.addInitParameter("ui",
- VadiinApp.class.getName());
- wrapper.addInitParameter("productionMode",config.getOrDefault("tamaya.server.productionMode", String.class,
- "false"));
- wrapper.addInitParameter("asyncSupported", "true");
- context.addServletMapping("/*", "vadiin-servlet");
- // bootstrap.addBundle(new AssetsBundle("/VAADIN", "/VAADIN", null, "vaadin"));
- tomcat.start();
- tomcat.getServer().await();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java
deleted file mode 100644
index ecf90ff..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java
+++ /dev/null
@@ -1,36 +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.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 BUTTON_SETTINGS = BUTTON_TINY;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/User.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/User.java
deleted file mode 100644
index ae5b34a..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/User.java
+++ /dev/null
@@ -1,154 +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.ui;
-
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * A simple User object.
- */
-public class User {
- /** The user ID. */
- private final String userID;
- /** The full name. */
- private String fulLName;
- /** The credentials. */
- private String credentials;
- /** The user's roles. */
- private Set<String> roles = new HashSet<>();
- /** The user's last login date. */
- private Date loginDate = new Date();
- /** The user's last logout date. */
- private Date logoutDate = new Date();
-
- /**
- * Constructor.
- * @param uid the user ID, not null.
- * @param fullName the full name.
- * @param credentials the credentials.
- * @param roles its roles.
- */
- public User(String uid, String fullName, String credentials, String... roles){
- this.userID = Objects.requireNonNull(uid);
- this.fulLName = fullName!=null?fullName:userID;
- if(fullName==null){
- this.fulLName = userID;
- }
- this.roles.addAll(Arrays.asList(roles));
- this.credentials = credentials;
- }
-
- /**
- * �Performs a login, checking the credentials.
- * @param credentials the credentials.
- * @return true, if the user could be logged in.
- */
- public boolean login(String credentials){
- if(this.credentials!=null){
- this.loginDate = new Date();
- return this.credentials.equals(credentials);
- }
- return credentials==null || credentials.isEmpty();
- }
-
- /**
- * Checks if the user is currently logged in.
- * @return true, if the user is currently logged in.
- */
- public boolean isLoggedin(){
- long now = System.currentTimeMillis();
- if(this.logoutDate!=null && this.logoutDate.getTime() < now){
- return false;
- }
- return this.loginDate!=null && this.loginDate.getTime() < now;
- }
-
- /**
- * Logs the user out.
- */
- public void logout(){
- this.logoutDate = new Date();
- }
-
- /**
- * Get the user ID.
- * @return the user ID, never null.
- */
- public String getUserID() {
- return userID;
- }
-
- /**
- * Get the full name.
- * @return the full name, never null.
- */
- public String getFullName() {
- return fulLName;
- }
-
- /**
- * Checks if the user has the given role.
- * @param role the role to be checked, not null.
- * @return true, if the user has the required role.
- */
- public boolean hasRole(String role){
- return this.roles.contains(role);
- }
-
- /**
- * Get the user's roles.
- * @return the roles, never null.
- */
- public Set<String> getRoles(){
- return Collections.unmodifiableSet(roles);
- }
-
- /**
- * Get the last login timestamp.
- * @return the last login date, or null.
- */
- public Date getLoginDate(){
- return loginDate;
- }
-
- /**
- * Get the last login timestamp.
- * @return the last login date, or null.
- */
- public Date getLogoutDate(){
- return logoutDate;
- }
-
- @Override
- public String toString() {
- return "User{" +
- "fulLName='" + fulLName + '\'' +
- ", userID='" + userID + '\'' +
- ", roles=" + roles +
- ", loginDate=" + loginDate +
- ", logoutDate=" + logoutDate +
- '}';
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java
deleted file mode 100644
index 9e2510d..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java
+++ /dev/null
@@ -1,97 +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.ui;
-
-import com.google.common.eventbus.Subscribe;
-import com.vaadin.annotations.Theme;
-import com.vaadin.annotations.Title;
-import com.vaadin.server.Page;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.UI;
-import org.apache.tamaya.ui.event.LogoutEvent;
-import org.apache.tamaya.ui.event.NavigationEvent;
-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 VadiinApp extends UI {
-
- public VadiinApp(){
- super(new Panel());
- super.setPollInterval(2000);
- }
-
- @Override
- protected void init(VaadinRequest vaadinRequest) {
- setupEventBus();
- if (CurrentUser.isLoggedIn()) {
- setContent(new ApplicationLayout(this));
- } else {
- setContent(new LoginView());
- }
- }
-
- @Subscribe
- public void userLoggedIn(
- LoginEvent event) {
- CurrentUser.set(event.getUser());
- setContent(new ApplicationLayout(this));
- }
-
- @Subscribe
- public void navigateTo(NavigationEvent evt) {
- if(getNavigator()==null){
- return;
- }
- if(evt.getViewName().isEmpty()){
- getNavigator().navigateTo("/home");
-
- }else {
- getNavigator().navigateTo(evt.getViewName());
- }
- }
-
- public static VadiinApp getCurrent() {
- return (VadiinApp) 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);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java
deleted file mode 100644
index 578689f..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java
+++ /dev/null
@@ -1,73 +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.ui;
-
-import com.vaadin.navigator.View;
-
-/**
- * Interface to register Tamaya UI parts. For priorization also use the @Priority annotations.
- */
-public interface ViewProvider {
-
- /**
- * View lifecycle options that determine when a view is created and how long an instance is used.
- */
- enum ViewLifecycle {
- /** Creates a new view instance whenever the view is showed. */
- CREATE,
- /** Loads the view on first access. */
- LAZY,
- /** Eagerly preloads the view. */
- EAGER
- }
-
- /**
- * Get the view lifecycle model.
- * @return the lifecycle model, not null.
- */
- ViewLifecycle getLifecycle();
-
- /**
- * Get the view's name, used for resolving the view display name.
- * @return the view's name.
- */
- String getName();
-
- /**
- * Get the url pattern where this view should be accessible.
- * @return the url pattern, not null.
- */
- String getUrlPattern();
-
- /**
- * Get the name to be displayed for this view. This value will also be used to lookup a name from the {@code /ui/lang/tamaya}
- * bundle. If not found the value returned will be used for display.
- *
- * @return the name to be displayed, or its resource bundle key, not null.
- */
- String getDisplayName();
-
- /**
- * Method that is called to create a new view instance.
- * @see #getLifecycle()
- * @param params any parameters that may be needed to create the view.
- * @return a new view instance, not null.
- */
- View createView(Object... params);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
deleted file mode 100644
index 2d1547f..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
+++ /dev/null
@@ -1,81 +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.ui.components;
-
-import com.vaadin.navigator.View;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.ViewProvider;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Lazily initializes a view when it's first accessed, then always returns the
- * same instance on subsequent calls.
- */
-public class LazyProvider implements ViewProvider {
- private static final Logger LOG = Logger.getLogger(
- LazyProvider.class.getName());
- private Class<? extends View> viewClass;
- private View view;
- private String urlPattern;
- private String name;
-
- public LazyProvider(String name, String urlPattern, Class<? extends View> viewClass) {
- this.viewClass = Objects.requireNonNull(viewClass);
- this.urlPattern = Objects.requireNonNull(urlPattern);
- this.name = Objects.requireNonNull(name);
- }
-
- @Override
- public String getUrlPattern() {
- return urlPattern;
- }
-
-
- @Override
- public ViewLifecycle getLifecycle() {
- return ViewLifecycle.LAZY;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getDisplayName() {
- return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage(name);
- }
-
- @Override
- public View createView(Object... params) {
- if(view==null){
- try {
- view = viewClass.newInstance();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create view: "+urlPattern, e);
- }
- }
- return view;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
deleted file mode 100644
index 83a0105..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
+++ /dev/null
@@ -1,47 +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.ui.components;
-
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener;
-import com.vaadin.server.Page;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-/**
- * Listener that updates the page title when a new view is shown.
- */
-public class PageTitleUpdater implements ViewChangeListener {
-
- @Override
- public boolean beforeViewChange(ViewChangeEvent event) {
- return true;
- }
-
- @Override
- public void afterViewChange(ViewChangeEvent event) {
- View view = event.getNewView();
- String displayName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("view."+view.getClass().getSimpleName()+".name");
- if (displayName != null) {
- Page.getCurrent().setTitle(displayName);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
deleted file mode 100644
index 94fc980..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
+++ /dev/null
@@ -1,32 +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.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/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/EventBus.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/EventBus.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/EventBus.java
deleted file mode 100644
index ffa9ba4..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/EventBus.java
+++ /dev/null
@@ -1,52 +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.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/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
deleted file mode 100644
index 680acc3..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
+++ /dev/null
@@ -1,48 +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.ui.event;
-
-import org.apache.tamaya.ui.User;
-
-import java.util.Objects;
-
-/**
- * Event sent when the user has been logged out.
- */
-public class LogoutEvent {
-
- /** The user logged out. */
- private User user;
-
- /**
- * Creates a new event.
- * @param user the user logged out, not null.
- */
- public LogoutEvent(User user) {
- this.user = Objects.requireNonNull(user);
- }
-
- /**
- * Get the user logged out.
- * @return the user logged out, not null.
- */
- public User getUser(){
- return user;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57934fdf/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
deleted file mode 100644
index bb863be..0000000
--- a/sandbox/ui/base/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.ui.event;
-
-
-import java.util.Objects;
-
-/**
- * Event sent when the user wants to navigate.
- */
-public class NavigationEvent {
- /** The target view. */
- private String viewName;
-
- /**
- * Constructor.
- * @param viewName the target view, not null.
- */
- public NavigationEvent(String viewName) {
- this.viewName = Objects.requireNonNull(viewName);
- }
-
- /**
- * Access the target view name.
- * @return the target view name, never null.
- */
- public String getViewName() {
- return viewName;
- }
-
- @Override
- public String toString() {
- return "NavigationEvent{" +
- "viewName='" + viewName + '\'' +
- '}';
- }
-}