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

Merge branch 'refactoring'

parents 06838aba 75ea6ef6
No related branches found
No related tags found
No related merge requests found
Showing
with 409 additions and 484 deletions
#
#Sun May 19 16:38:30 CEST 2013
owner=admin
last\ user=admin
analysis\ layout=id0 -593 -253 348 72;id1 -611 -32 312 72;id2 -243 -32 336 72;id3 133 -38 288 132;id4 479 -26 276 108;id5 1187 -41 468 96;id6 2055 -23 816 144;id7 1119 213 876 84;id8 2033 365 804 84;id9 2051 201 840 144;id10 2817 44 564 72;id11 2919 -71 360 72;id12 3349 -50 372 72;\#id2.2 id3.6 -43.5 -20 -43.5 10;id2.2 id3.5 -43.5 -20 -43.5 -14;id4.12 id5.14 648.5 -26 648.5 -29;id4.12 id7.20 648.5 -26 648.5 225;id5.0 id12.R 1588.5 -47 1588.5 -177 3130.5 -177 3130.5 -38;id6.1 id12.R 2502.5 -53 2502.5 -38;id6.17 id10.29 2502.5 -17 2502.5 56;id7.21 id8.23 1598.5 213 1598.5 365;id7.22 id8.24 1588.5 237 1588.5 389;id9.2 id12.R 3130.5 171 3130.5 -38;id9.27 id10.29 2502.5 231 2502.5 56;id10.3 id12.R 3130.5 56 3130.5 -38;id11.4 id12.R 3130.5 -59 3130.5 -38;
......@@ -48,12 +48,6 @@
</plugins>
<dependencies filePath="BookstoreApplication.jar"/>
<dependencies filePath="commons-cli-1.2.jar"/>
<views name="Counter View" description="Shows the available counters">
<displayConnectors name="Invalid Counter" display="//@plugins.3/@displays.2"/>
<displayConnectors name="Valid Counter" display="//@plugins.4/@displays.2"/>
<displayConnectors name="Global Counter" display="//@plugins.5/@displays.2"/>
<displayConnectors name="Global Counter (Meter Gauge)" display="//@plugins.5/@displays.3"/>
</views>
<properties name="recordsTimeUnit" value="NANOSECONDS"/>
<properties name="projectName" value="AnalysisProject"/>
</Project>
#
#Tue Jun 04 10:45:34 CEST 2013
#Thu Jun 06 21:28:46 CEST 2013
owner=admin
cockpit\ layout=0 0 0 1 1 0 1 1
last\ user=user
cockpit\ layout=
analysis\ layout=id0 -593 -253 348 72;id1 -671 -51 192 72;id2 -55 -63 336 84;id3 655 35 276 72;id4 315 47 276 84;id5 315 -93 252 84;id6 -399 -51 264 84;id7 643 -97 252 72;\#id2.2 id5.8 144.5 -63 144.5 -81;id2.3 id4.5 144.5 -39 144.5 59;id5.9 id7.14 484.5 -93 484.5 -85;
......@@ -10,12 +10,22 @@
<plugins xsi:type="Reader" name="FSReader" classname="kieker.analysis.plugin.reader.filesystem.FSReader">
<properties name="inputDirs" value="data/CPU-and-Memory-Example/testdata"/>
<properties name="ignoreUnknownRecordTypes" value="false"/>
<outputPorts name="monitoringRecords" subscribers="//@plugins.0/@inputPorts.0"/>
<outputPorts name="monitoringRecords" subscribers="//@plugins.2/@inputPorts.0"/>
</plugins>
<views name="View" description="No description available.">
<plugins xsi:type="Filter" name="RealtimeRecordDelayFilter" classname="kieker.analysis.plugin.filter.forward.RealtimeRecordDelayFilter">
<properties name="numWorkers" value="1"/>
<properties name="additionalShutdownDelaySeconds" value="5"/>
<properties name="warnOnNegativeSchedTimeSeconds" value="2"/>
<properties name="timerPrecision" value="MILLISECONDS"/>
<outputPorts name="outputRecords" subscribers="//@plugins.0/@inputPorts.0"/>
<inputPorts name="inputRecords"/>
</plugins>
<views name="CPU View" description="No description available.">
<displayConnectors name="XYPlot CPU utilization Display" display="//@plugins.0/@displays.0"/>
<displayConnectors name="Meter Gauge CPU total utilization Display" display="//@plugins.0/@displays.1"/>
</views>
<views name="Memory View" description="No description available.">
</views>
<properties name="recordsTimeUnit" value="NANOSECONDS"/>
<properties name="projectName" value="AnalysisProject"/>
</Project>
#
#Thu Jun 06 09:16:16 CEST 2013
#Thu Jun 06 12:48:33 CEST 2013
owner=admin
last\ user=user
cockpit\ layout=0 0 1 0 0 1
last\ user=admin
analysis\ layout=id0 -1418 -586 336 72;id1 -1140 -428 420 72;id2 -1490 -428 192 72;\#;
analysis\ layout=id0 -495 -241 336 72;id1 223 -83 420 72;id2 -567 -83 192 72;id3 -229 -83 396 72;\#;
......@@ -47,9 +47,6 @@
<displayConnectors name="Timestamp Records (Meter Gauge)" display="//@plugins.3/@displays.3"/>
<displayConnectors name="Timestamps (Meter Gauge)" display="//@plugins.4/@displays.3"/>
</views>
<views name="Only Records View" description="No description available.">
<displayConnectors name="Timestamp Records" display="//@plugins.3/@displays.1"/>
</views>
<properties name="recordsTimeUnit" value="NANOSECONDS"/>
<properties name="projectName" value="AnalysisProject"/>
</Project>
#
#Sun Jun 02 11:24:25 CEST 2013
#Thu Jun 06 21:29:55 CEST 2013
owner=admin
last\ user=admin
cockpit\ layout=0 0 0 1 0 2 1 0 1 1 1 2 0 3 1 3 0 0
cockpit\ layout=0 0 0 1 0 2 1 0 1 1 1 2 0 3 1 3
last\ user=user
analysis\ layout=id0 -2221 -900 336 72;id1 -2281 -618 216 84;id2 -1547 -748 204 72;id3 -1547 -618 204 72;id4 -1911 -606 396 84;id5 -1911 -740 312 84;\#id1.0 id5.9 -2142.5 -619.5 -2142.5 -729.5;id5.10 id2.2 -1682.5 -741.5 -1682.5 -737.5;
#
#Thu Jun 06 21:28:29 CEST 2013
owner=admin
last\ user=user
analysis\ layout=id0 -495 -241 336 72;id1 -507 -20 312 72;id2 -139 -20 336 72;id3 237 -26 288 132;id4 583 -14 276 108;id5 1291 -29 468 96;id6 2159 -11 816 144;id7 1223 225 876 84;id8 2137 377 804 84;id9 2155 213 840 144;id10 2921 56 564 72;id11 3023 -59 360 72;id12 3453 -38 372 72;\#id2.2 id3.6 60.5 -8.5 60.5 21.5;id2.2 id3.5 60.5 -8.5 60.5 -2.5;id4.12 id5.15 752.5 -14.5 752.5 -17.5;id4.12 id7.22 752.5 -14.5 752.5 236.5;id5.14 id12.R 1692.5 -35.5 1692.5 -165.5 3234.5 -165.5 3234.5 -26.5;id6.17 id12.R 2606.5 -41.5 2606.5 -26.5;id6.19 id10.33 2606.5 -5.5 2606.5 67.5;id7.23 id8.25 1702.5 224.5 1702.5 376.5;id7.24 id8.26 1692.5 248.5 1692.5 400.5;id9.27 id12.R 3234.5 182.5 3234.5 -26.5;id9.30 id10.33 2606.5 242.5 2606.5 67.5;id10.32 id12.R 3234.5 67.5 3234.5 -26.5;id11.34 id12.R 3234.5 -47.5 3234.5 -26.5;
......@@ -133,12 +133,12 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
<version>2.1.22</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
<version>2.1.22</version>
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -24,6 +24,7 @@ import kieker.analysis.display.HtmlText;
import kieker.analysis.display.Image;
import kieker.analysis.display.MeterGauge;
import kieker.analysis.display.PlainText;
import kieker.analysis.display.TagCloud;
import kieker.analysis.display.XYPlot;
import kieker.analysis.display.annotation.Display;
import kieker.analysis.plugin.AbstractPlugin;
......@@ -66,6 +67,7 @@ public class ClassContainer {
private Class<?> htmlTextClass;
private Class<?> xyPlotClass;
private Class<?> meterGaugeClass;
private Class<?> tagCloudClass;
private Class<? extends Annotation> pluginAnnotationClass;
private Class<? extends Annotation> repositoryAnnotationClass;
......@@ -101,6 +103,7 @@ public class ClassContainer {
this.imageClass = classLoader.loadClass(Image.class.getName());
this.xyPlotClass = classLoader.loadClass(XYPlot.class.getName());
this.meterGaugeClass = classLoader.loadClass(MeterGauge.class.getName());
this.tagCloudClass = classLoader.loadClass(TagCloud.class.getName());
// Now we load the more specific annotation classes
this.pluginAnnotationClass = (Class<? extends Annotation>) classLoader.loadClass(Plugin.class.getName());
......@@ -197,4 +200,8 @@ public class ClassContainer {
return this.meterGaugeClass;
}
public Class<?> getTagCloudClass() {
return this.tagCloudClass;
}
}
......@@ -32,6 +32,7 @@ public enum DisplayType {
/** Represents the image display type. */
IMAGE,
/** Represents the meter gauge display type. */
METER_GAUGE
METER_GAUGE,
/** Represents the tag cloud display type. */
TAG_CLOUD
}
......@@ -186,6 +186,9 @@ public class Analysis {
if (STATE.TERMINATED.toString().equals(state.toString())) {
retState = STATE.TERMINATED;
}
if (STATE.TERMINATING.toString().equals(state.toString())) {
retState = STATE.TERMINATING;
}
}
return retState;
} catch (final MirrorException ex) {
......@@ -250,6 +253,8 @@ public class Analysis {
return DisplayType.XY_PLOT;
} else if (parameter == this.classContainer.getMeterGaugeClass()) {
return DisplayType.METER_GAUGE;
} else if (parameter == this.classContainer.getTagCloudClass()) {
return DisplayType.TAG_CLOUD;
} else {
return null;
}
......
......@@ -58,6 +58,7 @@ import kieker.webgui.service.IProjectService;
import kieker.webgui.web.beans.application.GlobalPropertiesBean;
import kieker.webgui.web.beans.application.ProjectsBean;
import kieker.webgui.web.beans.session.UserBean;
import kieker.webgui.web.utility.IGraphListener;
import org.primefaces.context.RequestContext;
import org.primefaces.event.FileUploadEvent;
......@@ -79,7 +80,7 @@ import org.springframework.stereotype.Component;
*/
@Component
@Scope("view")
public class CurrentAnalysisEditorBean {
public class CurrentAnalysisEditorBean implements IGraphListener {
private static final MIAnalysisMetaModelFactory MODEL_FACTORY = MAnalysisMetaModelFactory.eINSTANCE;
private static final Log LOG = LogFactory.getLog(CurrentAnalysisEditorBean.class);
......@@ -148,9 +149,6 @@ public class CurrentAnalysisEditorBean {
*/
public void initializeGraph() {
try {
// Make sure that the currentAnalysisEditorGraphBean knows "this" as well.
this.currentAnalysisEditorGraphBean.setCurrentAnalysisEditorBean(this);
// Initialize the graph
this.currentAnalysisEditorGraphBean.declareGraph();
......@@ -158,41 +156,7 @@ public class CurrentAnalysisEditorBean {
this.initializeGlobalConfigurationInstance();
this.currentAnalysisEditorGraphBean.addGlobalConfigurationInstance(this.globalConfigurationInstance);
// Initialize the reader, filter and repositories
for (final MIPlugin plugin : this.project.getPlugins()) {
if (plugin instanceof MIReader) {
this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin);
} else {
this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin);
}
}
for (final MIRepository repository : this.project.getRepositories()) {
this.currentAnalysisEditorGraphBean.addRepository(repository);
}
// Now initialize the connections between filters...
for (final MIPlugin plugin : this.project.getPlugins()) {
for (final MIOutputPort oPort : plugin.getOutputPorts()) {
for (final MIInputPort iPort : oPort.getSubscribers()) {
this.currentAnalysisEditorGraphBean.addConnection(plugin, iPort.getParent(), oPort, iPort);
}
}
}
// ...and between filters and repositories
for (final MIPlugin plugin : this.project.getPlugins()) {
for (final MIRepositoryConnector rPort : plugin.getRepositories()) {
// It is possible that the connected repository is null, if it hasn't been set yet. Check this.
if (rPort.getRepository() != null) {
this.currentAnalysisEditorGraphBean.addConnection(plugin, rPort.getRepository(), rPort);
}
}
}
// Initialize the mouse click and the edge constraint listeners
this.currentAnalysisEditorGraphBean.initListeners();
this.currentAnalysisEditorGraphBean.initEdgeConstraints();
this.currentAnalysisEditorGraphBean.addProject(this.project);
// Now we have to set the default grid size and color of the user
this.currentAnalysisEditorGraphBean.setGridColor(this.userBean.getGridColor());
......@@ -207,11 +171,13 @@ public class CurrentAnalysisEditorBean {
this.currentAnalysisEditorGraphBean.startAutoLayout();
}
// Make sure that guests cannot modify the graph
this.currentAnalysisEditorGraphBean.checkReadOnlyForGuests();
// Make sure that the currentAnalysisEditorGraphBean knows "this" as well.
this.currentAnalysisEditorGraphBean.addGraphListener(this);
this.currentAnalysisEditorGraphBean.initializeListeners();
} catch (final NullPointerException ex) {
// This exception can occur when a property has not been initialized
CurrentAnalysisEditorBean.LOG.error("An error occured while initializing the graph.", ex);
LOG.error("An error occured while initializing the graph.", ex);
}
}
......@@ -340,7 +306,7 @@ public class CurrentAnalysisEditorBean {
// Add it to the project - and to the graph
this.project.getRepositories().add(repository);
this.currentAnalysisEditorGraphBean.addRepository(repository);
this.currentAnalysisEditorGraphBean.addComponent(repository);
this.setModificationsFlag();
}
......@@ -357,7 +323,7 @@ public class CurrentAnalysisEditorBean {
// Add it to the project - and to the graph
this.project.getPlugins().add(plugin);
this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin);
this.currentAnalysisEditorGraphBean.addComponent((MIReader) plugin);
this.setModificationsFlag();
}
......@@ -374,7 +340,7 @@ public class CurrentAnalysisEditorBean {
// Add it to the project - and to the graph
this.project.getPlugins().add(plugin);
this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin);
this.currentAnalysisEditorGraphBean.addComponent((MIFilter) plugin);
this.setModificationsFlag();
}
......@@ -451,26 +417,16 @@ public class CurrentAnalysisEditorBean {
return "No description available.";
}
/**
* This method should be called if a node (plugin, repository) has been selected.
*
* @param node
* The new node to be selected.
*/
public void nodeSelected(final MIAnalysisComponent node) {
this.selectedComponent = node;
@Override
public void componentSelectedEvent(final MIAnalysisComponent newSelectedComponent) {
this.selectedComponent = newSelectedComponent;
}
/**
* This method should be called if a node (plugin, repository) has been removed.
*
* @param node
* The new node to be removed.
*/
public void nodeRemoved(final MIAnalysisComponent node) {
@Override
public void componentDeletedEvent(final MIAnalysisComponent deletedComponent) {
// Remove the component from the project
if (node instanceof MIPlugin) {
this.project.getPlugins().remove(node);
if (deletedComponent instanceof MIPlugin) {
this.project.getPlugins().remove(deletedComponent);
// Remove the corresponding connections
final List<MIInputPort> toBeRemoved = new ArrayList<MIInputPort>();
......@@ -478,7 +434,7 @@ public class CurrentAnalysisEditorBean {
for (final MIOutputPort oPort : plugin.getOutputPorts()) {
toBeRemoved.clear();
for (final MIInputPort iPort : oPort.getSubscribers()) {
if (iPort.getParent() == node) {
if (iPort.getParent() == deletedComponent) {
toBeRemoved.add(iPort);
}
}
......@@ -486,12 +442,12 @@ public class CurrentAnalysisEditorBean {
}
}
} else {
this.project.getRepositories().remove(node);
this.project.getRepositories().remove(deletedComponent);
// Remove the corresponding connections
for (final MIPlugin plugin : this.project.getPlugins()) {
for (final MIRepositoryConnector repoConn : plugin.getRepositories()) {
if (repoConn.getRepository() == node) {
if (repoConn.getRepository() == deletedComponent) {
repoConn.setRepository(null);
}
}
......@@ -502,7 +458,7 @@ public class CurrentAnalysisEditorBean {
for (final MIView view : this.project.getViews()) {
final Collection<MIDisplayConnector> toBeRemoved = new ArrayList<MIDisplayConnector>();
for (final MIDisplayConnector connector : view.getDisplayConnectors()) {
if (connector.getDisplay().getParent() == node) {
if (connector.getDisplay().getParent() == deletedComponent) {
toBeRemoved.add(connector);
}
}
......@@ -510,65 +466,37 @@ public class CurrentAnalysisEditorBean {
}
// Deselect the currently selected node if it is the one which has just been removed
if (this.selectedComponent == node) {
if (this.selectedComponent == deletedComponent) {
this.selectedComponent = null; // NOPMD
}
this.setModificationsFlag();
}
/**
* This method should be delivered if an edge between two plugins has been created.
*
* @param sourcePort
* The source port.
* @param targetPort
* The target port.
*/
public void edgeCreated(final MIOutputPort sourcePort, final MIInputPort targetPort) {
sourcePort.getSubscribers().add(targetPort);
@Override
public void connectionAddedEvent(final MIRepositoryConnector sourcePort, final MIRepository target) {
sourcePort.setRepository(target);
this.setModificationsFlag();
}
/**
* This method should be delivered if an edge between two plugins has been removed.
*
* @param sourcePort
* The source port.
* @param targetPort
* The target port.
*/
public void edgeRemoved(final MIOutputPort sourcePort, final MIInputPort targetPort) {
sourcePort.getSubscribers().remove(targetPort);
@Override
public void connectionAddedEvent(final MIOutputPort outputPort, final MIInputPort targetPort) {
outputPort.getSubscribers().add(targetPort);
this.setModificationsFlag();
}
/**
* This method should be delivered if an edge between a plugin and a repository has been created.
*
* @param sourcePort
* The source port.
* @param target
* The target repository.
*/
public void edgeCreated(final MIRepositoryConnector sourcePort, final MIRepository target) {
sourcePort.setRepository(target);
@Override
public void connectionDeletedEvent(final MIRepositoryConnector sourcePort, final MIRepository targetRepo) {
sourcePort.setRepository(null);
this.setModificationsFlag();
}
/**
* This method should be delivered if an edge between a plugin and a repository has been removed.
*
* @param sourcePort
* The source port.
* @param target
* The target repository.
*/
public void edgeRemoved(final MIRepositoryConnector sourcePort, final MIRepository target) {
sourcePort.setRepository(null);
@Override
public void connectionDeletedEvent(final MIOutputPort sourcePort, final MIInputPort targetPort) {
sourcePort.getSubscribers().remove(targetPort);
this.setModificationsFlag();
}
......
/***************************************************************************
* Copyright 2013 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.webgui.web.beans.view;
import java.util.Stack;
import kieker.webgui.web.utility.command.AbstractEditorCommand;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* This bean contains the necessary data behind an instance of the analysis editor for the undo and redo operations.<br>
* </br>
*
* The class is a Spring managed bean with view scope to make sure that one user (even in one session) can open multiple projects at a time without causing any
* problems.
*
* @author Nils Christian Ehmke
*/
@Component
@Scope("view")
public class CurrentAnalysisEditorHistoryBean {
private final Stack<AbstractEditorCommand> undoCommands = new Stack<AbstractEditorCommand>();
private final Stack<AbstractEditorCommand> redoCommands = new Stack<AbstractEditorCommand>();
/**
* Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b>
*/
public CurrentAnalysisEditorHistoryBean() {
// No code necessary
}
/**
* Undos the last command.
*/
public void undoLastCommand() {
if (!this.undoCommands.isEmpty()) {
final AbstractEditorCommand command = this.undoCommands.pop();
command.execute();
this.redoCommands.push(this.invertCommand(command));
}
}
/**
* Redos the last command.
*/
public void redoLastCommand() {
if (!this.redoCommands.isEmpty()) {
final AbstractEditorCommand command = this.redoCommands.pop();
command.execute();
this.undoCommands.push(this.invertCommand(command));
}
}
/**
* Tells whether the undo stack is empty or not.
*
* @return true iff the undo stack is empty.
*/
public boolean isUndoStackEmpty() {
return this.undoCommands.isEmpty();
}
/**
* Tells whether the redo stack is empty or not.
*
* @return true iff the redo stack is empty.
*/
public boolean isRedoStackEmpty() {
return this.redoCommands.isEmpty();
}
private AbstractEditorCommand invertCommand(final AbstractEditorCommand command) {
return command;
}
}
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