Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions p2wrappers/emfutils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>sdq-demo-metamodels</groupId>
<artifactId>edu.kit.ipd.sdq.metamodels.families</artifactId>
</dependency>
</dependencies>
</project>
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
</modules>

<properties>
<repo.sdq-demo-metamodels.version>1.9.0</repo.sdq-demo-metamodels.version>
<repo.sdq-commons.version>2.2.0</repo.sdq-commons.version>
<vitruv.version>3.2.4-SNAPSHOT</vitruv.version>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>vitruv-tools</sonar.organization>
Expand Down Expand Up @@ -119,6 +121,7 @@
<version>1.16.0</version>
</dependency>


<!-- external test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -145,12 +148,29 @@
<artifactId>mockito-core</artifactId>
<version>5.20.0</version>
</dependency>
<dependency>
<groupId>sdq-demo-metamodels</groupId>
<artifactId>edu.kit.ipd.sdq.metamodels.families</artifactId>
<version>1.9.0.202311201524</version>
</dependency>
</dependencies>

</dependencyManagement>

<repositories>
<!-- allow snapshots -->
<repository>
<id>sdq-commons</id>
<name>SDQ Commons</name>
<url>https://kit-sdq.github.io/updatesite/release/commons/${repo.sdq-commons.version}</url>
<layout>p2</layout>
</repository>
<repository>
<id>sdq-demo-metamodels</id>
<name>SDQ Demo Metamodels</name>
<url>https://kit-sdq.github.io/updatesite/release/metamodels/demo/${repo.sdq-demo-metamodels.version}</url>
<layout>p2</layout>
</repository>
<repository>
<id>ossrh-snapshots</id>
<name>OSSRH Snapshots</name>
Expand Down
9 changes: 9 additions & 0 deletions remote/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,20 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tools.vitruv</groupId>
<artifactId>tools.vitruv.change.testutils.integration</artifactId>
<version>3.1.2</version>
</dependency>
<!-- p2 compile dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.server.p2wrappers.emfutils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>sdq-demo-metamodels</groupId>
<artifactId>edu.kit.ipd.sdq.metamodels.families</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
package tools.vitruv.framework.remote.client.impl;

import org.eclipse.emf.ecore.EPackage;
import tools.vitruv.framework.views.ChangeableViewSource;
import tools.vitruv.framework.views.ViewSelector;
import tools.vitruv.framework.views.ViewType;

/**
* A Vitruvius view type representing actual types on the virtual model, but is still capable of providing a view selector and allows creating
* A Vitruvius view type representing actual types on the virtual model,
* but is still capable of providing a view selector and allows creating
* views by querying the Vitruvius server.
*/
public class RemoteViewType implements ViewType<ViewSelector> {
private final String name;
private final VitruvRemoteConnection remoteConnection;
private final String name;
private final VitruvRemoteConnection remoteConnection;
private EPackage metamodel;

RemoteViewType(String name, VitruvRemoteConnection remoteConnection) {
this.name = name;
this.remoteConnection = remoteConnection;
}
/**
* Creates a new view type.
*
* @param name - String
* @param remoteConnection - {@link VitruvRemoteConnection}
*/
RemoteViewType(String name, VitruvRemoteConnection remoteConnection) {
this.name = name;
this.remoteConnection = remoteConnection;
}

@Override
public String getName() {
return name;
}
@Override
public String getName() {
return name;
}

/**
* Returns the {@link ViewSelector} of the {@link ViewType},
* which allows configuring views by delegating the request to the Vitruvius server.
*
* @param viewSource Ignored, can be null.
* @return A view selector for the view type represented by this remote view type.
*/
@Override
public ViewSelector createSelector(ChangeableViewSource viewSource) {
return remoteConnection.getSelector(name);
}

/**
* Returns the {@link ViewSelector} of the {@link ViewType}, which allows configuring views by delegating the request to the Vitruvius server.
*
* @param viewSource Ignored, can be null.
* @return A view selector for the view type represented by this remote view type.
*/
@Override
public ViewSelector createSelector(ChangeableViewSource viewSource) {
return remoteConnection.getSelector(name);
/**
* Returns the metamodel (i.e. actual view type) as {@link EPackage},
* by delegating the requrest to the Vitruvius server.
* When metamodel has already been loaded, returns it instead.
*
* @return {@link EPackage}
*/
@Override
public EPackage getMetamodel() {
if (metamodel == null) {
metamodel = remoteConnection.getMetamodel(name);
}
return metamodel;
}
}
Loading