From e0f54d874d1f984a2a967c124abfa205c420554e Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Sun, 28 Oct 2012 09:20:10 +0100 Subject: [PATCH] Refactoring --- Kieker.WebGUI/pom.xml | 5 - .../beans/application/ProjectsBean.java | 10 +- .../session/CurrentConfigurationBean.java | 202 ------------------ .../kieker/webgui/beans/session/UserBean.java | 176 +++++++++++++-- .../beans/view/CurrentAnalysisEditorBean.java | 31 +-- .../webgui/beans/view/CurrentCockpitBean.java | 6 +- .../beans/view/CurrentCockpitEditorBean.java | 6 +- .../beans/view/CurrentControllerBean.java | 6 +- .../beans/view/CurrentUserManagementBean.java | 6 +- ...anagerFacade.java => IProjectManager.java} | 2 +- ...erManagerFacade.java => IUserManager.java} | 2 +- ...acadeImpl.java => ProjectManagerImpl.java} | 12 +- ...erFacadeImpl.java => UserManagerImpl.java} | 22 +- .../webapp/WEB-INF/spring-bean-config.xml | 23 +- Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml | 2 +- .../main/webapp/dialogs/SettingsDialog.xhtml | 6 +- 16 files changed, 216 insertions(+), 301 deletions(-) delete mode 100644 Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentConfigurationBean.java rename Kieker.WebGUI/src/main/java/kieker/webgui/common/{IProjectManagerFacade.java => IProjectManager.java} (99%) rename Kieker.WebGUI/src/main/java/kieker/webgui/common/{IUserManagerFacade.java => IUserManager.java} (97%) rename Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/{ProjectManagerFacadeImpl.java => ProjectManagerImpl.java} (95%) rename Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/{UserManagerFacadeImpl.java => UserManagerImpl.java} (85%) diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 099cd3de..b7ad5ff9 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -132,11 +132,6 @@ <artifactId>derby</artifactId> <version>10.9.1.0</version> </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-runner</artifactId> - <version>8.1.7.v20120910</version> - </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> 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 ddcc1b67..f28ed670 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 @@ -28,7 +28,7 @@ import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.view.CurrentProjectOverviewBean; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -37,7 +37,7 @@ import kieker.webgui.common.exception.ProjectNotExistingException; * The {@link ProjectsBean} is a Spring managed bean to manage a list with all application wide available projects. It provides methods to receive this list as well * as methods to add, create, rename, open and copy projects. Furthermore the state of existing projects (like the timestamp or the state of the analysis) can be * received via this bean. In order to realize a good abstraction, this bean should be used for most accesses to the projects. The necessary synchronization is - * achieved in the {@link IProjectManagerFacade}.<br> + * achieved in the {@link IProjectManager}.<br> * As this bean contains the whole list of the available projects, it is session scoped. There is no reason for multiple instances of this class. * * @author Nils Christian Ehmke @@ -50,7 +50,7 @@ public final class ProjectsBean { private final List<String> projects = Collections.synchronizedList(new ArrayList<String>()); - private IProjectManagerFacade projectManagerFacade; + private IProjectManager projectManagerFacade; /** * Default constructor. <b>Do not use this constructor. This bean is Spring managed.</b> @@ -65,7 +65,7 @@ public final class ProjectsBean { * @param projectManagerFacade * The new value for the property. */ - public void setProjectManagerFacade(final IProjectManagerFacade projectManagerFacade) { + public void setProjectManagerFacade(final IProjectManager projectManagerFacade) { this.projectManagerFacade = projectManagerFacade; } @@ -148,7 +148,7 @@ public final class ProjectsBean { /** * This method can be used to open an already existing project. This means that the current state of the project on the file system is loaded into an instance of - * {@link MIProject}. This instance can be modified at will and for example later saved by the {@link IProjectManagerFacade}. + * {@link MIProject}. This instance can be modified at will and for example later saved by the {@link IProjectManager}. * * @param project * The name of the project to be opened. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentConfigurationBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentConfigurationBean.java deleted file mode 100644 index af849079..00000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentConfigurationBean.java +++ /dev/null @@ -1,202 +0,0 @@ -/*************************************************************************** - * Copyright 2012 Kieker Project (http://kieker-monitoring.net) - * - * 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.session; - -import java.io.Serializable; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; - -import kieker.webgui.beans.application.GlobalPropertiesBean; - -/** - * The class {@link CurrentConfigurationBean} is a session scoped Spring bean, containing the properties and configurations of the current (session) user.<br> - * It is session scoped as only one instance per user is necessary. This means also that is has to implement the {@link Serializable} interface. - * - * @author Nils Christian Ehmke - */ -public final class CurrentConfigurationBean implements Serializable { - - private static final long serialVersionUID = 4226402116177851270L; - - private String lookAndFeel; - private String gridColor; - private int gridSize; - - private GlobalPropertiesBean globalPropertiesBean; - - /** - * Default constructor. <b>Do not use this constructor. This bean is Spring managed.</b> - */ - public CurrentConfigurationBean() { - // No code necessary - } - - /** - * This method initializes the bean. In fact it loads the default values before trying to load the values of the user from their cookies. <b>Do not call this - * method. The method is Spring managed.</b> - */ - protected void initialize() { - this.loadDefaultValues(); - this.loadValuesFromCookies(); - } - - /** - * The setter for the property {@link CurrentConfigurationBean#globalPropertiesBean}. <b>Do not use this method. This property is Spring managed.</b> - * - * @param globalPropertiesBean - * The new value for the property. - */ - public void setGlobalPropertiesBean(final GlobalPropertiesBean globalPropertiesBean) { - synchronized (this) { - this.globalPropertiesBean = globalPropertiesBean; - } - } - - /** - * The getter for the property {@link CurrentConfigurationBean#lookAndFeel}. - * - * @return The current value for the property. - */ - public String getLookAndFeel() { - synchronized (this) { - return this.lookAndFeel; - } - } - - /** - * The setter for the property {@link CurrentConfigurationBean#lookAndFeel}. - * - * @param lookAndFeel - * The new value for the property. - */ - public void setLookAndFeel(final String lookAndFeel) { - synchronized (this) { - this.lookAndFeel = lookAndFeel; - CurrentConfigurationBean.saveValueInCookie(this.globalPropertiesBean.getThemeCookieName(), lookAndFeel); - } - } - - /** - * The getter for the property {@link CurrentConfigurationBean#gridColor}. - * - * @return The current value for the property. - */ - public String getGridColor() { - synchronized (this) { - return this.gridColor; - } - } - - /** - * The setter for the property {@link CurrentConfigurationBean#gridColor}. - * - * @param gridColor - * The new value for the property. - */ - public void setGridColor(final String gridColor) { - synchronized (this) { - this.gridColor = gridColor; - CurrentConfigurationBean.saveValueInCookie(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName(), gridColor); - } - } - - /** - * The getter for the property {@link CurrentConfigurationBean#gridSize}. - * - * @return The current value for the property. - */ - public int getGridSize() { - synchronized (this) { - return this.gridSize; - } - } - - /** - * The setter for the property {@link CurrentConfigurationBean#gridSize}. - * - * @param gridSize - * The new value for the property. - */ - public void setGridSize(final int gridSize) { - synchronized (this) { - this.gridSize = gridSize; - CurrentConfigurationBean.saveValueInCookie(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName(), Integer.toString(gridSize)); - } - } - - /** - * This method tries to load the default values of the properties from the {@link GlobalPropertiesBean} and the faces context. - */ - private void loadDefaultValues() { - synchronized (this) { - // Get the parameters within the current context. - final Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); // NOPMD (No concurrent access) - // Try to find the default theme within the parameters. - if (params.containsKey(this.globalPropertiesBean.getFacesContextThemeKey())) { - this.lookAndFeel = params.get(this.globalPropertiesBean.getFacesContextThemeKey()); - } else { - // Use the default theme. - this.lookAndFeel = this.globalPropertiesBean.getDefaultTheme(); - } - - this.gridColor = this.globalPropertiesBean.getAnalysisEditorDefaultGridColor(); - this.gridSize = Integer.parseInt(this.globalPropertiesBean.getAnalysisEditorDefaultGridSize()); - } - } - - /** - * This method tries to load the values of the properties from the user's cookies. - */ - private void loadValuesFromCookies() { - synchronized (this) { - // Get the available cookies - final Map<String, Object> cookies = FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap(); // NOPMD (No concurrent access) - - // Now load the values if available - if (cookies.containsKey(this.globalPropertiesBean.getThemeCookieName())) { - this.lookAndFeel = ((Cookie) cookies.get(this.globalPropertiesBean.getThemeCookieName())).getValue(); - } - if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName())) { - this.gridColor = ((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName())).getValue(); - } - if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())) { - this.gridSize = Integer.parseInt(((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())).getValue()); - } - } - } - - /** - * This method saves the given values in a cookie with the given name, using the maximal available age for the cookie. - * - * @param cookieName - * The name of the cookie. - * @param cookieValue - * The value for the cookie. - */ - private static void saveValueInCookie(final String cookieName, final String cookieValue) { - // Create the cookie and make sure that it will be saved for a year (maximum age) - final Cookie cookie = new Cookie(cookieName, cookieValue); - cookie.setMaxAge(60 * 60 * 24 * 365); - - // Deliver the cookie - final HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); - response.addCookie(cookie); - } -} 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 312ba73e..a9a6025d 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 @@ -17,6 +17,11 @@ package kieker.webgui.beans.session; import java.io.Serializable; +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; @@ -24,9 +29,8 @@ import org.springframework.security.core.userdetails.UserDetails; import kieker.webgui.beans.application.GlobalPropertiesBean; /** - * This bean contains information about the user of this session (like user name and authorization). It provides methods to perform a login into the application.<br> - * This class is a Spring managed bean with session scope. This means also that it is possible to login the same user multiple times and that is has to implement the - * {@link Serializable} interface. + * This bean contains information about the user of this session (like the properties and configurations). This class is a Spring managed bean with session scope. + * This means also that it is possible to login the same user multiple times. As it is a session bean, it must implement the {@link Serializable} interface. * * @author Nils Christian Ehmke */ @@ -34,6 +38,13 @@ public final class UserBean implements Serializable { private static final long serialVersionUID = 6422563876003638348L; + private String lookAndFeel; + private String gridColor; + private int gridSize; + + /** + * This property is injected by Spring. + */ private GlobalPropertiesBean globalPropertiesBean; /** @@ -44,18 +55,30 @@ public final class UserBean implements Serializable { } /** - * Returns the name of the user of the current session. + * This method initializes the bean. In fact it loads the default values before trying to load the values of the user from their cookies. <b>Do not call this + * method. The method is Spring managed.</b> + */ + protected void initialize() { + this.loadDefaultValues(); + this.loadValuesFromCookies(); + } + + /** + * Returns the name of the user of the current session. If something goes wrong during the search, it returns a human readable 'N/A'. * - * @return The user name. + * @return The user name of the session user. */ public String getUsername() { final String username; + // Try to get the principal final Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof UserDetails) { + // Looks like it worked. Extract the username. final UserDetails userDetails = (UserDetails) principal; username = userDetails.getUsername(); } else { + // Something went wrong username = "N/A"; } @@ -63,34 +86,145 @@ public final class UserBean implements Serializable { } /** - * Tries to login. If this has been successful the page of the project overview will be returned. + * The setter for the property {@link UserBean#globalPropertiesBean}. <b>Do not use this method. This property is Spring managed.</b> * - * @return The new page. + * @param globalPropertiesBean + * The new value for the property. */ - public String login() { - if (this.globalPropertiesBean != null) { - return this.globalPropertiesBean.getProjectOverviewPage(); - } else { - return ""; + public void setGlobalPropertiesBean(final GlobalPropertiesBean globalPropertiesBean) { + synchronized (this) { + this.globalPropertiesBean = globalPropertiesBean; } } /** - * The getter for the property {@link UserBean#globalPropertiesBean}. + * The getter for the property {@link UserBean#lookAndFeel}. * - * @return The current value of the property. + * @return The current value for the property. */ - public GlobalPropertiesBean getGlobalPropertiesBean() { - return this.globalPropertiesBean; + public String getLookAndFeel() { + synchronized (this) { + return this.lookAndFeel; + } } /** - * The setter for the property {@link UserBean#globalPropertiesBean}. + * The setter for the property {@link UserBean#lookAndFeel}. * - * @param globalPropertiesBean - * The new value of the property. + * @param lookAndFeel + * The new value for the property. */ - public void setGlobalPropertiesBean(final GlobalPropertiesBean globalPropertiesBean) { - this.globalPropertiesBean = globalPropertiesBean; + public void setLookAndFeel(final String lookAndFeel) { + synchronized (this) { + this.lookAndFeel = lookAndFeel; + UserBean.saveValueInCookie(this.globalPropertiesBean.getThemeCookieName(), lookAndFeel); + } + } + + /** + * The getter for the property {@link UserBean#gridColor}. + * + * @return The current value for the property. + */ + public String getGridColor() { + synchronized (this) { + return this.gridColor; + } + } + + /** + * The setter for the property {@link UserBean#gridColor}. + * + * @param gridColor + * The new value for the property. + */ + public void setGridColor(final String gridColor) { + synchronized (this) { + this.gridColor = gridColor; + UserBean.saveValueInCookie(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName(), gridColor); + } + } + + /** + * The getter for the property {@link UserBean#gridSize}. + * + * @return The current value for the property. + */ + public int getGridSize() { + synchronized (this) { + return this.gridSize; + } + } + + /** + * The setter for the property {@link UserBean#gridSize}. + * + * @param gridSize + * The new value for the property. + */ + public void setGridSize(final int gridSize) { + synchronized (this) { + this.gridSize = gridSize; + UserBean.saveValueInCookie(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName(), Integer.toString(gridSize)); + } + } + + /** + * This method tries to load the default values of the properties from the {@link GlobalPropertiesBean} and the faces context. + */ + private void loadDefaultValues() { + synchronized (this) { + // Get the parameters within the current context. + final Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); // NOPMD (No concurrent access) + // Try to find the default theme within the parameters. + if (params.containsKey(this.globalPropertiesBean.getFacesContextThemeKey())) { + this.lookAndFeel = params.get(this.globalPropertiesBean.getFacesContextThemeKey()); + } else { + // Use the default theme. + this.lookAndFeel = this.globalPropertiesBean.getDefaultTheme(); + } + + this.gridColor = this.globalPropertiesBean.getAnalysisEditorDefaultGridColor(); + this.gridSize = Integer.parseInt(this.globalPropertiesBean.getAnalysisEditorDefaultGridSize()); + } + } + + /** + * This method tries to load the values of the properties from the user's cookies. + */ + private void loadValuesFromCookies() { + synchronized (this) { + // Get the available cookies + final Map<String, Object> cookies = FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap(); // NOPMD (No concurrent access) + + // Now load the values if available + if (cookies.containsKey(this.globalPropertiesBean.getThemeCookieName())) { + this.lookAndFeel = ((Cookie) cookies.get(this.globalPropertiesBean.getThemeCookieName())).getValue(); + } + if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName())) { + this.gridColor = ((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridColorCookieName())).getValue(); + } + if (cookies.containsKey(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())) { + this.gridSize = Integer.parseInt(((Cookie) cookies.get(this.globalPropertiesBean.getAnalysisEditorGridSizeCookieName())).getValue()); + } + } + } + + /** + * This method saves the given values in a cookie with the given name, using the maximal available age for the cookie. + * + * @param cookieName + * The name of the cookie. + * @param cookieValue + * The value for the cookie. + */ + private static void saveValueInCookie(final String cookieName, final String cookieValue) { + // Create the cookie and make sure that it will be saved for a year (maximum age) + final Cookie cookie = new Cookie(cookieName, cookieValue); + cookie.setMaxAge(60 * 60 * 24 * 365); + + // Deliver the cookie + final HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addCookie(cookie); } } 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 4889d823..4462c676 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 @@ -51,9 +51,9 @@ import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.GlobalPropertiesBean; import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.beans.session.CurrentConfigurationBean; +import kieker.webgui.beans.session.UserBean; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.LibraryAlreadyExistingException; import kieker.webgui.common.exception.LibraryLoadException; import kieker.webgui.common.exception.NewerProjectException; @@ -132,10 +132,10 @@ public final class CurrentAnalysisEditorBean { * This field contains the currently selected component (this can either be a plugin ({@link MIPlugin}) or a repository ({@link MIRepository})). */ private EObject selectedComponent; - private IProjectManagerFacade projectManagerFacade; + private IProjectManager projectManagerFacade; private ProjectsBean projectsBean; private CurrentAnalysisEditorGraphBean currentAnalysisEditorGraphBean; - private CurrentConfigurationBean currentConfigurationBean; + private UserBean userBean; private GlobalPropertiesBean globalPropertiesBean; /** @@ -151,7 +151,7 @@ public final class CurrentAnalysisEditorBean { * @param projectManagerFacade * The new value of the attribute. */ - public void setProjectManagerFacade(final IProjectManagerFacade projectManagerFacade) { + public void setProjectManagerFacade(final IProjectManager projectManagerFacade) { this.projectManagerFacade = projectManagerFacade; } @@ -1027,22 +1027,13 @@ public final class CurrentAnalysisEditorBean { } /** - * The getter for the property {@link CurrentAnalysisEditorBean#currentConfigurationBean}. + * The setter for the property {@link CurrentAnalysisEditorBean#userBean}. * - * @return The current value of the property. - */ - public CurrentConfigurationBean getCurrentConfigurationBean() { - return this.currentConfigurationBean; - } - - /** - * The setter for the property {@link CurrentAnalysisEditorBean#currentConfigurationBean}. - * - * @param currentConfigurationBean + * @param userBean * The new value of the property. */ - public void setCurrentConfigurationBean(final CurrentConfigurationBean currentConfigurationBean) { - this.currentConfigurationBean = currentConfigurationBean; + public void setUserBean(final UserBean userBean) { + this.userBean = userBean; } /** @@ -1112,8 +1103,8 @@ public final class CurrentAnalysisEditorBean { this.currentAnalysisEditorGraphBean.addEdgeConstraints(); // Now we have to set the default grid size and color of the user - this.currentAnalysisEditorGraphBean.setGridColor(this.currentConfigurationBean.getGridColor()); - this.currentAnalysisEditorGraphBean.setGridSize(this.currentConfigurationBean.getGridSize()); + this.currentAnalysisEditorGraphBean.setGridColor(this.userBean.getGridColor()); + this.currentAnalysisEditorGraphBean.setGridSize(this.userBean.getGridSize()); // Repaint the graph this.currentAnalysisEditorGraphBean.refreshGraph(); 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 6ae27637..529e1d84 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 @@ -28,7 +28,7 @@ import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.GlobalPropertiesBean; import kieker.webgui.beans.application.ProjectsBean; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -43,7 +43,7 @@ import kieker.webgui.common.exception.ProjectNotExistingException; public final class CurrentCockpitBean { private static final Log LOG = LogFactory.getLog(CurrentCockpitBean.class); - private IProjectManagerFacade projectManagerFacade; + private IProjectManager projectManagerFacade; private String projectName; private MIProject project; private MIView activeView; @@ -68,7 +68,7 @@ public final class CurrentCockpitBean { } } - public void setProjectManagerFacade(final IProjectManagerFacade projectManagerFacade) { + public void setProjectManagerFacade(final IProjectManager projectManagerFacade) { this.projectManagerFacade = projectManagerFacade; } 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 19c278ae..68fc91eb 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 @@ -43,7 +43,7 @@ import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.GlobalPropertiesBean; import kieker.webgui.beans.application.ProjectsBean; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -70,7 +70,7 @@ public final class CurrentCockpitEditorBean { private static final Log LOG = LogFactory.getLog(CurrentCockpitEditorBean.class); private final MIAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - private IProjectManagerFacade projectManagerFacade; + private IProjectManager projectManagerFacade; private ClassAndMethodContainer classAndMethodContainer; private long timeStamp; @@ -97,7 +97,7 @@ public final class CurrentCockpitEditorBean { * @param projectManagerFacade * The new value of the property. */ - public void setProjectManagerFacade(final IProjectManagerFacade projectManagerFacade) { + public void setProjectManagerFacade(final IProjectManager projectManagerFacade) { this.projectManagerFacade = projectManagerFacade; } 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 6c19fc30..5c62d286 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 @@ -29,7 +29,7 @@ import kieker.analysis.AnalysisController; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.AnalysisInitializationException; import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -45,7 +45,7 @@ public final class CurrentControllerBean { private static final Log LOG = LogFactory.getLog(CurrentControllerBean.class); - private IProjectManagerFacade projectManagerFacade; + private IProjectManager projectManagerFacade; private final List<String> logEntries = new ArrayList<String>(); private String projectName; private ProjectsBean projectsBean; @@ -66,7 +66,7 @@ public final class CurrentControllerBean { return this.projectsBean; } - public void setProjectManagerFacade(final IProjectManagerFacade projectManagerFacade) { + public void setProjectManagerFacade(final IProjectManager projectManagerFacade) { this.projectManagerFacade = projectManagerFacade; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentUserManagementBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentUserManagementBean.java index 233bea19..f044ba0a 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentUserManagementBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentUserManagementBean.java @@ -19,7 +19,7 @@ package kieker.webgui.beans.view; import java.util.ArrayList; import java.util.List; -import kieker.webgui.common.IUserManagerFacade; +import kieker.webgui.common.IUserManager; import kieker.webgui.common.Role; import kieker.webgui.common.User; @@ -28,7 +28,7 @@ import kieker.webgui.common.User; */ public final class CurrentUserManagementBean { - private IUserManagerFacade userManagerFacade; + private IUserManager userManagerFacade; /** * This list contains all available users. */ @@ -47,7 +47,7 @@ public final class CurrentUserManagementBean { * @param userManagerFacade * The new value for the property. */ - public void setUserManagerFacade(final IUserManagerFacade userManagerFacade) { + public void setUserManagerFacade(final IUserManager userManagerFacade) { this.userManagerFacade = userManagerFacade; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManager.java similarity index 99% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManager.java index 32f40780..d7e68c11 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManager.java @@ -43,7 +43,7 @@ import org.primefaces.model.UploadedFile; * * @author Nils Christian Ehmke */ -public interface IProjectManagerFacade { +public interface IProjectManager { /** * This method adds a new project to the application. It creates an empty, but nevertheless valid kax-file to the file system. If the method fails due to an diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManagerFacade.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManager.java similarity index 97% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManagerFacade.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManager.java index b3ace296..c8266c2b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IUserManager.java @@ -20,7 +20,7 @@ import java.util.List; import org.springframework.security.access.prepost.PreAuthorize; -public interface IUserManagerFacade { +public interface IUserManager { @PreAuthorize("hasRole('ROLE_ADMIN')") public void addUser(final String username, final String password, final List<Role> roles); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerFacadeImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerImpl.java similarity index 95% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerFacadeImpl.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerImpl.java index 08248921..497457ca 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerFacadeImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/ProjectManagerImpl.java @@ -28,7 +28,7 @@ import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.plugin.AbstractPlugin; import kieker.analysis.repository.AbstractRepository; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.IProjectManagerFacade; +import kieker.webgui.common.IProjectManager; import kieker.webgui.common.exception.AnalysisInitializationException; import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; @@ -48,7 +48,7 @@ import org.primefaces.model.UploadedFile; * * @author Nils Christian Ehmke */ -public final class ProjectManagerFacadeImpl implements IProjectManagerFacade { +public final class ProjectManagerImpl implements IProjectManager { private final ConcurrentHashMap<String, Object> fileSystemLocks = new ConcurrentHashMap<String, Object>(); private final ConcurrentHashMap<String, Object> analysesLocks = new ConcurrentHashMap<String, Object>(); @@ -59,12 +59,12 @@ public final class ProjectManagerFacadeImpl implements IProjectManagerFacade { /** * Default constructor. <b>Do not use this constructor. This bean is Spring managed.</b> */ - public ProjectManagerFacadeImpl() { + public ProjectManagerImpl() { // No code necessary. } /** - * The setter for the property {@link ProjectManagerFacadeImpl#acManager}. <b>Do not use this method. This property is Spring managed.</b> + * The setter for the property {@link ProjectManagerImpl#acManager}. <b>Do not use this method. This property is Spring managed.</b> * * @param acManager */ @@ -73,7 +73,7 @@ public final class ProjectManagerFacadeImpl implements IProjectManagerFacade { } /** - * The setter for the property {@link ProjectManagerFacadeImpl#fsManager}. <b>Do not use this method. This property is Spring managed.</b> + * The setter for the property {@link ProjectManagerImpl#fsManager}. <b>Do not use this method. This property is Spring managed.</b> * * @param fsManager */ @@ -82,7 +82,7 @@ public final class ProjectManagerFacadeImpl implements IProjectManagerFacade { } /** - * The setter for the property {@link ProjectManagerFacadeImpl#pluginFinder}. <b>Do not use this method. This property is Spring managed.</b> + * The setter for the property {@link ProjectManagerImpl#pluginFinder}. <b>Do not use this method. This property is Spring managed.</b> * * @param pluginFinder */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerFacadeImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerImpl.java similarity index 85% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerFacadeImpl.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerImpl.java index 9381ab90..8054f581 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerFacadeImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/impl/UserManagerImpl.java @@ -31,20 +31,20 @@ import org.springframework.security.access.prepost.PreAuthorize; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; -import kieker.webgui.common.IUserManagerFacade; +import kieker.webgui.common.IUserManager; import kieker.webgui.common.Role; import kieker.webgui.common.User; -public class UserManagerFacadeImpl implements IUserManagerFacade { +public class UserManagerImpl implements IUserManager { - private static final Log LOG = LogFactory.getLog(UserManagerFacadeImpl.class); + private static final Log LOG = LogFactory.getLog(UserManagerImpl.class); private DataSource dataSource; private Connection connection; /** * Default constructor. <b>Do not use this constructor. This bean is Spring managed.</b> */ - public UserManagerFacadeImpl() { + public UserManagerImpl() { // No code necessary } @@ -55,7 +55,7 @@ public class UserManagerFacadeImpl implements IUserManagerFacade { try { this.connection = this.dataSource.getConnection(); } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not establish database connection.", ex); + UserManagerImpl.LOG.error("Could not establish database connection.", ex); } } @@ -63,7 +63,7 @@ public class UserManagerFacadeImpl implements IUserManagerFacade { try { this.connection.close(); } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not close database connection.", ex); + UserManagerImpl.LOG.error("Could not close database connection.", ex); } } @@ -90,20 +90,20 @@ public class UserManagerFacadeImpl implements IUserManagerFacade { roleCmd.execute(); } } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not add user to the database.", ex); + UserManagerImpl.LOG.error("Could not add user to the database.", ex); } finally { if (userCmd != null) { try { userCmd.close(); } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not close prepared statement.", ex); + UserManagerImpl.LOG.error("Could not close prepared statement.", ex); } } if (roleCmd != null) { try { roleCmd.close(); } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not close prepared statement.", ex); + UserManagerImpl.LOG.error("Could not close prepared statement.", ex); } } } @@ -159,14 +159,14 @@ public class UserManagerFacadeImpl implements IUserManagerFacade { // Now convert the map to the list result.addAll(tempMap.values()); } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not receive user list.", ex); + UserManagerImpl.LOG.error("Could not receive user list.", ex); } finally { try { if (queryResult != null) { queryResult.close(); } } catch (final SQLException ex) { - UserManagerFacadeImpl.LOG.error("Could not close query result.", ex); + UserManagerImpl.LOG.error("Could not close query result.", ex); } } diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/spring-bean-config.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/spring-bean-config.xml index e6e0029c..dfe8bd88 100644 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/spring-bean-config.xml +++ b/Kieker.WebGUI/src/main/webapp/WEB-INF/spring-bean-config.xml @@ -11,13 +11,13 @@ <bean id="acManager" class="kieker.webgui.common.util.ACManager"> <property name="fsManager" ref="fsManager" /> </bean> - <bean id="projectManagerFacade" class="kieker.webgui.common.impl.ProjectManagerFacadeImpl"> + <bean id="projectManager" class="kieker.webgui.common.impl.ProjectManagerImpl"> <property name="fsManager" ref="fsManager" /> <property name="acManager" ref="acManager" /> <property name="pluginFinder" ref="pluginFinder" /> </bean> <bean id="projectsBean" class="kieker.webgui.beans.application.ProjectsBean" init-method="initialize"> - <property name="projectManagerFacade" ref="projectManagerFacade" /> + <property name="projectManagerFacade" ref="projectManager" /> </bean> <bean id="globalPropertiesBean" class="kieker.webgui.beans.application.GlobalPropertiesBean"> <property name="themeCookieName" value="${kieker.webgui.config.lookAndFeel.cookieName}"/> @@ -66,45 +66,42 @@ </map> </property> </bean> - <bean destroy-method="destroy" init-method="initialize" id="userManagerFacade" class="kieker.webgui.common.impl.UserManagerFacadeImpl"> + <bean destroy-method="destroy" init-method="initialize" id="userManager" class="kieker.webgui.common.impl.UserManagerImpl"> <property name="dataSource" ref="userDataSource" /> </bean> <!-- The session scoped beans. --> - <bean id="currentConfigurationBean" class="kieker.webgui.beans.session.CurrentConfigurationBean" scope="session" init-method="initialize"> - <property name="globalPropertiesBean" ref="globalPropertiesBean"/> - </bean> - <bean id="userBean" class="kieker.webgui.beans.session.UserBean" scope="session"> + <bean id="userBean" init-method="initialize" class="kieker.webgui.beans.session.UserBean" scope="session"> <property name="globalPropertiesBean" ref="globalPropertiesBean"/> </bean> <!-- The view scoped beans. --> <bean id="currentAnalysisEditorBean" class="kieker.webgui.beans.view.CurrentAnalysisEditorBean" scope="view"> <property name="globalPropertiesBean" ref="globalPropertiesBean"/> - <property name="projectManagerFacade" ref="projectManagerFacade" /> + <property name="projectManagerFacade" ref="projectManager" /> <property name="projectsBean" ref="projectsBean" /> <property name="currentAnalysisEditorGraphBean" ref="currentAnalysisEditorGraphBean" /> - <property name="currentConfigurationBean" ref="currentConfigurationBean" /> + <property name="userBean" ref="userBean" /> </bean> <bean id="currentAnalysisEditorGraphBean" class="kieker.webgui.beans.view.CurrentAnalysisEditorGraphBean" scope="view"/> <bean id="currentCockpitBean" class="kieker.webgui.beans.view.CurrentCockpitBean" scope="view"> <property name="projectsBean" ref="projectsBean"/> - <property name="projectManagerFacade" ref="projectManagerFacade" /> + <property name="projectManagerFacade" ref="projectManager" /> </bean> <bean id="currentCockpitEditorBean" class="kieker.webgui.beans.view.CurrentCockpitEditorBean" scope="view"> <property name="globalPropertiesBean" ref="globalPropertiesBean"/> - <property name="projectManagerFacade" ref="projectManagerFacade" /> + <property name="projectManagerFacade" ref="projectManager" /> <property name="projectsBean" ref="projectsBean"/> </bean> <bean id="currentControllerBean" class="kieker.webgui.beans.view.CurrentControllerBean" scope="view"> <property name="projectsBean" ref="projectsBean"/> - <property name="projectManagerFacade" ref="projectManagerFacade" /> + <property name="projectManagerFacade" ref="projectManager" /> </bean> <bean id="currentProjectOverviewBean" class="kieker.webgui.beans.view.CurrentProjectOverviewBean" scope="view" init-method="initialialize"> <property name="projectsBean" ref="projectsBean"/> </bean> <bean id="currentUserManagementBean" class="kieker.webgui.beans.view.CurrentUserManagementBean" init-method="initialialize" scope="view"> - <property name="userManagerFacade" ref="userManagerFacade"/> + <property name="userManagerFacade" ref="userManager"/> </bean> <!-- The request scoped beans. --> diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml index 96f3c344..d323eaec 100644 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml +++ b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml @@ -19,7 +19,7 @@ <!-- This parameter makes sure that the primefaces theme chooser will work. --> <context-param> <param-name>primefaces.THEME</param-name> - <param-value>#{currentConfigurationBean.lookAndFeel}</param-value> + <param-value>#{userBean.lookAndFeel}</param-value> </context-param> <context-param> diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/SettingsDialog.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/SettingsDialog.xhtml index a0776c0c..bc4bdcdf 100644 --- a/Kieker.WebGUI/src/main/webapp/dialogs/SettingsDialog.xhtml +++ b/Kieker.WebGUI/src/main/webapp/dialogs/SettingsDialog.xhtml @@ -11,7 +11,7 @@ <p:tab title="#{localizedMessages.common}"> <h:panelGrid columns="2" cellpadding="10" columnClasses="rightAlignedColumn, normalColumn"> <h:outputText value="#{localizedMessages.lookAndFeel}:" /> - <p:themeSwitcher value="#{currentConfigurationBean.lookAndFeel}" style="width:150px" effect="fade"> + <p:themeSwitcher value="#{userBean.lookAndFeel}" style="width:150px" effect="fade"> <f:selectItem itemLabel="#{localizedMessages.chooseTheme}" itemValue="" /> <f:selectItems value="#{themeSwitcherBean.themes}" /> </p:themeSwitcher> @@ -31,10 +31,10 @@ </p:selectOneMenu> <h:outputText value="#{localizedMessages.gridSize}:"/> - <p:spinner style="width: 100%" value="#{currentConfigurationBean.gridSize}" valueChangeListener="#{currentAnalysisEditorBean.gridSizeListener}" suffix=" [px]"/> + <p:spinner style="width: 100%" value="#{userBean.gridSize}" valueChangeListener="#{currentAnalysisEditorBean.gridSizeListener}" suffix=" [px]"/> <h:outputText value="#{localizedMessages.gridColor}:"/> - <p:colorPicker style="width: 100%" value="#{currentConfigurationBean.gridColor}" valueChangeListener="#{currentAnalysisEditorBean.gridColorListener}"/> + <p:colorPicker style="width: 100%" value="#{userBean.gridColor}" valueChangeListener="#{currentAnalysisEditorBean.gridColorListener}"/> </h:panelGrid> </p:tab> <p:tab title="#{localizedMessages.analysisController}" disabled="true"> -- GitLab