From a9a950563f3df90876311a294542a49a024adf60 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Fri, 14 Sep 2012 19:41:55 +0200 Subject: [PATCH] Modified some PMD rules; Changed some code for quality reasons --- .../config/quality-config/pmdrules.xml | 3 + .../application/GlobalPropertiesBean.java | 50 ++--- .../beans/application/ProjectsBean.java | 14 +- .../kieker/webgui/beans/session/UserBean.java | 16 +- .../beans/view/CurrentAnalysisEditorBean.java | 19 +- .../view/CurrentAnalysisEditorGraphBean.java | 2 +- .../webgui/beans/view/CurrentCockpitBean.java | 186 ++++++------------ .../beans/view/CurrentCockpitEditorBean.java | 2 +- .../beans/view/CurrentControllerBean.java | 45 +++-- .../webgui/common/ProjectManagerFacade.java | 11 +- .../kieker/webgui/common/util/ACManager.java | 4 + .../kieker/webgui/common/util/Analysis.java | 145 ++++++-------- .../kieker/webgui/common/util/FSManager.java | 4 +- .../webgui/common/util/PluginFinder.java | 29 ++- .../webgui/common/util/package-info.java | 27 +++ .../src/main/webapp/AnalysisEditor.xhtml | 2 +- .../src/main/webapp/Controller.xhtml | 2 +- .../src/main/webapp/ProjectOverview.xhtml | 4 +- 18 files changed, 261 insertions(+), 304 deletions(-) create mode 100644 Kieker.WebGUI/src/main/java/kieker/webgui/common/util/package-info.java diff --git a/Kieker.WebGUI/config/quality-config/pmdrules.xml b/Kieker.WebGUI/config/quality-config/pmdrules.xml index ce632a01..47c4870b 100644 --- a/Kieker.WebGUI/config/quality-config/pmdrules.xml +++ b/Kieker.WebGUI/config/quality-config/pmdrules.xml @@ -28,6 +28,8 @@ <exclude name="OnlyOneReturn"/> <exclude name="UnusedModifier"/> <exclude name="UnnecessaryConstructor"/> + <exclude name="UseConcurrentHashMap"/> + <exclude name="AssignmentInOperand"/> </rule> <!--<rule ref="rulesets/coupling.xml">--> @@ -65,6 +67,7 @@ <exclude name="AvoidCatchingNPE"/> <exclude name="AvoidThrowingNullPointerException"/> <exclude name="SignatureDeclareThrowsException"/> + <exclude name="AvoidCatchingGenericException"/> </rule> <rule ref="rulesets/strings.xml"> 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 index 2d868911..64fdbeda 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/GlobalPropertiesBean.java @@ -30,9 +30,9 @@ 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. + * The class {@link GlobalPropertiesBean} is an application-scoped JSF bean, containing the necessary properties and constants for the application. It reads them + * from one or more properties-files to allow the simple modification of parameters without a necessary recompiling of the whole application.<br> + * It is application-scoped as only one instance of this class is necessary. * * @author Nils Christian Ehmke * @version 1.0 @@ -40,41 +40,17 @@ import kieker.common.logging.LogFactory; @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 static final Log LOG = LogFactory.getLog(GlobalPropertiesBean.class); + private final Properties globalProperties = new Properties(); /** @@ -94,7 +70,7 @@ public final class GlobalPropertiesBean { /** * Delivers the default theme. * - * @return The stored value of the property. + * @return The value of the property. */ public String getDefaultTheme() { return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_DEFAULT_THEME); @@ -103,7 +79,7 @@ public final class GlobalPropertiesBean { /** * Delivers the name of the theme cookie. * - * @return The stored value of the property. + * @return The value of the property. */ public String getThemeCookieName() { return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_THEME_COOKIE_NAME); @@ -112,7 +88,7 @@ public final class GlobalPropertiesBean { /** * Delivers the key name of the theme within the faces context. * - * @return The stored value of the property. + * @return The value of the property. */ public String getFacesContextThemeKey() { return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_FACES_CONTEXT_THEME_KEY); @@ -121,7 +97,7 @@ public final class GlobalPropertiesBean { /** * Delivers the key name of the theme within the faces context. * - * @return The stored value of the property. + * @return The value of the property. */ public String getProjectOverviewPage() { return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_PROJECT_OVERVIEW_PAGE); @@ -130,7 +106,7 @@ public final class GlobalPropertiesBean { /** * Delivers the welcome message. * - * @return The stored value of the property. + * @return The value of the property. */ public String getWelcomeMessage() { return this.globalProperties.getProperty(GlobalPropertiesBean.PROPERTY_WELCOME_MESSAGE); @@ -139,7 +115,7 @@ public final class GlobalPropertiesBean { /** * Delivers the short welcome message. * - * @return The stored value of the property. + * @return The 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 7d0eb40c..5e0295d5 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 @@ -57,13 +57,11 @@ import kieker.webgui.common.exception.ProjectNotExistingException; @ApplicationScoped public final class ProjectsBean { - /** - * This is the log instance which is used by all instances of the {@link ProjectsBean}. All error and exceptions will be logged with this instance. - */ private static final Log LOG = LogFactory.getLog(ProjectsBean.class); - /** - * This list contains all available projects by name. It is synchronized as a simple synchronized list, as the fine grained synchronization isn't necessary here. - */ + + private static final String DEFAULT_TIMESTAMP = "N/A"; + private static final String DEFAULT_ANALYSIS_STATE = ""; + private final List<String> projects = Collections.synchronizedList(new ArrayList<String>()); private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); @@ -187,7 +185,7 @@ public final class ProjectsBean { } catch (final ProjectNotExistingException ex) { ProjectsBean.LOG.info("A project with the given name does not exist.", ex); // We can assume that something went wrong - return "N/A"; + return ProjectsBean.DEFAULT_TIMESTAMP; } } @@ -216,7 +214,7 @@ public final class ProjectsBean { return this.projectManagerFacade.getCurrentState(project).toString(); } catch (final ProjectNotExistingException ex) { ProjectsBean.LOG.info("A project with the given name does not exist.", ex); - return ""; + return ProjectsBean.DEFAULT_ANALYSIS_STATE; } } 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 e52c4a38..e202446b 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 @@ -38,11 +38,10 @@ import org.primefaces.context.RequestContext; @ManagedBean @SessionScoped public final class UserBean { - /** - * This field contains the name of the user. - */ - private String userName; + private static final String WELCOME_MSG_TEMPLATE = "growlComp.renderMessage({summary : '%s', detail : '%s', severity: 'info'});"; + + private String userName; @ManagedProperty(value = "#{globalPropertiesBean}") private GlobalPropertiesBean globalPropertiesBean; @@ -78,7 +77,11 @@ public final class UserBean { * @return The new page. */ public String login() { - return this.globalPropertiesBean.getProjectOverviewPage(); + if (this.globalPropertiesBean != null) { + return this.globalPropertiesBean.getProjectOverviewPage(); + } else { + return ""; + } } /** @@ -105,8 +108,7 @@ public final class UserBean { */ public void showWelcomeMessage() { if (this.globalPropertiesBean != null) { - final String welcomeMsgTemplate = "growlComp.renderMessage({summary : '%s', detail : '%s', severity: 'info'});"; - final String finalMsg = String.format(welcomeMsgTemplate, this.globalPropertiesBean.getShortWelcomeMessage(), + final String finalMsg = String.format(UserBean.WELCOME_MSG_TEMPLATE, 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 782ef4c2..307beb5f 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 @@ -119,10 +119,6 @@ public final class CurrentAnalysisEditorBean { * meanwhile. */ private long timeStamp; - /** - * This flag determines whether the project has been modified internally and can be used to warn the user about unsaved changes. - */ - private boolean modified; /** * This list contains the available repositories for the current project. Keep in mind: The list doesn't really contain classes from the type * {@code AbstractRepository}, as the repositories are loaded with the specific project class loader. This is just possible as the generic-classes work @@ -241,12 +237,14 @@ public final class CurrentAnalysisEditorBean { this.initializeModelLibraries(); // Load the available readers, filters and repositories this.initializeToolPalette(); - // The project hasn't been modified (yet) - this.modified = false; } } catch (final ProjectLoadException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while loading the project.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); + } catch (final NullPointerException ex) { + // This exception can occur, when a property has not been initialized + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the project.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); } } } @@ -385,7 +383,7 @@ public final class CurrentAnalysisEditorBean { private void reloadClassLoader() throws ProjectLoadException { synchronized (this) { try { - this.classLoader = this.projectManagerFacade.getClassLoader(this.projectName); + this.classLoader = this.projectManagerFacade.getClassLoader(this.projectName); // NOPMD (ClassLoader) } catch (final NullPointerException ex) { throw new ProjectLoadException("Invalid class loader.", ex); } catch (final IOException ex) { @@ -676,6 +674,10 @@ public final class CurrentAnalysisEditorBean { } catch (final ProjectNotExistingException ex) { CurrentAnalysisEditorBean.LOG.error("The project does not exist.", ex); return new ArrayList<String>(); + } catch (final NullPointerException ex) { + // This exception occurs when a property has not been initialized correctly. + CurrentAnalysisEditorBean.LOG.error("A null pointer exception occured.", ex); + return new ArrayList<String>(); } } } @@ -720,7 +722,6 @@ public final class CurrentAnalysisEditorBean { CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_INFO, "Project saved."); // Update the time stamp! this.resetTimeStamp(); - this.modified = false; } catch (final IOException ex) { CurrentAnalysisEditorBean.LOG.error("An error occured while saving the project.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while saving the project."); @@ -845,7 +846,6 @@ public final class CurrentAnalysisEditorBean { this.project.getRepositories().add(repository); this.currentAnalysisEditorGraphBean.addRepository(repository); this.currentAnalysisEditorGraphBean.refreshGraph(); - this.modified = true; } } @@ -881,7 +881,6 @@ public final class CurrentAnalysisEditorBean { this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin); } this.currentAnalysisEditorGraphBean.refreshGraph(); - this.modified = true; } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorGraphBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorGraphBean.java index 63caeeb8..4e2db8f3 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorGraphBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentAnalysisEditorGraphBean.java @@ -129,7 +129,7 @@ public class CurrentAnalysisEditorGraphBean { private CurrentAnalysisEditorBean currentAnalysisEditorBean; /** - * Creates a new instance of this class. + * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by JSF.</b> */ public CurrentAnalysisEditorGraphBean() { // No code necessary 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 031ce5e3..23b92a95 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 @@ -21,27 +21,28 @@ package kieker.webgui.beans.view; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; +import javax.faces.application.FacesMessage; +import javax.faces.application.FacesMessage.Severity; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; -import kieker.analysis.display.HtmlText; -import kieker.analysis.display.Image; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIView; +import kieker.common.logging.Log; +import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.ProjectsBean; import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.IProjectManagerFacade; import kieker.webgui.common.ProjectManagerFacade; -import kieker.webgui.common.exception.ProjectLoadException; +import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.ProjectNotExistingException; /** - * The {@link CurrentCockpitBean} contains the necessary data behind an instance of the cockpit. It provides methods to read the state of the currently - * selected project.<br> + * The {@link CurrentCockpitBean} contains the necessary data behind an instance of the cockpit. It provides methods to read the state of the currently selected + * project.<br> * The class is a JSF managed bean with view scope to make sure that one user (even in one session) can open multiple projects at a time without causing any * problems. * @@ -52,26 +53,18 @@ import kieker.webgui.common.exception.ProjectNotExistingException; @ViewScoped public class CurrentCockpitBean { - /** - * This is the name of the stored project. It can be used as an identifier within the FS-Manager - */ + private static final Log LOG = LogFactory.getLog(CurrentCockpitBean.class); + + private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); private String projectName; - /** - * This is the actual model instance. It is the in-memory-model of the current (session) user. - */ private MIProject project; - /** - * This is the currently active view. - */ private MIView activeView; - + private ClassAndMethodContainer classAndMethodContainer; @ManagedProperty(value = "#{projectsBean}") private ProjectsBean projectsBean; - private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); - private ClassAndMethodContainer classAndMethodContainer; /** - * Creates a new instance of this class. + * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by JSF.</b> */ public CurrentCockpitBean() { // No code necessary @@ -127,25 +120,31 @@ public class CurrentCockpitBean { /** * This method initializes the bean by using the current project name to load the project. <b>Do not call this method manually. It will only be accessed by * JSF.</b> - * - * @throws ProjectLoadException - * If something went wrong during the initialization. */ - public void initalize() throws ProjectLoadException { - try { - synchronized (this) { + public void initalize() { + synchronized (this) { + try { // Make sure that the initialization will only be done for the init request. - if (!FacesContext.getCurrentInstance().isPostback() && (this.projectsBean != null)) { + if (!FacesContext.getCurrentInstance().isPostback()) { // Remember the given parameters this.project = this.projectsBean.openProject(this.projectName); if (this.project != null) { - this.classAndMethodContainer = new ClassAndMethodContainer(this.projectManagerFacade.getClassLoader(this.projectName)); + final ClassLoader classLoader = this.projectManagerFacade.getClassLoader(this.projectName); // NOPMD (ClassLoader) + this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); } } + } catch (final ProjectNotExistingException ex) { + CurrentCockpitBean.LOG.error("An error occured while loading the project.", ex); + CurrentCockpitBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); + } catch (final IOException ex) { + CurrentCockpitBean.LOG.error("An error occured while loading the project.", ex); + CurrentCockpitBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); + } catch (final NullPointerException ex) { + // This exception occurs, when the projectsBean has not been initialized + CurrentCockpitBean.LOG.error("An error occured while loading the project.", ex); + CurrentCockpitBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); } - } catch (final ProjectNotExistingException ex) { - } catch (final IOException ex) { } } @@ -165,124 +164,41 @@ public class CurrentCockpitBean { * * @param displayName * The name of the display. - * @return The current content of the display, if it exists. If the display does not exist or the active view is not set 'N/A' will be returned. If the display - * does exist, but the return content is not plain text, null will be returned. + * @return The current content of the display, if it exists. If the display does not exist or the active view is not set 'N/A' will be returned. If an access to + * the display fails, "Error" will be returned. */ public String updatePlainTextDisplay(final String displayName) { - try { - String result; - - synchronized (this) { - if ((this.activeView != null) && (this.projectName != null)) { + synchronized (this) { + if ((this.activeView != null) && (this.projectName != null)) { + try { final Object displayObj = this.projectManagerFacade.getDisplay(this.projectName, this.activeView.getName(), displayName); - if (displayObj == null) { - // The display does not exist - result = "N/A"; - } else { - if (this.classAndMethodContainer.getPlainTextClass().isAssignableFrom(displayObj.getClass())) { - // The display exists and is valid - try { - result = (String) (this.classAndMethodContainer.getPlainTextgetTextMethod().invoke(displayObj, new Object[0])); - } catch (final IllegalAccessException e) { - result = "Error"; - } catch (final IllegalArgumentException e) { - result = "Error"; - } catch (final InvocationTargetException e) { - result = "Error"; - } - } else { - // The display exists, but is not valid - result = null; - } - } - } else { - // The active view is not set - result = "N/A"; + final String result = (String) ClassAndMethodContainer.invokeMethod(this.classAndMethodContainer.getPlainTextgetTextMethod(), displayObj, + "Error"); + return result; + } catch (final DisplayNotFoundException ex) { + CurrentCockpitBean.LOG.warn("Display not found.", ex); } } - - return result; - } catch (final Exception ex) { - return ""; + return "N/A"; } } /** * Delivers the current content for the given display as html text. * - * @param displayName - * The name of the display. - * @return The current content of the display, if it exists. If the display does not exist or the active view is not set 'N/A' will be returned. If the display - * does exist, but the return content is not html text, null will be returned. + * @return Currently this method returns only N/A. */ - public String updateHtmlTextDisplay(final String displayName) { - try { - final String result; - - synchronized (this) { - if ((this.activeView != null) && (this.projectName != null)) { - final Object displayObj = this.projectManagerFacade.getDisplay(this.projectName, this.activeView.getName(), displayName); - if (displayObj == null) { - // The display does not exist - result = "N/A"; - } else { - if (displayObj instanceof HtmlText) { - // The display exists and is valid - result = ((HtmlText) displayObj).toString(); - } else { - // The display exists, but is not valid - result = null; - } - } - } else { - // The active view is not set - result = "N/A"; - } - } - - return result; - } catch (final Exception ex) { - return ""; - } + public String updateHtmlTextDisplay() { + return "N/A"; } /** * Delivers the current content for the given display as Image link. * - * @param displayName - * The name of the display. - * @return The current content of the display, if it exists. If the display does not exist or the active view is not set 'N/A' will be returned. If the display - * does exist, but the return content is not an image, null will be returned. + * @return Currently this method returns only N/A. */ - public String updateImageDisplay(final String displayName) { - try { - final String result; - - synchronized (this) { - if ((this.activeView != null) && (this.projectName != null)) { - final Object displayObj = this.projectManagerFacade.getDisplay(this.projectName, this.activeView.getName(), displayName); - if (displayObj == null) { - // The display does not exist - result = "N/A"; - } else { - if (displayObj instanceof Image) { - // The display exists and is valid - result = ((Image) displayObj).toString(); - } else { - // The display exists, but is not valid - result = null; - } - } - } else { - // The active view is not set - result = "N/A"; - } - } - - return result; - } catch (final Exception ex) { - return ""; - } + public String updateImageDisplay() { + return "N/A"; } /** @@ -307,4 +223,16 @@ public class CurrentCockpitBean { this.activeView = activeView; } } + + /** + * This method shows the current user a message by using the growl-component of PrimeFaces. + * + * @param severity + * The severity of the message. + * @param msg + * The message itself. + */ + private static void showMessage(final Severity severity, final String msg) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg)); + } } 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 7685e4d9..178a1188 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 @@ -95,7 +95,7 @@ public class CurrentCockpitEditorBean { private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); /** - * Creates a new instance of this class. + * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by JSF.</b> */ public CurrentCockpitEditorBean() { // No code necessary 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 94657224..4a11223e 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 @@ -42,9 +42,8 @@ import kieker.webgui.common.exception.ProjectNotExistingException; /** * /** - * The {@link CurrentControllerBean} contains the necessary data behind an instance of the analysis controller. - * The class is a JSF managed bean with view scope to make sure that one user (even in one session) can open multiple projects at a time without causing any - * problems. + * The {@link CurrentControllerBean} contains the necessary data behind an instance of the analysis controller. The class is a JSF managed bean with view scope to + * make sure that one user (even in one session) can open multiple projects at a time without causing any problems. * * @author Nils Christian Ehmke * @version 1.0 @@ -52,24 +51,16 @@ import kieker.webgui.common.exception.ProjectNotExistingException; @ManagedBean @ViewScoped public class CurrentControllerBean { - /** - * This is the log for errors, exceptions etc. - */ + private static final Log LOG = LogFactory.getLog(CurrentControllerBean.class); - /** - * This is the name of the stored project. It can be used as an identifier within the FS-Manager - */ + private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); private String projectName; - /** - * This is the actual model instance. It is the in-memory-model of the current (session) user. - */ private MIProject project; @ManagedProperty(value = "#{projectsBean}") private ProjectsBean projectsBean; - private final IProjectManagerFacade projectManagerFacade = ProjectManagerFacade.getInstance(); /** - * Creates a new instance of this class. + * Creates a new instance of this class. <b>Do not use this constructor. This bean is JSF managed.</b> */ public CurrentControllerBean() { // No code necessary @@ -122,6 +113,10 @@ public class CurrentControllerBean { } catch (final ProjectLoadException ex) { CurrentControllerBean.LOG.error("An error occured while loading the project.", ex); CurrentControllerBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.error("An error occured while loading the project.", ex); + CurrentControllerBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); } } } @@ -188,7 +183,7 @@ public class CurrentControllerBean { public void instantiateAnalysis() { try { synchronized (this) { - this.projectManagerFacade.initializeAnalysis(this.projectName, this.projectManagerFacade.getClassLoader(this.projectName)); + this.projectManagerFacade.initializeAnalysis(this.projectName, this.projectManagerFacade.getClassLoader(this.projectName)); // NOPMD (ClassLoader) } } catch (final AnalysisStateException ex) { CurrentControllerBean.LOG.error("The analysis has already been instantiated.", ex); @@ -231,6 +226,10 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); return false; + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.warn("A null pointer exception occured.", ex); + return false; } } } @@ -247,6 +246,10 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); return false; + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.warn("A null pointer exception occured.", ex); + return false; } } } @@ -263,6 +266,10 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); return true; + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.warn("A null pointer exception occured.", ex); + return true; } } } @@ -279,6 +286,10 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); return false; + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.warn("A null pointer exception occured.", ex); + return false; } } } @@ -295,6 +306,10 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); return false; + } catch (final NullPointerException ex) { + // This exception can occur, when the projectsBean has not been initialized + CurrentControllerBean.LOG.warn("A null pointer exception occured.", ex); + return false; } } } 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 d7fb1a65..1d181dcd 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java @@ -159,7 +159,7 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { final Object projectLock = this.getLock(projectName, this.fileSystemLocks); synchronized (projectLock) { - return FSManager.getInstance().getClassLoader(projectName); + return FSManager.getInstance().getClassLoader(projectName); // NOPMD (ClassLoader) } } @@ -170,7 +170,8 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { synchronized (projectLock) { try { - return PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); + return PluginFinder.getInstance() + .getAllRepositoriesWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); } catch (final MalformedURLException ex) { throw new LibraryLoadException("An error occured while loading the library.", ex); } @@ -184,7 +185,7 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { synchronized (projectLock) { try { - return PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); + return PluginFinder.getInstance().getAllPluginsWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); } catch (final MalformedURLException ex) { throw new LibraryLoadException("An error occured while loading the library.", ex); } @@ -195,7 +196,7 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { public List<Class<AbstractRepository>> getAllRepositoriesWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException { try { - return PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); + return PluginFinder.getInstance().getAllRepositoriesWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); } catch (final NullPointerException ex) { throw new LibraryLoadException("An error occured while loading the library.", ex); @@ -206,7 +207,7 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { public List<Class<AbstractPlugin>> getAllPluginsWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException { try { - return PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); + return PluginFinder.getInstance().getAllPluginsWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); } catch (final NullPointerException ex) { throw new LibraryLoadException("An error occured while loading the library.", ex); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java index 6ff24db5..8d2ad4dc 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java @@ -194,6 +194,10 @@ public final class ACManager { final Analysis analysis = this.analyses.get(projectName); final Enum<?> state = analysis.getCurrentState(); + if (state == null) { + throw new ProjectNotExistingException("Unknown state."); + } + if (STATE.FAILED.toString().equals(state.toString())) { return STATE.FAILED; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java index c62914ac..edc6d09b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java @@ -21,7 +21,6 @@ package kieker.webgui.common.util; import java.io.File; -import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; @@ -29,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap; import javax.annotation.PostConstruct; -import kieker.analysis.plugin.AbstractPlugin; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.ClassAndMethodContainer; @@ -43,13 +41,9 @@ import kieker.webgui.common.exception.ProjectLoadException; * @version 1.0 */ public class Analysis { - /** - * This is the log for errors, exceptions etc. - */ private static final Log LOG = LogFactory.getLog(Analysis.class); private static final long MAX_THREAD_WAIT_TIME_MS = 1000; private final ClassAndMethodContainer classAndMethodContainer; - private final Object modelProject; private final Object analysisController; private final Object analysisControllerThread; private final UpdateDisplaysThread updateDisplaysThread; @@ -69,14 +63,15 @@ public class Analysis { this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); final Method createMethod = this.classAndMethodContainer.getAnalysisControllerCreateAnalysisController(); - this.modelProject = ClassAndMethodContainer.invokeClassMethod(this.classAndMethodContainer.getAnalysisControllerLoadFromFile(), null, projectFile); - final Object controllerAndMapping = ClassAndMethodContainer.invokeClassMethod(createMethod, null, this.modelProject, classLoader); + final Object modelProject = ClassAndMethodContainer.invokeClassMethod(this.classAndMethodContainer.getAnalysisControllerLoadFromFile(), null, + projectFile); + final Object controllerAndMapping = ClassAndMethodContainer.invokeClassMethod(createMethod, null, modelProject, classLoader); this.analysisController = ClassAndMethodContainer.invokeMethod(this.classAndMethodContainer.getAnalysisControllerWithMappingGetController(), controllerAndMapping, null); this.analysisControllerThread = ClassAndMethodContainer.invokeConstructor(this.classAndMethodContainer.getAnalysisControllerThreadConstructor(), this.analysisController); - this.updateDisplaysThread = new UpdateDisplaysThread(ClassAndMethodContainer.invokeMethod( - this.classAndMethodContainer.getAnalysisControllerWithMappingGetMapping(), controllerAndMapping, null)); + this.updateDisplaysThread = new UpdateDisplaysThread();// ClassAndMethodContainer.invokeMethod( + // this.classAndMethodContainer.getAnalysisControllerWithMappingGetMapping(), controllerAndMapping, null)); if ((this.analysisController == null) || (this.analysisControllerThread == null)) { throw new AnalysisStateException("An error occured while instantiating the analysis."); } @@ -118,7 +113,7 @@ public class Analysis { synchronized (this) { try { this.classAndMethodContainer.getAnalysisControllerThreadTerminate().invoke(this.analysisControllerThread, new Object[0]); - // this.updateDisplaysThread.terminate(); + this.updateDisplaysThread.terminate(); this.classAndMethodContainer.getAnalysisControllerThreadJoin().invoke(this.analysisControllerThread, Analysis.MAX_THREAD_WAIT_TIME_MS); this.updateDisplaysThread.join(Analysis.MAX_THREAD_WAIT_TIME_MS); @@ -167,28 +162,16 @@ public class Analysis { * @author Nils Christian Ehmke * @version 1.0 */ - private class UpdateDisplaysThread extends Thread { + private static class UpdateDisplaysThread extends Thread { - /** - * This is the time the thread waits between the updates. - */ private static final long SLEEP_TIME_MS = 2 * 1000; - private final Object pluginMap; - /** - * The map containing all available display objects. - */ + // private final Object pluginMap; private final Map<String, Map<String, Object>> displayObjects = new ConcurrentHashMap<String, Map<String, Object>>(); // NOPMD - /** - * This map contains the mapping to get the methods to be called. - */ - private final Map<Object, Method> methodMap = new ConcurrentHashMap<Object, Method>(); // NOPMD (Use of concurrent hash map) - /** - * The field determining whether the thread has been terminated or not. // (USeConcurrentHashMap) - */ + // private final Map<Object, Method> methodMap = new ConcurrentHashMap<Object, Method>(); // NOPMD (Use of concurrent hash map) private volatile boolean terminated = false; - public UpdateDisplaysThread(final Object object) { - this.pluginMap = object; + public UpdateDisplaysThread() { + // this.pluginMap = object; } @PostConstruct @@ -239,29 +222,31 @@ public class Analysis { * The name within the display-annotation. * @return The method instance. */ - private Method getDisplayMethod(final Class<? extends AbstractPlugin> clazz, final String displayName) { - final Method[] methods = clazz.getMethods(); - for (final Method method : methods) { - try { - final Annotation displayAnnot = method.getAnnotation(Analysis.this.classAndMethodContainer.getDisplayAnnotationClass()); - if ((displayAnnot != null) - && (Analysis.this.classAndMethodContainer.getDisplayNameMethod().invoke(displayAnnot, new Object[0]).equals(displayName))) { - // We found the correct method - return method; - } - } catch (final IllegalAccessException ex) { - // Log this exception, but ignore it - Analysis.LOG.info("An error occured while calling a method.", ex); - } catch (final IllegalArgumentException ex) { - // Log this exception, but ignore it - Analysis.LOG.info("An error occured while calling a method.", ex); - } catch (final InvocationTargetException ex) { - // Log this exception, but ignore it - Analysis.LOG.info("An error occured while calling a method.", ex); - } - } - return null; - } + /* + * private Method getDisplayMethod(final Class<? extends AbstractPlugin> clazz, final String displayName) { + * final Method[] methods = clazz.getMethods(); + * for (final Method method : methods) { + * try { + * final Annotation displayAnnot = method.getAnnotation(Analysis.this.classAndMethodContainer.getDisplayAnnotationClass()); + * if ((displayAnnot != null) + * && (Analysis.this.classAndMethodContainer.getDisplayNameMethod().invoke(displayAnnot, new Object[0]).equals(displayName))) { + * // We found the correct method + * return method; + * } + * } catch (final IllegalAccessException ex) { + * // Log this exception, but ignore it + * Analysis.LOG.info("An error occured while calling a method.", ex); + * } catch (final IllegalArgumentException ex) { + * // Log this exception, but ignore it + * Analysis.LOG.info("An error occured while calling a method.", ex); + * } catch (final InvocationTargetException ex) { + * // Log this exception, but ignore it + * Analysis.LOG.info("An error occured while calling a method.", ex); + * } + * } + * return null; + * } + */ /** * Delivers the display object for the given view and the given display. @@ -278,36 +263,36 @@ public class Analysis { @Override public void run() { - // Run until we have been interrupted - // while (!this.terminated) { - // for (final MIView view : Analysis.this.modelProject.getViews()) { - // this.displayObjects.get(view.getName()); - // for (final MIDisplayConnector displayConnector : view.getDisplayConnectors()) { - // final Object displayObject = viewMap.get(displayConnector.getName()); - // final Object pluginObject = this.pluginMap.get(displayConnector.getDisplay().getParent()); - // Update the display object - // try { - // this.methodMap.get(displayObject).invoke(pluginObject, displayObject); - // } catch (final IllegalAccessException ex) { - // Analysis.LOG.error("An error occured while updating the display.", ex); - // } catch (final IllegalArgumentException ex) { - // Analysis.LOG.error("An error occured while updating the display.", ex); - // } catch (final InvocationTargetException ex) { - // Analysis.LOG.error("An error occured while updating the display.", ex); - // } catch (final NullPointerException ex) { // NOPMD - // Analysis.LOG.error("An error occured while updating the display.", ex); - // } - // } - // } + // Run until we final have been interrupted + while (!this.terminated) { + // for (final MIView view : Analysis.this.modelProject.getViews()) { + // this.displayObjects.get(view.getName()); + // for (final MIDisplayConnector displayConnector : view.getDisplayConnectors()) { + // final Object displayObject = viewMap.get(displayConnector.getName()); + // final Object pluginObject = this.pluginMap.get(displayConnector.getDisplay().getParent()); + // Update the display object + // try { + // this.methodMap.get(displayObject).invoke(pluginObject, displayObject); + // } catch (final IllegalAccessException ex) { + // Analysis.LOG.error("An error occured while updating the display.", ex); + // } catch (final IllegalArgumentException ex) { + // Analysis.LOG.error("An error occured while updating the display.", ex); + // } catch (final InvocationTargetException ex) { + // Analysis.LOG.error("An error occured while updating the display.", ex); + // } catch (final NullPointerException ex) { // NOPMD + // Analysis.LOG.error("An error occured while updating the display.", ex); + // } + // } + // } - // Wait a little bit. - // try { - // Thread.sleep(UpdateDisplaysThread.SLEEP_TIME_MS); - // / } catch (final InterruptedException ex) { - // // We have been interrupted. Exit the thread - // return; - // } - // } + // Wait a little bit. + try { + Thread.sleep(UpdateDisplaysThread.SLEEP_TIME_MS); + } catch (final InterruptedException ex) { + // We have been interrupted. Exit the thread + return; + } + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java index 10fed1a1..4170b7a5 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java @@ -175,7 +175,7 @@ public final class FSManager { final boolean deleteResults = libDirDeleted && projectFileDeleted && projectDeleted; // Rethrow the exception in order to inform the caller of this method - throw ex; + throw new IOException("An IO Exception occured while saving the project.", ex); } } @@ -234,7 +234,7 @@ public final class FSManager { final boolean deleteResults = libDirDeleted && projectFileDeleted && projectDeleted; // Rethrow the exception in order to inform the caller of this method - throw ex; + throw new IOException("An IO Exception occured while copying the project.", ex); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java index e8faa575..9bde9807 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java @@ -37,6 +37,16 @@ import kieker.webgui.common.ClassAndMethodContainer; * @version 1.0 */ public final class PluginFinder { + + private static final PluginFinder INSTANCE = new PluginFinder(); + + /** + * The default constructor. + */ + private PluginFinder() { + // No code necessary + } + /** * This method delivers all classes which are available in the given jar and are compatible with <code>AbstractRepository</code>). * @@ -44,10 +54,10 @@ public final class PluginFinder { * The url for the jar. * @return A list containing all available repository-classes or null, if an exception occurred. */ - public static List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url, final ClassLoader classLoader, + public List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) { // Get a list containing all available classes within the given jar - final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); + final List<Class<?>> clazzes = this.getAllClassesWithinJar(url, classLoader); List<Class<AbstractRepository>> result = null; @@ -75,9 +85,9 @@ public final class PluginFinder { * The class loader used to load the classes. * @return A list containing all available plugin-classes or null, if an exception occurred. */ - public static List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url, final ClassLoader classLoader, + public List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) { - final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); + final List<Class<?>> clazzes = this.getAllClassesWithinJar(url, classLoader); List<Class<AbstractPlugin>> result = null; if (clazzes != null) { @@ -103,7 +113,7 @@ public final class PluginFinder { * The class loader used to load the classes. * @return A list containing all available classes or null, if an exception occurred. */ - private static List<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) { + private List<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) { JarInputStream stream = null; try { final List<Class<?>> result = new ArrayList<Class<?>>(); @@ -139,4 +149,13 @@ public final class PluginFinder { } return null; } + + /** + * Returns the one and only instance of this class. + * + * @return The only class instance. + */ + public static PluginFinder getInstance() { + return PluginFinder.INSTANCE; + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/package-info.java new file mode 100644 index 00000000..74fa9c22 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/package-info.java @@ -0,0 +1,27 @@ +/*************************************************************************** + * 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. + ***************************************************************************/ + +/** + * This package contains utility classes, which are used in the parent-package. The classes within this package are not for public use. They should only be used by + * the classes in {@code kieker.webgui.common}. + * + * @author Nils Christian Ehmke + */ +package kieker.webgui.common.util; \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml index 65d1fd5d..071ef42c 100644 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml @@ -69,7 +69,7 @@ <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?faces-redirect=true"> - <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" /> + <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" rendered="#{not empty currentAnalysisEditorBean.projectName}" /> </p:button> <p:separator/> <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" disabled="true"> diff --git a/Kieker.WebGUI/src/main/webapp/Controller.xhtml b/Kieker.WebGUI/src/main/webapp/Controller.xhtml index 4a365f82..72715891 100644 --- a/Kieker.WebGUI/src/main/webapp/Controller.xhtml +++ b/Kieker.WebGUI/src/main/webapp/Controller.xhtml @@ -33,7 +33,7 @@ <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?faces-redirect=true"> - <f:param name="projectName" value="#{currentControllerBean.projectName}" /> + <f:param name="projectName" value="#{currentControllerBean.projectName}" rendered="#{not empty currentControllerBean.projectName}" /> </p:button> <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" disabled="true"> </p:button> diff --git a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml index 8ea8ebcb..fd67f460 100644 --- a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml +++ b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml @@ -24,10 +24,10 @@ <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?faces-redirect=true"> - <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}"/> + <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" rendered="#{not empty currentProjectOverviewBean.projectName}"/> </p:button> <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}"/> + <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" rendered="#{not empty currentProjectOverviewBean.projectName}"/> </p:button> <p:separator/> <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" disabled="true"> -- GitLab