Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web selector for annotating components #9

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
844c250
basic parsing
Kr0nox Dec 9, 2024
aede699
export system
Kr0nox Dec 10, 2024
1a8f733
setup viewer
Kr0nox Dec 11, 2024
94be9d8
prohibit editing
Kr0nox Dec 15, 2024
099809d
basic rendering
Kr0nox Dec 15, 2024
9bb294f
very basic renderer for assembly diagramm
Kr0nox Dec 15, 2024
ce62cd6
fix some edge rendering issues
Kr0nox Dec 15, 2024
d1e6846
display assembly diagramm with minimal layouting
Kr0nox Dec 27, 2024
f3f6087
clean up
Kr0nox Dec 28, 2024
dc4eb2a
mostly finished assembly diagramm
Kr0nox Dec 28, 2024
94a8c5e
finish display of assembly diagramm
Kr0nox Dec 29, 2024
20be385
clean up
Kr0nox Dec 29, 2024
e8aa9af
Allocation diagram
Kr0nox Dec 29, 2024
80055f3
resource environment
Kr0nox Dec 30, 2024
f509e17
refactoring and cleanup
Kr0nox Dec 31, 2024
d231839
usage model
Kr0nox Dec 31, 2024
d16ff3f
repository
Kr0nox Jan 1, 2025
92ec2cf
add vue base around diagrams
Kr0nox Jan 2, 2025
73985a4
fix build
Kr0nox Jan 2, 2025
27e3d4b
theme switch
Kr0nox Jan 2, 2025
116019b
move theme switch into tab bar
Kr0nox Jan 3, 2025
bf8f1f9
fix alignment
Kr0nox Jan 3, 2025
3e2a2c7
uncertainty sidebar
Kr0nox Jan 3, 2025
b7d69ac
tooltip
Kr0nox Jan 3, 2025
b6b45d7
selection mechanic
Kr0nox Jan 4, 2025
08461d8
allow deselection by clicking empty space
Kr0nox Jan 5, 2025
4da4933
better entryLevelSystemCall
Kr0nox Jan 5, 2025
68cc6fa
add more icons
Kr0nox Jan 6, 2025
eef3289
abstract seff node for unimplemented types
Kr0nox Jan 6, 2025
6f5e7dd
click on signature in basic component
Kr0nox Jan 6, 2025
4e2d264
small style adjustments
Kr0nox Jan 6, 2025
cf03e87
use file from arc3n
Kr0nox Jan 7, 2025
87b20a5
move clickable elements to top of list
Kr0nox Jan 8, 2025
4cda2a9
gray out symbols
Kr0nox Jan 8, 2025
0793f61
expand information on tooltip
Kr0nox Jan 8, 2025
ef73629
change select color
Kr0nox Jan 8, 2025
2ee9bc7
basic display of all seff elements
Kr0nox Jan 14, 2025
f3b2db6
better layout
Kr0nox Jan 14, 2025
01a0f2e
display multi selection
Kr0nox Jan 24, 2025
cc78df4
remove font awesome
Kr0nox Jan 28, 2025
0aa52cb
local hosting
Kr0nox Feb 1, 2025
7135f30
load and save selection
Kr0nox Feb 1, 2025
29f0171
run analysis
Kr0nox Feb 2, 2025
b859134
rename tabs
Kr0nox Feb 2, 2025
9d15312
trash can
Kr0nox Feb 2, 2025
1a17563
edge highlight colors
Kr0nox Feb 2, 2025
006655f
edge name
Kr0nox Feb 2, 2025
3e1b844
move dto to own classes
Kr0nox Feb 2, 2025
9f3de82
save movement
Kr0nox Feb 2, 2025
b224bd0
improve selection
Kr0nox Feb 11, 2025
185eb0f
comment code
Kr0nox Feb 16, 2025
d13e85a
finalize layouting
Kr0nox Mar 1, 2025
5d30f0a
add icons for branch
Kr0nox Mar 4, 2025
217971f
rename test case
Kr0nox Mar 4, 2025
43f13da
Merge remote-tracking branch 'origin/main' into web-selector
Kr0nox Mar 4, 2025
96889f2
fix manifest
Kr0nox Mar 4, 2025
3f55b5d
Merge remote-tracking branch 'origin/main' into web-selector
Kr0nox Mar 4, 2025
fce7523
fix tab bar
Kr0nox Mar 6, 2025
bdea54c
fix duplicate ids
Kr0nox Mar 6, 2025
a1ab8fd
save movement
Kr0nox Mar 6, 2025
05de852
fix missing edges
Kr0nox Mar 6, 2025
06e4eea
branch in usage model
Kr0nox Mar 6, 2025
57b013a
fix node cut of
Kr0nox Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bundles/dev.abunai.impact.analysis/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Bundle-SymbolicName: dev.abunai.impact.analysis
Bundle-Version: 1.0.0.qualifier
Export-Package: dev.abunai.impact.analysis,
dev.abunai.impact.analysis.interactive,
dev.abunai.impact.analysis.webview,
dev.abunai.impact.analysis.model,
dev.abunai.impact.analysis.model.impact,
dev.abunai.impact.analysis.util
Expand All @@ -15,7 +16,8 @@ Require-Bundle: org.eclipse.core.runtime,
com.fasterxml.jackson.core.jackson-core,
org.dataflowanalysis.pcm.extension.nodecharacteristics,
com.fasterxml.jackson.core.jackson-annotations,
dev.abunai.impact.analysis.testmodels;bundle-version="1.0.0"
dev.abunai.impact.analysis.testmodels;bundle-version="1.0.0",
org.palladiosimulator.pcm
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: dev.abunai.impact.analysis
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.abunai.impact.analysis.webview;

import dev.abunai.impact.analysis.webview.jsonmodel.JsonObject;
import org.eclipse.emf.ecore.EObject;

/**
* Transforms a model type from PCM to the web format
* @param <T> Type to transform
*/
interface AbstractTransformer<T extends EObject> {

/**
* Transforms a PCM object to the web format
* @param v Object to transform
* @return The web representation of the given object
*/
public JsonObject transform(T v);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package dev.abunai.impact.analysis.webview;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import dev.abunai.impact.analysis.webview.jsonmodel.AllocationDiagrammJson;
import dev.abunai.impact.analysis.webview.jsonmodel.AssemblyContextJson;
import dev.abunai.impact.analysis.webview.jsonmodel.JsonObject;
import dev.abunai.impact.analysis.webview.jsonmodel.ResourceContainerJson;
import org.palladiosimulator.pcm.allocation.Allocation;
import org.palladiosimulator.pcm.allocation.AllocationContext;


class AllocationTransformer implements AbstractTransformer<Allocation> {

@Override
public JsonObject transform(Allocation allocation) {
Map<String, ResourceContainerJson> resourceContainer = new HashMap<>();
List<ResourceContainerJson> contents = new ArrayList<>();

for (var c : allocation.eContents()) {
if (c instanceof AllocationContext) {
var o = (AllocationContext) c;
String containerID = o.getResourceContainer_AllocationContext().getId();
if (!resourceContainer.containsKey(containerID)) {
ResourceContainerJson container = new ResourceContainerJson(o.getResourceContainer_AllocationContext().getEntityName(), containerID, new ArrayList<>());
contents.add(container);
resourceContainer.put(containerID, container);
}
resourceContainer.get(containerID).contents.add(new AssemblyContextJson(o.getEntityName(), o.getId()));
}
}
return new AllocationDiagrammJson(allocation.getId(), contents);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package dev.abunai.impact.analysis.webview;

import java.util.List;
import java.util.Optional;

import org.eclipse.emf.ecore.EObject;
import org.palladiosimulator.pcm.core.composition.AssemblyConnector;
import org.palladiosimulator.pcm.core.composition.AssemblyContext;
import org.palladiosimulator.pcm.core.composition.ProvidedDelegationConnector;
import org.palladiosimulator.pcm.repository.Interface;
import org.palladiosimulator.pcm.repository.Signature;
import org.palladiosimulator.pcm.resourceenvironment.ResourceContainer;
import org.palladiosimulator.pcm.seff.ExternalCallAction;
import org.palladiosimulator.pcm.seff.SetVariableAction;
import org.palladiosimulator.pcm.usagemodel.Branch;
import org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall;
import org.palladiosimulator.pcm.usagemodel.UsageScenario;

import dev.abunai.impact.analysis.PCMUncertaintyImpactAnalysis;

/**
* Handles the adding of uncertainties to the analysis
*/
class AnalysisHandler {
private final PCMUncertaintyImpactAnalysis analysis;

public AnalysisHandler(PCMUncertaintyImpactAnalysis analysis) {
this.analysis = analysis;
}

/**
* Adds uncertainties to the analysis and executes it
* @param selections The selections made in the viewer
*/
public void handle(List<SelectionData> selections) {
for (SelectionData selection : selections) {
Optional<EObject> component = analysis.getResourceProvider().lookupElementWithId(selection.component);
if (component.isPresent()) {
addToAnalysis(component.get(), selection.component);
}
}

analysis.propagate().printResults(true, true, true, false);
}

private void addToAnalysis(EObject component, String id) {
if (component instanceof AssemblyContext) {
analysis.getUncertaintySources().addComponentUncertaintyInAssemblyContext(id);
}
if (component instanceof AssemblyConnector) {
analysis.getUncertaintySources().addConnectorUncertaintyInConnector(id);
}
if (component instanceof ProvidedDelegationConnector) {
analysis.getUncertaintySources().addConnectorUncertaintyInConnector(id);
}
if (component instanceof ResourceContainer) {
analysis.getUncertaintySources().addActorUncertaintyInResourceContainer(id);
}
if (component instanceof UsageScenario) {
analysis.getUncertaintySources().addActorUncertaintyInUsageScenario(id);
}
if (component instanceof Signature) {
analysis.getUncertaintySources().addInterfaceUncertaintyInSignature(id);
}
if (component instanceof Interface) {
analysis.getUncertaintySources().addInterfaceUncertaintyInInterface(id);
}
if (component instanceof ExternalCallAction) {
analysis.getUncertaintySources().addBehaviorUncertaintyInExternalCallAction(id);
}
if (component instanceof EntryLevelSystemCall) {
analysis.getUncertaintySources().addBehaviorUncertaintyInEntryLevelSystemCall(id);
}
if (component instanceof SetVariableAction) {
analysis.getUncertaintySources().addBehaviorUncertaintyInSetVariableAction(id);
}
if (component instanceof Branch) {
analysis.getUncertaintySources().addBehaviorUncertaintyInBranch(id);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package dev.abunai.impact.analysis.webview;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import dev.abunai.impact.analysis.webview.jsonmodel.*;
import org.palladiosimulator.pcm.core.entity.NamedElement;
import org.palladiosimulator.pcm.repository.BasicComponent;
import org.palladiosimulator.pcm.repository.CompositeDataType;
import org.palladiosimulator.pcm.repository.DataType;
import org.palladiosimulator.pcm.repository.InnerDeclaration;
import org.palladiosimulator.pcm.repository.Interface;
import org.palladiosimulator.pcm.repository.OperationInterface;
import org.palladiosimulator.pcm.repository.OperationProvidedRole;
import org.palladiosimulator.pcm.repository.OperationRequiredRole;
import org.palladiosimulator.pcm.repository.OperationSignature;
import org.palladiosimulator.pcm.repository.PrimitiveDataType;
import org.palladiosimulator.pcm.repository.Repository;
import org.palladiosimulator.pcm.repository.RepositoryComponent;
import org.palladiosimulator.pcm.seff.ResourceDemandingSEFF;

class RepositoryTransformer implements AbstractTransformer<Repository> {

@Override
public JsonObject transform(Repository repository) {
SeffTransformer seffTransformer = new SeffTransformer();
List<JsonObject> contents = new ArrayList<>();

for (RepositoryComponent component : repository.getComponents__Repository()) {
List<SeffJson> seffs = new ArrayList<>();
List<ComponentInterfaceConnection> required = new ArrayList<>();
List<ComponentInterfaceConnection> provided = new ArrayList<>();
if (component instanceof BasicComponent) {
BasicComponent basicComponent = (BasicComponent)component;
for (var s : basicComponent.getServiceEffectSpecifications__BasicComponent()) {
if (s instanceof ResourceDemandingSEFF) {
ResourceDemandingSEFF seff = (ResourceDemandingSEFF)s;

seffs.add(new SeffJson(seff.getId(),
seff.getBasicComponent_ServiceEffectSpecification().getEntityName() + "." + s.getDescribedService__SEFF().getEntityName(),
seff.getSteps_Behaviour().stream().map(a -> seffTransformer.transform(a)).toList()));
}
}
for (var r : component.getRequiredRoles_InterfaceRequiringEntity()) {
if (r instanceof OperationRequiredRole) {
OperationRequiredRole o = (OperationRequiredRole)r;
required.add(new ComponentInterfaceConnection(o.getEntityName(), o.getRequiredInterface__OperationRequiredRole().getId()));
}
}
for (var r : component.getProvidedRoles_InterfaceProvidingEntity()) {
if (r instanceof OperationProvidedRole) {
OperationProvidedRole o = (OperationProvidedRole)r;
required.add(new ComponentInterfaceConnection(o.getEntityName(), o.getProvidedInterface__OperationProvidedRole().getId()));
}
}
}
contents.add(new BasicComponentJson(component.getId(), component.getEntityName(), seffs, required, provided));
}

for (Interface i : repository.getInterfaces__Repository()) {
List<String> signatures = new ArrayList<>();
if (i instanceof OperationInterface) {
OperationInterface operationInterface = (OperationInterface)i;
for (OperationSignature o : operationInterface.getSignatures__OperationInterface()) {
String returnType = getDataType(o.getReturnType__OperationSignature());
String parameter = o.getParameters__OperationSignature().stream().map(p -> getDataType(p.getDataType__Parameter()) + " " + p.getParameterName()).collect(Collectors.joining(", "));

signatures.add(
returnType + " " +
o.getEntityName() + "(" +
parameter + ")"
);
}
}
contents.add(new InterfaceJson(i.getId(), i.getEntityName(), signatures));
}

for (DataType d : repository.getDataTypes__Repository()) {
if (d instanceof CompositeDataType) {
CompositeDataType compositeDataType = (CompositeDataType)d;
List<String> contained = new ArrayList<String>();
List<String> signatures = new ArrayList<>();
for (InnerDeclaration inner : compositeDataType.getInnerDeclaration_CompositeDataType()) {
signatures.add(inner.getEntityName() + ": " + getDataType(inner.getDatatype_InnerDeclaration()));
if (inner.getDatatype_InnerDeclaration() instanceof CompositeDataType) {
contained.add(((CompositeDataType)inner.getDatatype_InnerDeclaration()).getId());
}
}
contents.add(new CompositeDataTypeJson(compositeDataType.getId(), compositeDataType.getEntityName(), signatures, contained));
}
}

return new RepositoryJson(repository.getId(), contents);
}

String getDataType(DataType dataType) {
if (dataType instanceof NamedElement) {
NamedElement compositeDataType = (NamedElement)dataType;
return compositeDataType.getEntityName();
}
if (dataType instanceof PrimitiveDataType) {
PrimitiveDataType primitiveDataType = (PrimitiveDataType)dataType;
return primitiveDataType.getType().getLiteral();
}
return "void";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.abunai.impact.analysis.webview;

import java.util.ArrayList;
import java.util.List;

import dev.abunai.impact.analysis.webview.jsonmodel.ChildlessResourceContainerJson;
import dev.abunai.impact.analysis.webview.jsonmodel.JsonObject;
import dev.abunai.impact.analysis.webview.jsonmodel.LinkingResourceJson;
import dev.abunai.impact.analysis.webview.jsonmodel.ResourceEnvironmentJson;
import org.palladiosimulator.pcm.resourceenvironment.LinkingResource;
import org.palladiosimulator.pcm.resourceenvironment.ResourceContainer;
import org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment;

class ResourceEnvironmentTransformer implements AbstractTransformer<ResourceEnvironment> {

@Override
public JsonObject transform(ResourceEnvironment resourceEnvironment) {
List<JsonObject> contents = new ArrayList<>();
for (var c : resourceEnvironment.eContents()) {
if (c instanceof LinkingResource) {
LinkingResource o = (LinkingResource)c;
contents.add(new LinkingResourceJson(o.getEntityName(), o.getId(),
o.getConnectedResourceContainers_LinkingResource().stream().map(r -> r.getId()).toList()));
}
if (c instanceof ResourceContainer) {
ResourceContainer o = (ResourceContainer)c;
contents.add(new ChildlessResourceContainerJson(o.getEntityName(), o.getId()));
}
}
return new ResourceEnvironmentJson(resourceEnvironment.getEntityName(), contents);
}
}
Loading