From 6f6e2dda598864afcb15a2001ccd30aedc51e708 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Fri, 14 Sep 2012 15:26:12 +0200 Subject: [PATCH] Refactoring; Introduced a properties-file --- .../application/GlobalPropertiesBean.java | 147 ++++++++++++++++++ .../beans/application/ProjectsBean.java | 2 + .../beans/session/CurrentThemeBean.java | 2 +- .../kieker/webgui/beans/session/UserBean.java | 25 ++- .../beans/view/CurrentAnalysisEditorBean.java | 75 ++++++++- .../webgui/beans/view/CurrentCockpitBean.java | 18 +-- .../beans/view/CurrentCockpitEditorBean.java | 17 -- .../beans/view/CurrentControllerBean.java | 15 -- .../webgui/common/ProjectManagerFacade.java | 11 +- .../AbstractKiekerWebGUIException.java} | 40 +++-- .../exception/AnalysisStateException.java | 22 ++- .../exception/DisplayNotFoundException.java | 19 ++- .../LibraryAlreadyExistingException.java | 18 ++- .../exception/LibraryLoadException.java | 17 +- .../exception/NewerProjectException.java | 18 ++- .../ProjectAlreadyExistingException.java | 18 ++- .../exception/ProjectLoadException.java | 16 +- .../ProjectNotExistingException.java | 17 +- .../src/main/resources/global.properties | 26 ++++ .../src/main/webapp/AnalysisEditor.xhtml | 6 +- Kieker.WebGUI/src/main/webapp/Cockpit.xhtml | 2 +- .../src/main/webapp/CockpitEditor.xhtml | 2 +- .../src/main/webapp/Controller.xhtml | 6 +- Kieker.WebGUI/src/main/webapp/Login.xhtml | 6 +- .../src/main/webapp/ProjectOverview.xhtml | 4 +- 25 files changed, 436 insertions(+), 113 deletions(-) create mode 100644 Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java rename Kieker.WebGUI/src/main/java/kieker/webgui/common/{Global.java => exception/AbstractKiekerWebGUIException.java} (51%) create mode 100644 Kieker.WebGUI/src/main/resources/global.properties diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java new file mode 100644 index 00000000..2d868911 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * Licensed 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 kieker.webgui.beans.application; + +import java.io.IOException; +import java.util.Properties; + +import javax.faces.bean.ApplicationScoped; +import javax.faces.bean.ManagedBean; + +import kieker.common.logging.Log; +import kieker.common.logging.LogFactory; + +/** + * The class {@link GlobalPropertiesBean} contains the properties for the application (after reading them from one or more files within the resource-set). It is a + * singleton + * class. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +@ManagedBean +@ApplicationScoped +public final class GlobalPropertiesBean { + /** + * This is the log object which will be used to log errors and exceptions. + */ + private static final Log LOG = LogFactory.getLog(GlobalPropertiesBean.class); + /** + * This is the name of the global properties file, which should be contained in the resources of this war-archive. + */ + private static final String PROPERTIES_FILE_GLOBAL = "global.properties"; + /** + * A property name. + */ + private static final String PROPERTY_FACES_CONTEXT_THEME_KEY = "kieker.webgui.theme.facesContextKey"; + /** + * A property name. + */ + private static final String PROPERTY_THEME_COOKIE_NAME = "kieker.webgui.theme.cookieName"; + /** + * A property name. + */ + private static final String PROPERTY_DEFAULT_THEME = "kieker.webgui.theme.defaultTheme"; + /** + * A property name. + */ + private static final String PROPERTY_PROJECT_OVERVIEW_PAGE = "kieker.webgui.page.projectOverview"; + /** + * A property name. + */ + private static final String PROPERTY_WELCOME_MESSAGE = "kieker.webgui.common.welcomeMessage"; + /** + * A property name. + */ + private static final String PROPERTY_SHORT_WELCOME_MESSAGE = "kieker.webgui.common.shortWelcomeMessage"; + /** + * This field contains the global properties. + */ + private final Properties globalProperties = new Properties(); + + /** + * Default constructor. <b>Do not use this constructor. This bean is JSF managed.</b> + */ + public GlobalPropertiesBean() { + try { + // Try to load the properties from the properties file(s) + this.globalProperties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(GlobalPropertiesBean.PROPERTIES_FILE_GLOBAL)); + } catch (final IOException ex) { + // If this exception occurs there isn't much we can do. This means the resource isn't available. We can't shutdown the whole application, so instead we + // log the error. + GlobalPropertiesBean.LOG.error("An error occured during the loading of the properties", ex); + } + } + + /** + * Delivers the default theme. + * + * @return The stored value of the property. + */ + public String getDefaultTheme() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_DEFAULT_THEME); + } + + /** + * Delivers the name of the theme cookie. + * + * @return The stored value of the property. + */ + public String getThemeCookieName() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_THEME_COOKIE_NAME); + } + + /** + * Delivers the key name of the theme within the faces context. + * + * @return The stored value of the property. + */ + public String getFacesContextThemeKey() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_FACES_CONTEXT_THEME_KEY); + } + + /** + * Delivers the key name of the theme within the faces context. + * + * @return The stored value of the property. + */ + public String getProjectOverviewPage() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_PROJECT_OVERVIEW_PAGE); + } + + /** + * Delivers the welcome message. + * + * @return The stored value of the property. + */ + public String getWelcomeMessage() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_WELCOME_MESSAGE); + } + + /** + * Delivers the short welcome message. + * + * @return The stored value of the property. + */ + public String getShortWelcomeMessage() { + return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_SHORT_WELCOME_MESSAGE); + } +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java index 7fc69bbb..9f625e6b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java @@ -42,6 +42,8 @@ import kieker.webgui.common.ProjectManagerFacade; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; +import kieker.webgui.common.util.ACManager; +import kieker.webgui.common.util.FSManager; /** * The {@link ProjectsBean} is a JSF managed bean to manage a list with all application wide available projects. It provides methods to receive this list as well as diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java index a8664d8e..2a4e98fd 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java @@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse; /** * The {@link CurrentThemeBean} contains the current user theme (look and feel) of the (session) user. The default value is the "glass-x"-theme, if no other value - * can be find within the parameters of the faces context or in the cookies of the user. Every change of the theme will also result in storing the new theme within + * can be found within the parameters of the faces context or in the cookies of the user. Every change of the theme will also result in storing the new theme within * the cookies of the user.<br> * As the theme can be chosen by every user on his own, this class is a session scoped bean. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java index 4f9ec6f9..fe9f0217 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java @@ -23,9 +23,12 @@ package kieker.webgui.beans.session; import java.io.Serializable; import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; import javax.faces.bean.SessionScoped; -import kieker.webgui.common.Global; +import kieker.webgui.beans.application.GlobalPropertiesBean; + +import org.primefaces.context.RequestContext; /** * This bean contains information about the user of this session (like user name and authorization). It provides method to log into the application.<br> @@ -47,6 +50,9 @@ public final class UserBean implements Serializable { */ private String userName; + @ManagedProperty(value = "#{globalPropertiesBean}") + private GlobalPropertiesBean globalPropertiesBean; + /** * Default constructor. <b>Do not use this constructor. This bean is JSF managed.</b> */ @@ -79,7 +85,22 @@ public final class UserBean implements Serializable { * @return The new page. */ public String login() { - return Global.PAGE_PROJECT_OVERVIEW; + return this.globalPropertiesBean.getProjectOverviewPage(); + } + + public GlobalPropertiesBean getGlobalPropertiesBean() { + return this.globalPropertiesBean; + } + + public void setGlobalPropertiesBean(final GlobalPropertiesBean globalPropertiesBean) { + this.globalPropertiesBean = globalPropertiesBean; + } + + public void showWelcomeMessage() { + final String welcomeMsgTemplate = "growlComp.renderMessage({summary : '%s', detail : '%s', severity: 'info'});"; + final String finalMsg = String.format(welcomeMsgTemplate, this.globalPropertiesBean.getShortWelcomeMessage(), this.globalPropertiesBean.getWelcomeMessage()); + + RequestContext.getCurrentInstance().execute(finalMsg); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java index dbdbf69a..ea04294a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorBean.java @@ -290,12 +290,26 @@ public final class CurrentAnalysisEditorBean { } } + /** + * This method adds the contents (plugins, repositories) within the given dependency to the tool palette. + * + * @param dependency + * The dependency which should be added to the palette. + * @throws LibraryLoadException + * If something went wrong during the loading of the library. + */ private void addContentsToToolPalette(final MIDependency dependency) throws LibraryLoadException { this.addContentsToToolPalette( this.projectManagerFacade.getAllPluginsWithinLib(dependency, this.projectName, this.classLoader, this.classAndMethodContainer), this.projectManagerFacade.getAllRepositoriesWithinLib(dependency, this.projectName, this.classLoader, this.classAndMethodContainer)); } + /** + * This method adds the contents (plugins, repositories) within the kieker dependency to the tool palette. + * + * @throws LibraryLoadException + * If something went wrong during the loading of the library. + */ private void addKiekerContentsToToolPalette() throws LibraryLoadException { this.addContentsToToolPalette( this.projectManagerFacade.getAllPluginsWithinKiekerLib(this.classLoader, this.classAndMethodContainer), @@ -303,10 +317,12 @@ public final class CurrentAnalysisEditorBean { } /** - * This method adds all available readers, filters and repositories within the given library to the lists of this bean. + * This method adds all available readers, filters and repositories within the given parameters to the tool palette. * - * @param url - * The library url used to load the plugins and repositories. + * @param plugins + * The available readers and filters. + * @param repositories + * The available repositories. */ @SuppressWarnings("unchecked") private void addContentsToToolPalette(final List<Class<AbstractPlugin>> plugins, final List<Class<AbstractRepository>> repositories) { @@ -440,6 +456,15 @@ public final class CurrentAnalysisEditorBean { } } + /** + * Delivers the description of the property of the given component (plugin or repository). + * + * @param component + * The component whose property description should be delivered. + * @param propertyName + * The name of the property in question. + * @return The description of the property. + */ public String getDescription(final EObject component, final String propertyName) { try { final String className; @@ -1005,12 +1030,24 @@ public final class CurrentAnalysisEditorBean { this.currentAnalysisEditorGraphBean.refreshGraph(); } + /** + * This method should be called if a node (plugin, repository) has been selected. + * + * @param node + * The new node to be selected. + */ public void nodeSelected(final EObject node) { synchronized (this) { this.selectedComponent = node; } } + /** + * This method should be called if a node (plugin, repository) has been removed. + * + * @param node + * The new node to be removed. + */ public void nodeRemoved(final EObject node) { synchronized (this) { // Remove the component from the project @@ -1050,18 +1087,50 @@ public final class CurrentAnalysisEditorBean { } } + /** + * This method should be delivered if an edge between two plugins has been created. + * + * @param sourcePort + * The source port. + * @param targetPort + * The target port. + */ public void edgeCreated(final MIOutputPort sourcePort, final MIInputPort targetPort) { sourcePort.getSubscribers().add(targetPort); } + /** + * This method should be delivered if an edge between two plugins has been removed. + * + * @param sourcePort + * The source port. + * @param targetPort + * The target port. + */ public void edgeRemoved(final MIOutputPort sourcePort, final MIInputPort targetPort) { sourcePort.getSubscribers().remove(targetPort); } + /** + * This method should be delivered if an edge between a plugin and a repository has been created. + * + * @param sourcePort + * The source port. + * @param target + * The target repository. + */ public void edgeCreated(final MIRepositoryConnector sourcePort, final MIRepository target) { sourcePort.setRepository(target); } + /** + * This method should be delivered if an edge between a plugin and a repository has been removed. + * + * @param sourcePort + * The source port. + * @param target + * The target repository. + */ public void edgeRemoved(final MIRepositoryConnector sourcePort, final MIRepository target) { sourcePort.setRepository(null); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitBean.java index 59f43761..59c0c733 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitBean.java @@ -34,7 +34,6 @@ import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIView; import kieker.webgui.beans.application.ProjectsBean; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.Global; import kieker.webgui.common.IProjectManagerFacade; import kieker.webgui.common.ProjectManagerFacade; import kieker.webgui.common.exception.ProjectLoadException; @@ -130,6 +129,7 @@ public class CurrentCockpitBean { * JSF.</b> * * @throws ProjectLoadException + * If something went wrong during the initialization. */ public void initalize() throws ProjectLoadException { try { @@ -290,22 +290,6 @@ public class CurrentCockpitBean { } } - /** - * This method clears the bean. In other words: The stored project is set to null and the method will return the page of the project overview for navigation - * purposes. - * - * @return The name of the page of the project overview. - */ - public String clearProject() { - synchronized (this) { - this.projectName = null; // NOPMD - this.project = null; // NOPMD - this.activeView = null; // NOPMD - } - - return Global.PAGE_PROJECT_OVERVIEW; - } - /** * Delivers the currently active view. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitEditorBean.java index 19a35c2c..7685e4d9 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentCockpitEditorBean.java @@ -46,7 +46,6 @@ import kieker.analysis.plugin.AbstractPlugin; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.common.Global; import kieker.webgui.common.IProjectManagerFacade; import kieker.webgui.common.ProjectManagerFacade; import kieker.webgui.common.exception.NewerProjectException; @@ -178,22 +177,6 @@ public class CurrentCockpitEditorBean { } } - /** - * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. - * - * @return The name of the page of the project overview. - */ - public String clearProject() { - synchronized (this) { - this.projectName = null; // NOPMD - this.project = null; // NOPMD - this.activeView = null; // NOPMD - this.timeStamp = 0; - } - - return Global.PAGE_PROJECT_OVERVIEW; - } - /** * This method tries to save the current project and informs the user about success or fail. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentControllerBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentControllerBean.java index 55bb5f8c..94657224 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentControllerBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentControllerBean.java @@ -34,7 +34,6 @@ import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.common.Global; import kieker.webgui.common.IProjectManagerFacade; import kieker.webgui.common.ProjectManagerFacade; import kieker.webgui.common.exception.AnalysisStateException; @@ -149,20 +148,6 @@ public class CurrentControllerBean { } } - /** - * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. - * - * @return The name of the page of the project overview. - */ - public String clearProject() { - synchronized (this) { - this.projectName = null; // NOPMD - this.project = null; // NOPMD - } - - return Global.PAGE_PROJECT_OVERVIEW; - } - /** * This method starts the current analysis and informs the user about a fail. */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java index 81a0cf09..d7fb1a65 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java @@ -192,8 +192,8 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { } @Override - public List<Class<AbstractRepository>> getAllRepositoriesWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) - throws LibraryLoadException { + public List<Class<AbstractRepository>> getAllRepositoriesWithinKiekerLib(final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException { try { return PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); @@ -203,8 +203,8 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { } @Override - public List<Class<AbstractPlugin>> getAllPluginsWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) - throws LibraryLoadException { + public List<Class<AbstractPlugin>> getAllPluginsWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws + LibraryLoadException { try { return PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); @@ -268,7 +268,8 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { } @Override - public Object getDisplay(final String projectName, final String viewName, final String displayName) throws ProjectNotExistingException, DisplayNotFoundException { + public Object getDisplay(final String projectName, final String viewName, final String displayName) throws ProjectNotExistingException, + DisplayNotFoundException { final Object analysisLock = this.getLock(projectName, this.analysesLocks); synchronized (analysisLock) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Global.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AbstractKiekerWebGUIException.java similarity index 51% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/Global.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AbstractKiekerWebGUIException.java index e37c6f9e..b915cbd5 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Global.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AbstractKiekerWebGUIException.java @@ -18,25 +18,47 @@ * limitations under the License. ***************************************************************************/ -package kieker.webgui.common; +package kieker.webgui.common.exception; /** - * The class {@link Global} is a utility class with no properties, but global accessible constants. As there are no non-static fields or methods are available, it - * cannot be instantiated. There are also no static fields available which can be modified during runtime. + * This is the abstract base for all other exceptions used in this application. * * @author Nils Christian Ehmke * @version 1.0 */ -public final class Global { +public abstract class AbstractKiekerWebGUIException extends RuntimeException { + /** - * This is the name of the page for the project overview. The page name has been modified to use a redirect of the browser. + * The UID. */ - public static final String PAGE_PROJECT_OVERVIEW = "ProjectOverview.xhtml?faces-redirect=true"; + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance of this class. + */ + public AbstractKiekerWebGUIException() { + super(); + } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + */ + public AbstractKiekerWebGUIException(final String msg) { + super(msg); + } /** - * Default constructor. + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. */ - private Global() { - // No code necessary + public AbstractKiekerWebGUIException(final String msg, final Throwable cause) { + super(msg, cause); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java index e19ee992..6f4b46fe 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java @@ -21,21 +21,25 @@ package kieker.webgui.common.exception; /** + * This class represents an exception occurring when the analysis is in an invalid state for the ordered method. * * @author Nils Christian Ehmke * @version 1.0 */ -public class AnalysisStateException extends Exception { +public class AnalysisStateException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; /** + * private static final long serialVersionUID = 1L; + * + * /** * Creates a new instance of this class. */ public AnalysisStateException() { - // No code necessary + super(); } /** @@ -48,7 +52,15 @@ public class AnalysisStateException extends Exception { super(msg); } - public AnalysisStateException(final String msg, final Throwable ex) { - super(msg, ex); + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ + public AnalysisStateException(final String msg, final Throwable cause) { + super(msg, cause); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/DisplayNotFoundException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/DisplayNotFoundException.java index 59818587..de9e7eb8 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/DisplayNotFoundException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/DisplayNotFoundException.java @@ -21,13 +21,14 @@ package kieker.webgui.common.exception; /** + * This exception occurs when a display object has been ordered, which is not available. * * @author Nils Christian Ehmke * @version 1.0 */ -public class DisplayNotFoundException extends Exception { +public class DisplayNotFoundException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -35,7 +36,7 @@ public class DisplayNotFoundException extends Exception { * Creates a new instance of this class. */ public DisplayNotFoundException() { - // No code necessary + super(); } /** @@ -48,7 +49,15 @@ public class DisplayNotFoundException extends Exception { super(msg); } - public DisplayNotFoundException(final String msg, final Throwable ex) { - super(msg, ex); + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ + public DisplayNotFoundException(final String msg, final Throwable cause) { + super(msg, cause); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java index 64e2d7cb..4994738a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java @@ -26,9 +26,9 @@ package kieker.webgui.common.exception; * @author Nils Christian Ehmke * @version 1.0 */ -public class LibraryAlreadyExistingException extends Exception { +public class LibraryAlreadyExistingException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -36,7 +36,7 @@ public class LibraryAlreadyExistingException extends Exception { * Creates a new instance of this class. */ public LibraryAlreadyExistingException() { - // No code necessary + super(); } /** @@ -48,4 +48,16 @@ public class LibraryAlreadyExistingException extends Exception { public LibraryAlreadyExistingException(final String msg) { super(msg); } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ + public LibraryAlreadyExistingException(final String msg, final Throwable cause) { + super(msg, cause); + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java index 35a5e760..74ec0032 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java @@ -20,16 +20,15 @@ package kieker.webgui.common.exception; - /** - * This exception shows that a library with the same name exists already. + * This exception shows that an error occurred while loading a library. * * @author Nils Christian Ehmke * @version 1.0 */ -public class LibraryLoadException extends Exception { +public class LibraryLoadException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -37,7 +36,7 @@ public class LibraryLoadException extends Exception { * Creates a new instance of this class. */ public LibraryLoadException() { - // No code necessary + super(); } /** @@ -50,6 +49,14 @@ public class LibraryLoadException extends Exception { super(msg); } + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ public LibraryLoadException(final String msg, final Throwable cause) { super(msg, cause); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java index 4b1280be..a13cee9c 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java @@ -27,9 +27,9 @@ package kieker.webgui.common.exception; * @author Nils Christian Ehmke * @version 1.0 */ -public class NewerProjectException extends Exception { +public class NewerProjectException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -37,7 +37,7 @@ public class NewerProjectException extends Exception { * Creates a new instance of this class. */ public NewerProjectException() { - // No code necessary + super(); } /** @@ -49,4 +49,16 @@ public class NewerProjectException extends Exception { public NewerProjectException(final String msg) { super(msg); } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ + public NewerProjectException(final String msg, final Throwable cause) { + super(msg, cause); + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java index 02c28596..c83b2f9b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java @@ -26,9 +26,9 @@ package kieker.webgui.common.exception; * @author Nils Christian Ehmke * @version 1.0 */ -public class ProjectAlreadyExistingException extends Exception { +public class ProjectAlreadyExistingException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -36,7 +36,7 @@ public class ProjectAlreadyExistingException extends Exception { * Creates a new instance of this class. */ public ProjectAlreadyExistingException() { - // No code necessary + super(); } /** @@ -48,4 +48,16 @@ public class ProjectAlreadyExistingException extends Exception { public ProjectAlreadyExistingException(final String msg) { super(msg); } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ + public ProjectAlreadyExistingException(final String msg, final Throwable cause) { + super(msg, cause); + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java index e72132be..c81b11e7 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java @@ -19,9 +19,15 @@ ***************************************************************************/ package kieker.webgui.common.exception; -public class ProjectLoadException extends Exception { +/** + * This exception ocurs when something goes wrong during the loading/opening of a given project. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +public class ProjectLoadException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -29,7 +35,7 @@ public class ProjectLoadException extends Exception { * Creates a new instance of this class. */ public ProjectLoadException() { - // No code necessary + super(); } /** @@ -47,8 +53,8 @@ public class ProjectLoadException extends Exception { * * @param msg * The message used for the exception. - * @param The - * cause for the method. + * @param cause + * The cause for the exception. */ public ProjectLoadException(final String msg, final Throwable cause) { super(msg, cause); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectNotExistingException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectNotExistingException.java index 8b65b105..1a9311bb 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectNotExistingException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectNotExistingException.java @@ -20,14 +20,15 @@ package kieker.webgui.common.exception; - /** + * This exception shows that a project with the given name does not exist or does no longer exist. + * * @author Nils Christian Ehmke * @version 1.0 */ -public class ProjectNotExistingException extends Exception { +public class ProjectNotExistingException extends AbstractKiekerWebGUIException { /** - * The serial version UID. + * The UID. */ private static final long serialVersionUID = 1L; @@ -35,7 +36,7 @@ public class ProjectNotExistingException extends Exception { * Creates a new instance of this class. */ public ProjectNotExistingException() { - // No code necessary + super(); } /** @@ -48,6 +49,14 @@ public class ProjectNotExistingException extends Exception { super(msg); } + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + * @param cause + * The cause for the exception. + */ public ProjectNotExistingException(final String msg, final Throwable cause) { super(msg, cause); } diff --git a/Kieker.WebGUI/src/main/resources/global.properties b/Kieker.WebGUI/src/main/resources/global.properties new file mode 100644 index 00000000..a51a7c0b --- /dev/null +++ b/Kieker.WebGUI/src/main/resources/global.properties @@ -0,0 +1,26 @@ +#------------------------------------------------------------------------------ +# +# These constants concern common things +# +#------------------------------------------------------------------------------ + +kieker.webgui.common.shortWelcomeMessage = Welcome to the Kieker.WebGUI +kieker.webgui.common.welcomeMessage = This is an early alpha version of the Kieker Web GUI. Therefore it may contain bugs and some functionality may have not been implemented yet. Just click "Login" to continue. + +#------------------------------------------------------------------------------ +# +# These constants concern mostly the theme containing bean(s) +# +#------------------------------------------------------------------------------ + +kieker.webgui.theme.defaultTheme = glass-x +kieker.webgui.theme.cookieName = theme +kieker.webgui.theme.facesContextKey = theme + +#------------------------------------------------------------------------------ +# +# These constants concern the pages +# +#------------------------------------------------------------------------------ + +kieker.webgui.page.projectOverview = ProjectOverview.xhtml?faces-redirect=true diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml index 60fa41f8..65d1fd5d 100644 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml @@ -65,10 +65,10 @@ <h:outputText styleClass="kieker-title" value="Kieker » #{stringBean.shortenLongName(currentAnalysisEditorBean.projectName, 30)}"/> </p:toolbarGroup> <p:toolbarGroup align="right"> - <p:commandButton styleClass="perspective-button" icon="ui-icon-home" action="ProjectOverview.xhtml" /> + <p:commandButton styleClass="perspective-button" icon="ui-icon-home" action="ProjectOverview.xhtml?faces-redirect=true" /> <p:separator/> <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" disabled="true"/> - <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" outcome="Controller.xhtml"> + <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" outcome="Controller.xhtml?faces-redirect=true"> <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" /> </p:button> <p:separator/> @@ -91,7 +91,7 @@ <p:separator /> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-gear" value=" Settings" onclick="settingsDlg.show()" ajax="true"/> <p:separator /> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="ProjectOverview.xhtml" ajax="false"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="ProjectOverview.xhtml?faces-redirect=true" ajax="false"/> </p:submenu> <p:submenu label="Help"> diff --git a/Kieker.WebGUI/src/main/webapp/Cockpit.xhtml b/Kieker.WebGUI/src/main/webapp/Cockpit.xhtml index 4de136ca..044afd45 100644 --- a/Kieker.WebGUI/src/main/webapp/Cockpit.xhtml +++ b/Kieker.WebGUI/src/main/webapp/Cockpit.xhtml @@ -50,7 +50,7 @@ <p:submenu label="File"> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-gear" value=" Settings" onclick="settingsDlg.show()" ajax="true"/> <p:separator/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="#{ProjectOverview.xhtml}" ajax="false"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="ProjectOverview.xhtml?faces-redirect=true" ajax="false"/> </p:submenu> <p:submenu label="Help"> diff --git a/Kieker.WebGUI/src/main/webapp/CockpitEditor.xhtml b/Kieker.WebGUI/src/main/webapp/CockpitEditor.xhtml index 748b0e60..e3656385 100644 --- a/Kieker.WebGUI/src/main/webapp/CockpitEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/CockpitEditor.xhtml @@ -55,7 +55,7 @@ <p:separator/> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-gear" value=" Settings" onclick="settingsDlg.show()" ajax="true"/> <p:separator/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="#{ProjectOverview.xhtml}" ajax="false"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Project" action="ProjectOverview.xhtml" ajax="false"/> </p:submenu> <p:submenu label="Help"> diff --git a/Kieker.WebGUI/src/main/webapp/Controller.xhtml b/Kieker.WebGUI/src/main/webapp/Controller.xhtml index 07d84510..4a365f82 100644 --- a/Kieker.WebGUI/src/main/webapp/Controller.xhtml +++ b/Kieker.WebGUI/src/main/webapp/Controller.xhtml @@ -30,9 +30,9 @@ <h:outputText styleClass="kieker-title" value="Kieker » #{stringBean.shortenLongName(currentControllerBean.projectName, 30)}"/> </p:toolbarGroup> <p:toolbarGroup align="right"> - <p:commandButton styleClass="perspective-button" icon="ui-icon-home" action="ProjectOverview.xhtml" /> + <p:commandButton styleClass="perspective-button" icon="ui-icon-home" action="ProjectOverview.xhtml?faces-redirect=true" /> <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" style="white-space: none" outcome="AnalysisEditor.xhtml"> + <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" style="white-space: none" outcome="AnalysisEditor.xhtml?faces-redirect=true"> <f:param name="projectName" value="#{currentControllerBean.projectName}" /> </p:button> <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" disabled="true"> @@ -49,7 +49,7 @@ <p:submenu label="File"> <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-gear" value=" Settings" onclick="settingsDlg.show()" ajax="true"/> <p:separator/> - <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Controller" action="#{ProjectOverview.xhtml}" ajax="false"/> + <p:menuitem styleClass="element-with-whitespace" icon="ui-icon-circle-close" value=" Close Controller" action="ProjectOverview.xhtml?faces-redirect=true" ajax="false"/> </p:submenu> <p:submenu label="Help"> diff --git a/Kieker.WebGUI/src/main/webapp/Login.xhtml b/Kieker.WebGUI/src/main/webapp/Login.xhtml index 7cfc00ba..0665d838 100644 --- a/Kieker.WebGUI/src/main/webapp/Login.xhtml +++ b/Kieker.WebGUI/src/main/webapp/Login.xhtml @@ -10,7 +10,11 @@ <link rel="stylesheet" type="text/css" href="../css/Login.css" /> </h:head> - <h:body onload="growlComp.renderMessage({summary:'Welcome to the Kieker.WebGUI', detail: 'This is an early alpha version of the Kieker Web GUI. Therefore it may contain bugs and some functionality may have not been implemented yet. Just click "Login" to continue.', severity: 'info'})"> + + <h:body onload="showWelcomeMessage();"> + <h:form> + <p:remoteCommand action="#{userBean.showWelcomeMessage()}" name="showWelcomeMessage"/> + </h:form> <div align="center" > <img src="../img/kieker-header.jpg"/> </div> diff --git a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml index 1680f73e..8ea8ebcb 100644 --- a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml +++ b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml @@ -23,10 +23,10 @@ <p:toolbarGroup align="right"> <p:commandButton styleClass="perspective-button" icon="ui-icon-home" disabled="true" action="ProjectOverview.xhtml" /> <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" style="white-space: none" outcome="AnalysisEditor.xhtml"> + <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Analysis Editor" style="white-space: none" outcome="AnalysisEditor.xhtml?faces-redirect=true"> <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}"/> </p:button> - <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" outcome="Controller.xhtml"> + <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" outcome="Controller.xhtml?faces-redirect=true"> <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}"/> </p:button> <p:separator/> -- GitLab