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

added simple version of SoftwareSystemAggregator

parent 63b74ff1
No related branches found
No related tags found
No related merge requests found
package kieker.analysis.dev;
import java.util.HashMap;
import java.util.Map;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Dependency;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import teetime.stage.basic.AbstractTransformation;
// Transformation:
// SoftwareSystem (Deployment) --> SoftwareSystem (Assembly)
// aggregate Containers
public class SoftwareSystemAggregator extends AbstractTransformation<SoftwareSystem, SoftwareSystem> {
@Override
protected void execute(final SoftwareSystem deploymentSoftwareSystem) {
Map<Component, Component> components = new HashMap<>(); // Old -> New
Map<Operation, Operation> operations = new HashMap<>(); // Old -> New
SoftwareSystem assemblySoftwareSystem = new SoftwareSystem();
Container newContainer = assemblySoftwareSystem.addContainer("DEFAULT");
for (Container container : deploymentSoftwareSystem.getContainers()) {
for (Component component : container.getComponents()) {
Component newComponent = newContainer.addComponent(component.getName());
components.put(component, newComponent);
for (Operation operation : component.getOperations()) {
Operation newOperation = newComponent.addOperation(operation.getName());
newOperation.getOperationCalls().addAll(operation.getOperationCalls());
operations.put(operation, newOperation);
}
}
}
for (Dependency<Component> componentDependency : deploymentSoftwareSystem.getComponentDependencies()) {
Component newCaller = components.get(componentDependency.getCaller());
Component newCallee = components.get(componentDependency.getCallee());
// Adds only if absent
Dependency<Component> dependency = assemblySoftwareSystem.addComponentDependency(newCaller, newCallee);
dependency.addCalls(componentDependency.getCalls());
dependency.addFailuredCalls(componentDependency.getFailuredCalls());
}
for (Dependency<Operation> operationDependency : deploymentSoftwareSystem.getOperationDependencies()) {
Operation newCaller = operations.get(operationDependency.getCaller());
Operation newCallee = operations.get(operationDependency.getCallee());
// Adds only if absent
Dependency<Operation> dependency = assemblySoftwareSystem.addOperationDependency(newCaller, newCallee);
dependency.addCalls(operationDependency.getCalls());
dependency.addFailuredCalls(operationDependency.getFailuredCalls());
}
this.outputPort.send(assemblySoftwareSystem);
}
}
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