diff --git a/manifest.yml b/manifest.yml
new file mode 100644
index 0000000..2378e77
--- /dev/null
+++ b/manifest.yml
@@ -0,0 +1,8 @@
+---
+applications:
+ - name: boks-run
+ memory: 320MB
+ instances: 1
+ path: target/run-0.0.1-SNAPSHOT.jar
+services:
+ - boks-run-cloudant
diff --git a/pom.xml b/pom.xml
index a794510..7e439f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,8 @@
UTF-8
1.8
+ 1.4.2
+ 3.4
@@ -41,8 +43,14 @@
org.apache.commons
commons-lang3
- 3.4
+ ${commons.lang3.version}
+
+ org.ektorp
+ org.ektorp.spring
+ ${ektorp.version}
+
+
@@ -51,22 +59,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- com.spotify
- docker-maven-plugin
- 0.3.8
-
- boksrun/${project.artifactId}
- src/main/docker
-
-
- /
- ${project.build.directory}
- ${project.build.finalName}.war
-
-
-
-
diff --git a/src/main/docker/dockerfile b/src/main/docker/dockerfile
deleted file mode 100644
index 191abb6..0000000
--- a/src/main/docker/dockerfile
+++ /dev/null
@@ -1,19 +0,0 @@
-FROM ubuntu:14.04
-MAINTAINER Jason McNeil
-ENV DEBIAN_FRONTEND noninteractive
-RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
-# Common Deps
-RUN apt-get -y install curl software-properties-common
-# Oracle Java 8
-RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
-RUN add-apt-repository ppa:webupd8team/java && apt-get update
-RUN apt-get -y install oracle-java8-installer
-RUN update-java-alternatives -s java-8-oracle
-ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
-ENV JAVA8_HOME /usr/lib/jvm/java-8-oracle
-# MongoDB
-RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
-ADD mongodb.list /etc/apt/sources.list.d/mongodb.list
-RUN apt-get update && apt-get -y install mongodb-server
-
-EXPOSE 8080 8081 8443 8843 8880
\ No newline at end of file
diff --git a/src/main/java/be/boks/RunApplication.java b/src/main/java/be/boks/RunApplication.java
index 49e4c79..1ee25dd 100644
--- a/src/main/java/be/boks/RunApplication.java
+++ b/src/main/java/be/boks/RunApplication.java
@@ -1,14 +1,45 @@
package be.boks;
+import java.io.IOException;
+
+import org.ektorp.CouchDbConnector;
+import org.ektorp.CouchDbInstance;
+import org.ektorp.http.HttpClient;
+import org.ektorp.http.StdHttpClient;
+import org.ektorp.impl.StdCouchDbConnector;
+import org.ektorp.impl.StdCouchDbInstance;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class RunApplication {
+
+ private static final String DATABASE_NAME = "boks-run";
+ @Value("${vcap.services.boks-run-cloudant.credentials.host:}")
+ private String host;
+ @Value("${vcap.services.boks-run-cloudant.credentials.username:}")
+ private String username;
+ @Value("${vcap.services.boks-run-cloudant.credentials.password:}")
+ private String password;
public static void main(String[] args) {
SpringApplication.run(RunApplication.class, args);
}
+ @Bean
+ public CouchDbConnector couchDb() throws IOException {
+ HttpClient httpClient = new StdHttpClient.Builder()
+ .url("https://" + host).port(443).username(username)
+ .password(password).build();
+
+ CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
+
+ CouchDbConnector db = new StdCouchDbConnector(DATABASE_NAME, dbInstance);
+ db.createDatabaseIfNotExists();
+
+ return db;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/be/boks/domain/Club.java b/src/main/java/be/boks/domain/Club.java
new file mode 100644
index 0000000..cc08323
--- /dev/null
+++ b/src/main/java/be/boks/domain/Club.java
@@ -0,0 +1,42 @@
+package be.boks.domain;
+
+import java.io.Serializable;
+
+import org.springframework.data.annotation.Id;
+
+public class Club implements Serializable {
+
+ private static final long serialVersionUID = -1535672487981334177L;
+
+ @Id
+ private Long id;
+
+ private String name;
+
+ private String type = "club";
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/src/main/java/be/boks/domain/Runner.java b/src/main/java/be/boks/domain/Runner.java
index ad78675..ee0ca85 100644
--- a/src/main/java/be/boks/domain/Runner.java
+++ b/src/main/java/be/boks/domain/Runner.java
@@ -1,5 +1,6 @@
package be.boks.domain;
+import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
@@ -8,7 +9,10 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.data.annotation.Id;
-public class Runner {
+public class Runner implements Serializable {
+
+ private static final long serialVersionUID = 2530453437671327658L;
+
@Id
private Long id;
@@ -26,7 +30,7 @@ public class Runner {
private String city;
- private String runningClub;
+ private Club runningClub;
private List categories;
@@ -36,6 +40,8 @@ public class Runner {
private List