Interface
This commit is contained in:
parent
4522871825
commit
a25a9be20e
120
pom.xml
120
pom.xml
|
@ -15,11 +15,11 @@
|
||||||
|
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
||||||
<sis.version>1.0</sis.version>
|
<sis.version>1.0</sis.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,73 +40,82 @@
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency> -->
|
<!-- <dependency> -->
|
||||||
<!-- <groupId> org.glassfish.jersey </groupId> -->
|
<!-- <groupId> org.glassfish.jersey </groupId> -->
|
||||||
<!-- <artifactId>jersey-bom</artifactId> -->
|
<!-- <artifactId>jersey-bom</artifactId> -->
|
||||||
<!-- <version>${jersey.version}</version> -->
|
<!-- <version>${jersey.version}</version> -->
|
||||||
<!-- <type>pom</type> -->
|
<!-- <type>pom</type> -->
|
||||||
<!-- <scope>import</scope> -->
|
<!-- <scope>import</scope> -->
|
||||||
<!-- </dependency> -->
|
<!-- </dependency> -->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-csv</artifactId>
|
|
||||||
<version>1.8</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- SMARTGEARS -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>common-smartgears-app</artifactId>
|
||||||
<version>1.14.8</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-smartgears</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- JERSEY -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
|
<artifactId>jersey-container-servlet</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- INTERNAL LOGIC -->
|
||||||
|
|
||||||
|
<!-- Used to write centroids-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.postgis</groupId>
|
<groupId>net.postgis</groupId>
|
||||||
<artifactId>postgis-jdbc</artifactId>
|
<artifactId>postgis-jdbc</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.5.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId>
|
|
||||||
<version>9.1-901-1.jdbc4</version> <scope>compile</scope> </dependency> -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- jackson java time -->
|
<!-- jackson java time -->
|
||||||
|
<!-- Serialization from library -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
<version>2.8.8</version>
|
<version>2.8.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- read XLS -->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
<version>4.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- GPKG -->
|
<!-- GPKG -->
|
||||||
|
<!-- Read Geopackage -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mil.nga.geopackage</groupId>
|
<groupId>mil.nga.geopackage</groupId>
|
||||||
<artifactId>geopackage</artifactId>
|
<artifactId>geopackage</artifactId>
|
||||||
<version>3.5.0</version>
|
<version>3.5.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.persistence</groupId>
|
|
||||||
<artifactId>eclipselink</artifactId>
|
|
||||||
<version>2.5.0</version>
|
<!-- gCube SW -->
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.spatial.data</groupId>
|
<groupId>org.gcube.spatial.data</groupId>
|
||||||
|
@ -120,7 +129,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.spatial.data</groupId>
|
<groupId>org.gcube.spatial.data</groupId>
|
||||||
<artifactId>gis-interface</artifactId>
|
<artifactId>gis-interface</artifactId>
|
||||||
<version>[2.4.0,3.0.0)</version>
|
<version>[2.4.0,3.0.0)</version>
|
||||||
|
@ -150,13 +159,31 @@
|
||||||
<!-- SIS -->
|
<!-- SIS -->
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.sis.core</groupId>
|
<groupId>org.apache.sis.core</groupId>
|
||||||
<artifactId>sis-referencing</artifactId>
|
<artifactId>sis-referencing</artifactId>
|
||||||
<version>${sis.version}</version>
|
<version>${sis.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Common - basic -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.14.8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- TEST -->
|
<!-- TEST -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>eclipselink</artifactId>
|
||||||
|
<version>2.5.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
@ -170,12 +197,6 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency> -->
|
|
||||||
<!-- <groupId>commons-logging</groupId> -->
|
|
||||||
<!-- <artifactId>commons-logging</artifactId> -->
|
|
||||||
<!-- <version>1.2</version> -->
|
|
||||||
<!-- </dependency> -->
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
@ -187,6 +208,7 @@
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derby</artifactId>
|
<artifactId>derby</artifactId>
|
||||||
<version>10.8.3.0</version>
|
<version>10.8.3.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.gcube.application.geoportal.service;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.service.engine.ImplementationProvider;
|
||||||
|
import org.gcube.smartgears.ApplicationManager;
|
||||||
|
|
||||||
|
public class AppManager implements ApplicationManager{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInit() {
|
||||||
|
ImplementationProvider.get().shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShutdown() {
|
||||||
|
ImplementationProvider.get().shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,18 @@
|
||||||
package org.gcube.application.geoportal.service;
|
package org.gcube.application.geoportal.service;
|
||||||
|
|
||||||
|
import javax.ws.rs.ApplicationPath;
|
||||||
|
|
||||||
public class GeoportalService {
|
import org.gcube.application.geoportal.service.rest.InterfaceConstants;
|
||||||
|
import org.glassfish.jersey.server.ResourceConfig;
|
||||||
|
|
||||||
|
@ApplicationPath(InterfaceConstants.APPLICATION_PATH)
|
||||||
|
public class GeoportalService extends ResourceConfig{
|
||||||
|
|
||||||
|
|
||||||
|
public GeoportalService() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// TODO register servlets
|
||||||
|
// TODO register packages
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.geoportal.service;
|
||||||
|
|
||||||
|
public class InterfaceUtils {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.gcube.application.geoportal.service;
|
||||||
|
|
||||||
|
|
||||||
|
public class ServiceConstants {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.application.geoportal.service.engine;
|
||||||
|
|
||||||
|
import lombok.Synchronized;
|
||||||
|
|
||||||
|
public class ImplementationProvider {
|
||||||
|
|
||||||
|
private static ImplementationProvider instance=null;
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
public static ImplementationProvider get() {
|
||||||
|
if(instance==null) {
|
||||||
|
instance=new ImplementationProvider();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startup() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.gcube.application.geoportal.service.engine;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.service.model.Project;
|
||||||
|
|
||||||
|
public interface ProjectsArchiveManagerI {
|
||||||
|
|
||||||
|
public Project getByID();
|
||||||
|
|
||||||
|
public Collection<Project> getByFilters();
|
||||||
|
|
||||||
|
public Project addSection();
|
||||||
|
|
||||||
|
// public Project
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.geoportal.service.model;
|
||||||
|
|
||||||
|
public class Profile {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.geoportal.service.model;
|
||||||
|
|
||||||
|
public class Project {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.geoportal.service.model;
|
||||||
|
|
||||||
|
public class Section {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.gcube.application.geoportal.service.rest;
|
||||||
|
|
||||||
|
public class InterfaceConstants {
|
||||||
|
|
||||||
|
public static final String APPLICATION_PATH="/srv/";
|
||||||
|
public static final String SERVICE_CLASS="Application";
|
||||||
|
public static final String SERVICE_NAME="GeoPortal";
|
||||||
|
|
||||||
|
public static final class Methods{
|
||||||
|
public static final String PROFILES="profiles";
|
||||||
|
public static final String SECTIONS="sections";
|
||||||
|
public static final String PROJECTS="projects";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Parameters{
|
||||||
|
public static final String PROJECT_ID="project_id";
|
||||||
|
public static final String SECTION_ID="section_id";
|
||||||
|
public static final String PROFILE_ID="profile_id";
|
||||||
|
|
||||||
|
//INVESTIGATE CAPABILITIES
|
||||||
|
public static final String ORDER_BY="order_by";
|
||||||
|
public static final String LIMIT="limit";
|
||||||
|
public static final String OFFSET="offset";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.application.geoportal.service.rest;
|
||||||
|
|
||||||
|
public class Profiles {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.gcube.application.geoportal.service.rest;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.PUT;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.service.model.Project;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Path(InterfaceConstants.Methods.PROJECTS)
|
||||||
|
@Slf4j
|
||||||
|
public class Projects {
|
||||||
|
|
||||||
|
// GET BY ID
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Path("{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
||||||
|
public Project getByID(@PathParam(InterfaceConstants.Parameters.PROJECT_ID) String id) {
|
||||||
|
try {
|
||||||
|
log.info("Looking for profile [ID :{} ]",id);
|
||||||
|
throw new RuntimeException("Feature not yet available");
|
||||||
|
}catch(WebApplicationException e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw new WebApplicationException("Unable to serve request", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// GET ALL (Filters apply)
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public Project getAll() {
|
||||||
|
try {
|
||||||
|
log.info("Loading all projects..");
|
||||||
|
throw new RuntimeException("Feature not yet available");
|
||||||
|
}catch(WebApplicationException e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw new WebApplicationException("Unable to serve request", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new Project
|
||||||
|
@PUT
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public Project registerNew(Project toRegister) {
|
||||||
|
try {
|
||||||
|
log.info("Loading all projects..");
|
||||||
|
throw new RuntimeException("Feature not yet available");
|
||||||
|
}catch(WebApplicationException e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw new WebApplicationException("Unable to serve request", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Modify Project Document
|
||||||
|
|
||||||
|
// Delete Project
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.gcube.application.geoportal.service.rest;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.DELETE;
|
||||||
|
import javax.ws.rs.PUT;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.service.model.Project;
|
||||||
|
import org.gcube.application.geoportal.service.model.Section;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Path(InterfaceConstants.Methods.SECTIONS+"/{"+InterfaceConstants.Parameters.PROJECT_ID+"}")
|
||||||
|
public class Sections {
|
||||||
|
|
||||||
|
@PathParam(InterfaceConstants.Parameters.PROJECT_ID) String projectID;
|
||||||
|
|
||||||
|
|
||||||
|
// Add Section to Project Document
|
||||||
|
@PUT
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public Section registerNewSection(Section toRegister) {
|
||||||
|
try {
|
||||||
|
log.info("Creating new Section [PROJECT_ID:{}]",projectID);
|
||||||
|
throw new RuntimeException("Feature not yet available");
|
||||||
|
}catch(WebApplicationException e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw new WebApplicationException("Unable to serve request", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Remove Section to Project Document
|
||||||
|
@DELETE
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Path("{"+InterfaceConstants.Parameters.SECTION_ID+"}")
|
||||||
|
public Project deleteSection(@QueryParam(InterfaceConstants.Parameters.SECTION_ID) String sectionID) {
|
||||||
|
try {
|
||||||
|
log.info("Deleting Section [ID : {}, PROJECT_ID:{}]",projectID,sectionID);
|
||||||
|
throw new RuntimeException("Feature not yet available");
|
||||||
|
}catch(WebApplicationException e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable e){
|
||||||
|
log.warn("Unable to serve request",e);
|
||||||
|
throw new WebApplicationException("Unable to serve request", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<application mode='online'>
|
||||||
|
<name>GeoPortal-Service</name>
|
||||||
|
<group>Application</group>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>REST service for GeoPortal</description>
|
||||||
|
<local-persistence location='target' />
|
||||||
|
</application>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<web-app>
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>org.gcube.application.geoportal.service.GeoPortalService</servlet-name>
|
||||||
|
<servlet-class>org.glassfish.jersey.servlet.ServletContainer
|
||||||
|
</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>javax.ws.rs.Application</param-name>
|
||||||
|
<param-value>org.gcube.application.geoportal.service.GeoPortalService</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>jersey.config.server.provider.classnames</param-name>
|
||||||
|
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature
|
||||||
|
</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>jersey.config.xml.formatOutput</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>org.gcube.application.geoportal.service.GeoPortalService</servlet-name>
|
||||||
|
<url-pattern>/srv/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
</web-app>
|
Reference in New Issue