Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master 5ee4802c7 -> d344e7323
TAMAYA-150: Renabled UI after refactoring out several functionality into separate modules. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/fd26d6c0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/fd26d6c0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/fd26d6c0 Branch: refs/heads/master Commit: fd26d6c0b0e4cd44d6408b4449a01e946886f59b Parents: 5ee4802 Author: anatole <anat...@apache.org> Authored: Sat Apr 15 22:10:03 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sat Apr 15 22:10:03 2017 +0200 ---------------------------------------------------------------------- ui/base/pom.xml | 9 + .../org/apache/tamaya/ui/ApplicationLayout.java | 39 ++- .../main/java/org/apache/tamaya/ui/NavBar.java | 8 +- .../java/org/apache/tamaya/ui/TamayaUI.java | 75 +++++- .../java/org/apache/tamaya/ui/UIConstants.java | 2 + .../java/org/apache/tamaya/ui/VadiinApp.java | 97 ------- .../java/org/apache/tamaya/ui/ViewProvider.java | 73 ----- .../ConfigurationBasedMessageProvider.java | 6 +- .../ui/internal/ConfiguredUserService.java | 2 +- .../tamaya/ui/internal/PageTitleUpdater.java | 4 +- .../internal/ResourceBundleMessageProvider.java | 182 ++++++------- .../tamaya/ui/internal/URLPropertySource.java | 78 ------ .../ui/internal/VerticalSpacedLayout.java | 4 +- .../org/apache/tamaya/ui/spi/LazyProvider.java | 81 ------ .../apache/tamaya/ui/spi/MessageProvider.java | 2 +- .../tamaya/ui/spi/SystemInfoProvider.java | 15 ++ .../org/apache/tamaya/ui/spi/UserService.java | 2 +- .../ui/views/AbstractTextInfoProvider.java | 67 +++++ .../org/apache/tamaya/ui/views/ConfigView.java | 263 ++++++++----------- .../org/apache/tamaya/ui/views/HomeView.java | 48 +--- .../org/apache/tamaya/ui/views/SystemView.java | 77 ++---- .../views/TamayaGeneralSystemInfoProvider.java | 112 ++++++-- .../apache/tamaya/ui/views/login/LoginBox.java | 4 +- .../services/org.apache.tamaya.ui.ViewProvider | 3 - ...rg.apache.tamaya.ui.services.MessageProvider | 19 -- .../org.apache.tamaya.ui.services.UserService | 19 -- .../org.apache.tamaya.ui.spi.MessageProvider | 19 ++ .../org.apache.tamaya.ui.spi.SystemInfoProvider | 19 ++ .../org.apache.tamaya.ui.spi.UserService | 19 ++ .../main/resources/ui/lang/tamaya.properties | 6 +- ui/pom.xml | 88 ++++++- 31 files changed, 665 insertions(+), 777 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/pom.xml ---------------------------------------------------------------------- diff --git a/ui/base/pom.xml b/ui/base/pom.xml index 40914d8..c300feb 100644 --- a/ui/base/pom.xml +++ b/ui/base/pom.xml @@ -33,6 +33,10 @@ under the License. <artifactId>tamaya-ui-base_alpha</artifactId> <name>Apache Tamaya Modules - UI (Base)</name> + <properties> + <mainClass>org.apache.tamaya.ui.VadiinApp</mainClass> + </properties> + <build> <plugins> <plugin> @@ -151,6 +155,11 @@ under the License. <enabled>true</enabled> </snapshots> </repository> + <repository> + <id>vaadin-prereleases</id> + <name>Vaadin Pre-releases</name> + <url>https://maven.vaadin.com/vaadin-prereleases</url> + </repository> </repositories> </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java b/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java index 20190be..f1dd7e7 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/ApplicationLayout.java @@ -18,11 +18,18 @@ */ 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 com.vaadin.ui.UI; -import org.apache.tamaya.ui.components.PageTitleUpdater; +import org.apache.tamaya.spi.ServiceContext; +import org.apache.tamaya.spi.ServiceContextManager; +import org.apache.tamaya.ui.spi.MessageProvider; +import org.apache.tamaya.ui.views.ConfigView; import org.apache.tamaya.ui.views.ErrorView; +import org.apache.tamaya.ui.views.HomeView; +import org.apache.tamaya.ui.views.SystemView; /** @@ -32,7 +39,7 @@ public class ApplicationLayout extends HorizontalLayout { private NavBar navBar; private Panel content; - private NavigationBar navigator; + private Navigator navigator; public ApplicationLayout(UI ui) { addStyleName(UIConstants.MAIN_LAYOUT); @@ -41,7 +48,7 @@ public class ApplicationLayout extends HorizontalLayout { setupNavigator(ui); } - public NavigationBar getNavigationBar(){ + public Navigator getNavigator(){ return navigator; } @@ -56,16 +63,32 @@ public class ApplicationLayout extends HorizontalLayout { setExpandRatio(content, 1); } + public void addView(String uri, Class<? extends View> viewClass, String viewName){ + navigator.addView(uri, viewClass); + navBar.addViewButton(uri, viewName); + } - private void setupNavigator(UI ui) { - navigator = new NavigationBar(ui, content, navBar); + private void setupNavigator(UI ui) { + navigator = new Navigator(ui, content); + navigator.setErrorView(ErrorView.class); // 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.addViewChangeListener(new PageTitleUpdater()); + addView("/home", HomeView.class, getViewName(HomeView.class)); + addView("/system", SystemView.class, getViewName(SystemView.class)); + addView("/config", ConfigView.class, getViewName(ConfigView.class)); navigator.navigateTo("/home"); - navigator.setErrorView(ErrorView.class); + } + + private String getViewName(Class<? extends View> viewClass) { + MessageProvider prov = ServiceContextManager.getServiceContext() + .getService(MessageProvider.class); + String msg = null; + if(prov!=null){ + msg = prov.getMessage("views."+viewClass.getSimpleName()+".name"); + } + return msg; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java b/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java index 9020cd8..bdbfd49 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/NavBar.java @@ -20,7 +20,7 @@ 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.shared.ui.ContentMode; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Label; @@ -29,7 +29,7 @@ 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 org.apache.tamaya.ui.spi.MessageProvider; import java.util.HashMap; import java.util.Map; @@ -74,8 +74,8 @@ public class NavBar extends VerticalLayout implements ViewChangeListener { Button settings = new Button("...", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { - UISettingsDialog dlog = new UISettingsDialog(appLayout.getNavigationBar()); - dlog.show(); +// UISettingsDialog dlog = new UISettingsDialog(appLayout.getNavigationBar()); +// dlog.show(); } }); settings.addStyleName(UIConstants.BUTTON_SETTINGS); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java b/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java index f446d6f..515dcd7 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/TamayaUI.java @@ -18,27 +18,82 @@ */ 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.VaadinServlet; +import com.vaadin.server.VaadinSession; +import com.vaadin.ui.Panel; +import com.vaadin.ui.UI; 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 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; import java.io.File; import java.util.logging.Logger; /** - * Tamaya UI Main class. + * 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. */ -public class TamayaUI { +@Theme("valo") +@Title("Tamaya") +public class TamayaUI extends UI { private static final Logger LOG = Logger.getLogger(TamayaUI.class.getName()); /** * Not an instantiable class. */ - private TamayaUI(){} + public TamayaUI(){ + super(new Panel()); + super.setPollInterval(2000); + } + + @Override + protected void init(VaadinRequest vaadinRequest) { + setupEventBus(); + if (CurrentUser.isLoggedIn()) { + setContent(new ApplicationLayout(this)); + } else { + setContent(new LoginView()); + } + } + + @Subscribe + public void userLoggedIn( + LoginEvent event) { + CurrentUser.set(event.getUser()); + setContent(new ApplicationLayout(this)); + } + + @Subscribe + public void navigateTo(NavigationEvent evt) { + if(getNavigator()==null){ + return; + } + if(evt.getViewName().isEmpty()){ + getNavigator().navigateTo("/home"); + + }else { + getNavigator().navigateTo(evt.getViewName()); + } + } + + public static TamayaUI getCurrent() { + return (TamayaUI) UI.getCurrent(); + } /** * The main entry point, use configuration as follows: @@ -64,7 +119,7 @@ public class TamayaUI { Wrapper wrapper = tomcat.addServlet(context, "vadiin-servlet", VaadinServlet.class.getName()); wrapper.addInitParameter("ui", - VadiinApp.class.getName()); + TamayaUI.class.getName()); wrapper.addInitParameter("productionMode",config.getOrDefault("tamaya.server.productionMode", String.class, "false")); wrapper.addInitParameter("asyncSupported", "true"); @@ -74,4 +129,16 @@ public class TamayaUI { tomcat.getServer().await(); } + @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); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java b/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java index ecf90ff..78d5855 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/UIConstants.java @@ -33,4 +33,6 @@ public class UIConstants extends ValoTheme { public static final String BUTTON_LOGOUT = "logout"; public static final String BUTTON_SETTINGS = BUTTON_TINY; + + public static final String FIXED_FONT = "font-face: fixed;"; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java b/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java deleted file mode 100644 index 9e2510d..0000000 --- a/ui/base/src/main/java/org/apache/tamaya/ui/VadiinApp.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.ui; - -import com.google.common.eventbus.Subscribe; -import com.vaadin.annotations.Theme; -import com.vaadin.annotations.Title; -import com.vaadin.server.Page; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinSession; -import com.vaadin.ui.Panel; -import com.vaadin.ui.UI; -import org.apache.tamaya.ui.event.LogoutEvent; -import org.apache.tamaya.ui.event.NavigationEvent; -import org.apache.tamaya.ui.views.login.LoginEvent; -import org.apache.tamaya.ui.views.login.LoginView; - -/** - * This UI is the application entry point. A UI may either represent a browser window - * (or tab) or some part of a html page where a Vaadin application is embedded. - * <p> - * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be - * overridden to add component to the user interface and initialize non-component functionality. - */ -@Theme("valo") -@Title("Tamaya") -public class VadiinApp extends UI { - - public VadiinApp(){ - super(new Panel()); - super.setPollInterval(2000); - } - - @Override - protected void init(VaadinRequest vaadinRequest) { - setupEventBus(); - if (CurrentUser.isLoggedIn()) { - setContent(new ApplicationLayout(this)); - } else { - setContent(new LoginView()); - } - } - - @Subscribe - public void userLoggedIn( - LoginEvent event) { - CurrentUser.set(event.getUser()); - setContent(new ApplicationLayout(this)); - } - - @Subscribe - public void navigateTo(NavigationEvent evt) { - if(getNavigator()==null){ - return; - } - if(evt.getViewName().isEmpty()){ - getNavigator().navigateTo("/home"); - - }else { - getNavigator().navigateTo(evt.getViewName()); - } - } - - public static VadiinApp getCurrent() { - return (VadiinApp) UI.getCurrent(); - } - - @Subscribe - public void logout(LogoutEvent logoutEvent) { - // Don't invalidate the underlying HTTP session if you are using it for something else - VaadinSession.getCurrent().getSession().invalidate(); - VaadinSession.getCurrent().close(); - Page.getCurrent().reload(); - - } - - private void setupEventBus() { - org.apache.tamaya.ui.event.EventBus.register(this); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java deleted file mode 100644 index 578689f..0000000 --- a/ui/base/src/main/java/org/apache/tamaya/ui/ViewProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.ui; - -import com.vaadin.navigator.View; - -/** - * Interface to register Tamaya UI parts. For priorization also use the @Priority annotations. - */ -public interface ViewProvider { - - /** - * View lifecycle options that determine when a view is created and how long an instance is used. - */ - enum ViewLifecycle { - /** Creates a new view instance whenever the view is showed. */ - CREATE, - /** Loads the view on first access. */ - LAZY, - /** Eagerly preloads the view. */ - EAGER - } - - /** - * Get the view lifecycle model. - * @return the lifecycle model, not null. - */ - ViewLifecycle getLifecycle(); - - /** - * Get the view's name, used for resolving the view display name. - * @return the view's name. - */ - String getName(); - - /** - * Get the url pattern where this view should be accessible. - * @return the url pattern, not null. - */ - String getUrlPattern(); - - /** - * Get the name to be displayed for this view. This value will also be used to lookup a name from the {@code /ui/lang/tamaya} - * bundle. If not found the value returned will be used for display. - * - * @return the name to be displayed, or its resource bundle key, not null. - */ - String getDisplayName(); - - /** - * Method that is called to create a new view instance. - * @see #getLifecycle() - * @param params any parameters that may be needed to create the view. - * @return a new view instance, not null. - */ - View createView(Object... params); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java index e242418..811debf 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfigurationBasedMessageProvider.java @@ -19,9 +19,11 @@ package org.apache.tamaya.ui.internal; import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.core.propertysource.SimplePropertySource; 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 org.apache.tamaya.ui.spi.MessageProvider; import java.io.IOException; import java.net.URL; @@ -95,7 +97,7 @@ public final class ConfigurationBasedMessageProvider implements MessageProvider{ Enumeration<URL> urls = getClass().getClassLoader().getResources(bundleID+"."+format); while(urls.hasMoreElements()){ URL url = urls.nextElement(); - ctxBuilder.addPropertySources(new URLPropertySource(url)); + ctxBuilder.addPropertySources(new SimplePropertySource(url)); } } catch (IOException e) { e.printStackTrace(); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java index 14af644..ee687e9 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ConfiguredUserService.java @@ -21,7 +21,7 @@ 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 org.apache.tamaya.ui.spi.UserService; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/PageTitleUpdater.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/PageTitleUpdater.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/PageTitleUpdater.java index 83a0105..d10b66f 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/PageTitleUpdater.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/internal/PageTitleUpdater.java @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tamaya.ui.components; +package org.apache.tamaya.ui.internal; 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; +import org.apache.tamaya.ui.spi.MessageProvider; /** * Listener that updates the page title when a new view is shown. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java index 193144e..6772085 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/internal/ResourceBundleMessageProvider.java @@ -1,91 +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/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; -// } -// } -// -//} +/* + * 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.spi.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/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-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java deleted file mode 100644 index 83b4af4..0000000 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/URLPropertySource.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.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-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/internal/VerticalSpacedLayout.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/internal/VerticalSpacedLayout.java b/ui/base/src/main/java/org/apache/tamaya/ui/internal/VerticalSpacedLayout.java index 94fc980..405d0dc 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/internal/VerticalSpacedLayout.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/internal/VerticalSpacedLayout.java @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tamaya.ui.components; +package org.apache.tamaya.ui.internal; +import com.vaadin.ui.Alignment; import com.vaadin.ui.VerticalLayout; /** @@ -28,5 +29,6 @@ public class VerticalSpacedLayout extends VerticalLayout { public VerticalSpacedLayout() { setMargin(true); setSpacing(true); + setDefaultComponentAlignment(Alignment.TOP_LEFT); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/spi/LazyProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/spi/LazyProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/spi/LazyProvider.java deleted file mode 100644 index 2d1547f..0000000 --- a/ui/base/src/main/java/org/apache/tamaya/ui/spi/LazyProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.ui.components; - -import com.vaadin.navigator.View; -import org.apache.tamaya.spi.ServiceContextManager; -import org.apache.tamaya.ui.ViewProvider; -import org.apache.tamaya.ui.services.MessageProvider; - -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Lazily initializes a view when it's first accessed, then always returns the - * same instance on subsequent calls. - */ -public class LazyProvider implements ViewProvider { - private static final Logger LOG = Logger.getLogger( - LazyProvider.class.getName()); - private Class<? extends View> viewClass; - private View view; - private String urlPattern; - private String name; - - public LazyProvider(String name, String urlPattern, Class<? extends View> viewClass) { - this.viewClass = Objects.requireNonNull(viewClass); - this.urlPattern = Objects.requireNonNull(urlPattern); - this.name = Objects.requireNonNull(name); - } - - @Override - public String getUrlPattern() { - return urlPattern; - } - - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.LAZY; - } - - @Override - public String getName() { - return name; - } - - @Override - public String getDisplayName() { - return ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage(name); - } - - @Override - public View createView(Object... params) { - if(view==null){ - try { - view = viewClass.newInstance(); - } catch (Exception e) { - LOG.log(Level.SEVERE, "Failed to create view: "+urlPattern, e); - } - } - return view; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/spi/MessageProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/spi/MessageProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/spi/MessageProvider.java index a15ae46..2ea205d 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/spi/MessageProvider.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/spi/MessageProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tamaya.ui.services; +package org.apache.tamaya.ui.spi; import java.util.Locale; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/spi/SystemInfoProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/spi/SystemInfoProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/spi/SystemInfoProvider.java new file mode 100644 index 0000000..eb8ab7d --- /dev/null +++ b/ui/base/src/main/java/org/apache/tamaya/ui/spi/SystemInfoProvider.java @@ -0,0 +1,15 @@ +package org.apache.tamaya.ui.spi;/* + * (C) Copyright 2015-2017 Trivadis AG. All rights reserved. + */ + +import com.vaadin.ui.Accordion; + +/** + * Created by atsticks on 28.03.17. + */ +public interface SystemInfoProvider { + + void addSystemInfo(Accordion systemInfoPanel); + + void updateSystemInfo(Accordion systemInfoPanel); +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/spi/UserService.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/spi/UserService.java b/ui/base/src/main/java/org/apache/tamaya/ui/spi/UserService.java index 71a8a43..091ea60 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/spi/UserService.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/spi/UserService.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tamaya.ui.services; +package org.apache.tamaya.ui.spi; import org.apache.tamaya.ui.User; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/AbstractTextInfoProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/AbstractTextInfoProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/AbstractTextInfoProvider.java new file mode 100644 index 0000000..1185056 --- /dev/null +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/AbstractTextInfoProvider.java @@ -0,0 +1,67 @@ +/* + * 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.ui.Accordion; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.VerticalLayout; +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.ui.UIConstants; +import org.apache.tamaya.ui.spi.SystemInfoProvider; + +import javax.annotation.Priority; + +/** + * Created by atsticks on 29.06.16. + */ +public abstract class AbstractTextInfoProvider implements SystemInfoProvider { + + private TextArea textArea; + + protected abstract String getCaption(); + + protected abstract String getInfo(); + + @Override + public void addSystemInfo(Accordion systemInfoPanel) { + VerticalLayout layout = new VerticalLayout(); + textArea = new TextArea("System Info"); + textArea.addStyleName(UIConstants.FIXED_FONT); + textArea.setValue(getInfo()); + textArea.setRows(20); + textArea.setHeight("400px"); + textArea.setWidth("100%"); + layout.addComponents(textArea); + systemInfoPanel.addTab(layout, getCaption()); + } + + @Override + public void updateSystemInfo(Accordion systemInfoPanel) { + if(textArea!=null){ + textArea.setValue(getInfo()); + }else{ + textArea = new TextArea("System Info"); + textArea.setValue(getInfo()); + textArea.setSizeFull(); + systemInfoPanel.addTab(textArea, textArea.getCaption()); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/ConfigView.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/ConfigView.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/ConfigView.java index fb0d41b..e4c6de1 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/views/ConfigView.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/ConfigView.java @@ -18,26 +18,16 @@ */ package org.apache.tamaya.ui.views; -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.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -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 com.vaadin.shared.ui.ContentMode; +import com.vaadin.ui.*; +import org.apache.tamaya.Configuration; import org.apache.tamaya.ConfigurationProvider; -import org.apache.tamaya.spi.ServiceContextManager; +import org.apache.tamaya.functions.ConfigurationFunctions; +import org.apache.tamaya.functions.PropertyMatcher; 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 org.apache.tamaya.ui.internal.VerticalSpacedLayout; import javax.annotation.Priority; import java.util.Locale; @@ -45,98 +35,38 @@ import java.util.Map; import java.util.TreeMap; /** - * View for evaluating the current convifugration tree. + * View for evaluating the current convifugration configArea. */ @Priority(10) public class ConfigView extends VerticalSpacedLayout implements View { - /** - * Provider to register this view. - */ - @Priority(10) - public static final class Provider implements ViewProvider{ - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.CREATE; - } - - @Override - public String getName() { - return "view.config.name"; - } - - @Override - public String getUrlPattern() { - return "/config"; - } - - @Override - public String getDisplayName() { - return ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage("view.config.name"); - } - - @Override - public View createView(Object... params){ - return new ConfigView(); - } - } - private TextField keyFilter = new TextField("Key filter"); private TextField valueFilter = new TextField("Value filter"); - private CheckBox showMetaEntries = new CheckBox("Show Metadata", false); - private Tree tree = new Tree("Current Configuration"); + private TextArea configArea = new TextArea("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" + + "This view shows the overall <b>raw</b> configuration configArea. 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, showMetaEntries); - filters.setSpacing(true); + tabPane.setHeight("100%"); + tabPane.setWidth("100%"); + tabPane.addTab(createConfigTab(), "Configuration"); + tabPane.addTab(createEnvTab(), "Environment Properties"); + tabPane.addTab(createSysPropsTab(), "System Properties"); + tabPane.addTab(createRuntimeTab(), "Runtime Properties"); + addComponents(caption, description, tabPane); + caption.addStyleName(UIConstants.LABEL_HUGE); + description.addStyleName(UIConstants.LABEL_LARGE); + } - 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"); + private Component createRuntimeTab() { + VerticalLayout tabLayout = new VerticalLayout(); TextArea runtimeProps = new TextArea(); - runtimeProps.setRows(5); + runtimeProps.setRows(25); + StringBuilder b = new StringBuilder(); b.setLength(0); b.append("Available Processors : ").append(Runtime.getRuntime().availableProcessors()).append('\n'); b.append("Free Memory : ").append(Runtime.getRuntime().freeMemory()).append('\n'); @@ -145,85 +75,100 @@ public class ConfigView extends VerticalSpacedLayout implements View { 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); - showMetaEntries.addValueChangeListener(new Property.ValueChangeListener() { + runtimeProps.setHeight("100%"); + runtimeProps.setWidth("100%"); + tabLayout.addComponents(runtimeProps); + tabLayout.setHeight("100%"); + tabLayout.setWidth("100%"); + return tabLayout; + } + + private Component createSysPropsTab() { + VerticalLayout tabLayout = new VerticalLayout(); + TextArea sysProps = new TextArea(); + sysProps.setRows(25); + StringBuilder b = new StringBuilder(); + 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); + sysProps.setHeight("100%"); + sysProps.setWidth("100%"); + tabLayout.addComponents(sysProps); + tabLayout.setHeight("100%"); + tabLayout.setWidth("100%"); + return tabLayout; + } + + private Component createEnvTab() { + VerticalLayout tabLayout = new VerticalLayout(); + TextArea envProps = new TextArea(); + StringBuilder b = new StringBuilder(); + envProps.setRows(25); + 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); + envProps.setHeight("100%"); + envProps.setWidth("100%"); + tabLayout.addComponents(envProps); + tabLayout.setHeight("100%"); + tabLayout.setWidth("100%"); + return tabLayout; + } + + private Component createConfigTab() { + VerticalLayout tabLayout = new VerticalLayout(); + Component filters = createFilters(); + configArea.setWordWrap(false); + configArea.setReadOnly(true); + configArea.setHeight("100%"); + configArea.setWidth("100%"); + configArea.setRows(20); + fillTree(); + tabLayout.addComponents(filters, configArea); + tabLayout.setHeight("100%"); + tabLayout.setWidth("100%"); + return tabLayout; + } + + private Component createFilters() { + HorizontalLayout filters = new HorizontalLayout(); + Button filterButton = new Button("Filter", new Button.ClickListener() { @Override - public void valueChange(Property.ValueChangeEvent valueChangeEvent) { + public void buttonClick(Button.ClickEvent clickEvent) { fillTree(); } }); + filters.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT); + filters.addComponents(keyFilter, valueFilter, filterButton); + filters.setSpacing(true); + return filters; } 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(); - boolean showMetadata = showMetaEntries.getValue(); - 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; - } - if(!showMetadata && entry.getKey().startsWith("_")){ - 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 + final String keyFilterExp = this.keyFilter.getValue(); + final String valueFilterExp = this.valueFilter.getValue(); + Configuration config = ConfigurationProvider.getConfiguration() + .with(ConfigurationFunctions.filter(new PropertyMatcher() { + @Override + public boolean test(String key, String value) { + if(!keyFilterExp.isEmpty() && !key.matches(keyFilterExp)){ + return false; } - }else{ // singl root entry - if(parent!=null) { - tree.setParent(key, parent); + if(!valueFilterExp.isEmpty() && !value.matches(valueFilterExp)){ + return false; } + return true; } - } - } - - private String getCaption(String key, String value) { - int index = key.lastIndexOf('.'); - if(index<0){ - return key + " = " + value; - }else{ - return key.substring(index+1) + " = " + value; - } + })); + configArea.setValue(config.query(ConfigurationFunctions.textInfo())); } @Override public void enter(ViewChangeListener.ViewChangeEvent event) { - + fillTree(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/HomeView.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/HomeView.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/HomeView.java index 9d371d0..71944f2 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/views/HomeView.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/HomeView.java @@ -20,16 +20,12 @@ 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.shared.ui.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 org.apache.tamaya.ui.internal.VerticalSpacedLayout; -import javax.annotation.Priority; /** * Home view containing a title and a description, used as default entry point of the UI after login. @@ -37,40 +33,6 @@ import javax.annotation.Priority; 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{ - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.LAZY; - } - - @Override - public String getName() { - return "view.home.name"; - } - - @Override - public String getUrlPattern() { - return "/home"; - } - - @Override - public String getDisplayName() { - return ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage(getName()); - } - - @Override - public View createView(Object... params) { - return new HomeView(); - } - - } - - /** * Constructor. */ public HomeView() { @@ -79,12 +41,12 @@ public class HomeView extends VerticalSpacedLayout implements View { "<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); - + setHeight("100%"); + setWidth("100%"); + setSizeFull(); } @Override http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/SystemView.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/SystemView.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/SystemView.java index ea3421c..9206df0 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/views/SystemView.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/SystemView.java @@ -20,14 +20,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.shared.ui.ContentMode; +import com.vaadin.ui.Accordion; +import com.vaadin.ui.Alignment; import com.vaadin.ui.Label; -import com.vaadin.ui.Tree; 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 org.apache.tamaya.ui.internal.VerticalSpacedLayout; +import org.apache.tamaya.ui.spi.MessageProvider; +import org.apache.tamaya.ui.spi.SystemInfoProvider; import javax.annotation.Priority; @@ -37,43 +38,7 @@ import javax.annotation.Priority; @Priority(10000) public class SystemView extends VerticalSpacedLayout implements View { - - /** - * Provider to register this view. - */ - @Priority(20) - public static final class Provider implements ViewProvider{ - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.CREATE; - } - - @Override - public String getName() { - return "view.system.name"; - } - - @Override - public String getUrlPattern() { - return "/system"; - } - - @Override - public String getDisplayName() { - return ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage("view.system.name"); - } - - @Override - public View createView(Object... params){ - return new SystemView(); - } - } - - - private Tree configTree = new Tree(ServiceContextManager.getServiceContext().getService(MessageProvider.class) - .getMessage("default.label.system")); + private Accordion configTree = new Accordion(); public SystemView() { @@ -82,36 +47,32 @@ public class SystemView extends VerticalSpacedLayout implements View { "This view shows the system 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(); + ContentMode.TEXT); + configTree.setHeight("100%"); + configTree.setWidth("100%"); + fillAccordion(); addComponents(caption, description, configTree); - caption.addStyleName(UIConstants.LABEL_HUGE); - description.addStyleName(UIConstants.LABEL_LARGE); - } - private void fillComponentTree() { - configTree.removeAllItems(); + private void fillAccordion() { + configTree.removeAllComponents(); for(SystemInfoProvider infoProvider:ServiceContextManager.getServiceContext() .getServices(SystemInfoProvider.class)){ - infoProvider.provideSystemInfo(configTree); + infoProvider.addSystemInfo(configTree); } } - private String getCaption(String key, String value) { - int index = key.lastIndexOf('.'); - if(index<0){ - return key + " = " + value; - }else{ - return key.substring(index+1) + " = " + value; + private void updateAccordion() { + for(SystemInfoProvider infoProvider:ServiceContextManager.getServiceContext() + .getServices(SystemInfoProvider.class)){ + infoProvider.updateSystemInfo(configTree); } } @Override public void enter(ViewChangeListener.ViewChangeEvent event) { - + fillAccordion(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/TamayaGeneralSystemInfoProvider.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/TamayaGeneralSystemInfoProvider.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/TamayaGeneralSystemInfoProvider.java index fd37136..0896c3c 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/views/TamayaGeneralSystemInfoProvider.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/TamayaGeneralSystemInfoProvider.java @@ -18,39 +18,105 @@ */ package org.apache.tamaya.ui.views; -import com.vaadin.ui.Tree; import org.apache.tamaya.Configuration; import org.apache.tamaya.ConfigurationProvider; -import org.apache.tamaya.spi.PropertyValueCombinationPolicy; +import org.apache.tamaya.TypeLiteral; +import org.apache.tamaya.spi.ConfigurationContext; +import org.apache.tamaya.spi.PropertyConverter; +import org.apache.tamaya.spi.PropertyFilter; +import org.apache.tamaya.spi.PropertySource; import javax.annotation.Priority; +import java.util.List; +import java.util.Map; /** * Created by atsticks on 29.06.16. */ @Priority(0) -public class TamayaGeneralSystemInfoProvider implements SystemInfoProvider{ +public class TamayaGeneralSystemInfoProvider extends AbstractTextInfoProvider { + @Override - public void provideSystemInfo(Tree tree) { + protected String getCaption(){ + return "System Info"; + } + + @Override + protected String getInfo() { Configuration config = ConfigurationProvider.getConfiguration(); - String currentParent = "General"; - tree.addItem(currentParent); - tree.addItem("Configuration.class"); - tree.setItemCaption("Configuration.class", "Configuration class = " + config.getClass().getName()); - tree.setParent("Configuration.class", currentParent); - tree.setChildrenAllowed("Configuration.class", false); - - tree.addItem("ConfigurationContext.class"); - tree.setItemCaption("ConfigurationContext.class", "ConfigurationContext class = " + - config.getContext().getClass().getName()); - tree.setParent("ConfigurationContext.class", currentParent); - tree.setChildrenAllowed("ConfigurationContext.class", false); - - tree.addItem("PropertyValueCombinationPolicy.class"); - tree.setItemCaption("PropertyValueCombinationPolicy.class", - PropertyValueCombinationPolicy.class.getSimpleName() + " class = " + - config.getContext().getPropertyValueCombinationPolicy().getClass().getName()); - tree.setParent("PropertyValueCombinationPolicy.class", currentParent); - tree.setChildrenAllowed("PropertyValueCombinationPolicy.class", false); + return new StringBuilder() + .append("Configuration: ").append(config.getClass().getName()).append('\n') + .append("ConfigurationContext: ").append(config.getContext().getClass().getName()).append('\n') + .append("PropertyValueCombinationPolicy: ") + .append(config.getContext().getPropertyValueCombinationPolicy().getClass().getName()).append('\n') + .append("Property sources: ").append(config.getContext().getPropertySources().size()).append('\n') + .append(getPropertySourceList(config.getContext())).append('\n') + .append("Property filters: ").append(config.getContext().getPropertyFilters().size()).append('\n') + .append(getPropertyFilterList(config.getContext())).append('\n') + .append("Property converters: ").append(config.getContext().getPropertyConverters().size()).append('\n') + .append(getPropertyConverterList(config.getContext())).append('\n') + .toString(); + + } + + private String getPropertySourceList(ConfigurationContext context) { + StringBuilder b = new StringBuilder(); + b.append(" ").append(format("NAME", 40)).append(format("ORDINAL", 8)) + .append(format("CLASS", 30)).append('\n'); + b.append(" ---------------------------------------------------------------------------------" + + "-------------------------------------------------------------").append('\n'); + for(PropertySource ps:context.getPropertySources()){ + b.append(" ").append(format(ps.getName(),40)).append(format(String.valueOf(ps.getOrdinal()), 8)) + .append(format(ps.getClass().getSimpleName(), 30)).append('\n'); + } + return b.toString(); + } + + private String getPropertyFilterList(ConfigurationContext context) { + StringBuilder b = new StringBuilder(); + b.append(" ").append(format("CLASS", 80)).append('\n'); + b.append(" ---------------------------------------------------------------------------------" + + "-------------------------------------------------------------").append('\n'); + for(PropertyFilter ps:context.getPropertyFilters()){ + b.append(" ").append(format(ps.getClass().getName(), 80)).append('\n'); + } + return b.toString(); } + + private String getPropertyConverterList(ConfigurationContext context) { + StringBuilder b = new StringBuilder(); + b.append(" ").append(format("TYPE", 30)) + .append(format("CONVERTERS", 90)).append('\n'); + b.append(" ---------------------------------------------------------------------------------" + + "-------------------------------------------------------------").append('\n'); + for(Map.Entry<TypeLiteral<?>,List<PropertyConverter<?>>> ps:context.getPropertyConverters().entrySet()){ + b.append(" ").append(format(ps.getKey().getRawType().getSimpleName(),30)) + .append(format(getClassList(ps.getValue()), 90)).append('\n'); + } + return b.toString(); + } + + private String getClassList(List<PropertyConverter<?>> items) { + StringBuilder b = new StringBuilder(); + for (Object o : items) { + b.append(o.getClass().getName()).append(", "); + } + if (b.length() > 0) { + b.setLength(b.length() - 2); + } + return b.toString(); + } + + private String format(String val, int len){ + if(val.length()>len){ + return val.substring(0, len-3)+".. "; + } + StringBuilder b = new StringBuilder(val); + for(int i=0;i<len-val.length();i++){ + b.append(' '); + } + return b.toString(); + } + + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java ---------------------------------------------------------------------- diff --git a/ui/base/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java b/ui/base/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java index 73cf018..e40e23d 100644 --- a/ui/base/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java +++ b/ui/base/src/main/java/org/apache/tamaya/ui/views/login/LoginBox.java @@ -33,8 +33,8 @@ 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; +import org.apache.tamaya.ui.spi.MessageProvider; +import org.apache.tamaya.ui.spi.UserService; /** * Login dialog centerd on the screen. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider index 0ff3225..326528e 100644 --- a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider +++ b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider @@ -19,6 +19,3 @@ org.apache.tamaya.ui.views.HomeView$Provider org.apache.tamaya.ui.views.ConfigView$Provider org.apache.tamaya.ui.views.SystemView$Provider - -# Events Module -org.apache.tamaya.ui.events.EventView$Provider http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.MessageProvider deleted file mode 100644 index 6ce4a9f..0000000 --- a/ui/base/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-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService deleted file mode 100644 index 109865f..0000000 --- a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.services.UserService +++ /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.ConfiguredUserService \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.MessageProvider ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.MessageProvider b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.MessageProvider new file mode 100644 index 0000000..6ce4a9f --- /dev/null +++ b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.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-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.SystemInfoProvider ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.SystemInfoProvider b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.SystemInfoProvider new file mode 100644 index 0000000..a0a3ecd --- /dev/null +++ b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.SystemInfoProvider @@ -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.views.TamayaGeneralSystemInfoProvider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.UserService ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.UserService b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.UserService new file mode 100644 index 0000000..109865f --- /dev/null +++ b/ui/base/src/main/resources/META-INF/services/org.apache.tamaya.ui.spi.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-sandbox/blob/fd26d6c0/ui/base/src/main/resources/ui/lang/tamaya.properties ---------------------------------------------------------------------- diff --git a/ui/base/src/main/resources/ui/lang/tamaya.properties b/ui/base/src/main/resources/ui/lang/tamaya.properties index ba458de..a2f1423 100644 --- a/ui/base/src/main/resources/ui/lang/tamaya.properties +++ b/ui/base/src/main/resources/ui/lang/tamaya.properties @@ -23,6 +23,6 @@ default.label.username=Username default.label.password=Password default.label.system=Runtime -view.config.name=Configuration -view.home.name=Home -view.system.name=System Runtime +views.ConfigView.name=Configuration +views.HomeView.name=Home +views.SystemView.name=System Runtime http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/fd26d6c0/ui/pom.xml ---------------------------------------------------------------------- diff --git a/ui/pom.xml b/ui/pom.xml index 9e5f340..9214a84 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -23,18 +23,23 @@ <groupId>org.apache.tamaya.ext</groupId> <artifactId>tamaya-sandbox</artifactId> <version>0.3-incubating-SNAPSHOT</version> - <relativePath>..</relativePath> </parent> <artifactId>tamaya-ui-parent</artifactId> - <name>Apache Tamaya Modules - UI (parent)</name> - <description>Parent of the UI modules, which implement a servlet application + <name>Apache Tamaya Modules - Web UI (parent)</name> + <description>Parent of the UI modules, which implement a web application for accessing and changing of configuration. </description> <packaging>pom</packaging> <properties> - <jdkVersion>1.7</jdkVersion> + <jdkVersion>1.8</jdkVersion> + <maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel> + <maven.compile.targetLevel>${jdkVersion}</maven.compile.targetLevel> + <vaadin.plugin.version>2.1.0</vaadin.plugin.version> + <vaadin.version>8.0.4</vaadin.version> + <guava.version>21.0</guava.version> + <tomcat.version>7.0.57</tomcat.version> </properties> <modules> @@ -43,4 +48,79 @@ <module>mutableconfig</module> </modules> + <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> + </dependency> + <dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-functions</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-spisupport</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-server</artifactId> + <version>${vaadin.version}</version> + </dependency> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-client-compiled</artifactId> + <version>${vaadin.version}</version> + </dependency> + <dependency> + <groupId>com.vaadin</groupId> + <artifactId>vaadin-themes</artifactId> + <version>${vaadin.version}</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </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>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jaxrs_2.0_spec</artifactId> + <version>1.0-alpha-1</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>3.1.6</version> + </dependency> + </dependencies> + + <repositories> + <repository> + <id>vaadin-prereleases</id> + <name>Vaadin Pre-releases</name> + <url>https://maven.vaadin.com/vaadin-prereleases</url> + </repository> + </repositories> </project>