Skip to content

Commit

Permalink
Merge pull request #5 from simonpeterhans/kotlin-upgrade
Browse files Browse the repository at this point in the history
VREM Upgrade
  • Loading branch information
silvanheller authored Jul 23, 2021
2 parents c3245c5 + 2c438dd commit 231a8bc
Show file tree
Hide file tree
Showing 87 changed files with 3,616 additions and 2,961 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

37 changes: 24 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Ignore IntellJ project files
.idea/**
.gradle/**
*.iml
# Ignore IntelliJ build files
out/**

# Ignore build files
build/**
out/**
### Generic ###
data/
logs/
.idea/
out/

### Kotlin ###
# Compiled class file
*.class

Expand All @@ -33,6 +29,21 @@ out/**
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Temp files
*~
*.DS_Store
### Gradle ###
.gradle/
build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

### Gradle Patch ###
**/build/
15 changes: 6 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
language: java

matrix:
include:
- os: linux
jdk:
- openjdk11
- os: osx
osx_image: xcode11
os: linux

jdk:
- openjdk11
- openjdk12

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand All @@ -17,5 +15,4 @@ cache:
- $HOME/.gradle/wrapper/

script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./gradlew check ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./gradlew check ; fi
- ./gradlew check
59 changes: 39 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,62 @@
# Virtual Reality Exhibition Manager (VREM)
[![Build Status](https://travis-ci.org/VIRTUE-DBIS/virtual-exhibition-manager.svg?branch=master)](https://travis-ci.org/VIRTUE-DBIS/virtual-exhibition-manager)

The Virtual Reality Exhibition Manager (VREM) is a tool that allows for configuration, storage of and access to VR exhibition definitions.
This is the Backend. For the front end in Unity see [VREP](https://github.com/dbisUnibas/virtual-exhibition-presenter).
For the User Interface see [VREM-UI](https://github.com/sauterl/virtual-exhibition-manager-ui)
It has been created as part of the [Open Cultural Data Hackathon 2018](http://make.opendata.ch/wiki/event:2018-10), held in Zurich, Switzerland.
[![Build Status](https://travis-ci.org/VIRTUE-DBIS/virtual-exhibition-manager.svg?branch=master)](https://travis-ci.org/VIRTUE-DBIS/virtual-exhibition-manager)

The Virtual Reality Exhibition Manager (VREM) is a tool that allows for configuration, storage of and access to VR
exhibition definitions.
While VREM acts as a back end, the exhibitions can be viewed in
the [Virtual Exhibition Presenter (VREP)](https://github.com/dbisUnibas/virtual-exhibition-presenter) (Unity).
For the Angular UI see [VREM-UI](https://github.com/sauterl/virtual-exhibition-manager-ui). It has been created as part
of the [Open Cultural Data Hackathon 2018](http://make.opendata.ch/wiki/event:2018-10), held in Zurich, Switzerland.

## Prerequisites

Below is a very shortened version of the [setup guide](https://github.com/VIRTUE-DBIS/virtual-exhibition-presenter/wiki/Setup-Guide) on how to setup VREM.
Below is a very shortened version of
the [setup guide](https://github.com/VIRTUE-DBIS/virtual-exhibition-presenter/wiki/Setup-Guide) on how to setup VREM.

### System dependencies
* git
* JDK 8 or higher
* You will require [MongoDB](https://docs.mongodb.com/manual/installation/) as storage engine. We recommend using [Docker](https://www.docker.com).
If you have installed docker, you can start a new container using `docker run --name vrem-container -d -p 27017:27017 mongo`. If you already have a container, restart it using `docker start mongo`.
If you're on a unix-system, use the `startdb.sh` script.

* Git
* JDK 11 or higher
* You will require [MongoDB](https://docs.mongodb.com/manual/installation/) as storage engine. We recommend
using [Docker](https://www.docker.com). If you have installed docker, you can start a new container
using `docker run --name vrem-container -d -p 27017:27017 mongo`. If you already have a container, restart it
using `docker start mongo`. If you're on a unix-system, use the `launch_db.sh` script.

## Building VREM
VREM can be built using [Gradle](http://gradle.org/). Building and running it is as easy as

VREM can be built using [Gradle](http://gradle.org/). Building and running it is as simple as:

```
./gradlew clean deploy
java -jar build/libs/vrem.jar
java -jar vrem.jar <command>
cd build/libs
java -jar virtual-exhibition-manager-2.0.0-SNAPSHOT.jar
java -jar virtual-exhibition-manager-2.0.0-SNAPSHOT.jar <command>
```

Make sure you have the correct working directory set so VREM can properly import exhibitions and serve content.

## Starting a server

Before starting, you must adapt the configurations in your config.json file (see example file). Then you can start the VREM server
by typing into your console:
Before starting, you should adapt the configurations in your config.json file (see example file).
After doing so, you may serve stored exhibitions by running VREM with the following command:

```
java -jar build/libs/virtual-exhibition-manager-1.2.jar server -c /path/to/your/config.json
java -jar virtual-exhibition-manager-2.0.0-SNAPSHOT.jar server -c /path/to/your/config.json
```

## Importing a collection
As an exmple, consider the following command:
## Importing an exhibition

By using the `import-folder` command, you can import a stored exhibition to the running MongoDB instance in order to be
able to serve the exhibition via the `server`command afterwards.
The following command imports a collection from the `data/import/my_exhibition` folder (relative to VREM's directory):

```
import-folder --path ../vre-mixnhack19/exhibition --config mixnhack19.json --name "mixnhack19" --description "Exhibition for Mix'n'Hack 2019" --clean
import-folder --config=config.json --path=data/import/my_exhibition --name=demo
```

Since the images themselves are not stored in the database, VREP will maintain a folder containing the exhibition images
in `data/` (relative to VREM).

For an exhibition example, consult the repository
at [https://github.com/VIRTUE-DBIS/vre-mixnhack19](https://github.com/VIRTUE-DBIS/vre-mixnhack19).
147 changes: 120 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,51 +1,77 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlinVersion"
id 'org.openapi.generator' version "$openApiGenVersion"
id 'java'
id 'application'
id 'idea'
}

group 'ch.unibas.dmi.dbis'
version '1.2'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {

implementation group: 'com.google.code.gson', name: 'gson', version: '2.7'
// Allow custom specification of Cineast OpenAPI config via -PapiConfigPath=...
def apiConfigPath = project.properties["apiConfigPath"] ?: "$rootDir/cineast.json"

// Source/Target compatibility (currently used for source & target/JVM).
def javaCompatibility = 11

implementation group: 'com.sparkjava', name: 'spark-core', version: '2.7.2'

////// MongoDB
implementation group: 'org.mongodb', name: 'mongodb-driver', version: '3.8.2'

////// CLI PARSING
implementation group: 'com.github.rvesse', name: 'airline', version: '2.5.0'
// Project settings.
group 'ch.unibas.dmi.dbis'
version '2.0.0-SNAPSHOT'

////// LOGGING
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.+'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.+'
// Main class.
mainClassName = 'ch.unibas.dmi.dbis.vrem.VREMKt'

// Java properties.
java {
sourceCompatibility = javaCompatibility
targetCompatibility = javaCompatibility
}

testImplementation group: 'junit', name: 'junit', version: '4.12'
// Application properties.
application {
applicationDefaultJvmArgs = ["-Xms2G", "-Xmx4G"]
}

// Add generated code to sources.
sourceSets {
main {
java {
srcDirs += "$buildDir/generated/src/main/kotlin/"
}
}
}

// Jar properties.
jar {
manifest {
attributes "Version": "$version"
attributes "Manifest-Version": "1.0"
attributes 'Main-Class': 'ch.unibas.dmi.dbis.vrem.VREM'
attributes 'Version': archiveVersion.get()
attributes 'Main-Class': mainClassName // Same as for the application plugin.
attributes 'Manifest-Version': '1.0'
attributes 'Multi-Release': true
}

// Gradle 7.0 requires a duplicate handling strategy or fails if duplicates occur.
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}

// Generate Cineast OpenAPI bindings.
task generateOpenApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = 'kotlin'
inputSpec = apiConfigPath
packageName = "ch.unibas.dmi.dbis.vrem.cineast.client"
outputDir = "$buildDir/generated"

skipValidateSpec = true

configOptions = [
enumPropertyNaming: "UPPERCASE"
]
}

task copyResources {
doLast {
copy {
Expand All @@ -55,4 +81,71 @@ task copyResources {
}
}

task deploy(dependsOn: [build, jar, copyResources])
task deploy {
dependsOn generateOpenApi, build, copyResources
}

// Regenerate OpenAPI code before building.
compileKotlin {
mustRunAfter generateOpenApi
dependsOn generateOpenApi
kotlinOptions.jvmTarget = javaCompatibility
}

compileTestKotlin {
mustRunAfter generateOpenApi
dependsOn generateOpenApi
kotlinOptions.jvmTarget = javaCompatibility
}

// Regenerate OpenAPI code upon cleaning.
clean {
finalizedBy generateOpenApi
}

// IntelliJ properties.
idea {
module {
// IntelliJ should download Javadoc.
downloadJavadoc = true

// Exclude directories from IntelliJ (indexing etc.).
excludeDirs += file("data")
excludeDirs += file("logs")
}
}

repositories {
mavenCentral()
}

dependencies {
// CLI.
implementation group: 'com.github.ajalt', name: 'clikt', version: "$cliktVersion"

// Kotlinx Serialization.
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-serialization-json', version: "$kotlinxSerializationVersion"

// KMongo.
implementation group: 'org.litote.kmongo', name: 'kmongo-serialization', version: "$kmongoVersion"
implementation group: 'org.litote.kmongo', name: 'kmongo-id-serialization', version: "$kmongoVersion"

// Javalin.
implementation group: 'io.javalin', name: 'javalin', version: "$javalinVersion"

// Fuel.
implementation group: 'com.github.kittinunf.fuel', name: 'fuel', version: "$fuelVersion"
implementation group: 'com.github.kittinunf.fuel', name: 'fuel-kotlinx-serialization', version: "$fuelVersion"

// OpenAPI Dependencies (OkHttp3 and Moshi Serialization).
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: "$okhttpVersion"
implementation group: 'com.squareup.moshi', name: 'moshi-kotlin', version: "$moshiVersion"

// Logging.
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: "$log4jslf4jVersion"
implementation group: 'io.github.microutils', name: 'kotlin-logging-jvm', version: "$kotlinLoggingVersion"

// Kotlin test & JUnit library.
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: "$kotlinVersion"
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: "$kotlinVersion"
}
11 changes: 0 additions & 11 deletions build/libs/config.json

This file was deleted.

Loading

0 comments on commit 231a8bc

Please sign in to comment.