Skip to content
Snippets Groups Projects
Commit 12577e63 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Moved some code for code quality reasons; Updated the example; Filters and...

Moved some code for code quality reasons; Updated the example; Filters and repositories can now be added correctly; Connections should now be handled correctly
parent 4e56136b
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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"/> <properties name="thresholdNanos" value="1900000"/>
<outputPorts name="validResponseTimes" subscribers="//@plugins.1/@inputPorts.0 //@plugins.5/@inputPorts.0"/> <outputPorts name="validResponseTimes" subscribers="//@plugins.5/@inputPorts.0 //@plugins.2/@inputPorts.0"/>
<outputPorts name="invalidResponseTimes" subscribers="//@plugins.2/@inputPorts.0 //@plugins.6/@inputPorts.0"/> <outputPorts name="invalidResponseTimes" subscribers="//@plugins.6/@inputPorts.0 //@plugins.3/@inputPorts.0"/>
<inputPorts name="newResponseTime"/> <inputPorts name="newResponseTime"/>
</plugins> </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"/> <properties name="validOutput" value="true"/>
<inputPorts name="newEvent"/> <inputPorts name="newEvent"/>
</plugins> </plugins>
<plugins xsi:type="Filter" name="Print invalid" classname="kieker.examples.userguide.ch3and4bookstore.MyResponseTimeOutputPrinter"> <plugins xsi:type="Filter" name="Invalid Counter" classname="kieker.analysis.plugin.filter.forward.CountingFilter">
<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">
<outputPorts name="relayedEvents"/> <outputPorts name="relayedEvents"/>
<outputPorts name="currentEventCount"/> <outputPorts name="currentEventCount"/>
<displays name="Counter Display"/> <displays name="Counter Display"/>
<inputPorts name="inputEvents"/> <inputPorts name="inputEvents"/>
</plugins> </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="relayedEvents"/>
<outputPorts name="currentEventCount"/> <outputPorts name="currentEventCount"/>
<displays name="Counter Display"/> <displays name="Counter Display"/>
<inputPorts name="inputEvents"/> <inputPorts name="inputEvents"/>
</plugins> </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="relayedEvents"/>
<outputPorts name="currentEventCount"/> <outputPorts name="currentEventCount"/>
<displays name="Counter Display"/> <displays name="Counter Display"/>
<inputPorts name="inputEvents"/> <inputPorts name="inputEvents"/>
</plugins> </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="BookstoreApplication.jar"/>
<dependencies filePath="kieker-1.6-SNAPSHOT_emf.jar"/> <dependencies filePath="commons-cli-1.2.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>
</Project> </Project>
No preview for this file type
/***************************************************************************
* 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;
}
}
...@@ -115,6 +115,8 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -115,6 +115,8 @@ public class CurrentAnalysisEditorGraphBean {
* This is the javascript code to rename a node within the graph. * 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 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. * 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 { ...@@ -137,7 +139,7 @@ public class CurrentAnalysisEditorGraphBean {
RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_CLICK_LISTENER); 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_REMOVE_NODE_LISTENER);
RequestContext.getCurrentInstance().execute(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_CREATE_EDGE_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 { ...@@ -154,8 +156,10 @@ public class CurrentAnalysisEditorGraphBean {
* The filter which should be added to the graph. * The filter which should be added to the graph.
*/ */
public void addFilter(final MIFilter filter) { public void addFilter(final MIFilter filter) {
RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_FILTER, 0, 0, this.assembleGraphString(filter), RequestContext.getCurrentInstance().execute(
this.assembleGraphRepositoryPortString(filter), this.assembleGraphInputPortString(filter), this.assembleGraphOuputPortString(filter))); 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 { ...@@ -166,7 +170,7 @@ public class CurrentAnalysisEditorGraphBean {
*/ */
public void addReader(final MIReader reader) { public void addReader(final MIReader reader) {
RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_READER, 0, 0, this.assembleGraphString(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 { ...@@ -176,7 +180,8 @@ public class CurrentAnalysisEditorGraphBean {
* The repository which should be added to the graph. * The repository which should be added to the graph.
*/ */
public void addRepository(final MIRepository repository) { 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), RequestContext.getCurrentInstance().execute(String.format(CurrentAnalysisEditorGraphBean.JS_CMD_ADD_REPOSITORY, 0, 0, this.assembleGraphString(repository),
repoPort)); repoPort));
} }
...@@ -231,19 +236,19 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -231,19 +236,19 @@ public class CurrentAnalysisEditorGraphBean {
* The plugin whose repository ports will be used. * The plugin whose repository ports will be used.
* @return A string containing the JS commands to create the repository ports. * @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 StringBuilder builder = new StringBuilder();
final int len = plugin.getRepositories().size(); final int len = ports.size();
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
final MIRepositoryConnector port = plugin.getRepositories().get(i); final MIRepositoryConnector port = ports.get(i);
if (i != 0) { if (i != 0) {
builder.append(','); 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(); return builder.toString();
...@@ -267,7 +272,7 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -267,7 +272,7 @@ public class CurrentAnalysisEditorGraphBean {
* The plugin whose output ports will be used. * The plugin whose output ports will be used.
* @return A string containing the JS commands to create the output ports. * @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()); return this.assembleGraphPortString(plugin.getOutputPorts());
} }
...@@ -339,7 +344,6 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -339,7 +344,6 @@ public class CurrentAnalysisEditorGraphBean {
// Get the parameters // Get the parameters
final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); final Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
final String clickedNodeID = paramMap.get("ID"); final String clickedNodeID = paramMap.get("ID");
// Now search the correct node // Now search the correct node
try { try {
final EObject selectedNode = this.componentMap.get(Integer.parseInt(clickedNodeID)); final EObject selectedNode = this.componentMap.get(Integer.parseInt(clickedNodeID));
...@@ -362,10 +366,21 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -362,10 +366,21 @@ public class CurrentAnalysisEditorGraphBean {
// Now search the correct components // Now search the correct components
try { try {
final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID)); final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID));
final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); if (CurrentAnalysisEditorGraphBean.REPOSITORY_INPUT_PORT.equals(targetPortID)) {
// This is a special case: An edge between a filter and a repository
if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { final String targetID = paramMap.get("targetPortID").split("\\.")[0];
this.currentAnalysisEditorBean.edgeCreated(sourcePort, targetPort); 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) { } catch (final NumberFormatException ex) {
// Ignore an invalid ID, but log it. // Ignore an invalid ID, but log it.
...@@ -383,10 +398,20 @@ public class CurrentAnalysisEditorGraphBean { ...@@ -383,10 +398,20 @@ public class CurrentAnalysisEditorGraphBean {
// Now search the correct components // Now search the correct components
try { try {
final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID)); final EObject sourcePort = this.componentMap.get(Integer.parseInt(sourcePortID));
final EObject targetPort = this.componentMap.get(Integer.parseInt(targetPortID)); if (CurrentAnalysisEditorGraphBean.REPOSITORY_INPUT_PORT.equals(targetPortID)) {
// This is a special case: An edge between a filter and a repository
if ((sourcePort != null) && (targetPort != null) && (this.currentAnalysisEditorBean != null)) { final String targetID = paramMap.get("targetPortID").split("\\.")[0];
this.currentAnalysisEditorBean.edgeRemoved(sourcePort, targetPort); 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) { } catch (final NumberFormatException ex) {
// Ignore an invalid ID, but log it. // Ignore an invalid ID, but log it.
......
...@@ -20,17 +20,14 @@ ...@@ -20,17 +20,14 @@
package kieker.webgui.common; package kieker.webgui.common;
import java.io.IOException; import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarInputStream; import java.util.jar.JarInputStream;
import kieker.analysis.plugin.AbstractPlugin; import kieker.webgui.beans.view.ClassAndMethodContainer;
import kieker.analysis.plugin.annotation.Plugin; import kieker.webgui.common.exception.ProjectLoadException;
import kieker.analysis.repository.AbstractRepository;
import kieker.analysis.repository.annotation.Repository;
/** /**
* 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. * 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; ...@@ -40,11 +37,8 @@ import kieker.analysis.repository.annotation.Repository;
*/ */
public final class PluginFinder { public final class PluginFinder {
private final ClassAndMethodContainer classAndMethodContainer;
private final ClassLoader classLoader; 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. * Creates a new instance of this class, using the given class loader.
...@@ -52,16 +46,11 @@ public final class PluginFinder { ...@@ -52,16 +46,11 @@ public final class PluginFinder {
* @param classLoader * @param classLoader
* The {@link ClassLoader} which will be used to load the classes. * The {@link ClassLoader} which will be used to load the classes.
* @throws ClassNotFoundException * @throws ClassNotFoundException
* @throws ProjectLoadException
*/ */
@SuppressWarnings("unchecked") public PluginFinder(final ClassLoader classLoader) throws ClassNotFoundException, ProjectLoadException {
public PluginFinder(final ClassLoader classLoader) throws ClassNotFoundException {
this.classLoader = classLoader; this.classLoader = classLoader;
this.classAndMethodContainer = new ClassAndMethodContainer(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());
} }
/** /**
...@@ -81,7 +70,8 @@ public final class PluginFinder { ...@@ -81,7 +70,8 @@ public final class PluginFinder {
result = new ArrayList<Class<?>>(); result = new ArrayList<Class<?>>();
for (final Class<?> clazz : clazzes) { for (final Class<?> clazz : clazzes) {
// This is the cast resulting in an unchecked cast warning. // 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); result.add(clazz);
} }
} }
...@@ -108,7 +98,8 @@ public final class PluginFinder { ...@@ -108,7 +98,8 @@ public final class PluginFinder {
result = new ArrayList<Class<?>>(); result = new ArrayList<Class<?>>();
for (final Class<?> clazz : clazzes) { for (final Class<?> clazz : clazzes) {
// This is the cast resulting in an unchecked cast warning. // 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); result.add(clazz);
} }
} }
......
/***************************************************************************
* 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; package kieker.webgui.common.exception;
public class ProjectLoadException extends Exception { public class ProjectLoadException extends Exception {
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
<script language="javascript" type="text/javascript" src="../js/jit.js"></script> <script language="javascript" type="text/javascript" src="../js/jit.js"></script>
<script language="javascript" type="text/javascript" src="../js/flowEditor.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> <script>
nodeClickListener = function(node, info, e) { nodeClickListener = function(node, info, e) {
nodeClickCommand([{name : 'ID', value : node.id}]); nodeClickCommand([{name : 'ID', value : node.id}]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment