90 lines
2.5 KiB
Java
90 lines
2.5 KiB
Java
package org.gcube.datatransfer.resolver.services;
|
|
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.ws.rs.GET;
|
|
import javax.ws.rs.POST;
|
|
import javax.ws.rs.Path;
|
|
import javax.ws.rs.PathParam;
|
|
import javax.ws.rs.core.Context;
|
|
import javax.ws.rs.core.Response.Status;
|
|
|
|
import org.gcube.datatransfer.resolver.Constants;
|
|
import org.gcube.datatransfer.resolver.GeonetworkRequestFilterParameters.MODE;
|
|
import org.gcube.datatransfer.resolver.GeonetworkRequestFilterParameters.VISIBILITY;
|
|
import org.gcube.datatransfer.resolver.services.exceptions.BadRequestException;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@Path(Constants.SERVLET_GEONETWORK)
|
|
public class GisResolver {
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(GisResolver.class);
|
|
|
|
private String help = "https://wiki.gcube-system.org/gcube/URI_Resolver#GIS_Resolver";
|
|
|
|
@GET
|
|
public void submitGet(@Context HttpServletRequest req, @PathParam("mode") MODE mode, @PathParam("scope") String scope, @PathParam("visibility") VISIBILITY visibility, @PathParam("owner") String owner) {
|
|
|
|
// MODE mode = null;
|
|
// String theScope = null;
|
|
// VISIBILITY visibility = null;
|
|
// String owner = null;
|
|
|
|
|
|
//Checking mandatory parameter id
|
|
if(mode==null){
|
|
logger.error("Path Parameter 'mode' not found");
|
|
try {
|
|
throw new BadRequestException(req, Status.NOT_ACCEPTABLE, "Missing mandatory path parameter 'mode'", StorageHubResolver.class, new URI(help));
|
|
}
|
|
catch (URISyntaxException e) {
|
|
//silent
|
|
}
|
|
}
|
|
|
|
if(scope==null || scope.isEmpty()){
|
|
logger.error("Path Parameter 'scope' not found");
|
|
try {
|
|
throw new BadRequestException(req, Status.NOT_ACCEPTABLE, "Missing mandatory path parameter 'scope'", StorageHubResolver.class, new URI(help));
|
|
}
|
|
catch (URISyntaxException e) {
|
|
//silent
|
|
}
|
|
}
|
|
|
|
|
|
if(visibility==null){
|
|
logger.error("Path Parameter 'visibility' not found");
|
|
try {
|
|
throw new BadRequestException(req, Status.NOT_ACCEPTABLE, "Missing mandatory path parameter 'visibility'", StorageHubResolver.class, new URI(help));
|
|
}
|
|
catch (URISyntaxException e) {
|
|
//silent
|
|
}
|
|
}
|
|
|
|
if(visibility==null){
|
|
logger.error("Path Parameter 'visibility' not found");
|
|
try {
|
|
throw new BadRequestException(req, Status.NOT_ACCEPTABLE, "Missing mandatory path parameter 'visibility'", StorageHubResolver.class, new URI(help));
|
|
}
|
|
catch (URISyntaxException e) {
|
|
//silent
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@POST
|
|
public void submitPost(){
|
|
|
|
}
|
|
|
|
}
|