diff --git a/.project b/.project
index 4872539..92691af 100644
--- a/.project
+++ b/.project
@@ -5,6 +5,11 @@
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
org.eclipse.jdt.core.javabuilder
@@ -19,5 +24,6 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
diff --git a/GeonetworkSE.xml b/GeonetworkSE.xml
new file mode 100644
index 0000000..5a77632
--- /dev/null
+++ b/GeonetworkSE.xml
@@ -0,0 +1,34 @@
+
+
+ 2a3131f6-6ef6-4520-b8bf-70b29c7824f9
+ RuntimeResource
+
+ Gis
+
+ geonetwork
+ 3
+ 0
+ 5
+ 0
+
+
+ node3-d-d4s.d4science.org
+ READY
+
+
+
+ http://node3-d-d4s.d4science.org/geonetwork
+
+
+ admin
+ 5jykeFZrlF1Xfa4vohyDYg==
+
+
+
+ priority
+ 1
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 88ae2b2..0018654 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
0.0.1-SNAPSHOT
SDI Service
REST Interface towards SDI facilities
-
+ war
${project.basedir}/src/main/webapp/WEB-INF
${project.basedir}/distro
@@ -39,9 +39,31 @@
org.gcube.spatial.data
gis-interface
[2.4.0-SNAPSHOT,3.0.0-SNAPSHOT)
+
+
+ slf4j-log4j12
+ org.slf4j
+
+
+
+
+ org.gcube.core
+ common-smartgears-app
+
+
+ org.gcube.core
+ common-smartgears
+
+
+ jackson-databind
+ com.fasterxml.jackson.core
+
+
+
+
javax.ws.rs
@@ -74,7 +96,7 @@
org.glassfish.jersey.media
jersey-media-json-jackson
- ${jersey-version}
+ ${jersey-version}
@@ -114,6 +136,20 @@
1.2.2.Final
+
+
+
+ io.swagger
+ swagger-jersey2-jaxrs
+ 1.5.0
+
+
+ guava
+ com.google.guava
+
+
+
+
@@ -154,7 +190,7 @@
maven-war-plugin
2.4
- data-transfer-service
+ ${project.artifactId}
false
@@ -184,6 +220,7 @@
org.apache.maven.plugins
maven-assembly-plugin
+ 2.2
${distroDirectory}/descriptor.xml
diff --git a/src/main/java/org/gcube/spatial/data/sdi/SDIService.java b/src/main/java/org/gcube/spatial/data/sdi/SDIService.java
index f3ebc10..b385195 100644
--- a/src/main/java/org/gcube/spatial/data/sdi/SDIService.java
+++ b/src/main/java/org/gcube/spatial/data/sdi/SDIService.java
@@ -2,14 +2,48 @@ package org.gcube.spatial.data.sdi;
import javax.ws.rs.ApplicationPath;
+import org.gcube.smartgears.ContextProvider;
+import org.gcube.smartgears.configuration.container.ContainerConfiguration;
+import org.gcube.smartgears.context.application.ApplicationContext;
+import org.gcube.spatial.data.sdi.rest.GeoNetwork;
import org.glassfish.jersey.server.ResourceConfig;
+import io.swagger.jaxrs.config.BeanConfig;
+
@ApplicationPath(Constants.APPLICATION)
public class SDIService extends ResourceConfig{
public SDIService() {
super();
packages("org.gcube.spatial.data");
+ register(io.swagger.jaxrs.listing.ApiListingResource.class);
+ register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
+
+
+ ApplicationContext context=ContextProvider.get();
+ ContainerConfiguration configuration=context.container().configuration();
+
+ String hostName=configuration.hostname();
+ Integer port=configuration.port();
+
+
+
+
+
+
+ //SWAGGER
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.0");
+ beanConfig.setSchemes(new String[]{"http","https"});
+ beanConfig.setHost(hostName+":"+port);
+ beanConfig.setBasePath("/gcube/service/");
+ beanConfig.setResourcePackage(GeoNetwork.class.getPackage().getName());
+ beanConfig.setScan(true);
+
+
}
+
+
+
}
diff --git a/src/main/webapp/WEB-INF/README b/src/main/webapp/WEB-INF/README
index 1085fe1..61a7a81 100644
--- a/src/main/webapp/WEB-INF/README
+++ b/src/main/webapp/WEB-INF/README
@@ -25,7 +25,7 @@ no. 654119), SoBigData (grant no. 654024);
Version
--------------------------------------------------
-0.0.1-SNAPSHOT (2017-03-21)
+0.0.1-SNAPSHOT (2017-03-22)
Please see the file named "changelog.xml" in this directory for the release notes.
diff --git a/src/main/webapp/WEB-INF/descriptor.xml b/src/main/webapp/WEB-INF/descriptor.xml
index 2865775..7c5c605 100644
--- a/src/main/webapp/WEB-INF/descriptor.xml
+++ b/src/main/webapp/WEB-INF/descriptor.xml
@@ -23,7 +23,7 @@
-
+
/sdi-service
diff --git a/src/test/java/org/gcube/spatial/data/sdi/test/GeoNetworkProviderFactory.java b/src/test/java/org/gcube/spatial/data/sdi/test/GeoNetworkProviderFactory.java
index 7ce6187..96c8c88 100644
--- a/src/test/java/org/gcube/spatial/data/sdi/test/GeoNetworkProviderFactory.java
+++ b/src/test/java/org/gcube/spatial/data/sdi/test/GeoNetworkProviderFactory.java
@@ -9,7 +9,7 @@ import org.glassfish.hk2.api.Factory;
public class GeoNetworkProviderFactory implements Factory{
- private class GeoNetworkTestProvider extends GeoNetworkProviderImpl{
+ private static class GeoNetworkTestProvider extends GeoNetworkProviderImpl{
@Override
public GeoNetworkAdministration getGeoNetwork() throws ClientInitializationException {
@@ -17,6 +17,7 @@ public class GeoNetworkProviderFactory implements Factory{
return super.getGeoNetwork();
}
+
}
diff --git a/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java b/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
index b42b918..6beb26b 100644
--- a/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
+++ b/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
@@ -6,11 +6,14 @@ import javax.ws.rs.core.MediaType;
import org.gcube.spatial.data.sdi.Constants;
import org.gcube.spatial.data.sdi.SDIService;
import org.gcube.spatial.data.sdi.engine.GeoNetworkProvider;
+import org.gcube.spatial.data.sdi.rest.GeoNetwork;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;
+import io.swagger.jaxrs.config.BeanConfig;
+
public class MainTest extends JerseyTest{
public static class MyBinder extends AbstractBinder{
@@ -32,8 +35,23 @@ public class MainTest extends JerseyTest{
ResourceConfig config= new ResourceConfig(SDIService.class);
config.register(new MyBinder());
+ config.register(io.swagger.jaxrs.listing.ApiListingResource.class);
+ config.register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
-
+// //SWAGGER
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.0");
+ beanConfig.setSchemes(new String[]{"http","https"});
+ beanConfig.setHost("localhost:9998");
+ beanConfig.setBasePath("gcube/service");
+ String packageName=GeoNetwork.class.getPackage().getName();
+ System.out.println("PACKAGE : "+packageName);
+ beanConfig.setResourcePackage(packageName);
+ beanConfig.setScan(true);
+ System.out.println(beanConfig.getSwagger());
+
+
+
//Multipart
// config.packages("org.glassfish.jersey.media.multipart");
config.packages("org.gcube.spatial.data");
@@ -47,5 +65,15 @@ public class MainTest extends JerseyTest{
System.out.println(target(Constants.GEONETWORK_INTERFACE).
path(Constants.GEONETWORK_CONFIGURATION_PATH).
request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
+ System.out.println(target(Constants.GEONETWORK_INTERFACE).
+ path(Constants.GEONETWORK_CONFIGURATION_PATH).
+ getUri());
+ }
+
+ @Test
+ public void getSwagger(){
+ String path="gcube/service/swagger.json";
+ System.out.println(target(path).getUri());
+ System.out.println(target(path).request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
}
}
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
new file mode 100644
index 0000000..b70dd26
--- /dev/null
+++ b/src/test/resources/logback.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
\ No newline at end of file