diff --git a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar index 16506330416aca9510d1f05dbfd405bb776b31bd..ce5c3fec4b7d7afd9df08081d70171ea142193e6 100644 Binary files a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar and b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar differ 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 78e850444baad5b6c59fafeb05f750f495b2b383..7fc69bbb03fb305c7d0d8e1fc9cd848c0b61746b 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 @@ -155,6 +155,8 @@ public final class ProjectsBean { * @param project * The name of the project to be opened. * @return Either the model instance if the loading was successful or null otherwise. In the latter case, the user will be informed via the growl-component. + * @throws ProjectLoadException + * If something went wrong during the loading of the project. */ public MIProject openProject(final String project) throws ProjectLoadException { try { 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 5130acd212e9d587c47920c72fcd2ac94063c7cb..dbdbf69a72a2f724af161457892c90b09ff8a8a7 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 @@ -24,8 +24,6 @@ import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -61,9 +59,9 @@ 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.PluginFinder; import kieker.webgui.common.ProjectManagerFacade; import kieker.webgui.common.exception.LibraryAlreadyExistingException; +import kieker.webgui.common.exception.LibraryLoadException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -108,11 +106,6 @@ public final class CurrentAnalysisEditorBean { * library by default. */ private ClassLoader classLoader; - /** - * This is the plugin finder for the current project. It contains always a reference to the correct {@link CurrentAnalysisEditorBean#classLoader} to be able to - * locate the available plugins and repositories. - */ - private PluginFinder pluginFinder; /** * This component contains the classes and methods loaded with the specific project class loader. */ @@ -274,6 +267,7 @@ public final class CurrentAnalysisEditorBean { * This method loads the list of available readers, filters and repositories, using the current libraries within the model. * * @throws ProjectLoadException + * If something went wrong during the loading of the libraries. */ private void initializeToolPalette() throws ProjectLoadException { synchronized (this) { @@ -285,17 +279,29 @@ public final class CurrentAnalysisEditorBean { // Run through all libraries and add their content to our lists for (final MIDependency lib : this.project.getDependencies()) { - this.addContentsToToolPalette(this.projectManagerFacade.getURL(lib, this.projectName)); + this.addContentsToToolPalette(lib); } // Run also through the kieker library - this.addContentsToToolPalette(this.projectManagerFacade.getKiekerURL()); - } catch (final MalformedURLException ex) { + this.addKiekerContentsToToolPalette(); + } catch (final LibraryLoadException ex) { CurrentAnalysisEditorBean.LOG.error("A library could not be loaded correctly.", ex); throw new ProjectLoadException("A library could not be loaded correctly.", ex); } } } + private void addContentsToToolPalette(final MIDependency dependency) throws LibraryLoadException { + this.addContentsToToolPalette( + this.projectManagerFacade.getAllPluginsWithinLib(dependency, this.projectName, this.classLoader, this.classAndMethodContainer), + this.projectManagerFacade.getAllRepositoriesWithinLib(dependency, this.projectName, this.classLoader, this.classAndMethodContainer)); + } + + private void addKiekerContentsToToolPalette() throws LibraryLoadException { + this.addContentsToToolPalette( + this.projectManagerFacade.getAllPluginsWithinKiekerLib(this.classLoader, this.classAndMethodContainer), + this.projectManagerFacade.getAllRepositoriesWithinKiekerLib(this.classLoader, this.classAndMethodContainer)); + } + /** * This method adds all available readers, filters and repositories within the given library to the lists of this bean. * @@ -303,12 +309,8 @@ public final class CurrentAnalysisEditorBean { * The library url used to load the plugins and repositories. */ @SuppressWarnings("unchecked") - private void addContentsToToolPalette(final URL url) { + private void addContentsToToolPalette(final List<Class<AbstractPlugin>> plugins, final List<Class<AbstractRepository>> repositories) { synchronized (this) { - // Get all repositories and plugins within the given library - final List<Class<AbstractRepository>> repositories = this.pluginFinder.getAllRepositoriesWithinJar(url); - final List<Class<AbstractPlugin>> plugins = this.pluginFinder.getAllPluginsWithinJar(url); - // Now run through the available classes and add all non-abstract classes to our lists for (final Class<AbstractRepository> repository : repositories) { if (!Modifier.isAbstract(repository.getModifiers())) { @@ -336,6 +338,7 @@ public final class CurrentAnalysisEditorBean { * This method takes all libraries from the lib-folder and adds them to the in-memory-model. * * @throws ProjectLoadException + * If something went wrong during the loading of the libraries. */ private void initializeModelLibraries() throws ProjectLoadException { synchronized (this) { @@ -367,9 +370,6 @@ public final class CurrentAnalysisEditorBean { synchronized (this) { try { this.classLoader = this.projectManagerFacade.getClassLoader(this.projectName); - this.pluginFinder = new PluginFinder(this.classLoader); - } catch (final ClassNotFoundException ex) { - throw new ProjectLoadException("Could not load classes.", ex); } catch (final NullPointerException ex) { throw new ProjectLoadException("Invalid class loader.", ex); } catch (final IOException ex) { @@ -611,7 +611,7 @@ public final class CurrentAnalysisEditorBean { // Update our class loader and the available plugins & repositories this.reloadClassLoader(); this.reloadClassesAndMethods(); - this.addContentsToToolPalette(this.projectManagerFacade.getURL(lib, this.projectName)); + this.addContentsToToolPalette(lib); } catch (final LibraryAlreadyExistingException ex) { CurrentAnalysisEditorBean.LOG.info("A library with the same name exists already.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_WARN, "A library with the same name exists already."); @@ -624,6 +624,9 @@ public final class CurrentAnalysisEditorBean { } catch (final ProjectNotExistingException ex) { CurrentAnalysisEditorBean.LOG.error("Project does not exist.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "Project does not exist."); + } catch (final LibraryLoadException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while uploading the library.", ex); + CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while uploading the library."); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java index 40ca7376a26884ef08f5580af86cabedc440662d..804fc092230d16247c2ed2ed0e99cf3fafba83b0 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/IProjectManagerFacade.java @@ -21,17 +21,18 @@ package kieker.webgui.common; import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; import java.util.Collection; import java.util.List; import kieker.analysis.AnalysisController.STATE; import kieker.analysis.model.analysisMetaModel.MIDependency; import kieker.analysis.model.analysisMetaModel.MIProject; +import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.repository.AbstractRepository; import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.LibraryAlreadyExistingException; +import kieker.webgui.common.exception.LibraryLoadException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -183,9 +184,17 @@ public interface IProjectManagerFacade { */ public List<String> listAllLibraries(final String projectName) throws ProjectNotExistingException; - public URL getURL(final MIDependency lib, final String project) throws MalformedURLException; + public List<Class<AbstractRepository>> getAllRepositoriesWithinLib(final MIDependency lib, final String project, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException; - public URL getKiekerURL(); + public List<Class<AbstractPlugin>> getAllPluginsWithinLib(final MIDependency lib, final String project, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException; + + public List<Class<AbstractRepository>> getAllRepositoriesWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) + throws LibraryLoadException; + + public List<Class<AbstractPlugin>> getAllPluginsWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) + throws LibraryLoadException; /** * This method lists all available projects on the file system. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java deleted file mode 100644 index b885bc7c9fc9a7aa8310f897ff42817671b8b1fc..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ - -package kieker.webgui.common; - -/** - * This is a simple helper class which can store two values. - * - * @author Nils Christian Ehmke - * @version 1.0 - * - * @param <F> - * The type of the first element. - * @param <S> - * The type of the second element. - */ -public class Pair<F, S> { - - /** - * This is the first element. - */ - private F fst; - /** - * This is the second element. - */ - private S snd; - - /** - * Creates a new instance of this class with null values stored for the elements. - */ - public Pair() { - // No code necessary - } - - /** - * Creates a new instance of this class using the given values. - * - * @param fst - * The first element to be stored in this object. - * @param snd - * The second element to be stored in this object. - */ - public Pair(final F fst, final S snd) { - this.fst = fst; - this.snd = snd; - } - - /** - * Delivers the first element. - * - * @return The first element. - */ - public F getFst() { - return this.fst; - } - - /** - * Sets the first element to a new value. - * - * @param fst - * The new first element. - */ - public void setFst(final F fst) { - this.fst = fst; - } - - /** - * Delivers the second element. - * - * @return The second element. - */ - public S getSnd() { - return this.snd; - } - - /** - * Sets the second element to a new value. - * - * @param snd - * The new second element. - */ - public void setSnd(final S snd) { - this.snd = snd; - } - -} 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 b8391efd42acd35d480ff88a7e3a7653658dd9a3..81a0cf0930e81a2291371664f419c05b53aac90d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ProjectManagerFacade.java @@ -22,7 +22,6 @@ package kieker.webgui.common; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URL; import java.util.Collection; import java.util.List; import java.util.concurrent.ConcurrentHashMap; @@ -30,12 +29,18 @@ import java.util.concurrent.ConcurrentHashMap; import kieker.analysis.AnalysisController.STATE; import kieker.analysis.model.analysisMetaModel.MIDependency; import kieker.analysis.model.analysisMetaModel.MIProject; +import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.repository.AbstractRepository; import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.LibraryAlreadyExistingException; +import kieker.webgui.common.exception.LibraryLoadException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectNotExistingException; +import kieker.webgui.common.util.ACManager; +import kieker.webgui.common.util.FSManager; +import kieker.webgui.common.util.PluginFinder; import org.primefaces.model.UploadedFile; @@ -159,13 +164,53 @@ public final class ProjectManagerFacade implements IProjectManagerFacade { } @Override - public URL getURL(final MIDependency lib, final String project) throws MalformedURLException { - return FSManager.getInstance().getURL(lib, project); + public List<Class<AbstractRepository>> getAllRepositoriesWithinLib(final MIDependency lib, final String projectName, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException { + final Object projectLock = this.getLock(projectName, this.fileSystemLocks); + + synchronized (projectLock) { + try { + return PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); + } catch (final MalformedURLException ex) { + throw new LibraryLoadException("An error occured while loading the library.", ex); + } + } + } + + @Override + public List<Class<AbstractPlugin>> getAllPluginsWithinLib(final MIDependency lib, final String projectName, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws LibraryLoadException { + final Object projectLock = this.getLock(projectName, this.fileSystemLocks); + + synchronized (projectLock) { + try { + return PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getURL(lib, projectName), classLoader, classAndMethodContainer); + } catch (final MalformedURLException ex) { + throw new LibraryLoadException("An error occured while loading the library.", ex); + } + } + } + + @Override + public List<Class<AbstractRepository>> getAllRepositoriesWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) + throws LibraryLoadException { + try { + return PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); + + } catch (final NullPointerException ex) { + throw new LibraryLoadException("An error occured while loading the library.", ex); + } } @Override - public URL getKiekerURL() { - return FSManager.getInstance().getKiekerURL(); + public List<Class<AbstractPlugin>> getAllPluginsWithinKiekerLib(final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) + throws LibraryLoadException { + try { + return PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getKiekerURL(), classLoader, classAndMethodContainer); + + } catch (final NullPointerException ex) { + throw new LibraryLoadException("An error occured while loading the library.", ex); + } } @Override diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java new file mode 100644 index 0000000000000000000000000000000000000000..35a5e760aedf980cdbfa25a91317f4ce2da7c618 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryLoadException.java @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.common.exception; + + +/** + * This exception shows that a library with the same name exists already. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +public class LibraryLoadException extends Exception { + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance of this class. + */ + public LibraryLoadException() { + // No code necessary + } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + */ + public LibraryLoadException(final String msg) { + super(msg); + } + + public LibraryLoadException(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java similarity index 98% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java index 2b66f0d90a9db39128f0ca195f7cceb2065de0a6..c46299984edca761b2e1e0cba2273e1a38f02d74 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/ACManager.java @@ -18,7 +18,7 @@ * limitations under the License. ***************************************************************************/ -package kieker.webgui.common; +package kieker.webgui.common.util; import java.util.concurrent.ConcurrentHashMap; @@ -34,7 +34,7 @@ import kieker.webgui.common.exception.ProjectNotExistingException; * @author Nils Christian Ehmke * @version 1.0 */ -final class ACManager { +public final class ACManager { /** * This is the singleton instance of this class. */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Analysis.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java similarity index 98% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/Analysis.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java index 92addd1e5ebb488f50a92d790f0c8b7d240ec122..3f281a6d93dfd1d6bffa961e255770de7d83326d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Analysis.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/Analysis.java @@ -1,4 +1,4 @@ -package kieker.webgui.common; +package kieker.webgui.common.util; import java.io.File; import java.lang.annotation.Annotation; @@ -12,10 +12,10 @@ import javax.annotation.PostConstruct; import kieker.analysis.plugin.AbstractPlugin; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; +import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.ProjectLoadException; -// TODO AnalysisController, Thread etc. have to be initialized via the class loader as well public class Analysis { /** * This is the log for errors, exceptions etc. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java similarity index 99% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java index 7aae4fee5c30fdc161112254414a9707d1cc0052..10fed1a189d75d98e175afff85310e2335750c59 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/FSManager.java @@ -18,7 +18,7 @@ * limitations under the License. ***************************************************************************/ -package kieker.webgui.common; +package kieker.webgui.common.util; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -47,6 +47,7 @@ import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; +import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.LibraryAlreadyExistingException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; @@ -62,7 +63,7 @@ import org.primefaces.model.UploadedFile; * @author Nils Christian Ehmke * @version 1.0 */ -final class FSManager { +public final class FSManager { /** * This is the log object used to log messages, warnings etc. */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java similarity index 73% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java index c55b64de2f5a8f93a2a3f279f055ace818a91df0..39f14a9222f20f2ed4f478340bce7fc9386ec557 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/util/PluginFinder.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package kieker.webgui.common; +package kieker.webgui.common.util; import java.io.IOException; import java.net.URL; @@ -28,7 +28,7 @@ import java.util.jar.JarInputStream; import kieker.analysis.plugin.AbstractPlugin; import kieker.analysis.repository.AbstractRepository; -import kieker.webgui.common.exception.ProjectLoadException; +import kieker.webgui.common.ClassAndMethodContainer; /** * This tool class can be used to find all plugins and repositories within a given jar file - assuming that the given class loader knows these jars. @@ -37,23 +37,6 @@ import kieker.webgui.common.exception.ProjectLoadException; * @version 1.0 */ public final class PluginFinder { - - private final ClassAndMethodContainer classAndMethodContainer; - private final ClassLoader classLoader; - - /** - * Creates a new instance of this class, using the given class loader. - * - * @param classLoader - * The {@link ClassLoader} which will be used to load the classes. - * @throws ClassNotFoundException - * @throws ProjectLoadException - */ - public PluginFinder(final ClassLoader classLoader) throws ClassNotFoundException, ProjectLoadException { - this.classLoader = classLoader; - this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); - } - /** * This method delivers all classes which are available in the given jar and are compatible with <code>AbstractRepository</code>). * @@ -61,9 +44,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 List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url) { + public static 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 = this.getAllClassesWithinJar(url); + final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); List<Class<AbstractRepository>> result = null; @@ -71,8 +55,8 @@ public final class PluginFinder { result = new ArrayList<Class<AbstractRepository>>(); for (final Class<?> clazz : clazzes) { // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(this.classAndMethodContainer.getRepositoryAnnotationClass()) - && this.classAndMethodContainer.getAbstractRepositoryClass().isAssignableFrom(clazz)) { + if (clazz.isAnnotationPresent(classAndMethodContainer.getRepositoryAnnotationClass()) + && classAndMethodContainer.getAbstractRepositoryClass().isAssignableFrom(clazz)) { result.add((Class<AbstractRepository>) clazz); } } @@ -91,16 +75,17 @@ 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 List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url) { - final List<Class<?>> clazzes = this.getAllClassesWithinJar(url); + public static List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) { + final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); List<Class<AbstractPlugin>> result = null; if (clazzes != null) { result = new ArrayList<Class<AbstractPlugin>>(); for (final Class<?> clazz : clazzes) { // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(this.classAndMethodContainer.getPluginAnnotationClass()) - && this.classAndMethodContainer.getAbstractPluginClass().isAssignableFrom(clazz)) { + if (clazz.isAnnotationPresent(classAndMethodContainer.getPluginAnnotationClass()) + && classAndMethodContainer.getAbstractPluginClass().isAssignableFrom(clazz)) { result.add((Class<AbstractPlugin>) clazz); } } @@ -118,7 +103,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 List<Class<?>> getAllClassesWithinJar(final URL url) { + private static List<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) { try { final List<Class<?>> result = new ArrayList<Class<?>>(); // Open the jar as a stream and run through all entries within this file @@ -132,7 +117,7 @@ public final class PluginFinder { name = name.replace('/', '.'); name = name.replace(".class", ""); // Try to find a class with the same name and put it into our list - final Class<?> c = this.classLoader.loadClass(name); + final Class<?> c = classLoader.loadClass(name); result.add(c); } catch (final Throwable ex) { // NOPMD (Generic throwable and empty catch block) NOCS (IllegalCatchCheck) // Ignore error. diff --git a/Kieker.WebGUI/src/main/resources/kieker-1.6-SNAPSHOT_emf.jar b/Kieker.WebGUI/src/main/resources/kieker-1.6-SNAPSHOT_emf.jar index 16506330416aca9510d1f05dbfd405bb776b31bd..ce5c3fec4b7d7afd9df08081d70171ea142193e6 100644 Binary files a/Kieker.WebGUI/src/main/resources/kieker-1.6-SNAPSHOT_emf.jar and b/Kieker.WebGUI/src/main/resources/kieker-1.6-SNAPSHOT_emf.jar differ diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml index 50fb2f39083e3e798655fd2baf18bcd38aaf4b62..60fa41f8553d0aa14684eb269b1c11c5605b2443 100644 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml @@ -72,11 +72,9 @@ <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" /> </p:button> <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" outcome="CockpitEditor.xhtml"> - <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" disabled="true"> </p:button> - <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" outcome="Cockpit.xhtml"> - <f:param name="projectName" value="#{currentAnalysisEditorBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" disabled="true"> </p:button> </p:toolbarGroup> </p:toolbar> diff --git a/Kieker.WebGUI/src/main/webapp/Controller.xhtml b/Kieker.WebGUI/src/main/webapp/Controller.xhtml index cbc4197613a59cf8f3970292a73e287883846e8b..07d84510a61f449b21594cef6f122abbb60e32d2 100644 --- a/Kieker.WebGUI/src/main/webapp/Controller.xhtml +++ b/Kieker.WebGUI/src/main/webapp/Controller.xhtml @@ -38,11 +38,9 @@ <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" disabled="true"> </p:button> <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" style="white-space: none" outcome="CockpitEditor.xhtml"> - <f:param name="projectName" value="#{currentControllerBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" disabled="true"> </p:button> - <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" style="white-space: none" outcome="Cockpit.xhtml"> - <f:param name="projectName" value="#{currentControllerBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" disabled="true"> </p:button> </p:toolbarGroup> </p:toolbar> diff --git a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml index 387aadcb98f11c6d9e8178360808d32b886fe83e..1680f73eafeabd4f847aa2e251dc4f6ccc04f07c 100644 --- a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml +++ b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml @@ -24,17 +24,15 @@ <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"> - <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" /> + <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}"/> </p:button> <p:button styleClass="perspective-button" icon="ui-icon-circle-triangle-e" value="Analysis" style="white-space: none" outcome="Controller.xhtml"> - <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" /> + <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}"/> </p:button> <p:separator/> - <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" style="white-space: none" outcome="CockpitEditor.xhtml"> - <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-wrench" value="Cockpit Editor" disabled="true"> </p:button> - <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" style="white-space: none" outcome="Cockpit.xhtml"> - <f:param name="projectName" value="#{currentProjectOverviewBean.projectName}" /> + <p:button styleClass="perspective-button" icon="ui-icon-image" value="Cockpit" disabled="true"> </p:button> </p:toolbarGroup> </p:toolbar> @@ -75,8 +73,8 @@ <p:menuitem icon="ui-icon-circle-triangle-e" id="controlAnalysis" styleClass="element-with-whitespace" value=" Analysis" ajax="false" url="controller?projectName=#{project}" /> <p:separator/> - <p:menuitem icon="ui-icon-wrench" id="editAnalysisViews" styleClass="element-with-whitespace" value=" Cockpit Editor" ajax="false" url="cockpitEditor?projectName=#{project}" /> - <p:menuitem icon="ui-icon-image" id="showAnalysis" styleClass="element-with-whitespace" value=" Cockpit" ajax="false" url="cockpit?projectName=#{project}" /> + <p:menuitem icon="ui-icon-wrench" id="editAnalysisViews" styleClass="element-with-whitespace" value=" Cockpit Editor" ajax="false" disabled="true" /> + <p:menuitem icon="ui-icon-image" id="showAnalysis" styleClass="element-with-whitespace" value=" Cockpit" ajax="false" disabled="true" /> <p:separator/> <p:menuitem id="copyButton" icon="ui-icon-copy" styleClass="element-with-whitespace" value=" Copy Project" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="copyProjectDialog.show()"/> <p:menuitem id="renameButton" icon="ui-icon-pencil" styleClass="element-with-whitespace" value=" Rename Project" action="#{currentProjectOverviewBean.setProjectName(project)}" onclick="renameProjectDialog.show()" disabled="true"/>