Skip to content

Commit

Permalink
Merge pull request #1 from ICTD-Maroubra/add-tinyb
Browse files Browse the repository at this point in the history
Add Tinyb
  • Loading branch information
twgraham authored Sep 30, 2017
2 parents 7beb0f1 + 3777b3a commit d1e3ee2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM openjdk:8

ADD ./docker-entrypoint.sh /
COPY ./pems-server/build/libs/pems-all.jar /pems/
COPY ./pems-server/lib/tinyb/* /pems/

RUN apt-get update && \
apt-get install -q -y bluez

ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

cd /pems

service dbus start
service dbus status

service bluetooth restart

java -Djava.library.path=/pems/ -jar pems-all.jar
13 changes: 12 additions & 1 deletion pems-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.1'
}

group 'org.maroubra'
Expand All @@ -19,6 +20,10 @@ jar {
}
}

shadowJar {
archiveName 'pems-all.jar'
}

dependencies {
compile 'org.slf4j:slf4j-log4j12:1.7.25'

Expand All @@ -43,9 +48,15 @@ dependencies {

compile 'com.github.joschi:jadconfig:0.13.0'

compile files('lib/tinyb/tinyb-0.5.0-23.jar')

testCompile group: 'junit', name: 'junit', version: '4.12'
}

tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters'
}
}

tasks.withType(JavaExec) {
systemProperty 'java.library.path', projectDir.toString() + '/lib/tinyb'
}
Binary file added pems-server/lib/tinyb/libjavatinyb.so
Binary file not shown.
Binary file added pems-server/lib/tinyb/libtinyb.so
Binary file not shown.
Binary file added pems-server/lib/tinyb/tinyb-0.5.0-23.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ public static void main(String[] args) {
try {
httpServer.start();

System.out.println(String.format("Jersey app started at %s\nHit enter to stop it...", serverConfiguration.fullHost()));
System.in.read();
System.out.println(String.format("Jersey app started at %s", serverConfiguration.fullHost()));

Runtime.getRuntime().addShutdownHook(new Thread(httpServer::shutdownNow));

Thread.currentThread().join();
} catch (IOException e) {
log.error("error starting server: " + e.getLocalizedMessage(), e);
log.error("Error starting server: " + e.getLocalizedMessage(), e);
} catch (InterruptedException e) {
log.error("Server crash: %s", e);
}
}

Expand Down

0 comments on commit d1e3ee2

Please # to comment.