Skip to content
Snippets Groups Projects
Commit 0013c84a authored by Sören Henning's avatar Sören Henning
Browse files

removed deprecated classes

parent 6144897e
No related branches found
No related tags found
No related merge requests found
package kieker.analysis.dev;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import kieker.analysis.traceanalysisutil.Statistics;
import kieker.analysis.traceanalysisutil.StatisticsUtility;
import teetime.stage.basic.AbstractTransformation;
//TODO Not required
@Deprecated
public class ContainerStatisticsDecoratorStage extends AbstractTransformation<SoftwareSystem, SoftwareSystem> {
@Override
protected void execute(final SoftwareSystem softwareSystem) {
for (Container container : softwareSystem.getContainers()) {
// TODO How to handle Statistics?
// All durations of all OperationCalls
List<Long> durations = new ArrayList<>();
for (Component component : container.getComponents()) {
for (Operation operation : component.getOperations()) {
List<Long> operationsDurations = operation.getOperationCalls().stream().map(c -> c.getDuration()).collect(Collectors.toList());
durations.addAll(operationsDurations);
}
}
final Statistics statistics = StatisticsUtility.calculateStatistics(durations);
container.setTotalDuration(statistics.getTotalDuration());
container.setMaxDuration(statistics.getMaxDuration());
container.setMinDuration(statistics.getMinDuration());
container.setMeanDuration(statistics.getMeanDuration());
container.setMedianDuration(statistics.getMedianDuration());
}
}
}
package kieker.analysis.dev;
import java.util.Collection;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import kieker.analysis.domain.systemdependency.SystemEntity;
import kieker.analysis.util.graph.Graph;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.impl.GraphImpl;
@Deprecated
public class DependencyGraphCreator {
private final boolean containers = true;
private final boolean components = true;
private final boolean operations = true;
private final boolean containerDependencies = true;
private final boolean componentDependencies = true;
private final boolean operationDependencies = true;
public Graph create(final SoftwareSystem softwareSystem) {
Graph graph = new GraphImpl();
addContainers(graph, softwareSystem.getContainers());
return graph;
}
private void addContainers(final Graph graph, final Collection<Container> containers) {
for (Container container : containers) {
if (this.containers) {
Vertex vertex = graph.addVertex(container.getIdentifier());
vertex.setProperty("ContainerName", container.getName());
addDurationStatistics(vertex, container);
addComponents(vertex.addChildGraph(), container.getComponents());
} else {
addComponents(graph, container.getComponents());
}
}
}
private void addComponents(final Graph graph, final Collection<Component> components) {
for (Component component : components) {
if (this.components) {
Vertex vertex = graph.addVertex(component.getIdentifier());
vertex.setProperty("ComponentName", component.getName());
vertex.setProperty("ContainerName", component.getContainer().getName());
addDurationStatistics(vertex, component);
addOperations(vertex.addChildGraph(), component.getOperations());
} else {
addOperations(graph, component.getOperations());
}
}
}
private void addOperations(final Graph graph, final Collection<Operation> operations) {
for (Operation operation : operations) {
if (this.operations) {
Vertex vertex = graph.addVertex(operation.getIdentifier());
vertex.setProperty("OperationName", operation.getName());
vertex.setProperty("ComponentName", operation.getComponent().getName());
vertex.setProperty("ContainerName", operation.getComponent().getContainer().getName());
addDurationStatistics(vertex, operation);
}
}
}
private void addDurationStatistics(final Vertex vertex, final SystemEntity systemEntity) {
vertex.setProperty("MaxDuration", systemEntity.getMaxDuration());
vertex.setProperty("MinDuration", systemEntity.getMinDuration());
vertex.setProperty("MeanDuration", systemEntity.getMeanDuration());
vertex.setProperty("MedianDuration", systemEntity.getMedianDuration());
vertex.setProperty("TotalDuration", systemEntity.getTotalDuration());
}
}
package kieker.analysis.dev.dependencygraphs.dot;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.export.dot.DotFileWriterStage;
import kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
@Deprecated
public class DotComponentsDependencyExportStage extends DotFileWriterStage {
public DotComponentsDependencyExportStage(final String outputDirectory) {
super(outputDirectory);
this.exportConfiguration.addGraphAttribute(DotGraphAttribute.RANKDIR, g -> "LR");
this.exportConfiguration.addDefaultNodeAttribute(DotNodeAttribute.SHAPE, g -> "box");
this.exportConfiguration.addClusterAttribute(DotClusterAttribute.LABEL, new ClusterMapper());
this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new ComponentVertexMapper());
this.exportConfiguration.addEdgeAttribute(DotEdgeAttribute.LABEL, (e -> e.getProperty("calls").toString()));
// Styling
// Something like this would be cool:
// this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new PropertyMapper("calls"));
}
// TODO Make public and not nested, join with the other vertex mappers
private class ComponentVertexMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
final StringBuilder statistics = new StringBuilder();
statistics.append("<<deployment component>>\\n");
statistics.append(vertex.getProperty("Name").toString());
statistics.append("\\n");
statistics.append(generateStatistics(vertex));
return statistics.toString();
}
private String generateStatistics(final Vertex vertex) {
final String temporalUnit = "xs"; // TODO temp
final List<String> statisticStrings = new ArrayList<>(5);
if (vertex.getProperty("MinDuration") != null) {
statisticStrings.add("min: " + vertex.getProperty("MinDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MaxDuration") != null) {
statisticStrings.add("max: " + vertex.getProperty("MaxDuration").toString() + temporalUnit);
}
if (vertex.getProperty("TotalDuration") != null) {
statisticStrings.add("total: " + vertex.getProperty("TotalDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MeanDuration") != null) {
statisticStrings.add("avg: " + vertex.getProperty("MeanDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MedianDuration") != null) {
statisticStrings.add("med: " + vertex.getProperty("MedianDuration").toString() + temporalUnit);
}
// If there are more than 3 statistics elements add a line break after the 3rd last
if (statisticStrings.size() > 3) {
final int thirdLast = statisticStrings.size() - 3;
statisticStrings.set(thirdLast, statisticStrings.get(thirdLast).concat("\\n"));
}
return statisticStrings.stream().collect(Collectors.joining(", "));
}
}
private class ClusterMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
switch (vertex.getProperty("Type").toString()) {
case "Container":
return "<<execution container>>\\n" + vertex.getProperty("Name").toString();
case "Component":
return "<<deployment component>>\\n" + vertex.getProperty("Name").toString();
default:
return null;
}
}
}
}
package kieker.analysis.dev.dependencygraphs.dot;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.export.dot.DotFileWriterStage;
import kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
@Deprecated
public class DotContainersDependencyExportStage extends DotFileWriterStage {
public DotContainersDependencyExportStage(final String outputDirectory) {
super(outputDirectory);
this.exportConfiguration.addGraphAttribute(DotGraphAttribute.RANKDIR, g -> "LR");
this.exportConfiguration.addDefaultNodeAttribute(DotNodeAttribute.SHAPE, g -> "box3d");
this.exportConfiguration.addClusterAttribute(DotClusterAttribute.LABEL, new ClusterMapper());
this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new ContainerVertexMapper());
this.exportConfiguration.addEdgeAttribute(DotEdgeAttribute.LABEL, (e -> e.getProperty("calls").toString()));
// Styling
// Something like this would be cool:
// this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new PropertyMapper("calls"));
}
// TODO Make public and not nested, join with the other vertex mappers
private class ContainerVertexMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
final StringBuilder statistics = new StringBuilder();
statistics.append("<<execution container>>\\n");
statistics.append(vertex.getProperty("Name").toString());
statistics.append("\\n");
statistics.append(generateStatistics(vertex));
return statistics.toString();
}
private String generateStatistics(final Vertex vertex) {
final String temporalUnit = "xs"; // TODO temp
final List<String> statisticStrings = new ArrayList<>(5);
if (vertex.getProperty("MinDuration") != null) {
statisticStrings.add("min: " + vertex.getProperty("MinDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MaxDuration") != null) {
statisticStrings.add("max: " + vertex.getProperty("MaxDuration").toString() + temporalUnit);
}
if (vertex.getProperty("TotalDuration") != null) {
statisticStrings.add("total: " + vertex.getProperty("TotalDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MeanDuration") != null) {
statisticStrings.add("avg: " + vertex.getProperty("MeanDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MedianDuration") != null) {
statisticStrings.add("med: " + vertex.getProperty("MedianDuration").toString() + temporalUnit);
}
// If there are more than 3 statistics elements add a line break after the 3rd last
if (statisticStrings.size() > 3) {
final int thirdLast = statisticStrings.size() - 3;
statisticStrings.set(thirdLast, statisticStrings.get(thirdLast).concat("\\n"));
}
return statisticStrings.stream().collect(Collectors.joining(", "));
}
}
// Not used in this class
private class ClusterMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
switch (vertex.getProperty("Type").toString()) {
case "Container":
return "<<execution container>>\\n" + vertex.getProperty("Name").toString();
case "Component":
return "<<deployment component>>\\n" + vertex.getProperty("Name").toString();
default:
return null;
}
}
}
}
package kieker.analysis.dev.dependencygraphs.dot;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.export.dot.DotFileWriterStage;
import kieker.analysis.util.graph.util.dot.attributes.DotClusterAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotEdgeAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotGraphAttribute;
import kieker.analysis.util.graph.util.dot.attributes.DotNodeAttribute;
@Deprecated
public class DotOperationsDependencyExportStage extends DotFileWriterStage {
public DotOperationsDependencyExportStage(final String outputDirectory) {
super(outputDirectory);
this.exportConfiguration.addGraphAttribute(DotGraphAttribute.RANKDIR, g -> "LR");
this.exportConfiguration.addDefaultNodeAttribute(DotNodeAttribute.SHAPE, g -> "oval");
this.exportConfiguration.addClusterAttribute(DotClusterAttribute.LABEL, new ClusterMapper());
this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new OperationVertexMapper());
this.exportConfiguration.addEdgeAttribute(DotEdgeAttribute.LABEL, (e -> e.getProperty("calls").toString()));
// Styling
// Something like this would be cool:
// this.exportConfiguration.addNodeAttribute(DotNodeAttribute.LABEL, new PropertyMapper("calls"));
}
// TODO Make public and not nested, join with the other vertex mappers
private class OperationVertexMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
final StringBuilder statistics = new StringBuilder();
statistics.append(vertex.getProperty("Name").toString());
statistics.append("\\n");
statistics.append(generateStatistics(vertex));
return statistics.toString();
}
private String generateStatistics(final Vertex vertex) {
final String temporalUnit = "xs"; // TODO temp
final List<String> statisticStrings = new ArrayList<>(5);
if (vertex.getProperty("MinDuration") != null) {
statisticStrings.add("min: " + vertex.getProperty("MinDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MaxDuration") != null) {
statisticStrings.add("max: " + vertex.getProperty("MaxDuration").toString() + temporalUnit);
}
if (vertex.getProperty("TotalDuration") != null) {
statisticStrings.add("total: " + vertex.getProperty("TotalDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MeanDuration") != null) {
statisticStrings.add("avg: " + vertex.getProperty("MeanDuration").toString() + temporalUnit);
}
if (vertex.getProperty("MedianDuration") != null) {
statisticStrings.add("med: " + vertex.getProperty("MedianDuration").toString() + temporalUnit);
}
// If there are more than 3 statistics elements add a line break after the 3rd last
if (statisticStrings.size() > 3) {
final int thirdLast = statisticStrings.size() - 3;
statisticStrings.set(thirdLast, statisticStrings.get(thirdLast).concat("\\n"));
}
return statisticStrings.stream().collect(Collectors.joining(", "));
}
}
private class ClusterMapper implements Function<Vertex, String> {
@Override
public String apply(final Vertex vertex) {
switch (vertex.getProperty("Type").toString()) {
case "Container":
return "<<execution container>>\\n" + vertex.getProperty("Name").toString();
case "Component":
return "<<deployment component>>\\n" + vertex.getProperty("Name").toString();
default:
return null;
}
}
}
}
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