From 12577e63c0ceeb11e8d974c3fbd9ecb8082de093 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Fri, 7 Sep 2012 18:25:47 +0200 Subject: [PATCH] Moved some code for code quality reasons; Updated the example; Filters and repositories can now be added correctly; Connections should now be handled correctly --- .../Bookstore-Example/Bookstore-Example.kax | 39 ++- .../lib/BookstoreApplication.jar | Bin 16623 -> 16558 bytes .../beans/view/ClassAndMethodContainer.java | 193 +++++++++++++ .../beans/view/CurrentAnalysisEditorBean.java | 255 +++++------------- .../view/CurrentAnalysisEditorGraphBean.java | 63 +++-- .../kieker/webgui/common/PluginFinder.java | 29 +- .../exception/ProjectLoadException.java | 19 ++ .../src/main/webapp/AnalysisEditor.xhtml | 2 - 8 files changed, 357 insertions(+), 243 deletions(-) create mode 100644 Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java diff --git a/Kieker.WebGUI/bin/data/Bookstore-Example/Bookstore-Example.kax b/Kieker.WebGUI/bin/data/Bookstore-Example/Bookstore-Example.kax index 69649c9e..23dbdb89 100644 --- a/Kieker.WebGUI/bin/data/Bookstore-Example/Bookstore-Example.kax +++ b/Kieker.WebGUI/bin/data/Bookstore-Example/Bookstore-Example.kax @@ -1,47 +1,42 @@ <?xml version="1.0" encoding="UTF-8"?> <Project xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="platform:/resource/Kieker/model/AnalysisMetaModel.ecore"> - <plugins xsi:type="Filter" name="Response Time Filter" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeFilter"> + <plugins xsi:type="Filter" name="FSReader" classname="kieker.analysis.plugin.reader.filesystem.FSReader"> + <properties name="inputDirs" value="testdata"/> + <properties name="ignoreUnknownRecordTypes" value="false"/> + <outputPorts name="monitoringRecords" subscribers="//@plugins.1/@inputPorts.0 //@plugins.4/@inputPorts.0"/> + </plugins> + <plugins xsi:type="Filter" name="MyResponseTimeFilter" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeFilter"> <properties name="thresholdNanos" value="1900000"/> - <outputPorts name="validResponseTimes" subscribers="//@plugins.1/@inputPorts.0 //@plugins.5/@inputPorts.0"/> - <outputPorts name="invalidResponseTimes" subscribers="//@plugins.2/@inputPorts.0 //@plugins.6/@inputPorts.0"/> + <outputPorts name="validResponseTimes" subscribers="//@plugins.5/@inputPorts.0 //@plugins.2/@inputPorts.0"/> + <outputPorts name="invalidResponseTimes" subscribers="//@plugins.6/@inputPorts.0 //@plugins.3/@inputPorts.0"/> <inputPorts name="newResponseTime"/> </plugins> - <plugins xsi:type="Filter" name="Print valid" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeOutputPrinter"> + <plugins xsi:type="Filter" name="Valid Printer" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeOutputPrinter"> <properties name="validOutput" value="true"/> <inputPorts name="newEvent"/> </plugins> - <plugins xsi:type="Filter" name="Print invalid" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeOutputPrinter"> - <properties name="validOutput" value="false"/> - <inputPorts name="newEvent"/> - </plugins> - <plugins xsi:type="Reader" name="File System Reader" classname="kieker.analysis.plugin.reader.filesystem.FSReader"> - <properties name="ignoreUnknownRecordTypes" value="false"/> - <properties name="inputDirs" value="testdata"/> - <outputPorts name="monitoringRecords" subscribers="//@plugins.0/@inputPorts.0 //@plugins.4/@inputPorts.0"/> - </plugins> - <plugins xsi:type="Filter" name="Counter1" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> + <plugins xsi:type="Filter" name="Invalid Counter" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> <outputPorts name="relayedEvents"/> <outputPorts name="currentEventCount"/> <displays name="Counter Display"/> <inputPorts name="inputEvents"/> </plugins> - <plugins xsi:type="Filter" name="Counter2" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> + <plugins xsi:type="Filter" name="Global Counter" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> <outputPorts name="relayedEvents"/> <outputPorts name="currentEventCount"/> <displays name="Counter Display"/> <inputPorts name="inputEvents"/> </plugins> - <plugins xsi:type="Filter" name="Counter3" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> + <plugins xsi:type="Filter" name="Valid Counter" classname="kieker.analysis.plugin.filter.forward.CountingFilter"> <outputPorts name="relayedEvents"/> <outputPorts name="currentEventCount"/> <displays name="Counter Display"/> <inputPorts name="inputEvents"/> </plugins> + <plugins xsi:type="Filter" name="Invalid Printer" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeOutputPrinter"> + <properties name="validOutput" value="false"/> + <inputPorts name="newEvent"/> + </plugins> <dependencies filePath="BookstoreApplication.jar"/> - <dependencies filePath="kieker-1.6-SNAPSHOT_emf.jar"/> - <views name="View" description="No description available."> - <displayConnectors name="FS Counter" display="//@plugins.4/@displays.0"/> - <displayConnectors name="Valid Counter" display="//@plugins.5/@displays.0"/> - <displayConnectors name="Invalid Counter" display="//@plugins.6/@displays.0"/> - </views> + <dependencies filePath="commons-cli-1.2.jar"/> </Project> diff --git a/Kieker.WebGUI/bin/data/Bookstore-Example/lib/BookstoreApplication.jar b/Kieker.WebGUI/bin/data/Bookstore-Example/lib/BookstoreApplication.jar index 620d8a18d9fd304960034fe0a9e7a61b75478a79..36f7e73732cb5dd887275451074486430e44c7da 100644 GIT binary patch delta 4490 zcmZ8l1z1#DxE)$x7=|8(4y8MUq2cP#64D_p-3TZ!mk<!?A(R#Y3CW=a>6Q*DDFGQu z8YSc*__)t^zVCczo&T(V{d?~dd$0375Thgz1EisXg-rke+yVe(<JsimKy3I@m&Yy> zccsWUX&%G@c4EG{g3XfIl09gLi)bi*G=6R7W$K1^!PEyfiwbW=&lV~h_-ozV3zn5n zPQ<7RoeYl8g`}?XkNGkmA+k5)=$uf4{i~d_(fm5G;<w%%&fDvt_N$@dovlC+R>;n( z9X*NNi`dUgFpU|8NpD}WR<JgBh^L%2T-VSaLxb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>No0Wq09KyfBy$f&<E+UMNspdUQtn9~o}|egFUf diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java new file mode 100644 index 00000000..2fb36790 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/ClassAndMethodContainer.java @@ -0,0 +1,193 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ +package kieker.webgui.beans.view; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; + +import kieker.analysis.display.annotation.Display; +import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.plugin.annotation.InputPort; +import kieker.analysis.plugin.annotation.OutputPort; +import kieker.analysis.plugin.annotation.Plugin; +import kieker.analysis.plugin.annotation.Property; +import kieker.analysis.plugin.annotation.RepositoryPort; +import kieker.analysis.plugin.filter.AbstractFilterPlugin; +import kieker.analysis.plugin.reader.AbstractReaderPlugin; +import kieker.analysis.repository.AbstractRepository; +import kieker.analysis.repository.annotation.Repository; +import kieker.common.logging.Log; +import kieker.common.logging.LogFactory; +import kieker.webgui.common.exception.ProjectLoadException; + +public final class ClassAndMethodContainer { + + private static final Log LOG = LogFactory.getLog(ClassAndMethodContainer.class); + + private final Class<?> abstractRepositoryClass; + private final Class<?> abstractPluginClass; + private final Class<?> abstractFilterPluginClass; + private final Class<?> abstractReaderPluginClass; + private final Class<? extends Annotation> pluginAnnotationClass; + private final Class<? extends Annotation> repositoryAnnotationClass; + private final Class<? extends Annotation> propertyAnnotationClass; + private final Class<? extends Annotation> outputPortAnnotationClass; + private final Class<? extends Annotation> inputPortAnnotationClass; + private final Class<? extends Annotation> repositoryPortAnnotationClass; + private final Class<? extends Annotation> displayAnnotationClass; + private final Method pluginDescriptionMethod; + private final Method repositoryDescriptionMethod; + private final Method pluginConfigurationMethod; + private final Method repositoryConfigurationMethod; + private final Method pluginOutputPortsMethod; + private final Method pluginRepositoryPortsMethod; + private final Method displayNameMethod; + private final Method inputPortNameMethod; + private final Method outputPortNameMethod; + private final Method repositoryPortNameMethod; + private final Method propertyNameMethod; + private final Method propertyDefaultValueMethod; + + public ClassAndMethodContainer(final ClassLoader classLoader) throws ProjectLoadException { + try { + this.abstractFilterPluginClass = classLoader.loadClass(AbstractFilterPlugin.class.getCanonicalName()); + this.abstractReaderPluginClass = classLoader.loadClass(AbstractReaderPlugin.class.getCanonicalName()); + this.abstractRepositoryClass = classLoader.loadClass(AbstractRepository.class.getCanonicalName()); + this.abstractPluginClass = classLoader.loadClass(AbstractPlugin.class.getCanonicalName()); + + this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getCanonicalName()); + this.repositoryAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Repository.class.getCanonicalName()); + this.propertyAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Property.class.getCanonicalName()); + this.outputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(OutputPort.class.getCanonicalName()); + this.inputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(InputPort.class.getCanonicalName()); + this.repositoryPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(RepositoryPort.class.getCanonicalName()); + this.displayAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Display.class.getCanonicalName()); + + this.pluginDescriptionMethod = this.pluginAnnotationClass.getMethod("description", new Class<?>[0]); + this.repositoryDescriptionMethod = this.repositoryAnnotationClass.getMethod("description", new Class<?>[0]); + this.pluginConfigurationMethod = this.pluginAnnotationClass.getMethod("configuration", new Class<?>[0]); + this.repositoryConfigurationMethod = this.repositoryAnnotationClass.getMethod("configuration", new Class<?>[0]); + this.pluginOutputPortsMethod = this.pluginAnnotationClass.getMethod("outputPorts", new Class<?>[0]); + this.pluginRepositoryPortsMethod = this.pluginAnnotationClass.getMethod("repositoryPorts", new Class<?>[0]); + this.displayNameMethod = this.displayAnnotationClass.getMethod("name", new Class<?>[0]); + this.inputPortNameMethod = this.inputPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.outputPortNameMethod = this.outputPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.repositoryPortNameMethod = this.repositoryPortAnnotationClass.getMethod("name", new Class<?>[0]); + this.propertyNameMethod = this.propertyAnnotationClass.getMethod("name", new Class<?>[0]); + this.propertyDefaultValueMethod = this.propertyAnnotationClass.getMethod("defaultValue", new Class<?>[0]); + } catch (final ReflectiveOperationException ex) { + ClassAndMethodContainer.LOG.error("An error occured while loading the classes and methods.", ex); + throw new ProjectLoadException(); + } + } + + public Class<?> getAbstractFilterPluginClass() { + return this.abstractFilterPluginClass; + } + + public Class<?> getAbstractReaderPluginClass() { + return this.abstractReaderPluginClass; + } + + public Class<? extends Annotation> getPluginAnnotationClass() { + return this.pluginAnnotationClass; + } + + public Class<? extends Annotation> getRepositoryAnnotationClass() { + return this.repositoryAnnotationClass; + } + + public Class<? extends Annotation> getPropertyAnnotationClass() { + return this.propertyAnnotationClass; + } + + public Class<? extends Annotation> getOutputPortAnnotationClass() { + return this.outputPortAnnotationClass; + } + + public Class<? extends Annotation> getInputPortAnnotationClass() { + return this.inputPortAnnotationClass; + } + + public Class<? extends Annotation> getRepositoryPortAnnotationClass() { + return this.repositoryPortAnnotationClass; + } + + public Class<? extends Annotation> getDisplayAnnotationClass() { + return this.displayAnnotationClass; + } + + public Method getPluginDescriptionMethod() { + return this.pluginDescriptionMethod; + } + + public Method getRepositoryDescriptionMethod() { + return this.repositoryDescriptionMethod; + } + + public Method getPluginConfigurationMethod() { + return this.pluginConfigurationMethod; + } + + public Method getRepositoryConfigurationMethod() { + return this.repositoryConfigurationMethod; + } + + public Method getPluginOutputPortsMethod() { + return this.pluginOutputPortsMethod; + } + + public Method getPluginRepositoryPortsMethod() { + return this.pluginRepositoryPortsMethod; + } + + public Method getDisplayNameMethod() { + return this.displayNameMethod; + } + + public Class<?> getAbstractRepositoryClass() { + return this.abstractRepositoryClass; + } + + public Class<?> getAbstractPluginClass() { + return this.abstractPluginClass; + } + + public Method getInputPortNameMethod() { + return this.inputPortNameMethod; + } + + public Method getOutputPortNameMethod() { + return this.outputPortNameMethod; + } + + public Method getRepositoryPortNameMethod() { + return this.repositoryPortNameMethod; + } + + public Method getPropertyNameMethod() { + return this.propertyNameMethod; + } + + public Method getPropertyDefaultValueMethod() { + return this.propertyDefaultValueMethod; + } + +} 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 cf3b62ef..2f993716 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 @@ -22,16 +22,13 @@ package kieker.webgui.beans.view; import java.io.IOException; import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; 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.Collections; -import java.util.Iterator; import java.util.List; -import java.util.Map; import javax.faces.application.FacesMessage; import javax.faces.application.FacesMessage.Severity; @@ -40,7 +37,6 @@ import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; -import kieker.analysis.display.annotation.Display; import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.MIDependency; import kieker.analysis.model.analysisMetaModel.MIDisplay; @@ -55,16 +51,9 @@ import kieker.analysis.model.analysisMetaModel.MIRepository; import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector; import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.annotation.InputPort; -import kieker.analysis.plugin.annotation.OutputPort; -import kieker.analysis.plugin.annotation.Plugin; import kieker.analysis.plugin.annotation.Property; -import kieker.analysis.plugin.annotation.RepositoryPort; -import kieker.analysis.plugin.filter.AbstractFilterPlugin; import kieker.analysis.plugin.reader.AbstractReaderPlugin; import kieker.analysis.repository.AbstractRepository; -import kieker.analysis.repository.annotation.Repository; -import kieker.common.configuration.Configuration; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.beans.application.ProjectsBean; @@ -123,18 +112,15 @@ public final class CurrentAnalysisEditorBean { */ private long timeStamp; /** - * This list contains the available repositories for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembling. + * This list contains the available repositories for the current project. */ private final List<Class<?>> availableRepositories = Collections.synchronizedList(new ArrayList<Class<?>>()); /** - * This list contains the available filters for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembl + * This list contains the available filters for the current project. */ private final List<Class<?>> availableFilters = Collections.synchronizedList(new ArrayList<Class<?>>()); /** - * This list contains the available readers for the current project. The list is from the type Class<?> to allow a modular algorithm for the tree - * assembl + * This list contains the available readers for the current project. */ private final List<Class<?>> availableReaders = Collections.synchronizedList(new ArrayList<Class<?>>()); /** @@ -311,10 +297,10 @@ public final class CurrentAnalysisEditorBean { for (final Class<?> plugin : plugins) { if (!Modifier.isAbstract(plugin.getModifiers())) { // The following cast results in the unchecked-cast-warnings, but we know that the cast should be correct. - if (this.classAndMethodContainer.abstractFilterPluginClass.isAssignableFrom(plugin)) { + if (this.classAndMethodContainer.getAbstractFilterPluginClass().isAssignableFrom(plugin)) { this.availableFilters.add(plugin); } else { - if (this.classAndMethodContainer.abstractReaderPluginClass.isAssignableFrom(plugin)) { + if (this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(plugin)) { this.availableReaders.add(plugin); } } @@ -398,20 +384,20 @@ public final class CurrentAnalysisEditorBean { public String getDescription(final Class<?> clazz) { try { // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.pluginAnnotationClass); - final Annotation annotationRepository = clazz.getAnnotation(this.classAndMethodContainer.repositoryAnnotationClass); + final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.getPluginAnnotationClass()); + final Annotation annotationRepository = clazz.getAnnotation(this.classAndMethodContainer.getRepositoryAnnotationClass()); // Now check which one of them is available - if ((annotationPlugin == null) || ((String) this.classAndMethodContainer.pluginDescriptionMethod.invoke(annotationPlugin, new Object[0])).isEmpty()) { + if ((annotationPlugin == null) || ((String) this.classAndMethodContainer.getPluginDescriptionMethod().invoke(annotationPlugin, new Object[0])).isEmpty()) { if ((annotationRepository == null) - || ((String) this.classAndMethodContainer.repositoryDescriptionMethod.invoke(annotationRepository, new Object[0])).isEmpty()) { + || ((String) this.classAndMethodContainer.getRepositoryDescriptionMethod().invoke(annotationRepository, new Object[0])).isEmpty()) { // None. Deliver a human readable substitute. return "No description available"; } else { - return (String) this.classAndMethodContainer.repositoryDescriptionMethod.invoke(annotationRepository, new Object[0]); + return (String) this.classAndMethodContainer.getRepositoryDescriptionMethod().invoke(annotationRepository, new Object[0]); } } else { - return (String) this.classAndMethodContainer.pluginDescriptionMethod.invoke(annotationPlugin, new Object[0]); + return (String) this.classAndMethodContainer.getPluginDescriptionMethod().invoke(annotationPlugin, new Object[0]); } } catch (final ReflectiveOperationException ex) { CurrentAnalysisEditorBean.LOG.warn("Could not invoke method", ex); @@ -424,8 +410,8 @@ public final class CurrentAnalysisEditorBean { try { // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.pluginAnnotationClass); - final Annotation annotationRepository = clazz.getAnnotation(this.classAndMethodContainer.repositoryAnnotationClass); + final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.getPluginAnnotationClass()); + final Annotation annotationRepository = clazz.getAnnotation(this.classAndMethodContainer.getRepositoryAnnotationClass()); final Annotation[] properties; @@ -435,10 +421,10 @@ public final class CurrentAnalysisEditorBean { // None. properties = new Property[0]; } else { - properties = (Annotation[]) this.classAndMethodContainer.repositoryConfigurationMethod.invoke(annotationRepository, new Object[0]); + properties = (Annotation[]) this.classAndMethodContainer.getRepositoryConfigurationMethod().invoke(annotationRepository, new Object[0]); } } else { - properties = (Annotation[]) this.classAndMethodContainer.pluginConfigurationMethod.invoke(annotationPlugin, new Object[0]); + properties = (Annotation[]) this.classAndMethodContainer.getPluginConfigurationMethod().invoke(annotationPlugin, new Object[0]); } for (final Annotation property : properties) { @@ -463,7 +449,7 @@ public final class CurrentAnalysisEditorBean { for (final Method method : clazz.getMethods()) { // Get the potential annotation - final Annotation annotationPort = method.getAnnotation(this.classAndMethodContainer.inputPortAnnotationClass); + final Annotation annotationPort = method.getAnnotation(this.classAndMethodContainer.getInputPortAnnotationClass()); // Now check whether it is available if (annotationPort != null) { result.add(annotationPort); @@ -485,11 +471,11 @@ public final class CurrentAnalysisEditorBean { try { // Get the potential annotation - final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.pluginAnnotationClass); + final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.getPluginAnnotationClass()); // Now check whether it is available if (annotationPlugin != null) { - for (final Annotation oPort : (Annotation[]) this.classAndMethodContainer.pluginOutputPortsMethod.invoke(annotationPlugin, new Object[0])) { + for (final Annotation oPort : (Annotation[]) this.classAndMethodContainer.getPluginOutputPortsMethod().invoke(annotationPlugin, new Object[0])) { result.add(oPort); } } @@ -511,11 +497,11 @@ public final class CurrentAnalysisEditorBean { final List<Annotation> result = new ArrayList<Annotation>(); try { // Get the potential annotation - final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.pluginAnnotationClass); + final Annotation annotationPlugin = clazz.getAnnotation(this.classAndMethodContainer.getPluginAnnotationClass()); // Now check whether it is available if (annotationPlugin != null) { - for (final Annotation rPort : (Annotation[]) this.classAndMethodContainer.pluginRepositoryPortsMethod.invoke(annotationPlugin, new Object[0])) { + for (final Annotation rPort : (Annotation[]) this.classAndMethodContainer.getPluginRepositoryPortsMethod().invoke(annotationPlugin, new Object[0])) { result.add(rPort); } } @@ -530,7 +516,7 @@ public final class CurrentAnalysisEditorBean { for (final Method method : clazz.getMethods()) { // Get the potential annotation - final Annotation display = method.getAnnotation(this.classAndMethodContainer.displayAnnotationClass); + final Annotation display = method.getAnnotation(this.classAndMethodContainer.getDisplayAnnotationClass()); // Now check whether it is available if (display != null) { result.add(display); @@ -653,7 +639,7 @@ public final class CurrentAnalysisEditorBean { final List<Annotation> displays = this.getDisplays(clazz); for (final Annotation display : displays) { final MIDisplay mDisplay = this.factory.createDisplay(); - mDisplay.setName((String) this.classAndMethodContainer.displayNameMethod.invoke(display, new Object[0])); + mDisplay.setName((String) this.classAndMethodContainer.getDisplayNameMethod().invoke(display, new Object[0])); plugin.getDisplays().add(mDisplay); } @@ -683,58 +669,42 @@ public final class CurrentAnalysisEditorBean { private boolean fillPorts(final Class<AbstractPlugin> clazz, final MIPlugin plugin) { synchronized (this) { try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractPlugin pluginInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - - // Get the port and use them to initialize the model plugin. - final String[] inputPortNames = pluginInstance.getAllInputPortNames(); - final String[] outputPortNames = pluginInstance.getAllOutputPortNames(); - final String[] repositoryPortNames = pluginInstance.getAllRepositoryPortNames(); + // Get the ports + final List<Annotation> inputPorts = this.getInputPorts(clazz); + final List<Annotation> outputPorts = this.getOutputPorts(clazz); + final List<Annotation> repositoryPorts = this.getRepositoryPorts(clazz); // Add input ports if (plugin instanceof MIFilter) { - for (final String inputPortName : inputPortNames) { + for (final Annotation inputPort : inputPorts) { final MIInputPort mInputPort = this.factory.createInputPort(); - mInputPort.setName(inputPortName); - + mInputPort.setName((String) this.classAndMethodContainer.getInputPortNameMethod().invoke(inputPort, new Object[0])); mInputPort.setParent((MIFilter) plugin); } } // Add output ports. - for (final String outputPortName : outputPortNames) { + for (final Annotation outputPort : outputPorts) { final MIOutputPort mOutputPort = this.factory.createOutputPort(); - mOutputPort.setName(outputPortName); + mOutputPort.setName((String) this.classAndMethodContainer.getOutputPortNameMethod().invoke(outputPort, new Object[0])); mOutputPort.setParent(plugin); } // Add repository ports. - for (final String repositoryPortName : repositoryPortNames) { + for (final Annotation repositoryPort : repositoryPorts) { final MIRepositoryConnector mConnector = this.factory.createRepositoryConnector(); - mConnector.setName(repositoryPortName); + mConnector.setName((String) this.classAndMethodContainer.getRepositoryPortNameMethod().invoke(repositoryPort, new Object[0])); plugin.getRepositories().add(mConnector); } return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the ports of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the ports of the plugin.", ex); + } catch (final ReflectiveOperationException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the ports of the plugin.", ex); + } catch (final ClassCastException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the ports of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the ports of the plugin."); return false; } @@ -753,32 +723,25 @@ public final class CurrentAnalysisEditorBean { */ private boolean fillProperties(final Class<AbstractRepository> clazz, final MIRepository repository) { try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractRepository repositoryInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - // Get the current configuration and use it to initialize the model repository, as THIS configuration instance will contain all keys. - final Configuration configuration = repositoryInstance.getCurrentConfiguration(); + // Get the default configuration and use it to initialize the model repository + final List<Annotation> properties = this.getProperties(clazz); + + for (final Annotation property : properties) { + final MIProperty mProperty = this.factory.createProperty(); - repository.getProperties().addAll(this.extractProperties(configuration)); + mProperty.setName((String) this.classAndMethodContainer.getPropertyNameMethod().invoke(property, new Object[0])); + mProperty.setValue((String) this.classAndMethodContainer.getPropertyDefaultValueMethod().invoke(property, new Object[0])); + + repository.getProperties().add(mProperty); + } return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the repository.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the repository.", ex); + } catch (final ReflectiveOperationException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the repository.", ex); + } catch (final ClassCastException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the repository.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the repository."); return false; } @@ -796,63 +759,30 @@ public final class CurrentAnalysisEditorBean { */ private boolean fillProperties(final Class<AbstractPlugin> clazz, final MIPlugin plugin) { try { - // Try to instantiate the given class, using the special constructor of Kieker. - final AbstractPlugin pluginInstance = clazz.getConstructor(Configuration.class).newInstance(new Configuration()); - // Get the current configuration and use it to initialize the model plugin, as THIS configuration instance will contain all keys. - final Configuration configuration = pluginInstance.getCurrentConfiguration(); + // Get the default configuration and use it to initialize the model plugin + final List<Annotation> properties = this.getProperties(clazz); - plugin.getProperties().addAll(this.extractProperties(configuration)); + for (final Annotation property : properties) { + final MIProperty mProperty = this.factory.createProperty(); + + mProperty.setName((String) this.classAndMethodContainer.getPropertyNameMethod().invoke(property, new Object[0])); + mProperty.setValue((String) this.classAndMethodContainer.getPropertyDefaultValueMethod().invoke(property, new Object[0])); + + plugin.getProperties().add(mProperty); + } return true; - } catch (final InstantiationException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final IllegalAccessException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final InvocationTargetException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the plugin.", ex); - CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); - return false; - } catch (final NoSuchMethodException ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the plugin.", ex); + } catch (final ReflectiveOperationException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); return false; - } catch (final NoClassDefFoundError ex) { - CurrentAnalysisEditorBean.LOG.error("An errcor occured while loading the properties of the plugin.", ex); + } catch (final ClassCastException ex) { + CurrentAnalysisEditorBean.LOG.error("An error occured while loading the properties of the plugin.", ex); CurrentAnalysisEditorBean.showMessage(FacesMessage.SEVERITY_ERROR, "An errcor occured while loading the properties of the plugin."); return false; } } - /** - * This method extracts the properties from the given configuration. In other words: For every key within the configuration, the method creates a model - * counterpart. - * - * @param configuration - * The configuration to be used for extraction. - * @return The list containing one {@link MIProperty} for every key within the configuration. - */ - private List<MIProperty> extractProperties(final Configuration configuration) { - final List<MIProperty> result = new ArrayList<MIProperty>(); - - // Run through all entries. - final Iterator<Map.Entry<Object, Object>> iterator = configuration.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry<Object, Object> entry = iterator.next(); - // Create a property object for the current entry. - final MIProperty property = this.factory.createProperty(); - property.setName(entry.getKey().toString()); - property.setValue(entry.getValue().toString()); - - result.add(property); - } - - return result; - } - /** * This method adds a new repository to the current model, using the given instance of {@code Class} for it. * @@ -1097,56 +1027,19 @@ public final class CurrentAnalysisEditorBean { } } - public void edgeCreated(final EObject sourcePort, final EObject targetPort) { - ((MIOutputPort) sourcePort).getSubscribers().add((MIInputPort) targetPort); + public void edgeCreated(final MIOutputPort sourcePort, final MIInputPort targetPort) { + sourcePort.getSubscribers().add(targetPort); } - public void edgeRemoved(final EObject sourcePort, final EObject targetPort) { - ((MIOutputPort) sourcePort).getSubscribers().remove(targetPort); + public void edgeRemoved(final MIOutputPort sourcePort, final MIInputPort targetPort) { + sourcePort.getSubscribers().remove(targetPort); } - private static final class ClassAndMethodContainer { - - public final Class<?> abstractFilterPluginClass; - public final Class<?> abstractReaderPluginClass; - public final Class<? extends Annotation> pluginAnnotationClass; - public final Class<? extends Annotation> repositoryAnnotationClass; - public final Class<? extends Annotation> propertyAnnotationClass; - public final Class<? extends Annotation> outputPortAnnotationClass; - public final Class<? extends Annotation> inputPortAnnotationClass; - public final Class<? extends Annotation> repositoryPortAnnotationClass; - public final Class<? extends Annotation> displayAnnotationClass; - public final Method pluginDescriptionMethod; - public final Method repositoryDescriptionMethod; - public final Method pluginConfigurationMethod; - public final Method repositoryConfigurationMethod; - public final Method pluginOutputPortsMethod; - public final Method pluginRepositoryPortsMethod; - public final Method displayNameMethod; - - public ClassAndMethodContainer(final ClassLoader classLoader) throws ProjectLoadException { - try { - this.abstractFilterPluginClass = classLoader.loadClass(AbstractFilterPlugin.class.getCanonicalName()); - this.abstractReaderPluginClass = classLoader.loadClass(AbstractReaderPlugin.class.getCanonicalName()); - this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getCanonicalName()); - this.repositoryAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Repository.class.getCanonicalName()); - this.propertyAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Property.class.getCanonicalName()); - this.outputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(OutputPort.class.getCanonicalName()); - this.inputPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(InputPort.class.getCanonicalName()); - this.repositoryPortAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(RepositoryPort.class.getCanonicalName()); - this.displayAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Display.class.getCanonicalName()); - - this.pluginDescriptionMethod = this.pluginAnnotationClass.getMethod("description", new Class<?>[0]); - this.repositoryDescriptionMethod = this.repositoryAnnotationClass.getMethod("description", new Class<?>[0]); - this.pluginConfigurationMethod = this.pluginAnnotationClass.getMethod("configuration", new Class<?>[0]); - this.repositoryConfigurationMethod = this.repositoryAnnotationClass.getMethod("configuration", new Class<?>[0]); - this.pluginOutputPortsMethod = this.pluginAnnotationClass.getMethod("outputPorts", new Class<?>[0]); - this.pluginRepositoryPortsMethod = this.pluginAnnotationClass.getMethod("repositoryPorts", new Class<?>[0]); - this.displayNameMethod = this.displayAnnotationClass.getMethod("name", new Class<?>[0]); - } catch (final ReflectiveOperationException ex) { - CurrentAnalysisEditorBean.LOG.error("An error occured while loading the classes and methods.", ex); - throw new ProjectLoadException(); - } - } + public void edgeCreated(final MIRepositoryConnector sourcePort, final MIRepository target) { + sourcePort.setRepository(target); + } + + public void edgeRemoved(final MIRepositoryConnector sourcePort, final MIRepository target) { + sourcePort.setRepository(null); } } 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 9a6d9c94..b75cfa92 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 @@ -115,6 +115,8 @@ public class CurrentAnalysisEditorGraphBean { * This is the javascript code to rename a node within the graph. */ private static final String JS_CMD_RENAME_NODE = "graph.getNode(%s).name = '%s';"; + private static final Object REPOSITORY_INPUT_PORT = "R"; + /** * This map contains all components (plugins, repositories and ports) within the graph to identify them with a unique ID. */ @@ -137,7 +139,7 @@ public class CurrentAnalysisEditorGraphBean { RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_CLICK_LISTENER); RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_REMOVE_NODE_LISTENER); RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_CREATE_EDGE_LISTENER); - RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_REMOVE_EDGE_LISTENER); + // RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_REMOVE_EDGE_LISTENER); } /** @@ -154,8 +156,10 @@ public class CurrentAnalysisEditorGraphBean { * The filter which should be added to the graph. */ public void addFilter(final MIFilter filter) { - RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_FILTER, 0, 0, this.assembleGraphString(filter), - this.assembleGraphRepositoryPortString(filter), this.assembleGraphInputPortString(filter), this.assembleGraphOuputPortString(filter))); + RequestContext.getCurrentInstance().execute( + String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_FILTER, 0, 0, this.assembleGraphString(filter), + this.assembleGraphRepositoryPortString(filter.getRepositories()), this.assembleGraphInputPortString(filter), + this.assembleGraphOutputPortString(filter))); } /** @@ -166,7 +170,7 @@ public class CurrentAnalysisEditorGraphBean { */ public void addReader(final MIReader reader) { RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_READER, 0, 0, this.assembleGraphString(reader), - this.assembleGraphRepositoryPortString(reader), this.assembleGraphOuputPortString(reader))); + this.assembleGraphRepositoryPortString(reader.getRepositories()), this.assembleGraphOutputPortString(reader))); } /** @@ -176,7 +180,8 @@ public class CurrentAnalysisEditorGraphBean { * The repository which should be added to the graph. */ public void addRepository(final MIRepository repository) { - final String repoPort = String.format(CurrentAnalysisEditorGraphBean.JS_CMD_PORT, CurrentAnalysisEditorGraphBean.JS_CMD_PORT_TYPE_INPUT, "ip1", "N/A"); + final String repoPort = String.format(CurrentAnalysisEditorGraphBean.JS_CMD_PORT, CurrentAnalysisEditorGraphBean.JS_CMD_PORT_TYPE_INPUT, + CurrentAnalysisEditorGraphBean.REPOSITORY_INPUT_PORT, "N/A"); RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_REPOSITORY, 0, 0, this.assembleGraphString(repository), repoPort)); } @@ -231,19 +236,19 @@ public class CurrentAnalysisEditorGraphBean { * The plugin whose repository ports will be used. * @return A string containing the JS commands to create the repository ports. */ - private String assembleGraphRepositoryPortString(final MIPlugin plugin) { + private String assembleGraphRepositoryPortString(final EList<MIRepositoryConnector> ports) { final StringBuilder builder = new StringBuilder(); - final int len = plugin.getRepositories().size(); + final int len = ports.size(); for (int i = 0; i < len; i++) { - final MIRepositoryConnector port = plugin.getRepositories().get(i); + final MIRepositoryConnector port = ports.get(i); if (i != 0) { builder.append(','); } - builder.append(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_PORT, port.getName(), port.getName(), port.getName())); + builder.append(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_PORT, port.getName(), this.componentMap.get(port), port.getName())); } return builder.toString(); @@ -267,7 +272,7 @@ public class CurrentAnalysisEditorGraphBean { * The plugin whose output ports will be used. * @return A string containing the JS commands to create the output ports. */ - private String assembleGraphOuputPortString(final MIPlugin plugin) { + private String assembleGraphOutputPortString(final MIPlugin plugin) { return this.assembleGraphPortString(plugin.getOutputPorts()); } @@ -339,7 +344,6 @@ public class CurrentAnalysisEditorGraphBean { // Get the parameters final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); final String clickedNodeID = paramMap.get("ID"); - // Now search the correct node try { final EObject selectedNode = this.componentMap.get(Integer.parseInt(clickedNodeID)); @@ -362,10 +366,21 @@ public class CurrentAnalysisEditorGraphBean { // Now search the correct components try { final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID)); - final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); - - if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { - this.currentAnalysisEditorBean.edgeCreated(sourcePort, targetPort); + if (CurrentAnalysisEditorGraphBean.REPOSITORY_INPUT_PORT.equals(targetPortID)) { + // This is a special case: An edge between a filter and a repository + final String targetID = paramMap.get("targetPortID").split("\\.")[0]; + final EObject targetRepo = this.componentMap.get(Integer.parseInt(targetID)); + + if ((sourcePort instanceof MIRepositoryConnector) && (targetRepo instanceof MIRepository) && (this.currentAnalysisEditorBean != null)) { + this.currentAnalysisEditorBean.edgeCreated((MIRepositoryConnector) sourcePort, (MIRepository) targetRepo); + } + } else { + // This is the normal case: An edge between two filters + final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); + + if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { + this.currentAnalysisEditorBean.edgeCreated((MIOutputPort) sourcePort, (MIInputPort) targetPort); + } } } catch (final NumberFormatException ex) { // Ignore an invalid ID, but log it. @@ -383,10 +398,20 @@ public class CurrentAnalysisEditorGraphBean { // Now search the correct components try { final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID)); - final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); - - if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { - this.currentAnalysisEditorBean.edgeRemoved(sourcePort, targetPort); + if (CurrentAnalysisEditorGraphBean.REPOSITORY_INPUT_PORT.equals(targetPortID)) { + // This is a special case: An edge between a filter and a repository + final String targetID = paramMap.get("targetPortID").split("\\.")[0]; + final EObject targetRepo = this.componentMap.get(Integer.parseInt(targetID)); + if ((sourcePort instanceof MIRepositoryConnector) && (targetRepo instanceof MIRepository) && (this.currentAnalysisEditorBean != null)) { + this.currentAnalysisEditorBean.edgeRemoved((MIRepositoryConnector) sourcePort, (MIRepository) targetRepo); + } + } else { + // This is the normal case: An edge between two filters + final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); + + if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { + this.currentAnalysisEditorBean.edgeRemoved((MIOutputPort) sourcePort, (MIInputPort) targetPort); + } } } catch (final NumberFormatException ex) { // Ignore an invalid ID, but log it. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java index 8c0ff5e7..e2e2dbbe 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java @@ -20,17 +20,14 @@ package kieker.webgui.common; import java.io.IOException; -import java.lang.annotation.Annotation; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; -import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.annotation.Plugin; -import kieker.analysis.repository.AbstractRepository; -import kieker.analysis.repository.annotation.Repository; +import kieker.webgui.beans.view.ClassAndMethodContainer; +import kieker.webgui.common.exception.ProjectLoadException; /** * 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. @@ -40,11 +37,8 @@ import kieker.analysis.repository.annotation.Repository; */ public final class PluginFinder { + private final ClassAndMethodContainer classAndMethodContainer; private final ClassLoader classLoader; - private final Class<? extends Annotation> repositoryAnnotationClass; - private final Class<?> abstractRepositoryClass; - private final Class<? extends Annotation> pluginAnnotationClass; - private final Class<?> abstractPluginClass; /** * Creates a new instance of this class, using the given class loader. @@ -52,16 +46,11 @@ public final class PluginFinder { * @param classLoader * The {@link ClassLoader} which will be used to load the classes. * @throws ClassNotFoundException + * @throws ProjectLoadException */ - @SuppressWarnings("unchecked") - public PluginFinder(final ClassLoader classLoader) throws ClassNotFoundException { + public PluginFinder(final ClassLoader classLoader) throws ClassNotFoundException, ProjectLoadException { this.classLoader = classLoader; - - // Load the necessary classes and annotations for a correct comparison - this.repositoryAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Repository.class.getCanonicalName()); - this.abstractRepositoryClass = classLoader.loadClass(AbstractRepository.class.getCanonicalName()); - this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getCanonicalName()); - this.abstractPluginClass = classLoader.loadClass(AbstractPlugin.class.getCanonicalName()); + this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); } /** @@ -81,7 +70,8 @@ public final class PluginFinder { result = new ArrayList<Class<?>>(); for (final Class<?> clazz : clazzes) { // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(this.repositoryAnnotationClass) && this.abstractRepositoryClass.isAssignableFrom(clazz)) { + if (clazz.isAnnotationPresent(this.classAndMethodContainer.getRepositoryAnnotationClass()) + && this.classAndMethodContainer.getAbstractRepositoryClass().isAssignableFrom(clazz)) { result.add(clazz); } } @@ -108,7 +98,8 @@ public final class PluginFinder { result = new ArrayList<Class<?>>(); for (final Class<?> clazz : clazzes) { // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(this.pluginAnnotationClass) && this.abstractPluginClass.isAssignableFrom(clazz)) { + if (clazz.isAnnotationPresent(this.classAndMethodContainer.getPluginAnnotationClass()) + && this.classAndMethodContainer.getAbstractPluginClass().isAssignableFrom(clazz)) { result.add(clazz); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java index fbcedbbf..3937564d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectLoadException.java @@ -1,3 +1,22 @@ +/*************************************************************************** + * 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; public class ProjectLoadException extends Exception { diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml index aa389139..bc81a429 100644 --- a/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml +++ b/Kieker.WebGUI/src/main/webapp/AnalysisEditor.xhtml @@ -25,8 +25,6 @@ <script language="javascript" type="text/javascript" src="../js/jit.js"></script> <script language="javascript" type="text/javascript" src="../js/flowEditor.js"></script> - <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> - <script> nodeClickListener = function(node, info, e) { nodeClickCommand([{name : 'ID', value : node.id}]); -- GitLab