This commit is contained in:
simon987 2019-04-07 13:50:07 -04:00
parent 4aab07f4cd
commit 038f88e3d2
8 changed files with 63 additions and 44 deletions

26
pom.xml
View File

@ -32,7 +32,7 @@
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>
<mainClass>net.simon987.Main</mainClass> <mainClass>net.simon987.musicgraph.Main</mainClass>
</manifest> </manifest>
</archive> </archive>
<descriptorRefs> <descriptorRefs>
@ -43,19 +43,13 @@
</plugins> </plugins>
</build> </build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.neo4j/neo4j-ogm-core -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>3.1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.neo4j/neo4j-ogm-bolt-driver --> <dependencies>
<!-- https://mvnrepository.com/artifact/org.neo4j.driver/neo4j-java-driver -->
<dependency> <dependency>
<groupId>org.neo4j</groupId> <groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-ogm-bolt-driver</artifactId> <artifactId>neo4j-java-driver</artifactId>
<version>3.1.8</version> <version>1.7.3</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-grizzly2-http --> <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-grizzly2-http -->
@ -98,5 +92,13 @@
<version>2.3.0.1</version> <version>2.3.0.1</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,20 +0,0 @@
package net.simon987.models;
public class ApiInfo {
private String name;
private String version;
public ApiInfo(String name, String version) {
this.name = name;
this.version = version;
}
public String getName() {
return name;
}
public String getVersion() {
return version;
}
}

View File

@ -1,7 +1,7 @@
package net.simon987; package net.simon987.musicgraph;
import net.simon987.logging.LogManager; import net.simon987.musicgraph.logging.LogManager;
import net.simon987.webapi.Index; import net.simon987.musicgraph.webapi.Index;
import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.jackson.JacksonFeature;
@ -17,6 +17,7 @@ public class Main {
public static void main(String[] args) { public static void main(String[] args) {
LOGGER.info("test"); LOGGER.info("test");
startHttpServer(); startHttpServer();
} }
@ -25,11 +26,12 @@ public class Main {
ResourceConfig rc = new ResourceConfig(); ResourceConfig rc = new ResourceConfig();
rc.registerClasses(Index.class); rc.registerClasses(Index.class);
rc.registerClasses(JacksonFeature.class); rc.registerClasses(JacksonFeature.class);
try { try {
HttpServer server = GrizzlyHttpServerFactory.createHttpServer( HttpServer server = GrizzlyHttpServerFactory.createHttpServer(
new URI("http://localhost:8080/"), new URI("http://localhost:3030/"),
rc); rc);
server.start(); server.start();

View File

@ -0,0 +1,32 @@
package net.simon987.musicgraph.entities;
public class ApiInfo {
private String name;
private String version;
private String wadl;
private String source;
public ApiInfo(String name, String version, String wadl, String source) {
this.name = name;
this.version = version;
this.wadl = wadl;
this.source = source;
}
public String getName() {
return name;
}
public String getVersion() {
return version;
}
public String getWadl() {
return wadl;
}
public String getSource() {
return source;
}
}

View File

@ -1,6 +1,7 @@
package net.simon987.logging; package net.simon987.musicgraph.logging;
import java.util.logging.*; import java.util.logging.Handler;
import java.util.logging.Logger;
public class LogManager { public class LogManager {

View File

@ -1,4 +1,4 @@
package net.simon987.logging; package net.simon987.musicgraph.logging;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;

View File

@ -1,4 +1,4 @@
package net.simon987.logging; package net.simon987.musicgraph.logging;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;

View File

@ -1,6 +1,6 @@
package net.simon987.webapi; package net.simon987.musicgraph.webapi;
import net.simon987.models.ApiInfo; import net.simon987.musicgraph.entities.ApiInfo;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -11,8 +11,10 @@ import javax.ws.rs.core.MediaType;
public class Index { public class Index {
private static final ApiInfo INFO = new ApiInfo( private static final ApiInfo INFO = new ApiInfo(
"music-graph", "music-graph-api",
"0.1" "0.1",
"http://localhost:3030/application.wadl",
"https://github.com/simon987/music-graph-api"
); );
@GET @GET