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

VREM Upgrade #5

Merged
merged 53 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2e00685
Ported core features of VREM to kotlin / javalin
sauterl Jan 18, 2020
a82e754
Added logging and exception handling
sauterl Jan 19, 2020
a756948
Kotlin-ified VREMCodecProvider
sauterl Jan 19, 2020
aabe39f
Rewrote mongodb interface to use kmongo
sauterl Jan 19, 2020
84cad77
Experimented with javalin + kotlinx.serialization - did not work out …
sauterl Jan 19, 2020
b79f91b
Added javalin jackson serialization handling of kmonog.id
sauterl Jan 19, 2020
6a87a19
Removed codecs and DAO code cleanup
sauterl Jan 19, 2020
4fe7903
Dependencies cleanup
sauterl Jan 19, 2020
6dee15b
Started on porting exhibition importer to kotlin
sauterl Jan 23, 2020
4f521ab
Added import utilities
sauterl Feb 7, 2020
3496434
Finished port of importer
sauterl Feb 14, 2020
ff0aa8c
Fixed wrong osx jdk version
sauterl Feb 18, 2020
0bf1abf
Removed osx from ci and added java 12
sauterl Feb 18, 2020
93ebe07
Cleanup of ci script
sauterl Feb 18, 2020
d52f3ac
Cleanup of importer
sauterl Feb 18, 2020
c408c97
Removed legacy java code
sauterl Feb 18, 2020
b7b1291
Removed temporary 'kotlin' package prefix
sauterl Feb 18, 2020
0d6da43
Refactored the usage of default values
sauterl Feb 18, 2020
1884401
Updated to newest log4j 2 lib
sauterl Feb 18, 2020
b00b42f
Fixes in database mapping and dependencies cleanup
sauterl Feb 20, 2020
55f398d
Upgrade to gradle 7 and kt 1.5
simonpeterhans Jun 2, 2021
51901af
Complete build.gradle, adjust logging
Jun 3, 2021
f02fe43
Reformat sources
Jun 3, 2021
a976b9b
Document config, database and import packages
Jun 3, 2021
4f480ce
Adjust some documentation and logging
Jun 3, 2021
0e92f00
Correct calculateWallExhibitPosition() doc
Jun 4, 2021
907d967
Add more documentation and minor refactoring/spelling fixes
Jun 4, 2021
1979475
More documentation; slight simplification for ID parsing (wip)
simonpeterhans Jun 5, 2021
406a1c3
Add API functionality to generate random collections based on a folde…
Jun 7, 2021
267963f
Various clean up, documentation of CollGen
Jun 8, 2021
37046bc
Refactor loggers into companion objects
Jun 8, 2021
80d52b0
Add TODO, some refactor, and fix Exhibit/Exhibition IDs
Jun 8, 2021
b55d820
Handle all serialization via kotlinx-serialization, simplify models
simonpeterhans Jun 13, 2021
eb46e8b
Remove ignoreUnknownKeys for deserializer, additional name for id fie…
simonpeterhans Jun 13, 2021
39992fb
Add OpenAPI client code to call vitrivr's REST API
simonpeterhans Jun 14, 2021
cd70d57
Use build/ folder as source for generated OpenAPI code
simonpeterhans Jun 16, 2021
1bb2966
Add fuel dependency and Cineast OpenAPI spec
simonpeterhans Jun 17, 2021
49b02d2
Remove unused airline dependency
simonpeterhans Jun 17, 2021
c43bcf6
Update .gitignore
simonpeterhans Jun 21, 2021
3639381
Refactor exhibition import to store all imported exhibitions in the d…
simonpeterhans Jun 21, 2021
56008c9
Primitive rework of RequestContentHandler to also serve from Cineast
simonpeterhans Jun 21, 2021
f3a1d40
Add extremely primitive similarity generator for testing
Jun 23, 2021
2162320
Upgrade to gradle 7.1, clean up build.gradle
simonpeterhans Jun 30, 2021
37e85d3
Clean up repository
simonpeterhans Jun 30, 2021
bc5f5a6
Add cineast config and clean up.
Jul 12, 2021
2194eda
Update git and build
Jul 12, 2021
f6d816c
Clean documentation and logging, refactoring.
Jul 12, 2021
a5f319d
Clean up, use lambdas for logging as should be
Jul 22, 2021
3f665dc
Update logging config
Jul 22, 2021
242a3be
Fix config level and layout reference
Jul 22, 2021
112615a
Remove leftovers
Jul 22, 2021
98ff718
Restructure database package to remove redundant layer
Jul 22, 2021
2c438dd
Update readme and deploy task
Jul 22, 2021
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
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