You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/04/19 13:54:34 UTC
[01/15] incubator-tamaya git commit: Fixed UI module,
adding modularity. Added initial version for the vents module.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master ec457f272 -> cb2987cb2
Fixed UI module, adding modularity. Added initial version for the vents module.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/11a2e35f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/11a2e35f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/11a2e35f
Branch: refs/heads/master
Commit: 11a2e35f6fe8b4ba5f3fc2ba7db260a375b5b86e
Parents: ec457f2
Author: anatole <an...@apache.org>
Authored: Sat Apr 16 08:21:36 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:43 2016 +0200
----------------------------------------------------------------------
modules/events/pom.xml | 14 ++++-
.../ObservingPropertySourceProvider.java | 3 +-
.../tamaya/spisupport/BasePropertySource.java | 5 ++
.../tamaya/spisupport/MapPropertySource.java | 2 +-
sandbox/ui/pom.xml | 5 ++
.../org/apache/tamaya/ui/ApplicationLayout.java | 44 ++++++++++-----
.../java/org/apache/tamaya/ui/CurrentUser.java | 18 ++++++
.../main/java/org/apache/tamaya/ui/Header.java | 44 ---------------
.../main/java/org/apache/tamaya/ui/MyUI.java | 2 -
.../main/java/org/apache/tamaya/ui/NavBar.java | 28 +++++++++-
.../java/org/apache/tamaya/ui/UIConstants.java | 23 ++++++--
.../main/java/org/apache/tamaya/ui/User.java | 25 ++++++++-
.../java/org/apache/tamaya/ui/ViewConfig.java | 20 -------
.../tamaya/ui/components/LazyProvider.java | 36 ++++++++++--
.../tamaya/ui/components/PageTitleUpdater.java | 33 +++++++++--
.../ui/components/VerticalSpacedLayout.java | 18 ++++++
.../org/apache/tamaya/ui/event/EventBus.java | 18 ++++++
.../org/apache/tamaya/ui/event/LogoutEvent.java | 18 ++++++
.../apache/tamaya/ui/event/NavigationEvent.java | 18 ++++++
.../apache/tamaya/ui/services/LoginService.java | 12 ----
.../apache/tamaya/ui/views/ComponentView.java | 58 ++++++++++++++++++--
.../org/apache/tamaya/ui/views/ConfigView.java | 57 +++++++++++++++++--
.../org/apache/tamaya/ui/views/ErrorView.java | 19 +++++++
.../org/apache/tamaya/ui/views/HomeView.java | 50 ++++++++++++++++-
.../apache/tamaya/ui/views/login/LoginBox.java | 14 +++--
.../src/main/resources/config/application.yml | 19 +++++++
.../src/test/resources/config/application.yml | 19 +++++++
27 files changed, 490 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/modules/events/pom.xml
----------------------------------------------------------------------
diff --git a/modules/events/pom.xml b/modules/events/pom.xml
index 74d3a4b..0952795 100644
--- a/modules/events/pom.xml
+++ b/modules/events/pom.xml
@@ -39,7 +39,6 @@ under the License.
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-api</artifactId>
<version>${project.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tamaya.ext</groupId>
@@ -47,10 +46,21 @@ under the License.
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spisupport</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-core</artifactId>
<version>${project.version}</version>
- <scope>provided</scope>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-ui</artifactId>
+ <version>${project.version}</version>
+ <optional>true</optional>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/modules/events/src/main/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java b/modules/events/src/main/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
index 347576f..feddd70 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/folderobserver/ObservingPropertySourceProvider.java
@@ -40,12 +40,12 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.core.propertysource.BasePropertySource;
import org.apache.tamaya.events.ConfigEventManager;
import org.apache.tamaya.events.ConfigurationContextChange;
import org.apache.tamaya.events.ConfigurationContextChangeBuilder;
import org.apache.tamaya.spi.PropertySource;
import org.apache.tamaya.spi.PropertySourceProvider;
+import org.apache.tamaya.spisupport.BasePropertySource;
/**
* This implementation runs in a folder taking up all files compatible with the given
@@ -118,6 +118,7 @@ public class ObservingPropertySourceProvider implements PropertySourceProvider,
protected Collection<PropertySource> getPropertySources(final Path file) {
return Arrays.asList(new PropertySource[]{new BasePropertySource() {
private final Map<String,String> props = readProperties(file);
+
@Override
public Map<String, String> getProperties() {
return props;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/BasePropertySource.java
----------------------------------------------------------------------
diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/BasePropertySource.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/BasePropertySource.java
index 2a6b47e..0d90c8c 100644
--- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/BasePropertySource.java
+++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/BasePropertySource.java
@@ -48,6 +48,11 @@ public abstract class BasePropertySource implements PropertySource{
}
@Override
+ public String getName() {
+ return getClass().getSimpleName();
+ }
+
+ @Override
public int getOrdinal() {
PropertyValue configuredOrdinal = get(TAMAYA_ORDINAL);
if(configuredOrdinal!=null){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/MapPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/MapPropertySource.java b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/MapPropertySource.java
index ab4176f..ec4abc9 100644
--- a/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/MapPropertySource.java
+++ b/modules/spi-support/src/main/java/org/apache/tamaya/spisupport/MapPropertySource.java
@@ -109,7 +109,7 @@ public class MapPropertySource extends BasePropertySource {
* @param props the properties, not null.
* @return the corresponding Map instance.
*/
- private static Map<String, String> getMap(Properties props) {
+ public static Map<String, String> getMap(Properties props) {
Map<String, String> result = new HashMap<>();
for (Map.Entry en : props.entrySet()) {
result.put(en.getKey().toString(), en.getValue().toString());
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/pom.xml b/sandbox/ui/pom.xml
index f11aa75..3441951 100644
--- a/sandbox/ui/pom.xml
+++ b/sandbox/ui/pom.xml
@@ -89,6 +89,11 @@ under the License.
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spisupport</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet</groupId>-->
<!--<artifactId>javax.servlet-api</artifactId>-->
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
index 7d57362..c3aeabb 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -1,15 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy 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.Navigator;
-import com.vaadin.navigator.View;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Panel;
+import org.apache.tamaya.spi.ServiceContextManager;
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.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.views.ErrorView;
-import org.apache.tamaya.ui.views.HomeView;
+
public class ApplicationLayout extends HorizontalLayout {
@@ -50,32 +67,31 @@ public class ApplicationLayout extends HorizontalLayout {
}
private void registerViews() {
- addView(HomeView.class);
- addView(ConfigView.class);
- addView(ComponentView.class);
+ for(ViewProvider provider: ServiceContextManager.getServiceContext().getServices(ViewProvider.class)) {
+ addView(provider);
+ }
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);
+ private void addView(ViewProvider provider) {
- switch (viewConfig.createMode()) {
+ switch (provider.getLifecycle()) {
case CREATE:
- navigator.addView(viewConfig.uri(), viewClass);
+ navigator.addView(provider.getUrlPattern(), provider.createView());
break;
case LAZY:
- navigator.addProvider(new LazyProvider(viewConfig.uri(), viewClass));
+ navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider));
break;
case EAGER:
try {
- navigator.addView(viewConfig.uri(), viewClass.newInstance());
+ navigator.addView(provider.getUrlPattern(), provider.createView());
} catch (Exception e) {
e.printStackTrace();
}
}
- navBar.addView(viewConfig.uri(), viewConfig.displayName());
+ navBar.addView(provider.getUrlPattern(), provider.getDisplayName());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
index c894420..8c754e2 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui;
import com.vaadin.server.VaadinSession;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/Header.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/Header.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/Header.java
deleted file mode 100644
index 3e92dac..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/Header.java
+++ /dev/null
@@ -1,44 +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.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/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
index 845c400..0dce440 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
@@ -50,9 +50,7 @@ import org.apache.tamaya.ui.views.login.LoginView;
@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) {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
index caed4cd..5b3537a 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui;
import com.vaadin.navigator.ViewChangeListener;
@@ -6,9 +24,12 @@ 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.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.internal.ResourceBundleMessageProvider;
+import org.apache.tamaya.ui.services.MessageProvider;
import java.util.HashMap;
import java.util.Map;
@@ -21,8 +42,8 @@ public class NavBar extends CssLayout implements ViewChangeListener {
setHeight("100%");
addStyleName(UIConstants.MENU_ROOT);
addStyleName(UIConstants.NAVBAR);
-
- Label logo = new Label("<strong>Apache Tamaya</strong>", ContentMode.HTML);
+ 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);
@@ -30,7 +51,8 @@ public class NavBar extends CssLayout implements ViewChangeListener {
}
private void addLogoutButton() {
- Button logout = new Button("Log out", new Button.ClickListener() {
+ 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) {
EventBus.post(new LogoutEvent());
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
index 1631e0b..2f75b5c 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui;
import com.vaadin.ui.themes.ValoTheme;
@@ -14,9 +32,4 @@ public class UIConstants extends ValoTheme {
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/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
index bf01664..4cb6f5a 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
@@ -1,5 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy 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 org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
+import org.apache.tamaya.ui.services.MessageProvider;
+
import java.util.Date;
import java.util.Objects;
@@ -9,7 +31,8 @@ import java.util.Objects;
public class User {
private String userID = "-";
- private String fulLName = "<unknown>";
+ private String fulLName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("default.label.unknown");
private Date logInDate = new Date();
public User(String userID, String fullName){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
deleted file mode 100644
index 0ab0c66..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewConfig.java
+++ /dev/null
@@ -1,20 +0,0 @@
-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/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
index ca36a21..867b802 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
@@ -1,23 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy 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.Navigator;
import com.vaadin.navigator.View;
+import org.apache.tamaya.ui.ViewProvider;
+
+import java.util.Objects;
/**
* Lazily initializes a view when it's first accessed, then always returns the
* same instance on subsequent calls.
*/
-public class LazyProvider extends Navigator.ClassBasedViewProvider {
+public class LazyProvider implements com.vaadin.navigator.ViewProvider {
+ private ViewProvider provider;
private View view;
- public LazyProvider(String viewName, Class<? extends View> viewClass) {
- super(viewName, viewClass);
+ public LazyProvider(String viewName, ViewProvider provider) {
+ this.provider = Objects.requireNonNull(provider);
+ }
+
+ @Override
+ public String getViewName(String s) {
+ return provider.getDisplayName();
}
@Override
public View getView(String viewName) {
if (view == null) {
- view = super.getView(viewName);
+ view = provider.createView();
}
return view;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
index 37a6e8f..9f95ae7 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
@@ -1,11 +1,33 @@
+/*
+ * 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.ui.ViewConfig;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
+import org.apache.tamaya.ui.services.MessageProvider;
+
public class PageTitleUpdater implements ViewChangeListener {
+
@Override
public boolean beforeViewChange(ViewChangeEvent event) {
return true;
@@ -13,12 +35,11 @@ public class PageTitleUpdater implements ViewChangeListener {
@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());
+ String displayName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view."+view.getClass().getSimpleName()+".name");
+ if (displayName != null) {
+ Page.getCurrent().setTitle(displayName);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
index 52fe525..94fc980 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.components;
import com.vaadin.ui.VerticalLayout;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
index d269dc3..ffa9ba4 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.event;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
index 3168a76..ec00a42 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.event;
public class LogoutEvent {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
index 0ec1ec5..9d3b744 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.event;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
deleted file mode 100644
index ceb4cc0..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/LoginService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-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/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
index abfdb11..19211f1 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
@@ -1,26 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.*;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Tree;
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.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.UIConstants;
-import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.ViewProvider;
import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+import javax.annotation.Priority;
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");
+
+ @Priority(20)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/components";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.components.name");
+ }
+
+ @Override
+ public View createView(){
+ return new ComponentView();
+ }
+ }
+
+
+ private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("default.label.components"));
public ComponentView() {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
index c3828f9..79e3389 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
@@ -1,21 +1,70 @@
+/*
+ * 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.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.*;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Tree;
import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.ui.CurrentUser;
+import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.UIConstants;
-import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.ViewProvider;
import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+import javax.annotation.Priority;
import java.util.Map;
-@ViewConfig(uri = "/config", displayName = "Configuration")
public class ConfigView extends VerticalSpacedLayout implements View {
+ @Priority(10)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/config";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.config.name");
+ }
+
+ @Override
+ public View createView(){
+ return new ConfigView();
+ }
+ }
+
private TextField keyFilter = new TextField("Key filter");
private TextField valueFilter = new TextField("Value filter");
private Tree tree = new Tree("Current Configuration");
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
index ba16bf2..ef3fa2e 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.views;
import com.vaadin.navigator.View;
@@ -8,6 +26,7 @@ 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();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
index c656389..78297d2 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
@@ -1,18 +1,64 @@
+/*
+ * 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.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.spi.ServiceContextManager;
import org.apache.tamaya.ui.CurrentUser;
import org.apache.tamaya.ui.UIConstants;
-import org.apache.tamaya.ui.ViewConfig;
+import org.apache.tamaya.ui.ViewProvider;
import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
-@ViewConfig(uri = "", displayName = "Home")
public class HomeView extends VerticalSpacedLayout implements View {
+ @Priority(0)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.home.name");
+ }
+
+ @Override
+ public View createView(){
+ return new HomeView();
+ }
+ }
+
public HomeView() {
Label caption = new Label("Welcome, " + CurrentUser.get().getUserID());
Label description = new Label(
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
index 83d6b20..8bdcbee 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
@@ -2,15 +2,18 @@ package org.apache.tamaya.ui.views.login;
import com.vaadin.event.ShortcutAction;
import com.vaadin.ui.*;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
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;
+import org.apache.tamaya.ui.services.MessageProvider;
+import org.apache.tamaya.ui.services.UserService;
public class LoginBox extends VerticalLayout {
- private LoginService loginService = new LoginService() {
+ private UserService userService = new UserService() {
@Override
public User login(String userId, String credentials) {
if("admin".equals(userId)){
@@ -42,8 +45,9 @@ public class LoginBox extends VerticalLayout {
private void addForm() {
FormLayout loginForm = new FormLayout();
- username = new TextField("Username");
- password = new PasswordField("Password");
+ MessageProvider mp = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
+ username = new TextField(mp.getMessage("default.label.username"));
+ password = new PasswordField(mp.getMessage("default.label.password"));
loginForm.addComponents(username, password);
addComponent(loginForm);
loginForm.setSpacing(true);
@@ -77,7 +81,7 @@ public class LoginBox extends VerticalLayout {
}
private void login() {
- User user = loginService.login(username.getValue(), password.getValue());
+ User user = userService.login(username.getValue(), password.getValue());
if(user!=null){
EventBus.post(new LoginEvent(user));
}else{
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/main/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/config/application.yml b/sandbox/ui/src/main/resources/config/application.yml
index a0a6fad..a22ec36 100644
--- a/sandbox/ui/src/main/resources/config/application.yml
+++ b/sandbox/ui/src/main/resources/config/application.yml
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
server:
type: default
maxThreads: 1024
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/11a2e35f/sandbox/ui/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/test/resources/config/application.yml b/sandbox/ui/src/test/resources/config/application.yml
index 9ec8d5b..33c353c 100644
--- a/sandbox/ui/src/test/resources/config/application.yml
+++ b/sandbox/ui/src/test/resources/config/application.yml
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
server:
type: default
maxThreads: 1024
[04/15] incubator-tamaya git commit: Added tabs for sys and env props
and memory values. Exchanged dropwizard with tomcat.
Posted by an...@apache.org.
Added tabs for sys and env props and memory values.
Exchanged dropwizard with tomcat.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/8852db04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8852db04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8852db04
Branch: refs/heads/master
Commit: 8852db04c50bb457801f051acc217b73f39a27e5
Parents: 8de2fbd
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 22:25:17 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
sandbox/ui/pom.xml | 53 ++++++----
.../org/apache/tamaya/ui/ApplicationLayout.java | 2 +-
.../main/java/org/apache/tamaya/ui/MyUI.java | 100 -------------------
.../java/org/apache/tamaya/ui/TamayaUI.java | 60 +++++++++++
.../org/apache/tamaya/ui/VaadinApplication.java | 91 -----------------
.../java/org/apache/tamaya/ui/VaadinBundle.java | 55 ----------
.../java/org/apache/tamaya/ui/VadiinApp.java | 86 ++++++++++++++++
.../org/apache/tamaya/ui/views/ConfigView.java | 53 ++++++++--
8 files changed, 225 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8852db04/sandbox/ui/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/pom.xml b/sandbox/ui/pom.xml
index 216382f..4edbeb8 100644
--- a/sandbox/ui/pom.xml
+++ b/sandbox/ui/pom.xml
@@ -39,6 +39,9 @@ under the License.
<mainClass>org.apache.tamaya.ui.VaadinApplication</mainClass>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servlet.api.version>3.0.1</servlet.api.version>
+ <tomcat.version>7.0.57</tomcat.version>
+ <jersey.version>1.19.1</jersey.version>
+ <guava.version>18.0</guava.version>
</properties>
@@ -89,35 +92,45 @@ under the License.
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
</dependency>
<dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-assets</artifactId>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-testing</artifactId>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat.version}</version>
</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>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>${tomcat.version}</version>
</dependency>
- -->
<dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-themes</artifactId>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${tomcat.version}</version>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>javax.ws.rs</groupId>-->
+ <!--<artifactId>jsr311-api</artifactId>-->
+ <!--<version>1.1.1</version>-->
+ <!--<scope>provided</scope>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>com.sun.jersey</groupId>-->
+ <!--<artifactId>jersey-server</artifactId>-->
+ <!--<version>${jersey.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>com.sun.jersey</groupId>-->
+ <!--<artifactId>jersey-servlet</artifactId>-->
+ <!--<version>${jersey.version}</version>-->
+ <!--</dependency>-->
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
index 7a303eb..2c303a8 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -54,7 +54,7 @@ public class ApplicationLayout extends HorizontalLayout {
}
private void setupNavigator() {
- navigator = new Navigator(MyUI.getCurrent(), content);
+ navigator = new Navigator(VadiinApp.getCurrent(), content);
registerViews();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
deleted file mode 100644
index 0dce440..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/MyUI.java
+++ /dev/null
@@ -1,100 +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 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 Content content = new Content();
-
- @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/blob/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
new file mode 100644
index 0000000..b90c402
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.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;
+
+public class TamayaUI {
+
+ private static final Logger LOG = Logger.getLogger(TamayaUI.class.getName());
+
+
+ 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/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
deleted file mode 100644
index 1bdf19e..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
+++ /dev/null
@@ -1,91 +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 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/blob/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
deleted file mode 100644
index dcdce66..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinBundle.java
+++ /dev/null
@@ -1,55 +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.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/blob/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
new file mode 100644
index 0000000..60f3d34
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
@@ -0,0 +1,86 @@
+/*
+ * 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.*;
+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 {
+
+ private Content content = new Content();
+
+ @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 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/8852db04/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
index 79e3389..e286bf2 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
@@ -21,12 +21,8 @@ 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.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Tree;
+import com.vaadin.ui.*;
+import javafx.scene.control.TabPane;
import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.UIConstants;
@@ -35,7 +31,9 @@ import org.apache.tamaya.ui.components.VerticalSpacedLayout;
import org.apache.tamaya.ui.services.MessageProvider;
import javax.annotation.Priority;
+import java.util.Locale;
import java.util.Map;
+import java.util.TreeMap;
public class ConfigView extends VerticalSpacedLayout implements View {
@@ -75,6 +73,10 @@ public class ConfigView extends VerticalSpacedLayout implements View {
"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);
+
+ TabSheet tabPane = new TabSheet();
+ VerticalLayout configLayout = new VerticalLayout();
+
HorizontalLayout filters = new HorizontalLayout();
Button filterButton = new Button("Filter", new Button.ClickListener() {
@@ -87,8 +89,43 @@ public class ConfigView extends VerticalSpacedLayout implements View {
filters.addComponents(keyFilter, valueFilter, filterButton);
fillTree();
-
- addComponents(caption, description, filters, tree);
+ configLayout.addComponents(filters, tree);
+ tabPane.addTab(configLayout, "Configuration");
+ TextArea envProps = new TextArea();
+ StringBuilder b = new StringBuilder();
+ envProps.setHeight("100%");
+ envProps.setWidth("100%");
+ envProps.setSizeFull();
+ envProps.setRows(System.getenv().size());
+ for(Map.Entry<String,String> en:new TreeMap<>(System.getenv()).entrySet()){
+ b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
+ }
+ envProps.setValue(b.toString());
+ envProps.setReadOnly(true);
+ tabPane.addTab(envProps, "Environment Properties");
+ TextArea sysProps = new TextArea();
+ sysProps.setSizeFull();
+ sysProps.setRows(System.getProperties().size());
+ b.setLength(0);
+ for(Map.Entry<Object,Object> en:new TreeMap<>(System.getProperties()).entrySet()){
+ b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
+ }
+ sysProps.setValue(b.toString());
+ sysProps.setReadOnly(true);
+ tabPane.addTab(sysProps, "System Properties");
+ TextArea runtimeProps = new TextArea();
+ runtimeProps.setRows(5);
+ b.setLength(0);
+ b.append("Available Processors : ").append(Runtime.getRuntime().availableProcessors()).append('\n');
+ b.append("Free Memory : ").append(Runtime.getRuntime().freeMemory()).append('\n');
+ b.append("Max Memory : ").append(Runtime.getRuntime().maxMemory()).append('\n');
+ b.append("Total Memory : ").append(Runtime.getRuntime().totalMemory()).append('\n');
+ b.append("Default Locale : ").append(Locale.getDefault()).append('\n');
+ runtimeProps.setValue(b.toString());
+ runtimeProps.setReadOnly(true);
+ tabPane.addTab(runtimeProps, "Runtime Properties");
+ runtimeProps.setSizeFull();
+ addComponents(caption, description, tabPane);
caption.addStyleName(UIConstants.LABEL_HUGE);
description.addStyleName(UIConstants.LABEL_LARGE);
[11/15] incubator-tamaya git commit: TAMAYA-149 Final fixes
restabilizing modules after Tomcat is now used.
Posted by an...@apache.org.
TAMAYA-149 Final fixes restabilizing modules after Tomcat is now used.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/1a11d159
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/1a11d159
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/1a11d159
Branch: refs/heads/master
Commit: 1a11d1598d5705f5e0ef4009d2c68390dcadd484
Parents: 8fb90f6
Author: anatole <an...@apache.org>
Authored: Tue Apr 19 13:42:48 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
modules/ui/pom.xml | 254 +++++++++++++++++++
.../org/apache/tamaya/ui/ApplicationLayout.java | 96 +++++++
.../main/java/org/apache/tamaya/ui/Content.java | 34 +++
.../java/org/apache/tamaya/ui/CurrentUser.java | 41 +++
.../main/java/org/apache/tamaya/ui/NavBar.java | 94 +++++++
.../java/org/apache/tamaya/ui/TamayaUI.java | 60 +++++
.../java/org/apache/tamaya/ui/UIConstants.java | 35 +++
.../main/java/org/apache/tamaya/ui/User.java | 56 ++++
.../java/org/apache/tamaya/ui/VadiinApp.java | 86 +++++++
.../java/org/apache/tamaya/ui/ViewProvider.java | 66 +++++
.../tamaya/ui/components/LazyProvider.java | 50 ++++
.../tamaya/ui/components/PageTitleUpdater.java | 45 ++++
.../ui/components/VerticalSpacedLayout.java | 32 +++
.../org/apache/tamaya/ui/event/EventBus.java | 52 ++++
.../org/apache/tamaya/ui/event/LogoutEvent.java | 22 ++
.../apache/tamaya/ui/event/NavigationEvent.java | 32 +++
.../ConfigurationBasedMessageProvider.java | 174 +++++++++++++
.../ui/internal/ConfiguredMessageProvider.java | 61 +++++
.../internal/ResourceBundleMessageProvider.java | 91 +++++++
.../tamaya/ui/internal/URLPropertySource.java | 60 +++++
.../tamaya/ui/services/MessageProvider.java | 43 ++++
.../apache/tamaya/ui/services/UserService.java | 30 +++
.../apache/tamaya/ui/views/ComponentView.java | 175 +++++++++++++
.../org/apache/tamaya/ui/views/ConfigView.java | 199 +++++++++++++++
.../org/apache/tamaya/ui/views/ErrorView.java | 40 +++
.../org/apache/tamaya/ui/views/HomeView.java | 80 ++++++
.../apache/tamaya/ui/views/login/LoginBox.java | 91 +++++++
.../tamaya/ui/views/login/LoginEvent.java | 15 ++
.../apache/tamaya/ui/views/login/LoginView.java | 13 +
.../services/org.apache.tamaya.ui.ViewProvider | 21 ++
...rg.apache.tamaya.ui.services.MessageProvider | 19 ++
.../src/main/resources/config/application.yml | 28 ++
.../main/resources/ui/lang/tamaya.properties | 28 ++
.../src/test/resources/config/application.yml | 32 +++
sandbox/ui/pom.xml | 254 -------------------
.../org/apache/tamaya/ui/ApplicationLayout.java | 96 -------
.../main/java/org/apache/tamaya/ui/Content.java | 34 ---
.../java/org/apache/tamaya/ui/CurrentUser.java | 41 ---
.../main/java/org/apache/tamaya/ui/NavBar.java | 94 -------
.../java/org/apache/tamaya/ui/TamayaUI.java | 60 -----
.../java/org/apache/tamaya/ui/UIConstants.java | 35 ---
.../main/java/org/apache/tamaya/ui/User.java | 56 ----
.../java/org/apache/tamaya/ui/VadiinApp.java | 86 -------
.../java/org/apache/tamaya/ui/ViewProvider.java | 66 -----
.../tamaya/ui/components/LazyProvider.java | 50 ----
.../tamaya/ui/components/PageTitleUpdater.java | 45 ----
.../ui/components/VerticalSpacedLayout.java | 32 ---
.../org/apache/tamaya/ui/event/EventBus.java | 52 ----
.../org/apache/tamaya/ui/event/LogoutEvent.java | 22 --
.../apache/tamaya/ui/event/NavigationEvent.java | 32 ---
.../ConfigurationBasedMessageProvider.java | 174 -------------
.../ui/internal/ConfiguredMessageProvider.java | 61 -----
.../internal/ResourceBundleMessageProvider.java | 91 -------
.../tamaya/ui/internal/URLPropertySource.java | 60 -----
.../tamaya/ui/services/MessageProvider.java | 43 ----
.../apache/tamaya/ui/services/UserService.java | 30 ---
.../apache/tamaya/ui/views/ComponentView.java | 175 -------------
.../org/apache/tamaya/ui/views/ConfigView.java | 199 ---------------
.../org/apache/tamaya/ui/views/ErrorView.java | 40 ---
.../org/apache/tamaya/ui/views/HomeView.java | 80 ------
.../apache/tamaya/ui/views/login/LoginBox.java | 91 -------
.../tamaya/ui/views/login/LoginEvent.java | 15 --
.../apache/tamaya/ui/views/login/LoginView.java | 13 -
.../services/org.apache.tamaya.ui.ViewProvider | 21 --
...rg.apache.tamaya.ui.services.MessageProvider | 19 --
.../src/main/resources/config/application.yml | 28 --
.../main/resources/ui/lang/tamaya.properties | 28 --
.../src/test/resources/config/application.yml | 32 ---
68 files changed, 2255 insertions(+), 2255 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ui/pom.xml b/modules/ui/pom.xml
new file mode 100644
index 0000000..4edbeb8
--- /dev/null
+++ b/modules/ui/pom.xml
@@ -0,0 +1,254 @@
+<?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-extensions</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <packaging>war</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tamaya-ui</artifactId>
+ <name>Apache Tamaya Modules - UI</name>
+
+ <properties>
+ <vaadin.version>7.6.4</vaadin.version>
+ <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
+ <mainClass>org.apache.tamaya.ui.VaadinApplication</mainClass>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <servlet.api.version>3.0.1</servlet.api.version>
+ <tomcat.version>7.0.57</tomcat.version>
+ <jersey.version>1.19.1</jersey.version>
+ <guava.version>18.0</guava.version>
+ </properties>
+
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-bom</artifactId>
+ <version>${vaadin.version}</version>
+ <type>pom</type>
+ <scope>import</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>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spisupport</artifactId>
+ <version>${project.version}</version>
+ </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>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>javax.ws.rs</groupId>-->
+ <!--<artifactId>jsr311-api</artifactId>-->
+ <!--<version>1.1.1</version>-->
+ <!--<scope>provided</scope>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>com.sun.jersey</groupId>-->
+ <!--<artifactId>jersey-server</artifactId>-->
+ <!--<version>${jersey.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>com.sun.jersey</groupId>-->
+ <!--<artifactId>jersey-servlet</artifactId>-->
+ <!--<version>${jersey.version}</version>-->
+ <!--</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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
new file mode 100644
index 0000000..2c303a8
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -0,0 +1,96 @@
+/*
+ * 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.Navigator;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Panel;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.components.LazyProvider;
+import org.apache.tamaya.ui.components.PageTitleUpdater;
+import org.apache.tamaya.ui.views.ErrorView;
+
+
+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(VadiinApp.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() {
+ for(ViewProvider provider: ServiceContextManager.getServiceContext().getServices(ViewProvider.class)) {
+ addView(provider);
+ }
+ navigator.setErrorView(ErrorView.class);
+ }
+
+ /**
+ * Registers av given view to the navigator and adds it to the NavBar
+ */
+ private void addView(ViewProvider provider) {
+
+ switch (provider.getLifecycle()) {
+ case CREATE:
+ navigator.addView(provider.getUrlPattern(), provider.createView());
+ break;
+ case LAZY:
+ navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider));
+ break;
+ case EAGER:
+ try {
+ navigator.addView(provider.getUrlPattern(), provider.createView());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ navBar.addView(provider.getUrlPattern(), provider.getDisplayName());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/Content.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/Content.java b/modules/ui/src/main/java/org/apache/tamaya/ui/Content.java
new file mode 100644
index 0000000..c03fdf1
--- /dev/null
+++ b/modules/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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
new file mode 100644
index 0000000..8c754e2
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
@@ -0,0 +1,41 @@
+/*
+ * 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 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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
new file mode 100644
index 0000000..16b9860
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
@@ -0,0 +1,94 @@
+/*
+ * 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.Button;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+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;
+
+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);
+ 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);
+
+ addLogoutButton();
+ }
+
+ private void addLogoutButton() {
+ 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) {
+ 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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
new file mode 100644
index 0000000..b90c402
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.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;
+
+public class TamayaUI {
+
+ private static final Logger LOG = Logger.getLogger(TamayaUI.class.getName());
+
+
+ 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/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java b/modules/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
new file mode 100644
index 0000000..2f75b5c
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
@@ -0,0 +1,35 @@
+/*
+ * 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";
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/User.java b/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
new file mode 100644
index 0000000..2201bdb
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public class User {
+
+ private String userID = "-";
+ private String fulLName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("default.label.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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
new file mode 100644
index 0000000..60f3d34
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
@@ -0,0 +1,86 @@
+/*
+ * 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.*;
+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 {
+
+ private Content content = new Content();
+
+ @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 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/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
new file mode 100644
index 0000000..35990ab
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
@@ -0,0 +1,66 @@
+/*
+ * 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 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()
+ * @return a new view instance, not null.
+ */
+ View createView();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
new file mode 100644
index 0000000..867b802
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.ui.components;
+
+import com.vaadin.navigator.View;
+import org.apache.tamaya.ui.ViewProvider;
+
+import java.util.Objects;
+
+/**
+ * Lazily initializes a view when it's first accessed, then always returns the
+ * same instance on subsequent calls.
+ */
+public class LazyProvider implements com.vaadin.navigator.ViewProvider {
+ private ViewProvider provider;
+ private View view;
+
+ public LazyProvider(String viewName, ViewProvider provider) {
+ this.provider = Objects.requireNonNull(provider);
+ }
+
+ @Override
+ public String getViewName(String s) {
+ return provider.getDisplayName();
+ }
+
+ @Override
+ public View getView(String viewName) {
+ if (view == null) {
+ view = provider.createView();
+ }
+ return view;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
new file mode 100644
index 0000000..a236d55
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+
+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/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java b/modules/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
new file mode 100644
index 0000000..94fc980
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy 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/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java b/modules/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
new file mode 100644
index 0000000..ffa9ba4
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
@@ -0,0 +1,52 @@
+/*
+ * 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/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
new file mode 100644
index 0000000..ec00a42
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+public class LogoutEvent {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
new file mode 100644
index 0000000..9d3b744
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy 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;
+
+
+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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
new file mode 100644
index 0000000..99521c4
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
@@ -0,0 +1,174 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.ConfigurationContext;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spisupport.BasePropertySource;
+import org.apache.tamaya.spisupport.DefaultConfiguration;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+ * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
+ * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
+ * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
+ */
+public final class ConfigurationBasedMessageProvider implements MessageProvider{
+
+ /**
+ * The property name for configuring the resource bundle's base name either as
+ * system property, environment property or configuration entry.
+ */
+ private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
+
+ private final String baseName = evaluateBaseName();
+
+ private Map<String, Map<String,String>> propertiesCache = new ConcurrentHashMap<>();
+
+
+ /**
+ * Private singleton constructor.
+ */
+ public ConfigurationBasedMessageProvider(){
+
+ }
+
+ /**
+ * Get a message using the defaul locale.
+ * @param key the message key, not null.
+ * @return the resolved message, or the bundle ID, never null.
+ */
+ public String getMessage(String key){
+ return getMessage(key, Locale.getDefault());
+ }
+
+ /**
+ * Get a message.
+ * @param key the message key, not null.
+ * @param locale the target locale, or null, for the default locale.
+ * @return the resolved message, or the key, never null.
+ */
+ public String getMessage(String key, Locale locale){
+ List<String> bundleIds = evaluateBundleIds(locale);
+ for(String bundleID:bundleIds){
+ Map<String,String> entries = this.propertiesCache.get(bundleID);
+ if(entries==null){
+ entries = loadEntries(bundleID);
+ }
+ String value = entries.get(key);
+ if(value!=null){
+ return value;
+ }
+ }
+ return null;
+ }
+
+ private Map<String, String> loadEntries(String bundleID) {
+ ConfigurationContextBuilder ctxBuilder = ConfigurationProvider.getConfigurationContextBuilder();
+ for(String format:new String[]{"xml", "properties"}) {
+ try {
+ Enumeration<URL> urls = getClass().getClassLoader().getResources(bundleID+"."+format);
+ while(urls.hasMoreElements()){
+ URL url = urls.nextElement();
+ ctxBuilder.addPropertySources(new URLPropertySource(url));
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ Map<String, String> entries = new DefaultConfiguration(ctxBuilder.build()).getProperties();
+ this.propertiesCache.put(bundleID, entries);
+ return entries;
+ }
+
+ private List<String> evaluateBundleIds(Locale locale) {
+ List<String> bundleIds = new ArrayList<>();
+ String country = locale.getCountry();
+ if(country==null){
+ country="";
+ }
+ String lang = locale.getLanguage();
+ if(lang==null){
+ lang="";
+ }
+ String variant = locale.getVariant();
+ if(variant==null){
+ variant="";
+ }
+ String key = baseName + "_"+country+"_"+lang+"_"+variant;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName + "_"+country+"_"+lang;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName + "_"+country;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName;
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ return bundleIds;
+ }
+
+ /**
+ * Remove all doubled '_' hereby normalizing the bundle key.
+ * @param key the key, not null.
+ * @return the normaliuzed key, not null.
+ */
+ private String reduceKey(String key) {
+ String reduced = key.replace("___","_").replace("__","_");
+ if(reduced.endsWith("_")){
+ reduced = reduced.substring(0,reduced.length()-1);
+ }
+ return reduced;
+ }
+
+ /**
+ * Evaluates the base name to be used for creating the resource bundle used.
+ * @return
+ */
+ private String evaluateBaseName() {
+ String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
+ if(baseName==null || baseName.isEmpty()){
+ baseName = System.getenv("tamaya.ui.baseName");
+ }
+ if(baseName==null || baseName.isEmpty()){
+ baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
+ }
+ if(baseName==null || baseName.isEmpty()){
+ baseName = "ui/lang/tamaya";
+ }
+ return baseName.replace('.', '/');
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
new file mode 100644
index 0000000..e2a761c
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
@@ -0,0 +1,61 @@
+///*
+// * 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.internal;
+//
+//import org.apache.tamaya.ui.services.MessageProvider;
+//
+//import java.util.Locale;
+//import java.util.ResourceBundle;
+//
+///**
+// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+// */
+//public class ConfiguredMessageProvider implements MessageProvider{
+//
+// /**
+// * Private singleton constructor.
+// */
+// public ConfiguredMessageProvider(){}
+//
+// /**
+// * Get a message using the defaul locale.
+// * @param bundleID the message bundle key, not null.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID){
+// return getMessage(bundleID, Locale.getDefault());
+// }
+//
+// /**
+// * Get a message.
+// * @param bundleID the message bundle key, not null.
+// * @param locale the target locale, or null, for the default locale.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID, Locale locale){
+// try{
+// ResourceBundle bundle = ResourceBundle.getBundle("ui/lang/tamaya", locale);
+// return bundle.getString(bundleID);
+// }
+// catch(Exception e){
+// return bundleID;
+// }
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
new file mode 100644
index 0000000..c0aa092
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
@@ -0,0 +1,91 @@
+///*
+// * 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.internal;
+//
+//import org.apache.tamaya.ConfigurationProvider;
+//import org.apache.tamaya.ui.services.MessageProvider;
+//
+//import java.util.Locale;
+//import java.util.ResourceBundle;
+//
+///**
+// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+// * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
+// * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
+// * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
+// */
+//public class ResourceBundleMessageProvider implements MessageProvider{
+//
+// private static final String BASENAME = evaluateBaseName();
+//
+// /**
+// * The property name for configuring the resource bundle's base name either as
+// * system property, environment property or configuration entry.
+// */
+// private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
+//
+// /**
+// * Evaluates the base name to be used for creating the resource bundle used.
+// * @return
+// */
+// private static String evaluateBaseName() {
+// String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
+// if(baseName==null || baseName.isEmpty()){
+// baseName = System.getenv("tamaya.ui.baseName");
+// }
+// if(baseName==null || baseName.isEmpty()){
+// baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
+// }
+// if(baseName==null || baseName.isEmpty()){
+// baseName = "ui/lang/tamaya";
+// }
+// return baseName;
+// }
+//
+// /**
+// * Private singleton constructor.
+// */
+// public ResourceBundleMessageProvider(){}
+//
+// /**
+// * Get a message using the defaul locale.
+// * @param bundleID the message bundle key, not null.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID){
+// return getMessage(bundleID, Locale.getDefault());
+// }
+//
+// /**
+// * Get a message.
+// * @param bundleID the message bundle key, not null.
+// * @param locale the target locale, or null, for the default locale.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID, Locale locale){
+// try{
+// ResourceBundle bundle = ResourceBundle.getBundle(BASENAME, locale);
+// return bundle.getString(bundleID);
+// }
+// catch(Exception e){
+// return bundleID;
+// }
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
new file mode 100644
index 0000000..0727515
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
@@ -0,0 +1,60 @@
+package org.apache.tamaya.ui.internal;
+
+import org.apache.tamaya.spisupport.BasePropertySource;
+import org.apache.tamaya.spisupport.MapPropertySource;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Simple property source, used for internationalization.
+ */
+final class URLPropertySource extends BasePropertySource{
+
+ private static final Logger LOG = Logger.getLogger(URLPropertySource.class.getName());
+ private URL url;
+ private Map<String, String> properties;
+
+ public URLPropertySource(URL url){
+ this.url = Objects.requireNonNull(url);
+ load();
+ }
+
+ /**
+ * Loads/reloads the properties from the URL. If loading of the properties failed the previus state is preserved,
+ * unless there is no such state. In this case an empty map is assigned.
+ */
+ public void load(){
+ try(InputStream is = url.openStream()) {
+ Properties props = new Properties();
+ if (url.getFile().endsWith(".xml")) {
+ props.loadFromXML(is);
+ } else {
+ props.load(is);
+ }
+ properties = Collections.unmodifiableMap(MapPropertySource.getMap(props));
+ }
+ catch(Exception e){
+ LOG.log(Level.WARNING, "Failed to read config from "+url,e);
+ if(properties==null) {
+ properties = Collections.emptyMap();
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return url.toString();
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
new file mode 100644
index 0000000..a15ae46
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.services;
+
+import java.util.Locale;
+
+/**
+ * Component resolving messages for being shown in the UI.
+ */
+public interface MessageProvider {
+
+ /**
+ * Get a message using the default locale.
+ * @param key the message key, not null.
+ * @return the resolved message, or the key, never null.
+ */
+ String getMessage(String key);
+
+ /**
+ * Get a message.
+ * @param key the message key, not null.
+ * @param locale the target locale, or null, for the default locale.
+ * @return the resolved message, or the key, never null.
+ */
+ String getMessage(String key, Locale locale);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java b/modules/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
new file mode 100644
index 0000000..71a8a43
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.services;
+
+import org.apache.tamaya.ui.User;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public interface UserService {
+
+ User login(String userId, String credentials);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
new file mode 100644
index 0000000..7572510
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
@@ -0,0 +1,175 @@
+/*
+ * 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.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Tree;
+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.ViewProvider;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
+import java.util.List;
+import java.util.Map;
+
+
+public class ComponentView extends VerticalSpacedLayout implements View {
+
+
+ @Priority(20)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/components";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.components.name");
+ }
+
+ @Override
+ public View createView(){
+ return new ComponentView();
+ }
+ }
+
+
+ private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("default.label.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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
new file mode 100644
index 0000000..e286bf2
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
@@ -0,0 +1,199 @@
+/*
+ * 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.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.*;
+import javafx.scene.control.TabPane;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewProvider;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TreeMap;
+
+
+public class ConfigView extends VerticalSpacedLayout implements View {
+
+ @Priority(10)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/config";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.config.name");
+ }
+
+ @Override
+ public View createView(){
+ return new ConfigView();
+ }
+ }
+
+ 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);
+
+ TabSheet tabPane = new TabSheet();
+ VerticalLayout configLayout = new VerticalLayout();
+
+ 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();
+ configLayout.addComponents(filters, tree);
+ tabPane.addTab(configLayout, "Configuration");
+ TextArea envProps = new TextArea();
+ StringBuilder b = new StringBuilder();
+ envProps.setHeight("100%");
+ envProps.setWidth("100%");
+ envProps.setSizeFull();
+ envProps.setRows(System.getenv().size());
+ for(Map.Entry<String,String> en:new TreeMap<>(System.getenv()).entrySet()){
+ b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
+ }
+ envProps.setValue(b.toString());
+ envProps.setReadOnly(true);
+ tabPane.addTab(envProps, "Environment Properties");
+ TextArea sysProps = new TextArea();
+ sysProps.setSizeFull();
+ sysProps.setRows(System.getProperties().size());
+ b.setLength(0);
+ for(Map.Entry<Object,Object> en:new TreeMap<>(System.getProperties()).entrySet()){
+ b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
+ }
+ sysProps.setValue(b.toString());
+ sysProps.setReadOnly(true);
+ tabPane.addTab(sysProps, "System Properties");
+ TextArea runtimeProps = new TextArea();
+ runtimeProps.setRows(5);
+ b.setLength(0);
+ b.append("Available Processors : ").append(Runtime.getRuntime().availableProcessors()).append('\n');
+ b.append("Free Memory : ").append(Runtime.getRuntime().freeMemory()).append('\n');
+ b.append("Max Memory : ").append(Runtime.getRuntime().maxMemory()).append('\n');
+ b.append("Total Memory : ").append(Runtime.getRuntime().totalMemory()).append('\n');
+ b.append("Default Locale : ").append(Locale.getDefault()).append('\n');
+ runtimeProps.setValue(b.toString());
+ runtimeProps.setReadOnly(true);
+ tabPane.addTab(runtimeProps, "Runtime Properties");
+ runtimeProps.setSizeFull();
+ addComponents(caption, description, tabPane);
+
+ 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
[13/15] incubator-tamaya git commit: Removed comment line.
Posted by an...@apache.org.
Removed comment line.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/56318ab1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/56318ab1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/56318ab1
Branch: refs/heads/master
Commit: 56318ab1721feac4aaf92a39245223a30e427275
Parents: 8852db0
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 22:26:01 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/tamaya/server/ConfigServiceApp.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/56318ab1/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
index 73944d9..22422b3 100644
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
+++ b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
@@ -60,7 +60,6 @@ public class ConfigServiceApp {
// Define a web application context.
Context context = tomcat.addWebapp(contextPath, new File(
appBase).getAbsolutePath());
-// tomcat.getHost().setAppBase(appBase);
// Add servlet that will register Jersey REST resources
Wrapper wrapper = tomcat.addServlet(context, "jersey-container-servlet",
ServletContainer.class.getName());
[05/15] incubator-tamaya git commit: - Minor update of dist download
dir. - Added scm publish plugin.
Posted by an...@apache.org.
- Minor update of dist download dir.
- Added scm publish plugin.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/692ce55d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/692ce55d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/692ce55d
Branch: refs/heads/master
Commit: 692ce55d4cc46cd6c008f374cbcae7341f0b27c1
Parents: 11a2e35
Author: anatole <an...@apache.org>
Authored: Sat Apr 16 08:23:14 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
pom.xml | 7 ++++++-
src/site/asciidoc/download.adoc | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/692ce55d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a026f1a..dc30ff0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -532,8 +532,13 @@ under the License.
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-scm-publish-plugin</artifactId>
+ <version>1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.4</version>
+ <version>3.4.1</version>
<inherited>true</inherited>
<dependencies>
<dependency><!-- add support for ssh/scp -->
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/692ce55d/src/site/asciidoc/download.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/download.adoc b/src/site/asciidoc/download.adoc
index 78e0700..89d04e7 100644
--- a/src/site/asciidoc/download.adoc
+++ b/src/site/asciidoc/download.adoc
@@ -24,7 +24,7 @@ include::temp-properties-files-for-site/attributes.adoc[]
The latest release is Apache Tamaya {tamaya_version_current}.
You can download it it from the
-http://www.apache.org/dist/incubator/[Apache Software Foundation Distribution Directory^].
+http://www.apache.org/dist/incubator/tamaya[Apache Software Foundation Distribution Directory^].
// @todo The release notes are available [here][4].
// http://www.apache.org/dist/incubator/tamaya/0.1-incubating/ReleaseNotes-0.1-incubating.html
[03/15] incubator-tamaya git commit: Moved serverroot to /
Posted by an...@apache.org.
Moved serverroot to /
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/8de2fbd3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8de2fbd3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8de2fbd3
Branch: refs/heads/master
Commit: 8de2fbd30aa3db667b51771a3ce3a05f1f3a6c80
Parents: 75fe9d2
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 21:07:33 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/tamaya/server/ConfigServiceApp.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8de2fbd3/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
index 2c74ea1..73944d9 100644
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
+++ b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
@@ -52,7 +52,7 @@ public class ConfigServiceApp {
public static void main(String[] args) throws Exception {
Configuration config = ConfigurationProvider.getConfiguration();
- String contextPath = config.getOrDefault("tamaya.server.contextPath", "/tamaya");
+ String contextPath = config.getOrDefault("tamaya.server.contextPath", "/");
String appBase = ".";
Tomcat tomcat = new Tomcat();
tomcat.setPort(Integer.valueOf(config.getOrDefault("tamaya.server.port", Integer.class, 8085) ));
[08/15] incubator-tamaya git commit: - Removed dependency from
Dropwizard, using tomcat embedded now.
Posted by an...@apache.org.
- Removed dependency from Dropwizard, using tomcat embedded now.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/4b2d041b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/4b2d041b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/4b2d041b
Branch: refs/heads/master
Commit: 4b2d041bdf028b66e595dd19073aefd67136cbb3
Parents: d736136
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 21:01:07 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
modules/server/pom.xml | 67 +++++++++++++++++---
.../apache/tamaya/server/ConfigServiceApp.java | 66 ++++++++++++-------
.../server/ConfigServiceConfiguration.java | 41 ------------
.../tamaya/server/ConfigurationResource.java | 4 --
4 files changed, 101 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4b2d041b/modules/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/server/pom.xml b/modules/server/pom.xml
index 55c75ec..4e706ce 100644
--- a/modules/server/pom.xml
+++ b/modules/server/pom.xml
@@ -32,23 +32,74 @@ under the License.
<properties>
<jdkVersion>1.7</jdkVersion>
- <dropwizard.version>0.9.2</dropwizard.version>
+ <tomcat.version>7.0.57</tomcat.version>
+ <jersey.version>1.19.1</jersey.version>
</properties>
- <!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
- <groupId>io.dropwizard</groupId>
- <artifactId>dropwizard-core</artifactId>
- <version>${dropwizard.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-api</artifactId>
<version>${project.version}</version>
- <scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${tomcat.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <!--<dependency>-->
+ <!--<groupId>org.apache.tomcat.embed</groupId>-->
+ <!--<artifactId>tomcat-embed-jasper</artifactId>-->
+ <!--<version>${tomcat.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.tomcat</groupId>-->
+ <!--<artifactId>tomcat-jasper</artifactId>-->
+ <!--<version>${tomcat.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.tomcat</groupId>-->
+ <!--<artifactId>tomcat-jasper-el</artifactId>-->
+ <!--<version>${tomcat.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.tomcat</groupId>-->
+ <!--<artifactId>tomcat-jsp-api</artifactId>-->
+ <!--<version>${tomcat.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>jstl</groupId>-->
+ <!--<artifactId>jstl</artifactId>-->
+ <!--<version>1.2</version>-->
+ <!--</dependency>-->
+ <dependency>
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-core</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4b2d041b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
index 2e98998..2c74ea1 100644
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
+++ b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
@@ -18,39 +18,57 @@
*/
package org.apache.tamaya.server;
-import io.dropwizard.Application;
-import io.dropwizard.setup.Bootstrap;
-import io.dropwizard.setup.Environment;
+
+import com.sun.jersey.api.core.ResourceConfig;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+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 javax.servlet.Servlet;
+import javax.ws.rs.core.Application;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
/**
* Main Application for the Tamaya Configuration Server.
*/
-public class ConfigServiceApp extends Application<ConfigServiceConfiguration> {
+public class ConfigServiceApp {
- public static void main(String... args) throws Exception {
- new ConfigServiceApp().run(args);
- }
+ public class ResourceLoader extends Application{
- @Override
- public String getName() {
- return "Tamaya Config-Server";
- }
+ @Override
+ public Set<Class<?>> getClasses() {
+ final Set<Class<?>> classes = new HashSet<Class<?>>();
- @Override
- public void initialize(Bootstrap<ConfigServiceConfiguration> bootstrap) {
- // nothing to do yet
+ // register root resource
+ classes.add(ConfigurationResource.class);
+ return classes;
+ }
}
- @Override
- public void run(ConfigServiceConfiguration configuration,
- Environment environment) {
- final ConfigurationResource resource = new ConfigurationResource(
- configuration.getScope()
- );
- // final TemplateHealthCheck healthCheck =
- // new TemplateHealthCheck(configuration.getTemplate());
- // environment.healthChecks().register("template", healthCheck);
- environment.jersey().register(resource);
+ 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, 8085) ));
+
+ // Define a web application context.
+ Context context = tomcat.addWebapp(contextPath, new File(
+ appBase).getAbsolutePath());
+// tomcat.getHost().setAppBase(appBase);
+ // Add servlet that will register Jersey REST resources
+ Wrapper wrapper = tomcat.addServlet(context, "jersey-container-servlet",
+ ServletContainer.class.getName());
+ wrapper.addInitParameter("com.sun.jersey.config.property.packages",
+ ConfigurationResource.class.getPackage().getName());
+ context.addServletMapping("/*", "jersey-container-servlet");
+ tomcat.start();
+ tomcat.getServer().await();
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4b2d041b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceConfiguration.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceConfiguration.java
deleted file mode 100644
index 6248e82..0000000
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceConfiguration.java
+++ /dev/null
@@ -1,41 +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.server;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.dropwizard.Configuration;
-
-/**
- *Configuration Server DropWizard Configuration.
- */
-public class ConfigServiceConfiguration extends Configuration {
-
- private String scope;
-
- @JsonProperty
- public String getScope() {
- return scope;
- }
-
- @JsonProperty
- public void setScope(String scope) {
- this.scope = scope;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4b2d041b/modules/server/src/main/java/org/apache/tamaya/server/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigurationResource.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigurationResource.java
index ebc6eca..f13446a 100644
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigurationResource.java
+++ b/modules/server/src/main/java/org/apache/tamaya/server/ConfigurationResource.java
@@ -51,14 +51,10 @@ import org.apache.tamaya.functions.ConfigurationFunctions;
@Path("/")
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
public class ConfigurationResource {
- private final String scope;
private final AtomicLong readCounter = new AtomicLong();
private final AtomicLong writeCounter = new AtomicLong();
private final AtomicLong deleteCounter = new AtomicLong();
- public ConfigurationResource(String scope) {
- this.scope = scope;
- }
@GET
@Path("/version")
[12/15] incubator-tamaya git commit: Fixed lang support for
modularization.
Posted by an...@apache.org.
Fixed lang support for modularization.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/75fe9d2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/75fe9d2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/75fe9d2f
Branch: refs/heads/master
Commit: 75fe9d2fc625c2762b711861f8ad18490d19ccac
Parents: 4b2d041
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 21:05:13 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
sandbox/ui/pom.xml | 23 --------------------
.../org/apache/tamaya/ui/ApplicationLayout.java | 1 -
.../main/java/org/apache/tamaya/ui/NavBar.java | 1 -
.../main/java/org/apache/tamaya/ui/User.java | 1 -
.../org/apache/tamaya/ui/VaadinApplication.java | 2 --
.../tamaya/ui/components/PageTitleUpdater.java | 1 -
.../apache/tamaya/ui/views/ComponentView.java | 1 -
.../apache/tamaya/ui/views/login/LoginBox.java | 1 -
8 files changed, 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/pom.xml b/sandbox/ui/pom.xml
index 3441951..216382f 100644
--- a/sandbox/ui/pom.xml
+++ b/sandbox/ui/pom.xml
@@ -36,9 +36,7 @@ under the License.
<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>
@@ -53,27 +51,6 @@ under the License.
<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>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
index c3aeabb..7a303eb 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -24,7 +24,6 @@ import com.vaadin.ui.Panel;
import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.components.LazyProvider;
import org.apache.tamaya.ui.components.PageTitleUpdater;
-import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.views.ErrorView;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
index 5b3537a..16b9860 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
@@ -28,7 +28,6 @@ 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.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.services.MessageProvider;
import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
index 4cb6f5a..2201bdb 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
@@ -19,7 +19,6 @@
package org.apache.tamaya.ui;
import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.services.MessageProvider;
import java.util.Date;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
index 7931a4b..1bdf19e 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VaadinApplication.java
@@ -18,8 +18,6 @@
*/
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;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
index 9f95ae7..a236d55 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
@@ -22,7 +22,6 @@ 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.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.services.MessageProvider;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
index 19211f1..7572510 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
@@ -27,7 +27,6 @@ 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.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.UIConstants;
import org.apache.tamaya.ui.ViewProvider;
import org.apache.tamaya.ui.components.VerticalSpacedLayout;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/75fe9d2f/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
index 8bdcbee..049d885 100644
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
@@ -3,7 +3,6 @@ package org.apache.tamaya.ui.views.login;
import com.vaadin.event.ShortcutAction;
import com.vaadin.ui.*;
import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.internal.ResourceBundleMessageProvider;
import org.apache.tamaya.ui.UIConstants;
import org.apache.tamaya.ui.User;
import org.apache.tamaya.ui.event.EventBus;
[14/15] incubator-tamaya git commit: TAMAYA-150 Added UI module and
related functionality.
Posted by an...@apache.org.
TAMAYA-150 Added UI module and related functionality.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/d9e6e55c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/d9e6e55c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/d9e6e55c
Branch: refs/heads/master
Commit: d9e6e55c79212f34915049006436a6f81a0e2828
Parents: 1a11d15
Author: anatole <an...@apache.org>
Authored: Tue Apr 19 13:52:19 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../org/apache/tamaya/events/ui/EventView.java | 15 ++-
.../events/delta/ConfigurationChangeTest.java | 8 +-
modules/mutable-config/pom.xml | 15 ++-
.../mutableconfig/ui/ConfigUpdaterView.java | 107 +++++++++++++++++++
.../services/org.apache.tamaya.ui.ViewProvider | 19 ++++
5 files changed, 153 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9e6e55c/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
index 56e4b35..bee6e7b 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
@@ -23,7 +23,13 @@ import com.vaadin.data.Property;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.*;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
import org.apache.tamaya.events.ConfigEvent;
import org.apache.tamaya.events.ConfigEventListener;
import org.apache.tamaya.events.ConfigEventManager;
@@ -36,9 +42,14 @@ import org.apache.tamaya.ui.services.MessageProvider;
import javax.annotation.Priority;
import java.util.Date;
-
+/**
+ * Tamaya View for observing the current event stream.
+ */
public class EventView extends VerticalSpacedLayout implements View {
+ /**
+ * Provider used to register the view.
+ */
@Priority(20)
public static final class Provider implements ViewProvider{
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9e6e55c/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
index 95269e2..b20ebef 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
@@ -45,9 +45,15 @@ public class ConfigurationChangeTest {
Configuration config = ConfigurationProvider.getConfiguration();
ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
assertNotNull(change);
- assertTrue(change.isEmpty());
+ assertTrue(change.getUpdatedSize()==0);
+ assertTrue(change.getAddedSize()==0);
+ assertTrue(change.getRemovedSize()==0);
+ assertTrue(change.getChanges().size()==0);
for (Map.Entry<String, String> en : config.getProperties().entrySet()) {
if (!"[meta]frozenAt".equals(en.getKey())) {
+ if(en.getKey().contains("random.new")){ // dynamic generated value!
+ continue;
+ }
assertEquals("Error for " + en.getKey(), en.getValue(), change.getResource().get(en.getKey()));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9e6e55c/modules/mutable-config/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mutable-config/pom.xml b/modules/mutable-config/pom.xml
index 0ddd7bf..cf06546 100644
--- a/modules/mutable-config/pom.xml
+++ b/modules/mutable-config/pom.xml
@@ -41,24 +41,23 @@ under the License.
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-api</artifactId>
<version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tamaya.ext</groupId>
<artifactId>tamaya-spisupport</artifactId>
<version>${project.version}</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>org.apache.tamaya.ext</groupId>-->
- <!--<artifactId>tamaya-events</artifactId>-->
- <!--<version>${project.version}</version>-->
- <!--</dependency>-->
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-ui</artifactId>
+ <version>${project.version}</version>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-core</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
+ <scope>runtime</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9e6e55c/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java
new file mode 100644
index 0000000..7a4956c
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ui/ConfigUpdaterView.java
@@ -0,0 +1,107 @@
+/*
+ * 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.mutableconfig.ui;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import org.apache.tamaya.mutableconfig.MutableConfigurationProvider;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewProvider;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
+import java.util.Arrays;
+
+/**
+ * Tamaya UI view to change configuration.
+ */
+public class ConfigUpdaterView extends VerticalSpacedLayout implements View {
+
+ /**
+ * Provider to register the view.
+ */
+ @Priority(20)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.LAZY;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/edit";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "view.update.name";
+ }
+
+ @Override
+ public View createView(){
+ return new ConfigUpdaterView();
+ }
+ }
+
+ private ComboBox changePropagationPolicy = new ComboBox("view.update.select.propagationPolicy",
+ Arrays.asList(new String[]{"ALL", "MOST_SIGNIFICANT_ONLY", "SELECTIVE", "NONE"}));
+
+ private TextField changePropagationPolicyOther = new TextField("view.update.text.propagationPolicyOther",
+ MutableConfigurationProvider.getApplyAllChangePolicy().getClass().getName());
+
+ private TextArea generalInfo = new TextArea(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.update.textArea.general"));
+
+
+
+ public ConfigUpdaterView() {
+ Label caption = new Label(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.update.name"));
+ Label description = new Label(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.update.description"),
+ ContentMode.HTML);
+
+ caption.addStyleName(UIConstants.LABEL_HUGE);
+ description.addStyleName(UIConstants.LABEL_LARGE);
+ addComponents(caption, description,changePropagationPolicy,changePropagationPolicyOther,generalInfo);
+ }
+
+
+ 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/blob/d9e6e55c/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
new file mode 100644
index 0000000..d2ac687
--- /dev/null
+++ b/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.mutableconfig.ui.ConfigUpdaterView$Provider
\ No newline at end of file
[02/15] incubator-tamaya git commit: TAMAYA-150 Added UI module and
related functionality.
Posted by an...@apache.org.
TAMAYA-150 Added UI module and related functionality.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/cb2987cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/cb2987cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/cb2987cb
Branch: refs/heads/master
Commit: cb2987cb2db51bff730eb3deb621f2e75964382f
Parents: d9e6e55
Author: anatole <an...@apache.org>
Authored: Tue Apr 19 13:52:49 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
modules/pom.xml | 1 +
.../apache/tamaya/server/ConfigServiceApp.java | 10 +-
modules/ui/pom.xml | 28 +----
.../org/apache/tamaya/ui/ApplicationLayout.java | 14 ++-
.../java/org/apache/tamaya/ui/CurrentUser.java | 23 +++-
.../main/java/org/apache/tamaya/ui/NavBar.java | 15 ++-
.../java/org/apache/tamaya/ui/TamayaUI.java | 17 +++
.../main/java/org/apache/tamaya/ui/User.java | 124 +++++++++++++++++--
.../java/org/apache/tamaya/ui/VadiinApp.java | 7 +-
.../tamaya/ui/components/PageTitleUpdater.java | 4 +-
.../org/apache/tamaya/ui/event/LogoutEvent.java | 26 ++++
.../apache/tamaya/ui/event/NavigationEvent.java | 23 +++-
.../ConfigurationBasedMessageProvider.java | 8 +-
.../ui/internal/ConfiguredUserService.java | 76 ++++++++++++
.../tamaya/ui/internal/URLPropertySource.java | 18 +++
.../apache/tamaya/ui/views/ComponentView.java | 20 ++-
.../org/apache/tamaya/ui/views/ConfigView.java | 18 ++-
.../org/apache/tamaya/ui/views/ErrorView.java | 3 +
.../org/apache/tamaya/ui/views/HomeView.java | 12 +-
.../apache/tamaya/ui/views/login/LoginBox.java | 49 +++++---
.../tamaya/ui/views/login/LoginEvent.java | 42 ++++++-
.../apache/tamaya/ui/views/login/LoginView.java | 24 ++++
.../META-INF/javaconfiguration.properties | 21 ++++
.../org.apache.tamaya.ui.services.UserService | 19 +++
sandbox/pom.xml | 1 -
25 files changed, 523 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
index e32b92f..43f75e5 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -55,6 +55,7 @@ under the License.
<module>server</module>
<module>spi-support</module>
<module>yaml</module>
+ <module>ui</module>
</modules>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
index 22422b3..880c4f5 100644
--- a/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
+++ b/modules/server/src/main/java/org/apache/tamaya/server/ConfigServiceApp.java
@@ -19,7 +19,6 @@
package org.apache.tamaya.server;
-import com.sun.jersey.api.core.ResourceConfig;
import com.sun.jersey.spi.container.servlet.ServletContainer;
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
@@ -27,7 +26,6 @@ import org.apache.catalina.startup.Tomcat;
import org.apache.tamaya.Configuration;
import org.apache.tamaya.ConfigurationProvider;
-import javax.servlet.Servlet;
import javax.ws.rs.core.Application;
import java.io.File;
import java.util.HashSet;
@@ -38,6 +36,14 @@ import java.util.Set;
*/
public class ConfigServiceApp {
+ /**
+ * Utility class.
+ */
+ private ConfigServiceApp(){}
+
+ /**
+ * JAX RS Application.
+ */
public class ResourceLoader extends Application{
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ui/pom.xml b/modules/ui/pom.xml
index 4edbeb8..2ddb704 100644
--- a/modules/ui/pom.xml
+++ b/modules/ui/pom.xml
@@ -28,7 +28,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>tamaya-ui</artifactId>
<name>Apache Tamaya Modules - UI</name>
@@ -64,6 +64,11 @@ under the License.
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-functions</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.tamaya</groupId>
<artifactId>tamaya-core</artifactId>
<version>${project.version}</version>
@@ -74,11 +79,6 @@ under the License.
<artifactId>tamaya-spisupport</artifactId>
<version>${project.version}</version>
</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>
@@ -115,22 +115,6 @@ under the License.
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>${tomcat.version}</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>javax.ws.rs</groupId>-->
- <!--<artifactId>jsr311-api</artifactId>-->
- <!--<version>1.1.1</version>-->
- <!--<scope>provided</scope>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>com.sun.jersey</groupId>-->
- <!--<artifactId>jersey-server</artifactId>-->
- <!--<version>${jersey.version}</version>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>com.sun.jersey</groupId>-->
- <!--<artifactId>jersey-servlet</artifactId>-->
- <!--<version>${jersey.version}</version>-->
- <!--</dependency>-->
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
index 2c303a8..3c3b68e 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
@@ -26,7 +26,9 @@ import org.apache.tamaya.ui.components.LazyProvider;
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;
@@ -35,9 +37,7 @@ public class ApplicationLayout extends HorizontalLayout {
public ApplicationLayout() {
addStyleName(UIConstants.MAIN_LAYOUT);
-
setSizeFull();
-
initLayouts();
setupNavigator();
}
@@ -81,15 +81,17 @@ public class ApplicationLayout extends HorizontalLayout {
case CREATE:
navigator.addView(provider.getUrlPattern(), provider.createView());
break;
- case LAZY:
- navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider));
- break;
case EAGER:
try {
navigator.addView(provider.getUrlPattern(), provider.createView());
} catch (Exception e) {
e.printStackTrace();
}
+ break;
+ case LAZY:
+ default:
+ navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider));
+ break;
}
navBar.addView(provider.getUrlPattern(), provider.getDisplayName());
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
index 8c754e2..f186dbe 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
@@ -23,19 +23,36 @@ import com.vaadin.server.VaadinSession;
/**
* Convenience wrapper for storing and retreiving a user from the VaadinSession
*/
-public class CurrentUser {
+public final class CurrentUser {
+ /** The key used. */
+ private static final String KEY = "currentUser";
- private static final String KEY = "currentser";
+ /**
+ * 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
+ */
public static boolean isLoggedIn() {
- return get() != null;
+ return get() != null && get().isLoggedin();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
index 16b9860..464bcd6 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
@@ -33,6 +33,9 @@ import org.apache.tamaya.ui.services.MessageProvider;
import java.util.HashMap;
import java.util.Map;
+/**
+ * Left side navigation bar.
+ */
public class NavBar extends CssLayout implements ViewChangeListener {
private Map<String, Button> buttonMap = new HashMap<>();
@@ -45,7 +48,6 @@ public class NavBar extends CssLayout implements ViewChangeListener {
Label logo = new Label("<strong>"+ messages.getMessage("project.name")+"</strong>", ContentMode.HTML);
logo.addStyleName(UIConstants.MENU_TITLE);
addComponent(logo);
-
addLogoutButton();
}
@@ -54,7 +56,12 @@ public class NavBar extends CssLayout implements ViewChangeListener {
Button logout = new Button(messages.getMessage("default.label.logout"), new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent clickEvent) {
- EventBus.post(new LogoutEvent());
+ User user = CurrentUser.get();
+ if(user!=null){
+ user.logout();
+ EventBus.post(new LogoutEvent(user));
+ }
+ CurrentUser.set(null);
}
});
addComponent(logout);
@@ -89,6 +96,8 @@ public class NavBar extends CssLayout implements ViewChangeListener {
button.removeStyleName(UIConstants.SELECTED);
}
Button button = buttonMap.get(event.getViewName());
- if (button != null) button.addStyleName(UIConstants.SELECTED);
+ if (button != null) {
+ button.addStyleName(UIConstants.SELECTED);
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
index b90c402..f446d6f 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
@@ -28,11 +28,28 @@ 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");
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/User.java b/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
index 2201bdb..ae5b34a 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/User.java
@@ -18,39 +18,137 @@
*/
package org.apache.tamaya.ui;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.services.MessageProvider;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.HashSet;
import java.util.Objects;
+import java.util.Set;
/**
- * Created by atsticks on 29.03.16.
+ * 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();
- private String userID = "-";
- private String fulLName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("default.label.unknown");
- private Date logInDate = new Date();
-
- public User(String userID, String fullName){
- this.userID = Objects.requireNonNull(userID);
- this.fulLName = fullName;
+ /**
+ * 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;
}
- public String getLoginDate(){
- return logInDate.toString();
+ /**
+ * 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/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
index 60f3d34..d763930 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
@@ -24,7 +24,7 @@ import com.vaadin.annotations.Title;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.*;
+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;
@@ -43,6 +43,11 @@ public class VadiinApp extends UI {
private Content content = new Content();
+
+ public VadiinApp(){
+ super.setPollInterval(2000);
+ }
+
@Override
protected void init(VaadinRequest vaadinRequest) {
setupEventBus();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
index a236d55..83a0105 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
@@ -24,7 +24,9 @@ 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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
index ec00a42..680acc3 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
@@ -18,5 +18,31 @@
*/
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/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
index 9d3b744..bb863be 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
@@ -19,14 +19,35 @@
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 = 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 + '\'' +
+ '}';
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
index 99521c4..78d6167 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
@@ -19,15 +19,17 @@
package org.apache.tamaya.ui.internal;
import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spisupport.BasePropertySource;
import org.apache.tamaya.spisupport.DefaultConfiguration;
import org.apache.tamaya.ui.services.MessageProvider;
import java.io.IOException;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java
new file mode 100644
index 0000000..14af644
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java
@@ -0,0 +1,76 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+import org.apache.tamaya.ui.User;
+import org.apache.tamaya.ui.services.UserService;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * User service reading users and credentials from the configuration. Users are configured as follows (e.g. using
+ * properties format):
+ * <pre>
+ * tamaya.users.admin.pwd=admin
+ * tamaya.users.admin.fullName=Administrator
+ * tamaya.users.admin.roles=admin
+ * tamaya.users.john.pwd=meymey
+ * tamaya.users.john.fullName=John Doe
+ * tamaya.users.john.roles=admin,user
+ * </pre>
+ */
+public class ConfiguredUserService implements UserService{
+
+ private Map<String, User> users = new ConcurrentHashMap<>();
+
+ /**
+ * Constructor reading the configuration and initializing the users table.
+ */
+ public ConfiguredUserService(){
+ // read from config
+ Map<String,String> config = ConfigurationProvider.getConfiguration().with(
+ ConfigurationFunctions.section("tamaya.users.", true)).getProperties();
+ for(Map.Entry<String,String> en:config.entrySet()){
+ if(en.getKey().endsWith(".pwd")){
+ String uid = en.getKey().substring(0,en.getKey().length()-4);
+ String pwd = en.getValue();
+ String fullName = config.get(uid+".fullName");
+ String roles = config.get(uid+".roles");
+ if(roles==null){
+ roles="";
+ }
+ users.put(uid.toLowerCase(), new User(uid, fullName, pwd, roles.split(",")));
+ }
+ }
+
+ }
+
+ @Override
+ public User login(String userId, String credentials) {
+ User user = this.users.get(userId.toLowerCase());
+ if(user!=null && user.login(credentials)){
+ return user;
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
index 0727515..83b4af4 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.ui.internal;
import org.apache.tamaya.spisupport.BasePropertySource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
index 7572510..a751e02 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
@@ -26,7 +26,11 @@ import com.vaadin.ui.Tree;
import org.apache.tamaya.Configuration;
import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.*;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.spi.PropertyFilter;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.UIConstants;
import org.apache.tamaya.ui.ViewProvider;
import org.apache.tamaya.ui.components.VerticalSpacedLayout;
@@ -36,10 +40,15 @@ import javax.annotation.Priority;
import java.util.List;
import java.util.Map;
-
+/**
+ * View showing the current loaded system components.
+ */
public class ComponentView extends VerticalSpacedLayout implements View {
+ /**
+ * Provider to register this view.
+ */
@Priority(20)
public static final class Provider implements ViewProvider{
@@ -99,12 +108,15 @@ public class ComponentView extends VerticalSpacedLayout implements View {
configTree.setChildrenAllowed("Configuration.class", false);
configTree.addItem("ConfigurationContext.class");
- configTree.setItemCaption("ConfigurationContext.class", "ConfigurationContext class = " + config.getContext().getClass().getName());
+ 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.setItemCaption("PropertyValueCombinationPolicy.class",
+ PropertyValueCombinationPolicy.class.getSimpleName() + " class = " +
+ config.getContext().getPropertyValueCombinationPolicy().getClass().getName());
configTree.setParent("PropertyValueCombinationPolicy.class", currentParent);
configTree.setChildrenAllowed("PropertyValueCombinationPolicy.class", false);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
index e286bf2..1e32037 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
@@ -21,8 +21,15 @@ 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 javafx.scene.control.TabPane;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.UIConstants;
@@ -35,9 +42,14 @@ import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
-
+/**
+ * View for evaluating the current convifugration tree.
+ */
public class ConfigView extends VerticalSpacedLayout implements View {
+ /**
+ * Provider to register this view.
+ */
@Priority(10)
public static final class Provider implements ViewProvider{
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
index ef3fa2e..eef0db8 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
@@ -25,6 +25,9 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import org.apache.tamaya.ui.UIConstants;
+/**
+ * View used for shoiwing unexpected errors.
+ */
public class ErrorView extends VerticalLayout implements View {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
index 78297d2..d3154b9 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
@@ -31,9 +31,14 @@ import org.apache.tamaya.ui.services.MessageProvider;
import javax.annotation.Priority;
-
+/**
+ * Home view containing a title and a description, used as default entry point of the UI after login.
+ */
public class HomeView extends VerticalSpacedLayout implements View {
+ /**
+ * Provider to bew registered providing this view to the UI module.
+ */
@Priority(0)
public static final class Provider implements ViewProvider{
@@ -59,6 +64,9 @@ public class HomeView extends VerticalSpacedLayout implements View {
}
}
+ /**
+ * Constructor.
+ */
public HomeView() {
Label caption = new Label("Welcome, " + CurrentUser.get().getUserID());
Label description = new Label(
@@ -75,6 +83,6 @@ public class HomeView extends VerticalSpacedLayout implements View {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
-
+ // nothing to do
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
index 049d885..73cf018 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
@@ -1,7 +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.views.login;
import com.vaadin.event.ShortcutAction;
-import com.vaadin.ui.*;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import org.apache.tamaya.spi.ServiceContextManager;
import org.apache.tamaya.ui.UIConstants;
import org.apache.tamaya.ui.User;
@@ -9,18 +36,11 @@ import org.apache.tamaya.ui.event.EventBus;
import org.apache.tamaya.ui.services.MessageProvider;
import org.apache.tamaya.ui.services.UserService;
-
+/**
+ * Login dialog centerd on the screen.
+ */
public class LoginBox extends VerticalLayout {
- private UserService userService = new UserService() {
- @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;
@@ -61,7 +81,7 @@ public class LoginBox extends VerticalLayout {
Button forgotButton = new Button("Forgot", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent clickEvent) {
- Notification.show("Not implemented", Notification.Type.TRAY_NOTIFICATION);
+ Notification.show("Sorry, this feature is not yet implemented.", Notification.Type.TRAY_NOTIFICATION);
}
});
Button loginButton = new Button("Login", new Button.ClickListener() {
@@ -80,11 +100,12 @@ public class LoginBox extends VerticalLayout {
}
private void login() {
- User user = userService.login(username.getValue(), password.getValue());
+ User user = ServiceContextManager.getServiceContext().getService(UserService.class)
+ .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);
+ Notification.show("Login failed.", "Sorry the system could not log you in.", Notification.Type.WARNING_MESSAGE);
username.focus();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
index b6ba2b4..004c545 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
@@ -1,15 +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.views.login;
import org.apache.tamaya.ui.User;
+import java.util.Objects;
+
+/**
+ * Event sent when a user has been authenticated.
+ */
public class LoginEvent {
+ /** The user, not null. */
private User user;
+ /**
+ * Creates a new event.
+ * @param user the user logged in, not null.
+ */
public LoginEvent(User user) {
- this.user = user;
+ this.user = Objects.requireNonNull(user);
}
+ /**
+ * Get the user logged in.
+ * @return the user logged in, never null.
+ */
public User getUser() {
return user;
}
+
+ @Override
+ public String toString() {
+ return "LoginEvent{" +
+ "user=" + user +
+ '}';
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
index e1181d1..15730d3 100644
--- a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
@@ -1,10 +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.views.login;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.VerticalLayout;
+/**
+ * View used for login the users.
+ */
public class LoginView extends VerticalLayout {
+ /**
+ * Creates a new view.
+ */
public LoginView() {
setSizeFull();
setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/META-INF/javaconfiguration.properties b/modules/ui/src/main/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..98d7155
--- /dev/null
+++ b/modules/ui/src/main/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy 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.users.admin.pwd=admin
+tamaya.users.admin.fullName=Administrator
+tamaya.users.admin.roles=admin
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService
new file mode 100644
index 0000000..109865f
--- /dev/null
+++ b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.ui.internal.ConfiguredUserService
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cb2987cb/sandbox/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index 12a3760..a5831c7 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -39,7 +39,6 @@ under the License.
<module>metamodels</module>
<module>jodatime</module>
<module>sysprops</module>
- <module>ui</module>
<module>remote</module>
</modules>
[06/15] incubator-tamaya git commit: Modulularized UI module,
added multi file based i18n, using config mechanisms.
Posted by an...@apache.org.
Modulularized UI module, added multi file based i18n, using config mechanisms.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/6411646c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/6411646c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/6411646c
Branch: refs/heads/master
Commit: 6411646cdb2b964716472442b01e597141f6bd20
Parents: 692ce55
Author: anatole <an...@apache.org>
Authored: Sat Apr 16 08:25:46 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../org/apache/tamaya/events/ui/EventView.java | 134 ++++++++++++++
.../services/org.apache.tamaya.ui.ViewProvider | 19 ++
.../main/resources/ui/lang/tamaya.properties | 5 +
.../tamaya/events/RandomPropertySource.java | 48 +++++
.../org.apache.tamaya.spi.PropertySource | 19 ++
.../services/org.apache.tamaya.ui.ViewProvider | 19 ++
.../src/test/resources/config/application.yml | 13 ++
.../java/org/apache/tamaya/ui/ViewProvider.java | 66 +++++++
.../ConfigurationBasedMessageProvider.java | 174 +++++++++++++++++++
.../ui/internal/ConfiguredMessageProvider.java | 61 +++++++
.../internal/ResourceBundleMessageProvider.java | 91 ++++++++++
.../tamaya/ui/internal/URLPropertySource.java | 60 +++++++
.../tamaya/ui/services/MessageProvider.java | 43 +++++
.../apache/tamaya/ui/services/UserService.java | 30 ++++
.../services/org.apache.tamaya.ui.ViewProvider | 21 +++
...rg.apache.tamaya.ui.services.MessageProvider | 19 ++
.../main/resources/ui/lang/tamaya.properties | 28 +++
17 files changed, 850 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
new file mode 100644
index 0000000..a69b04c
--- /dev/null
+++ b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
@@ -0,0 +1,134 @@
+/*
+ * 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.events.ui;
+
+import com.vaadin.data.Property;
+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.events.ConfigEvent;
+import org.apache.tamaya.events.ConfigEventListener;
+import org.apache.tamaya.events.ConfigEventManager;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewProvider;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
+
+
+public class EventView extends VerticalSpacedLayout implements View {
+
+ @Priority(20)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.EAGER;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/events";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "view.events.name";
+ }
+
+ @Override
+ public View createView(){
+ return new EventView();
+ }
+ }
+
+ private CheckBox changeMonitorEnabled = new CheckBox(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.button.enableMonitoring"));
+ private Button clearViewButton = new Button(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.button.clearView"));
+ private Table eventsTable = new Table(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.table.name"));
+
+
+ public EventView() {
+ Label caption = new Label(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.name"));
+ Label description = new Label(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.description"),
+ ContentMode.HTML);
+
+ ConfigEventManager.addListener(new ConfigEventListener() {
+ @Override
+ public void onConfigEvent(ConfigEvent<?> event) {
+ addEvent(event);
+ }
+ });
+ changeMonitorEnabled.addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
+ ConfigEventManager.enableChangeMonitoring(changeMonitorEnabled.getValue());
+ }
+ });
+ clearViewButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ eventsTable.removeAllItems();
+ }
+ });
+
+ changeMonitorEnabled.setData(ConfigEventManager.isChangeMonitoring());
+ eventsTable.addContainerProperty("Timestamp", Long.class, null);
+ eventsTable.addContainerProperty("Type", Class.class, null);
+ eventsTable.addContainerProperty("Payload", String.class, null);
+ eventsTable.addContainerProperty("Version", String.class, null);
+ eventsTable.setPageLength(20);
+ eventsTable.setWidth("100%");
+ eventsTable.setResponsive(true);
+
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.addComponents(changeMonitorEnabled, clearViewButton);
+ caption.addStyleName(UIConstants.LABEL_HUGE);
+ description.addStyleName(UIConstants.LABEL_LARGE);
+ addComponents(caption, description, hl, eventsTable);
+ }
+
+ private void addEvent(ConfigEvent<?> evt){
+ eventsTable.addItem(new Object[]{evt.getTimestamp(), evt.getResourceType().getSimpleName(),
+ String.valueOf(evt.getResource()),evt.getVersion()});
+ this.markAsDirty();
+ }
+
+
+ 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/blob/6411646c/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
new file mode 100644
index 0000000..f779d5c
--- /dev/null
+++ b/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.events.ui.EventView$Provider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/main/resources/ui/lang/tamaya.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/main/resources/ui/lang/tamaya.properties b/modules/events/src/main/resources/ui/lang/tamaya.properties
new file mode 100644
index 0000000..37ca420
--- /dev/null
+++ b/modules/events/src/main/resources/ui/lang/tamaya.properties
@@ -0,0 +1,5 @@
+view.events.name=Configuration Events
+view.events.table.name=Observed Events
+view.events.button.enableMonitoring=Change Monitor active
+view.events.button.clearView=Clear View
+view.events.description=This view shows the configuration events triggered in the system.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
new file mode 100644
index 0000000..f32ead7
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
@@ -0,0 +1,48 @@
+package org.apache.tamaya.events;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * PropertySource that provides a randome entry, different on each access!
+ */
+public class RandomPropertySource implements PropertySource{
+
+ private Map<String, String> data = new HashMap<>();
+
+ @Override
+ public int getOrdinal() {
+ return 0;
+ }
+
+ @Override
+ public String getName() {
+ return "random";
+ }
+
+ @Override
+ public PropertyValue get(String key) {
+ if(key.equals("random.new")){
+ return PropertyValue.of(key, String.valueOf(Math.random()),getName());
+ }
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ synchronized(data) {
+ data.put("random.new", String.valueOf(Math.random()));
+ data.put("_random.new.source", getName());
+ data.put("_random.new.timestamp", String.valueOf(System.currentTimeMillis()));
+ return new HashMap<>(data);
+ }
+ }
+
+ @Override
+ public boolean isScannable() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
new file mode 100644
index 0000000..9c2b9f6
--- /dev/null
+++ b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.events.RandomPropertySource
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
new file mode 100644
index 0000000..f779d5c
--- /dev/null
+++ b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.events.ui.EventView$Provider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/modules/events/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/config/application.yml b/modules/events/src/test/resources/config/application.yml
new file mode 100644
index 0000000..9ec8d5b
--- /dev/null
+++ b/modules/events/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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
new file mode 100644
index 0000000..35990ab
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
@@ -0,0 +1,66 @@
+/*
+ * 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 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()
+ * @return a new view instance, not null.
+ */
+ View createView();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
new file mode 100644
index 0000000..99521c4
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
@@ -0,0 +1,174 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.ConfigurationContext;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spisupport.BasePropertySource;
+import org.apache.tamaya.spisupport.DefaultConfiguration;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+ * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
+ * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
+ * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
+ */
+public final class ConfigurationBasedMessageProvider implements MessageProvider{
+
+ /**
+ * The property name for configuring the resource bundle's base name either as
+ * system property, environment property or configuration entry.
+ */
+ private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
+
+ private final String baseName = evaluateBaseName();
+
+ private Map<String, Map<String,String>> propertiesCache = new ConcurrentHashMap<>();
+
+
+ /**
+ * Private singleton constructor.
+ */
+ public ConfigurationBasedMessageProvider(){
+
+ }
+
+ /**
+ * Get a message using the defaul locale.
+ * @param key the message key, not null.
+ * @return the resolved message, or the bundle ID, never null.
+ */
+ public String getMessage(String key){
+ return getMessage(key, Locale.getDefault());
+ }
+
+ /**
+ * Get a message.
+ * @param key the message key, not null.
+ * @param locale the target locale, or null, for the default locale.
+ * @return the resolved message, or the key, never null.
+ */
+ public String getMessage(String key, Locale locale){
+ List<String> bundleIds = evaluateBundleIds(locale);
+ for(String bundleID:bundleIds){
+ Map<String,String> entries = this.propertiesCache.get(bundleID);
+ if(entries==null){
+ entries = loadEntries(bundleID);
+ }
+ String value = entries.get(key);
+ if(value!=null){
+ return value;
+ }
+ }
+ return null;
+ }
+
+ private Map<String, String> loadEntries(String bundleID) {
+ ConfigurationContextBuilder ctxBuilder = ConfigurationProvider.getConfigurationContextBuilder();
+ for(String format:new String[]{"xml", "properties"}) {
+ try {
+ Enumeration<URL> urls = getClass().getClassLoader().getResources(bundleID+"."+format);
+ while(urls.hasMoreElements()){
+ URL url = urls.nextElement();
+ ctxBuilder.addPropertySources(new URLPropertySource(url));
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ Map<String, String> entries = new DefaultConfiguration(ctxBuilder.build()).getProperties();
+ this.propertiesCache.put(bundleID, entries);
+ return entries;
+ }
+
+ private List<String> evaluateBundleIds(Locale locale) {
+ List<String> bundleIds = new ArrayList<>();
+ String country = locale.getCountry();
+ if(country==null){
+ country="";
+ }
+ String lang = locale.getLanguage();
+ if(lang==null){
+ lang="";
+ }
+ String variant = locale.getVariant();
+ if(variant==null){
+ variant="";
+ }
+ String key = baseName + "_"+country+"_"+lang+"_"+variant;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName + "_"+country+"_"+lang;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName + "_"+country;
+ key = reduceKey(key);
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ key = baseName;
+ if(!bundleIds.contains(key)){
+ bundleIds.add(key);
+ }
+ return bundleIds;
+ }
+
+ /**
+ * Remove all doubled '_' hereby normalizing the bundle key.
+ * @param key the key, not null.
+ * @return the normaliuzed key, not null.
+ */
+ private String reduceKey(String key) {
+ String reduced = key.replace("___","_").replace("__","_");
+ if(reduced.endsWith("_")){
+ reduced = reduced.substring(0,reduced.length()-1);
+ }
+ return reduced;
+ }
+
+ /**
+ * Evaluates the base name to be used for creating the resource bundle used.
+ * @return
+ */
+ private String evaluateBaseName() {
+ String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
+ if(baseName==null || baseName.isEmpty()){
+ baseName = System.getenv("tamaya.ui.baseName");
+ }
+ if(baseName==null || baseName.isEmpty()){
+ baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
+ }
+ if(baseName==null || baseName.isEmpty()){
+ baseName = "ui/lang/tamaya";
+ }
+ return baseName.replace('.', '/');
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
new file mode 100644
index 0000000..e2a761c
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
@@ -0,0 +1,61 @@
+///*
+// * 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.internal;
+//
+//import org.apache.tamaya.ui.services.MessageProvider;
+//
+//import java.util.Locale;
+//import java.util.ResourceBundle;
+//
+///**
+// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+// */
+//public class ConfiguredMessageProvider implements MessageProvider{
+//
+// /**
+// * Private singleton constructor.
+// */
+// public ConfiguredMessageProvider(){}
+//
+// /**
+// * Get a message using the defaul locale.
+// * @param bundleID the message bundle key, not null.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID){
+// return getMessage(bundleID, Locale.getDefault());
+// }
+//
+// /**
+// * Get a message.
+// * @param bundleID the message bundle key, not null.
+// * @param locale the target locale, or null, for the default locale.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID, Locale locale){
+// try{
+// ResourceBundle bundle = ResourceBundle.getBundle("ui/lang/tamaya", locale);
+// return bundle.getString(bundleID);
+// }
+// catch(Exception e){
+// return bundleID;
+// }
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
new file mode 100644
index 0000000..c0aa092
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
@@ -0,0 +1,91 @@
+///*
+// * 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.internal;
+//
+//import org.apache.tamaya.ConfigurationProvider;
+//import org.apache.tamaya.ui.services.MessageProvider;
+//
+//import java.util.Locale;
+//import java.util.ResourceBundle;
+//
+///**
+// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
+// * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
+// * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
+// * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
+// */
+//public class ResourceBundleMessageProvider implements MessageProvider{
+//
+// private static final String BASENAME = evaluateBaseName();
+//
+// /**
+// * The property name for configuring the resource bundle's base name either as
+// * system property, environment property or configuration entry.
+// */
+// private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
+//
+// /**
+// * Evaluates the base name to be used for creating the resource bundle used.
+// * @return
+// */
+// private static String evaluateBaseName() {
+// String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
+// if(baseName==null || baseName.isEmpty()){
+// baseName = System.getenv("tamaya.ui.baseName");
+// }
+// if(baseName==null || baseName.isEmpty()){
+// baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
+// }
+// if(baseName==null || baseName.isEmpty()){
+// baseName = "ui/lang/tamaya";
+// }
+// return baseName;
+// }
+//
+// /**
+// * Private singleton constructor.
+// */
+// public ResourceBundleMessageProvider(){}
+//
+// /**
+// * Get a message using the defaul locale.
+// * @param bundleID the message bundle key, not null.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID){
+// return getMessage(bundleID, Locale.getDefault());
+// }
+//
+// /**
+// * Get a message.
+// * @param bundleID the message bundle key, not null.
+// * @param locale the target locale, or null, for the default locale.
+// * @return the resolved message, or the bundle ID, never null.
+// */
+// public String getMessage(String bundleID, Locale locale){
+// try{
+// ResourceBundle bundle = ResourceBundle.getBundle(BASENAME, locale);
+// return bundle.getString(bundleID);
+// }
+// catch(Exception e){
+// return bundleID;
+// }
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
new file mode 100644
index 0000000..0727515
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
@@ -0,0 +1,60 @@
+package org.apache.tamaya.ui.internal;
+
+import org.apache.tamaya.spisupport.BasePropertySource;
+import org.apache.tamaya.spisupport.MapPropertySource;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Simple property source, used for internationalization.
+ */
+final class URLPropertySource extends BasePropertySource{
+
+ private static final Logger LOG = Logger.getLogger(URLPropertySource.class.getName());
+ private URL url;
+ private Map<String, String> properties;
+
+ public URLPropertySource(URL url){
+ this.url = Objects.requireNonNull(url);
+ load();
+ }
+
+ /**
+ * Loads/reloads the properties from the URL. If loading of the properties failed the previus state is preserved,
+ * unless there is no such state. In this case an empty map is assigned.
+ */
+ public void load(){
+ try(InputStream is = url.openStream()) {
+ Properties props = new Properties();
+ if (url.getFile().endsWith(".xml")) {
+ props.loadFromXML(is);
+ } else {
+ props.load(is);
+ }
+ properties = Collections.unmodifiableMap(MapPropertySource.getMap(props));
+ }
+ catch(Exception e){
+ LOG.log(Level.WARNING, "Failed to read config from "+url,e);
+ if(properties==null) {
+ properties = Collections.emptyMap();
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return url.toString();
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
new file mode 100644
index 0000000..a15ae46
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.services;
+
+import java.util.Locale;
+
+/**
+ * Component resolving messages for being shown in the UI.
+ */
+public interface MessageProvider {
+
+ /**
+ * Get a message using the default locale.
+ * @param key the message key, not null.
+ * @return the resolved message, or the key, never null.
+ */
+ String getMessage(String key);
+
+ /**
+ * Get a message.
+ * @param key the message key, not null.
+ * @param locale the target locale, or null, for the default locale.
+ * @return the resolved message, or the key, never null.
+ */
+ String getMessage(String key, Locale locale);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
new file mode 100644
index 0000000..71a8a43
--- /dev/null
+++ b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.services;
+
+import org.apache.tamaya.ui.User;
+
+/**
+ * Created by atsticks on 29.03.16.
+ */
+public interface UserService {
+
+ User login(String userId, String credentials);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
new file mode 100644
index 0000000..eeb467b
--- /dev/null
+++ b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.ui.views.HomeView$Provider
+org.apache.tamaya.ui.views.ConfigView$Provider
+org.apache.tamaya.ui.views.ComponentView$Provider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
new file mode 100644
index 0000000..6ce4a9f
--- /dev/null
+++ b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.ui.internal.ConfigurationBasedMessageProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/6411646c/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/ui/lang/tamaya.properties b/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
new file mode 100644
index 0000000..16880d4
--- /dev/null
+++ b/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
@@ -0,0 +1,28 @@
+#
+# 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.name=Apache Tamaya
+default.label.logout=Log out
+default.label.unknown=<unknown>
+default.label.username=Username
+default.label.password=Password
+default.label.components=Components
+
+view.config.name=Configuration
+view.home.name=Home
+view.components.name=Components
[07/15] incubator-tamaya git commit: Added license headers.
Posted by an...@apache.org.
Added license headers.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/d7361367
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/d7361367
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/d7361367
Branch: refs/heads/master
Commit: d7361367f6e66a853cee07830c03654783243a53
Parents: 6411646
Author: anatole <an...@apache.org>
Authored: Sat Apr 16 08:37:42 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../src/main/resources/ui/lang/tamaya.properties | 19 +++++++++++++++++++
.../tamaya/events/RandomPropertySource.java | 18 ++++++++++++++++++
.../src/test/resources/config/application.yml | 18 ++++++++++++++++++
pom.xml | 2 +-
4 files changed, 56 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d7361367/modules/events/src/main/resources/ui/lang/tamaya.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/main/resources/ui/lang/tamaya.properties b/modules/events/src/main/resources/ui/lang/tamaya.properties
index 37ca420..8f83a5c 100644
--- a/modules/events/src/main/resources/ui/lang/tamaya.properties
+++ b/modules/events/src/main/resources/ui/lang/tamaya.properties
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
view.events.name=Configuration Events
view.events.table.name=Observed Events
view.events.button.enableMonitoring=Change Monitor active
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d7361367/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
index f32ead7..dead0d9 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tamaya.events;
import org.apache.tamaya.spi.PropertySource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d7361367/modules/events/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/config/application.yml b/modules/events/src/test/resources/config/application.yml
index 9ec8d5b..00d6d43 100644
--- a/modules/events/src/test/resources/config/application.yml
+++ b/modules/events/src/test/resources/config/application.yml
@@ -1,3 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy 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.
+#
server:
type: default
maxThreads: 1024
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d7361367/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dc30ff0..d230f69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -538,7 +538,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.4.1</version>
+ <version>3.5.1</version>
<inherited>true</inherited>
<dependencies>
<dependency><!-- add support for ssh/scp -->
[09/15] incubator-tamaya git commit: TAMAYA-149 Final fixes
restabilizing modules after Tomcat is now used.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
deleted file mode 100644
index 7572510..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ComponentView.java
+++ /dev/null
@@ -1,175 +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.views;
-
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Tree;
-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.ViewProvider;
-import org.apache.tamaya.ui.components.VerticalSpacedLayout;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import javax.annotation.Priority;
-import java.util.List;
-import java.util.Map;
-
-
-public class ComponentView extends VerticalSpacedLayout implements View {
-
-
- @Priority(20)
- public static final class Provider implements ViewProvider{
-
- @Override
- public ViewLifecycle getLifecycle() {
- return ViewLifecycle.CREATE;
- }
-
- @Override
- public String getUrlPattern() {
- return "/components";
- }
-
- @Override
- public String getDisplayName() {
- return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("view.components.name");
- }
-
- @Override
- public View createView(){
- return new ComponentView();
- }
- }
-
-
- private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("default.label.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
deleted file mode 100644
index e286bf2..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ConfigView.java
+++ /dev/null
@@ -1,199 +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.views;
-
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.*;
-import javafx.scene.control.TabPane;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.UIConstants;
-import org.apache.tamaya.ui.ViewProvider;
-import org.apache.tamaya.ui.components.VerticalSpacedLayout;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import javax.annotation.Priority;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-public class ConfigView extends VerticalSpacedLayout implements View {
-
- @Priority(10)
- public static final class Provider implements ViewProvider{
-
- @Override
- public ViewLifecycle getLifecycle() {
- return ViewLifecycle.CREATE;
- }
-
- @Override
- public String getUrlPattern() {
- return "/config";
- }
-
- @Override
- public String getDisplayName() {
- return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("view.config.name");
- }
-
- @Override
- public View createView(){
- return new ConfigView();
- }
- }
-
- 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);
-
- TabSheet tabPane = new TabSheet();
- VerticalLayout configLayout = new VerticalLayout();
-
- 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();
- configLayout.addComponents(filters, tree);
- tabPane.addTab(configLayout, "Configuration");
- TextArea envProps = new TextArea();
- StringBuilder b = new StringBuilder();
- envProps.setHeight("100%");
- envProps.setWidth("100%");
- envProps.setSizeFull();
- envProps.setRows(System.getenv().size());
- for(Map.Entry<String,String> en:new TreeMap<>(System.getenv()).entrySet()){
- b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
- }
- envProps.setValue(b.toString());
- envProps.setReadOnly(true);
- tabPane.addTab(envProps, "Environment Properties");
- TextArea sysProps = new TextArea();
- sysProps.setSizeFull();
- sysProps.setRows(System.getProperties().size());
- b.setLength(0);
- for(Map.Entry<Object,Object> en:new TreeMap<>(System.getProperties()).entrySet()){
- b.append(en.getKey()).append("=").append(en.getValue()).append('\n');
- }
- sysProps.setValue(b.toString());
- sysProps.setReadOnly(true);
- tabPane.addTab(sysProps, "System Properties");
- TextArea runtimeProps = new TextArea();
- runtimeProps.setRows(5);
- b.setLength(0);
- b.append("Available Processors : ").append(Runtime.getRuntime().availableProcessors()).append('\n');
- b.append("Free Memory : ").append(Runtime.getRuntime().freeMemory()).append('\n');
- b.append("Max Memory : ").append(Runtime.getRuntime().maxMemory()).append('\n');
- b.append("Total Memory : ").append(Runtime.getRuntime().totalMemory()).append('\n');
- b.append("Default Locale : ").append(Locale.getDefault()).append('\n');
- runtimeProps.setValue(b.toString());
- runtimeProps.setReadOnly(true);
- tabPane.addTab(runtimeProps, "Runtime Properties");
- runtimeProps.setSizeFull();
- addComponents(caption, description, tabPane);
-
- 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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
deleted file mode 100644
index ef3fa2e..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
+++ /dev/null
@@ -1,40 +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.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
deleted file mode 100644
index 78297d2..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
+++ /dev/null
@@ -1,80 +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.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.spi.ServiceContextManager;
-import org.apache.tamaya.ui.CurrentUser;
-import org.apache.tamaya.ui.UIConstants;
-import org.apache.tamaya.ui.ViewProvider;
-import org.apache.tamaya.ui.components.VerticalSpacedLayout;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import javax.annotation.Priority;
-
-
-public class HomeView extends VerticalSpacedLayout implements View {
-
- @Priority(0)
- public static final class Provider implements ViewProvider{
-
- @Override
- public ViewLifecycle getLifecycle() {
- return ViewLifecycle.CREATE;
- }
-
- @Override
- public String getUrlPattern() {
- return "";
- }
-
- @Override
- public String getDisplayName() {
- return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("view.home.name");
- }
-
- @Override
- public View createView(){
- return new HomeView();
- }
- }
-
- 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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
deleted file mode 100644
index 049d885..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.tamaya.ui.views.login;
-
-import com.vaadin.event.ShortcutAction;
-import com.vaadin.ui.*;
-import org.apache.tamaya.spi.ServiceContextManager;
-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.MessageProvider;
-import org.apache.tamaya.ui.services.UserService;
-
-
-public class LoginBox extends VerticalLayout {
-
- private UserService userService = new UserService() {
- @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();
- MessageProvider mp = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
- username = new TextField(mp.getMessage("default.label.username"));
- password = new PasswordField(mp.getMessage("default.label.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 = userService.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
deleted file mode 100644
index b6ba2b4..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
deleted file mode 100644
index e1181d1..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
+++ /dev/null
@@ -1,13 +0,0 @@
-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/blob/1a11d159/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
deleted file mode 100644
index eeb467b..0000000
--- a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
+++ /dev/null
@@ -1,21 +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.
-#
-org.apache.tamaya.ui.views.HomeView$Provider
-org.apache.tamaya.ui.views.ConfigView$Provider
-org.apache.tamaya.ui.views.ComponentView$Provider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider b/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
deleted file mode 100644
index 6ce4a9f..0000000
--- a/sandbox/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
+++ /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.
-#
-org.apache.tamaya.ui.internal.ConfigurationBasedMessageProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/config/application.yml b/sandbox/ui/src/main/resources/config/application.yml
deleted file mode 100644
index a22ec36..0000000
--- a/sandbox/ui/src/main/resources/config/application.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy 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.
-#
-
-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/blob/1a11d159/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/resources/ui/lang/tamaya.properties b/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
deleted file mode 100644
index 16880d4..0000000
--- a/sandbox/ui/src/main/resources/ui/lang/tamaya.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy 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.name=Apache Tamaya
-default.label.logout=Log out
-default.label.unknown=<unknown>
-default.label.username=Username
-default.label.password=Password
-default.label.components=Components
-
-view.config.name=Configuration
-view.home.name=Home
-view.components.name=Components
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/test/resources/config/application.yml b/sandbox/ui/src/test/resources/config/application.yml
deleted file mode 100644
index 33c353c..0000000
--- a/sandbox/ui/src/test/resources/config/application.yml
+++ /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 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.
-#
-
-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
[10/15] incubator-tamaya git commit: TAMAYA-149 Final fixes
restabilizing modules after Tomcat is now used.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
new file mode 100644
index 0000000..ef3fa2e
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/ErrorView.java
@@ -0,0 +1,40 @@
+/*
+ * 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.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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
new file mode 100644
index 0000000..78297d2
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/HomeView.java
@@ -0,0 +1,80 @@
+/*
+ * 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.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.spi.ServiceContextManager;
+import org.apache.tamaya.ui.CurrentUser;
+import org.apache.tamaya.ui.UIConstants;
+import org.apache.tamaya.ui.ViewProvider;
+import org.apache.tamaya.ui.components.VerticalSpacedLayout;
+import org.apache.tamaya.ui.services.MessageProvider;
+
+import javax.annotation.Priority;
+
+
+public class HomeView extends VerticalSpacedLayout implements View {
+
+ @Priority(0)
+ public static final class Provider implements ViewProvider{
+
+ @Override
+ public ViewLifecycle getLifecycle() {
+ return ViewLifecycle.CREATE;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return ServiceContextManager.getServiceContext().getService(MessageProvider.class)
+ .getMessage("view.home.name");
+ }
+
+ @Override
+ public View createView(){
+ return new HomeView();
+ }
+ }
+
+ 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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
new file mode 100644
index 0000000..049d885
--- /dev/null
+++ b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java
@@ -0,0 +1,91 @@
+package org.apache.tamaya.ui.views.login;
+
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.ui.*;
+import org.apache.tamaya.spi.ServiceContextManager;
+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.MessageProvider;
+import org.apache.tamaya.ui.services.UserService;
+
+
+public class LoginBox extends VerticalLayout {
+
+ private UserService userService = new UserService() {
+ @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();
+ MessageProvider mp = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
+ username = new TextField(mp.getMessage("default.label.username"));
+ password = new PasswordField(mp.getMessage("default.label.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 = userService.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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginEvent.java
new file mode 100644
index 0000000..b6ba2b4
--- /dev/null
+++ b/modules/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/blob/1a11d159/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java b/modules/ui/src/main/java/org/apache/tamaya/ui/views/login/LoginView.java
new file mode 100644
index 0000000..e1181d1
--- /dev/null
+++ b/modules/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/blob/1a11d159/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
new file mode 100644
index 0000000..eeb467b
--- /dev/null
+++ b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.ui.views.HomeView$Provider
+org.apache.tamaya.ui.views.ConfigView$Provider
+org.apache.tamaya.ui.views.ComponentView$Provider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
new file mode 100644
index 0000000..6ce4a9f
--- /dev/null
+++ b/modules/ui/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.ui.internal.ConfigurationBasedMessageProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/main/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/config/application.yml b/modules/ui/src/main/resources/config/application.yml
new file mode 100644
index 0000000..a22ec36
--- /dev/null
+++ b/modules/ui/src/main/resources/config/application.yml
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+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/blob/1a11d159/modules/ui/src/main/resources/ui/lang/tamaya.properties
----------------------------------------------------------------------
diff --git a/modules/ui/src/main/resources/ui/lang/tamaya.properties b/modules/ui/src/main/resources/ui/lang/tamaya.properties
new file mode 100644
index 0000000..16880d4
--- /dev/null
+++ b/modules/ui/src/main/resources/ui/lang/tamaya.properties
@@ -0,0 +1,28 @@
+#
+# 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.name=Apache Tamaya
+default.label.logout=Log out
+default.label.unknown=<unknown>
+default.label.username=Username
+default.label.password=Password
+default.label.components=Components
+
+view.config.name=Configuration
+view.home.name=Home
+view.components.name=Components
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/modules/ui/src/test/resources/config/application.yml
----------------------------------------------------------------------
diff --git a/modules/ui/src/test/resources/config/application.yml b/modules/ui/src/test/resources/config/application.yml
new file mode 100644
index 0000000..33c353c
--- /dev/null
+++ b/modules/ui/src/test/resources/config/application.yml
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/pom.xml b/sandbox/ui/pom.xml
deleted file mode 100644
index 4edbeb8..0000000
--- a/sandbox/ui/pom.xml
+++ /dev/null
@@ -1,254 +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-extensions</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <packaging>war</packaging>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tamaya-ui</artifactId>
- <name>Apache Tamaya Modules - UI</name>
-
- <properties>
- <vaadin.version>7.6.4</vaadin.version>
- <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
- <mainClass>org.apache.tamaya.ui.VaadinApplication</mainClass>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <servlet.api.version>3.0.1</servlet.api.version>
- <tomcat.version>7.0.57</tomcat.version>
- <jersey.version>1.19.1</jersey.version>
- <guava.version>18.0</guava.version>
- </properties>
-
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-bom</artifactId>
- <version>${vaadin.version}</version>
- <type>pom</type>
- <scope>import</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>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-spisupport</artifactId>
- <version>${project.version}</version>
- </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>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-themes</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <!--<dependency>-->
- <!--<groupId>javax.ws.rs</groupId>-->
- <!--<artifactId>jsr311-api</artifactId>-->
- <!--<version>1.1.1</version>-->
- <!--<scope>provided</scope>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>com.sun.jersey</groupId>-->
- <!--<artifactId>jersey-server</artifactId>-->
- <!--<version>${jersey.version}</version>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>com.sun.jersey</groupId>-->
- <!--<artifactId>jersey-servlet</artifactId>-->
- <!--<version>${jersey.version}</version>-->
- <!--</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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
deleted file mode 100644
index 2c303a8..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java
+++ /dev/null
@@ -1,96 +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.Navigator;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Panel;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.components.LazyProvider;
-import org.apache.tamaya.ui.components.PageTitleUpdater;
-import org.apache.tamaya.ui.views.ErrorView;
-
-
-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(VadiinApp.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() {
- for(ViewProvider provider: ServiceContextManager.getServiceContext().getServices(ViewProvider.class)) {
- addView(provider);
- }
- navigator.setErrorView(ErrorView.class);
- }
-
- /**
- * Registers av given view to the navigator and adds it to the NavBar
- */
- private void addView(ViewProvider provider) {
-
- switch (provider.getLifecycle()) {
- case CREATE:
- navigator.addView(provider.getUrlPattern(), provider.createView());
- break;
- case LAZY:
- navigator.addProvider(new LazyProvider(provider.getUrlPattern(), provider));
- break;
- case EAGER:
- try {
- navigator.addView(provider.getUrlPattern(), provider.createView());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- navBar.addView(provider.getUrlPattern(), provider.getDisplayName());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/Content.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/Content.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/Content.java
deleted file mode 100644
index c03fdf1..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/Content.java
+++ /dev/null
@@ -1,34 +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.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
deleted file mode 100644
index 8c754e2..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/CurrentUser.java
+++ /dev/null
@@ -1,41 +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 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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
deleted file mode 100644
index 16b9860..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/NavBar.java
+++ /dev/null
@@ -1,94 +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.Button;
-import com.vaadin.ui.CssLayout;
-import com.vaadin.ui.Label;
-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;
-
-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);
- 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);
-
- addLogoutButton();
- }
-
- private void addLogoutButton() {
- 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) {
- 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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
deleted file mode 100644
index b90c402..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/TamayaUI.java
+++ /dev/null
@@ -1,60 +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;
-
-public class TamayaUI {
-
- private static final Logger LOG = Logger.getLogger(TamayaUI.class.getName());
-
-
- 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/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
deleted file mode 100644
index 2f75b5c..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/UIConstants.java
+++ /dev/null
@@ -1,35 +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";
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
deleted file mode 100644
index 2201bdb..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/User.java
+++ /dev/null
@@ -1,56 +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 org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import java.util.Date;
-import java.util.Objects;
-
-/**
- * Created by atsticks on 29.03.16.
- */
-public class User {
-
- private String userID = "-";
- private String fulLName = ServiceContextManager.getServiceContext().getService(MessageProvider.class)
- .getMessage("default.label.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
deleted file mode 100644
index 60f3d34..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/VadiinApp.java
+++ /dev/null
@@ -1,86 +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.*;
-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 {
-
- private Content content = new Content();
-
- @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 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/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
deleted file mode 100644
index 35990ab..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/ViewProvider.java
+++ /dev/null
@@ -1,66 +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 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()
- * @return a new view instance, not null.
- */
- View createView();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
deleted file mode 100644
index 867b802..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/LazyProvider.java
+++ /dev/null
@@ -1,50 +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.ui.ViewProvider;
-
-import java.util.Objects;
-
-/**
- * Lazily initializes a view when it's first accessed, then always returns the
- * same instance on subsequent calls.
- */
-public class LazyProvider implements com.vaadin.navigator.ViewProvider {
- private ViewProvider provider;
- private View view;
-
- public LazyProvider(String viewName, ViewProvider provider) {
- this.provider = Objects.requireNonNull(provider);
- }
-
- @Override
- public String getViewName(String s) {
- return provider.getDisplayName();
- }
-
- @Override
- public View getView(String viewName) {
- if (view == null) {
- view = provider.createView();
- }
- return view;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
deleted file mode 100644
index a236d55..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/PageTitleUpdater.java
+++ /dev/null
@@ -1,45 +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;
-
-
-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/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/components/VerticalSpacedLayout.java
deleted file mode 100644
index 94fc980..0000000
--- a/sandbox/ui/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/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/EventBus.java
deleted file mode 100644
index ffa9ba4..0000000
--- a/sandbox/ui/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/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
deleted file mode 100644
index ec00a42..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/LogoutEvent.java
+++ /dev/null
@@ -1,22 +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;
-
-public class LogoutEvent {
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.java
deleted file mode 100644
index 9d3b744..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/event/NavigationEvent.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.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/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
deleted file mode 100644
index 99521c4..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java
+++ /dev/null
@@ -1,174 +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.internal;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spisupport.BasePropertySource;
-import org.apache.tamaya.spisupport.DefaultConfiguration;
-import org.apache.tamaya.ui.services.MessageProvider;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
- * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
- * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
- * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
- */
-public final class ConfigurationBasedMessageProvider implements MessageProvider{
-
- /**
- * The property name for configuring the resource bundle's base name either as
- * system property, environment property or configuration entry.
- */
- private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
-
- private final String baseName = evaluateBaseName();
-
- private Map<String, Map<String,String>> propertiesCache = new ConcurrentHashMap<>();
-
-
- /**
- * Private singleton constructor.
- */
- public ConfigurationBasedMessageProvider(){
-
- }
-
- /**
- * Get a message using the defaul locale.
- * @param key the message key, not null.
- * @return the resolved message, or the bundle ID, never null.
- */
- public String getMessage(String key){
- return getMessage(key, Locale.getDefault());
- }
-
- /**
- * Get a message.
- * @param key the message key, not null.
- * @param locale the target locale, or null, for the default locale.
- * @return the resolved message, or the key, never null.
- */
- public String getMessage(String key, Locale locale){
- List<String> bundleIds = evaluateBundleIds(locale);
- for(String bundleID:bundleIds){
- Map<String,String> entries = this.propertiesCache.get(bundleID);
- if(entries==null){
- entries = loadEntries(bundleID);
- }
- String value = entries.get(key);
- if(value!=null){
- return value;
- }
- }
- return null;
- }
-
- private Map<String, String> loadEntries(String bundleID) {
- ConfigurationContextBuilder ctxBuilder = ConfigurationProvider.getConfigurationContextBuilder();
- for(String format:new String[]{"xml", "properties"}) {
- try {
- Enumeration<URL> urls = getClass().getClassLoader().getResources(bundleID+"."+format);
- while(urls.hasMoreElements()){
- URL url = urls.nextElement();
- ctxBuilder.addPropertySources(new URLPropertySource(url));
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- Map<String, String> entries = new DefaultConfiguration(ctxBuilder.build()).getProperties();
- this.propertiesCache.put(bundleID, entries);
- return entries;
- }
-
- private List<String> evaluateBundleIds(Locale locale) {
- List<String> bundleIds = new ArrayList<>();
- String country = locale.getCountry();
- if(country==null){
- country="";
- }
- String lang = locale.getLanguage();
- if(lang==null){
- lang="";
- }
- String variant = locale.getVariant();
- if(variant==null){
- variant="";
- }
- String key = baseName + "_"+country+"_"+lang+"_"+variant;
- key = reduceKey(key);
- if(!bundleIds.contains(key)){
- bundleIds.add(key);
- }
- key = baseName + "_"+country+"_"+lang;
- key = reduceKey(key);
- if(!bundleIds.contains(key)){
- bundleIds.add(key);
- }
- key = baseName + "_"+country;
- key = reduceKey(key);
- if(!bundleIds.contains(key)){
- bundleIds.add(key);
- }
- key = baseName;
- if(!bundleIds.contains(key)){
- bundleIds.add(key);
- }
- return bundleIds;
- }
-
- /**
- * Remove all doubled '_' hereby normalizing the bundle key.
- * @param key the key, not null.
- * @return the normaliuzed key, not null.
- */
- private String reduceKey(String key) {
- String reduced = key.replace("___","_").replace("__","_");
- if(reduced.endsWith("_")){
- reduced = reduced.substring(0,reduced.length()-1);
- }
- return reduced;
- }
-
- /**
- * Evaluates the base name to be used for creating the resource bundle used.
- * @return
- */
- private String evaluateBaseName() {
- String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
- if(baseName==null || baseName.isEmpty()){
- baseName = System.getenv("tamaya.ui.baseName");
- }
- if(baseName==null || baseName.isEmpty()){
- baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
- }
- if(baseName==null || baseName.isEmpty()){
- baseName = "ui/lang/tamaya";
- }
- return baseName.replace('.', '/');
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
deleted file mode 100644
index e2a761c..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ConfiguredMessageProvider.java
+++ /dev/null
@@ -1,61 +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.internal;
-//
-//import org.apache.tamaya.ui.services.MessageProvider;
-//
-//import java.util.Locale;
-//import java.util.ResourceBundle;
-//
-///**
-// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
-// */
-//public class ConfiguredMessageProvider implements MessageProvider{
-//
-// /**
-// * Private singleton constructor.
-// */
-// public ConfiguredMessageProvider(){}
-//
-// /**
-// * Get a message using the defaul locale.
-// * @param bundleID the message bundle key, not null.
-// * @return the resolved message, or the bundle ID, never null.
-// */
-// public String getMessage(String bundleID){
-// return getMessage(bundleID, Locale.getDefault());
-// }
-//
-// /**
-// * Get a message.
-// * @param bundleID the message bundle key, not null.
-// * @param locale the target locale, or null, for the default locale.
-// * @return the resolved message, or the bundle ID, never null.
-// */
-// public String getMessage(String bundleID, Locale locale){
-// try{
-// ResourceBundle bundle = ResourceBundle.getBundle("ui/lang/tamaya", locale);
-// return bundle.getString(bundleID);
-// }
-// catch(Exception e){
-// return bundleID;
-// }
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
deleted file mode 100644
index c0aa092..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java
+++ /dev/null
@@ -1,91 +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.internal;
-//
-//import org.apache.tamaya.ConfigurationProvider;
-//import org.apache.tamaya.ui.services.MessageProvider;
-//
-//import java.util.Locale;
-//import java.util.ResourceBundle;
-//
-///**
-// * Component resolving messages for being shown in the UI, based on the ResourceBundle mechanisms.
-// * The baseName used can optionally be configured by setting {@code tamaya.ui.baseName} either as system property,
-// * environment property or Tamaya configuration. Be aware that the JDK resource bundle mechanism only reads
-// * the first property file on the classpath (or a corresponding class file implementing ResourceBundle).
-// */
-//public class ResourceBundleMessageProvider implements MessageProvider{
-//
-// private static final String BASENAME = evaluateBaseName();
-//
-// /**
-// * The property name for configuring the resource bundle's base name either as
-// * system property, environment property or configuration entry.
-// */
-// private static final String TAMAYA_UI_BASE_NAME = "tamaya.ui.baseName";
-//
-// /**
-// * Evaluates the base name to be used for creating the resource bundle used.
-// * @return
-// */
-// private static String evaluateBaseName() {
-// String baseName = System.getProperty(TAMAYA_UI_BASE_NAME);
-// if(baseName==null || baseName.isEmpty()){
-// baseName = System.getenv("tamaya.ui.baseName");
-// }
-// if(baseName==null || baseName.isEmpty()){
-// baseName = ConfigurationProvider.getConfiguration().get("tamaya.ui.baseName");
-// }
-// if(baseName==null || baseName.isEmpty()){
-// baseName = "ui/lang/tamaya";
-// }
-// return baseName;
-// }
-//
-// /**
-// * Private singleton constructor.
-// */
-// public ResourceBundleMessageProvider(){}
-//
-// /**
-// * Get a message using the defaul locale.
-// * @param bundleID the message bundle key, not null.
-// * @return the resolved message, or the bundle ID, never null.
-// */
-// public String getMessage(String bundleID){
-// return getMessage(bundleID, Locale.getDefault());
-// }
-//
-// /**
-// * Get a message.
-// * @param bundleID the message bundle key, not null.
-// * @param locale the target locale, or null, for the default locale.
-// * @return the resolved message, or the bundle ID, never null.
-// */
-// public String getMessage(String bundleID, Locale locale){
-// try{
-// ResourceBundle bundle = ResourceBundle.getBundle(BASENAME, locale);
-// return bundle.getString(bundleID);
-// }
-// catch(Exception e){
-// return bundleID;
-// }
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
deleted file mode 100644
index 0727515..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.tamaya.ui.internal;
-
-import org.apache.tamaya.spisupport.BasePropertySource;
-import org.apache.tamaya.spisupport.MapPropertySource;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple property source, used for internationalization.
- */
-final class URLPropertySource extends BasePropertySource{
-
- private static final Logger LOG = Logger.getLogger(URLPropertySource.class.getName());
- private URL url;
- private Map<String, String> properties;
-
- public URLPropertySource(URL url){
- this.url = Objects.requireNonNull(url);
- load();
- }
-
- /**
- * Loads/reloads the properties from the URL. If loading of the properties failed the previus state is preserved,
- * unless there is no such state. In this case an empty map is assigned.
- */
- public void load(){
- try(InputStream is = url.openStream()) {
- Properties props = new Properties();
- if (url.getFile().endsWith(".xml")) {
- props.loadFromXML(is);
- } else {
- props.load(is);
- }
- properties = Collections.unmodifiableMap(MapPropertySource.getMap(props));
- }
- catch(Exception e){
- LOG.log(Level.WARNING, "Failed to read config from "+url,e);
- if(properties==null) {
- properties = Collections.emptyMap();
- }
- }
- }
-
- @Override
- public String getName() {
- return url.toString();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
deleted file mode 100644
index a15ae46..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/MessageProvider.java
+++ /dev/null
@@ -1,43 +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.services;
-
-import java.util.Locale;
-
-/**
- * Component resolving messages for being shown in the UI.
- */
-public interface MessageProvider {
-
- /**
- * Get a message using the default locale.
- * @param key the message key, not null.
- * @return the resolved message, or the key, never null.
- */
- String getMessage(String key);
-
- /**
- * Get a message.
- * @param key the message key, not null.
- * @param locale the target locale, or null, for the default locale.
- * @return the resolved message, or the key, never null.
- */
- String getMessage(String key, Locale locale);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a11d159/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
----------------------------------------------------------------------
diff --git a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java b/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
deleted file mode 100644
index 71a8a43..0000000
--- a/sandbox/ui/src/main/java/org/apache/tamaya/ui/services/UserService.java
+++ /dev/null
@@ -1,30 +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.services;
-
-import org.apache.tamaya.ui.User;
-
-/**
- * Created by atsticks on 29.03.16.
- */
-public interface UserService {
-
- User login(String userId, String credentials);
-
-}
[15/15] incubator-tamaya git commit: ixed table rendering and setting
of polling interval.
Posted by an...@apache.org.
ixed table rendering and setting of polling interval.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/8fb90f69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/8fb90f69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/8fb90f69
Branch: refs/heads/master
Commit: 8fb90f691e9909542a3fedd131be4ce856275167
Parents: 56318ab
Author: anatole <an...@apache.org>
Authored: Sun Apr 17 23:55:50 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Tue Apr 19 13:53:44 2016 +0200
----------------------------------------------------------------------
.../tamaya/events/ConfigEventManager.java | 4 +-
.../internal/DefaultConfigChangeObserver.java | 9 ++--
.../org/apache/tamaya/events/ui/EventView.java | 53 ++++++++++++++++----
3 files changed, 49 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8fb90f69/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
index 9989fbb..f6bd3da 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/ConfigEventManager.java
@@ -168,7 +168,7 @@ public final class ConfigEventManager {
*
* @return the check period in ms.
*/
- public long getChangeMonitoringPeriod(){
+ public static long getChangeMonitoringPeriod(){
return SPI.getChangeMonitoringPeriod();
}
@@ -179,7 +179,7 @@ public final class ConfigEventManager {
* @see #enableChangeMonitoring(boolean)
* @see #isChangeMonitoring()
*/
- public void setChangeMonitoringPeriod(long millis){
+ public static void setChangeMonitoringPeriod(long millis){
SPI.setChangeMonitoringPeriod(millis);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8fb90f69/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java b/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
index 5cd3f6c..f4457b2 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
@@ -36,7 +36,7 @@ public class DefaultConfigChangeObserver {
private static final Logger LOG = Logger.getLogger(DefaultConfigChangeObserver.class.getName());
- private final Timer timer = new Timer("DefaultConfigChangeObserver", true);
+ private Timer timer = new Timer("DefaultConfigChangeObserver", true);
private long checkPeriod = 2000L;
@@ -52,9 +52,9 @@ public class DefaultConfigChangeObserver {
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
- if(running) {
- checkConfigurationUpdate();
- }
+ if(running) {
+ checkConfigurationUpdate();
+ }
}
}, START_DELAY, checkPeriod);
}
@@ -98,6 +98,7 @@ public class DefaultConfigChangeObserver {
LOG.finest("Resetting check period to " + checkPeriod + " ms, reregistering timer.");
this.checkPeriod = checkPeriod;
timer.cancel();
+ timer = new Timer("DefaultConfigChangeObserver", true);
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8fb90f69/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
index a69b04c..56e4b35 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/ui/EventView.java
@@ -18,6 +18,7 @@
*/
package org.apache.tamaya.events.ui;
+import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
@@ -33,6 +34,7 @@ import org.apache.tamaya.ui.components.VerticalSpacedLayout;
import org.apache.tamaya.ui.services.MessageProvider;
import javax.annotation.Priority;
+import java.util.Date;
public class EventView extends VerticalSpacedLayout implements View {
@@ -65,6 +67,8 @@ public class EventView extends VerticalSpacedLayout implements View {
.getService(MessageProvider.class).getMessage("view.events.button.enableMonitoring"));
private Button clearViewButton = new Button(ServiceContextManager.getServiceContext()
.getService(MessageProvider.class).getMessage("view.events.button.clearView"));
+ private TextField pollingInterval = new TextField(ServiceContextManager.getServiceContext()
+ .getService(MessageProvider.class).getMessage("view.events.field.pollingInterval"));
private Table eventsTable = new Table(ServiceContextManager.getServiceContext()
.getService(MessageProvider.class).getMessage("view.events.table.name"));
@@ -86,35 +90,62 @@ public class EventView extends VerticalSpacedLayout implements View {
@Override
public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
ConfigEventManager.enableChangeMonitoring(changeMonitorEnabled.getValue());
+ if(changeMonitorEnabled.getValue()) {
+ Notification.show("Event Monitoring (Polling) active.");
+ }else{
+ Notification.show("Event Monitoring (Polling) inactive.");
+ }
}
});
clearViewButton.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent clickEvent) {
eventsTable.removeAllItems();
+ Notification.show("Events cleared.");
}
});
- changeMonitorEnabled.setData(ConfigEventManager.isChangeMonitoring());
- eventsTable.addContainerProperty("Timestamp", Long.class, null);
- eventsTable.addContainerProperty("Type", Class.class, null);
- eventsTable.addContainerProperty("Payload", String.class, null);
- eventsTable.addContainerProperty("Version", String.class, null);
+ HorizontalLayout eventSettings = new HorizontalLayout();
+ eventSettings.addComponents(changeMonitorEnabled, new Label(" Polling Interval"), pollingInterval, clearViewButton);
+ changeMonitorEnabled.setValue(ConfigEventManager.isChangeMonitoring());
+ pollingInterval.setValue(String.valueOf(ConfigEventManager.getChangeMonitoringPeriod()));
+ pollingInterval.setRequired(true);
+ pollingInterval.addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
+ try{
+ long millis = Long.parseLong((String)valueChangeEvent.getProperty().getValue());
+ ConfigEventManager.setChangeMonitoringPeriod(millis);
+ Notification.show("Updated Event Monitoring Poll Interval to " + millis + " milliseconds.");
+ }catch(Exception e){
+ Notification.show("Cannot update Event Monitoring Poll Interval to "
+ + valueChangeEvent.getProperty().getValue(), Notification.Type.ERROR_MESSAGE);
+ }
+ }
+ });
+ eventsTable.addContainerProperty("Timestamp", Date.class, null);
+ eventsTable.addContainerProperty("Type", String.class, "?");
+ eventsTable.addContainerProperty("Payload", String.class, "<empty>");
+ eventsTable.addContainerProperty("Version", String.class, "?");
eventsTable.setPageLength(20);
eventsTable.setWidth("100%");
eventsTable.setResponsive(true);
- HorizontalLayout hl = new HorizontalLayout();
- hl.addComponents(changeMonitorEnabled, clearViewButton);
+
caption.addStyleName(UIConstants.LABEL_HUGE);
description.addStyleName(UIConstants.LABEL_LARGE);
- addComponents(caption, description, hl, eventsTable);
+ addComponents(caption, description, eventSettings, eventsTable);
}
private void addEvent(ConfigEvent<?> evt){
- eventsTable.addItem(new Object[]{evt.getTimestamp(), evt.getResourceType().getSimpleName(),
- String.valueOf(evt.getResource()),evt.getVersion()});
- this.markAsDirty();
+ Object newItemId = eventsTable.addItem();
+ Item row = eventsTable.getItem(newItemId);
+ row.getItemProperty("Timestamp").setValue(new Date(evt.getTimestamp()));
+ row.getItemProperty("Type").setValue(evt.getResourceType().getSimpleName());
+ String value = String.valueOf(evt.getResource());
+ String valueShort = value.length()<150?value:value.substring(0,147)+"...";
+ row.getItemProperty("Payload").setValue(valueShort);
+ row.getItemProperty("Version").setValue(evt.getVersion());
}