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

Add the vitruv client server implementation from Thomas Mayer #584

Closed
wants to merge 19 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ xtend-gen/
target/
.polyglot.build.properties
.mvn/wrapper/maven-wrapper.jar
*.polyglot*

# Custom
EvaluationData

#IntelliJ
.idea/
*.iml
39 changes: 39 additions & 0 deletions bundles/tools.vitruv.framework.remote/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry exported="true" kind="lib" path="target/dependency/log4j.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/slf4j-log4j12.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/slf4j-api.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jackson-annotations.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jackson-core.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jackson-databind.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/javax.servlet-api.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-client.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-http.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-io.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-security.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-server.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-servlet.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-util.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-util-ajax.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-webapp.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/jetty-xml.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/spark-core.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/websocket-api.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/websocket-client.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/websocket-common.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/websocket-server.jar"/>
<classpathentry exported="true" kind="lib" path="target/dependency/websocket-servlet.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible" pattern="tools/vitruv/framework/vsum/internal/InternalVirtualModel"/>
</accessrules>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
28 changes: 28 additions & 0 deletions bundles/tools.vitruv.framework.remote/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tools.vitruv.framework.remote</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
40 changes: 40 additions & 0 deletions bundles/tools.vitruv.framework.remote/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Vitruv Framework Remote
Bundle-SymbolicName: tools.vitruv.framework.remote;singleton:=true
Automatic-Module-Name: tools.vitruv.framework.remote
Bundle-ClassPath: .,
target/dependency/jackson-annotations.jar,
target/dependency/jackson-core.jar,
target/dependency/jackson-databind.jar,
target/dependency/javax.servlet-api.jar,
target/dependency/jetty-client.jar,
target/dependency/jetty-http.jar,
target/dependency/jetty-io.jar,
target/dependency/jetty-security.jar,
target/dependency/jetty-server.jar,
target/dependency/jetty-servlet.jar,
target/dependency/jetty-util.jar,
target/dependency/jetty-util-ajax.jar,
target/dependency/jetty-webapp.jar,
target/dependency/jetty-xml.jar,
target/dependency/spark-core.jar,
target/dependency/websocket-api.jar,
target/dependency/websocket-client.jar,
target/dependency/websocket-common.jar,
target/dependency/websocket-server.jar,
target/dependency/websocket-servlet.jar,
target/dependency/slf4j-api.jar,
target/dependency/log4j.jar,
target/dependency/slf4j-log4j12.jar
Bundle-Version: 3.0.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: tools.vitruv.framework.views,
tools.vitruv.change.composite,
tools.vitruv.framework.vsum,
org.eclipse.emf.ecore.xmi,
com.google.guava
Export-Package: tools.vitruv.framework.remote.client,
tools.vitruv.framework.remote.client.exception,
tools.vitruv.framework.remote.server
Bundle-Vendor: vitruv.tools
29 changes: 29 additions & 0 deletions bundles/tools.vitruv.framework.remote/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
source.. = src/,\
res/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
target/dependency/jackson-annotations.jar,\
target/dependency/jackson-core.jar,\
target/dependency/jackson-databind.jar,\
target/dependency/javax.servlet-api.jar,\
target/dependency/jetty-client.jar,\
target/dependency/jetty-http.jar,\
target/dependency/jetty-io.jar,\
target/dependency/jetty-security.jar,\
target/dependency/jetty-server.jar,\
target/dependency/jetty-servlet.jar,\
target/dependency/jetty-util.jar,\
target/dependency/jetty-util-ajax.jar,\
target/dependency/jetty-webapp.jar,\
target/dependency/jetty-xml.jar,\
target/dependency/spark-core.jar,\
target/dependency/websocket-api.jar,\
target/dependency/websocket-client.jar,\
target/dependency/websocket-common.jar,\
target/dependency/websocket-server.jar,\
target/dependency/websocket-servlet.jar,\
target/dependency/slf4j-api.jar,\
target/dependency/log4j.jar,\
target/dependency/slf4j-log4j12.jar

8 changes: 8 additions & 0 deletions bundles/tools.vitruv.framework.remote/res/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Root logger option
log4j.rootLogger=INFO, stdout

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package tools.vitruv.framework.remote.client;

import tools.vitruv.framework.remote.client.exception.BadServerResponseException;
import tools.vitruv.framework.views.View;

import java.util.List;

/**
* A vitruv client can connect to a vitruv server and query view type names and views from this server.
*/
public interface VitruvClient {

/**
* Queries the vitruvius server to gain a list of all available view type names.
*
* @return A {@link List} of view type names.
* @throws BadServerResponseException if the server answered with a bad response or a connection error occurred.
*/
List<String> queryViewTypes() throws BadServerResponseException;

/**
* Queries the vitruvius server to obtain the view described through the view type with the given name.
* The {@link View views} returned from this method are responsible to synchronize changes with
* the vitruv server themselves.
*
* @param typeName the name of the view type
* @return A {@link View} of the given view type.
* @throws BadServerResponseException if the server answered with a bad response or a connection error occurred.
*/
View queryView(String typeName) throws BadServerResponseException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package tools.vitruv.framework.remote.client;

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

public class VitruvClientFactory {

public static final int STD_PORT = 8080;

/**
* Creates a new {@link VitruvClient} using the given url and the standard port of 8080.
*
* @param url of the vitruv server
* @return a {@link VitruvClient}
*/
public static VitruvClient create(String url) {
return create(url, STD_PORT);
}

/**
* Creates a new {@link VitruvClient} using the given url and port.
*
* @param url of the vitruv server
* @param port of the vitruv server
* @return a {@link VitruvClient}
*/
public static VitruvClient create(String url, int port) {
return new VitruvRemoteConnection(url, port);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tools.vitruv.framework.remote.client.exception;

public class BadServerResponseException extends RuntimeException {
private static final long serialVersionUID = -3664330903873102942L;

public BadServerResponseException() {
super();
}

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

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

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