Skip to content

Commit

Permalink
Merge pull request #610 from vitruv-tools/vitruv-remote
Browse files Browse the repository at this point in the history
Vitruv Remote with Server/Client
  • Loading branch information
HansMartinA authored Nov 21, 2024
2 parents 8b0744b + 97e31af commit c9b5723
Show file tree
Hide file tree
Showing 75 changed files with 3,019 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<modules>
<module>views</module>
<module>vsum</module>
<module>remote</module>
<module>testutils</module>
<module>applications</module>
</modules>
Expand Down Expand Up @@ -144,6 +145,11 @@
<artifactId>guava</artifactId>
<version>33.3.1-jre</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.13.3</version>
</dependency>
<dependency>
<groupId>emf-compare</groupId>
<artifactId>org.eclipse.emf.compare</artifactId>
Expand Down Expand Up @@ -255,6 +261,28 @@
<version>5.14.2</version>
<scope>test</scope>
</dependency>

<!-- Dependencies Vitruv Remote -->
<dependency>
<groupId>org.eclipse.emfcloud</groupId>
<artifactId>emfjson-jackson</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.18.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
164 changes: 164 additions & 0 deletions remote/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>tools.vitruv</groupId>
<artifactId>tools.vitruv.framework</artifactId>
<version>3.1.0-SNAPSHOT</version>
</parent>

<artifactId>tools.vitruv.framework.remote</artifactId>

<name>Vitruv V-SUM remote definition</name>
<description />

<dependencies>
<!-- project dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.utils</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.composite</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.propagation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.correspondence</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.interaction</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.atomic</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.framework.views</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.framework.vsum</artifactId>
<version>${project.version}</version>
</dependency>

<!-- project test depencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.testutils.metamodels</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tools.vitruv.change.testutils.core</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<!-- external dependencies -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>sdq-commons</groupId>
<artifactId>edu.kit.ipd.sdq.commons.util.emf</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.lib</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emfcloud</groupId>
<artifactId>emfjson-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>


<!-- external test dependencies -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xannotations</groupId>
<artifactId>edu.kit.ipd.sdq.activextendannotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>sdq-commons</groupId>
<artifactId>edu.kit.ipd.sdq.commons.util.java</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package tools.vitruv.framework.remote.client;

import tools.vitruv.framework.views.ViewProvider;
import tools.vitruv.framework.views.ViewTypeProvider;

/**
* A Vitruvius client can remotely access the available {@link tools.vitruv.framework.views.ViewType}s of a Vitruvius instance and query
* {@link tools.vitruv.framework.views.ViewSelector}s in order to create remotely editable {@link tools.vitruv.framework.views.View}s.
*/
public interface VitruvClient extends ViewTypeProvider, ViewProvider {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package tools.vitruv.framework.remote.client;

import tools.vitruv.framework.remote.client.impl.VitruvRemoteConnection;
import tools.vitruv.framework.remote.common.DefaultConnectionSettings;

import java.nio.file.Path;

public class VitruvClientFactory {
/**
* Creates a new {@link VitruvClient} using the given host name or IP address and the standard port of 8080.
*
* @param url The host name or IP address of the Vitruvius server.
* @param temp A non-existing or empty directory for temporary files.
* @return A {@link VitruvClient}.
*/
public static VitruvClient create(String url, Path temp) {
return create(url, DefaultConnectionSettings.STD_PORT, temp);
}

/**
* Creates a new {@link VitruvClient} using the given host name or IP address and port.
*
* @param hostOrIp The host name or IP address of the Vitruvius server.
* @param port Port of the Vitruvius server.
* @param temp A non-existing or empty directory for temporary files.
* @return A {@link VitruvClient}.
*/
public static VitruvClient create(String hostOrIp, int port, Path temp) {
return create(DefaultConnectionSettings.STD_PROTOCOL, hostOrIp, port, temp);
}

/**
* Creates a new {@link VitruvClient} using the given protocol, host name or IP address, and port.
*
* @param protocol The protocol.
* @param hostOrIp The host name of IP address of the Vitruvius server.
* @param port Port of the Vitruvius server.
* @param temp A non-existing or empty directory for temporary files.
* @return A {@link VitruvClient}.
*/
public static VitruvClient create(String protocol, String hostOrIp, int port, Path temp) {
return new VitruvRemoteConnection(protocol, hostOrIp, port, temp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package tools.vitruv.framework.remote.client.exception;

public class BadClientResponseException extends RuntimeException {
public BadClientResponseException() {
super();
}

public BadClientResponseException(String msg) {
super(msg);
}

public BadClientResponseException(String msg, Throwable cause) {
super(msg, cause);
}

public BadClientResponseException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package tools.vitruv.framework.remote.client.exception;

public class BadServerResponseException extends RuntimeException {
private int statusCode = -1;

public BadServerResponseException() {
super();
}

public BadServerResponseException(String msg) {
super(msg);
}

public BadServerResponseException(String msg, int statusCode) {
super(msg);
this.statusCode = statusCode;
}

public BadServerResponseException(String msg, Throwable cause) {
super(msg, cause);
}

public BadServerResponseException(Throwable cause) {
super(cause);
}

public int getStatusCode() {
return statusCode;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* This package defines exceptions for the Vitruvius client.
*/
package tools.vitruv.framework.remote.client.exception;
Loading

0 comments on commit c9b5723

Please sign in to comment.