Starting to shape the DeleteRequest and delete resource method.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@162161 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Manuele Simi 2018-01-15 03:55:32 +00:00
parent 4c161325cd
commit 4336297bcd
4 changed files with 55 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import org.gcube.resourcemanagement.manager.io.codeexceptions.WebCodeException;
import org.gcube.resourcemanagement.manager.io.rs.RMCode;
/**
* Actions that can be performed on the context.
* Create request for a new context.
*
* @author Manuele Simi (ISTI-CNR)
*

View File

@ -0,0 +1,51 @@
package org.gcube.resourcemanagement.manager.webapp.context;
import java.util.Objects;
import java.util.UUID;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
/**
* Delete request for a context.
*
* @author Manuele Simi (ISTI CNR)
*
*/
public final class DeleteRequest extends RequestToResourceRegistry {
final UUID context;
private DeleteRequest(UUID context) {
this.context = context;
}
public static DeleteRequest fromHolder(UUID context) {
Objects.requireNonNull(context);
return new DeleteRequest(context);
}
/* (non-Javadoc)
* @see org.gcube.resourcemanagement.manager.webapp.context.RequestToResourceRegistry#validate()
*/
@Override
public RequestToResourceRegistry validate() throws Exception {
// TODO check if the context exists
return null;
}
/* (non-Javadoc)
* @see org.gcube.resourcemanagement.manager.webapp.context.RequestToResourceRegistry#send()
*/
@Override
protected ResponseFromResourceRegistry send() {
try {
boolean created = resourceRegistryContextClient.delete(context);
} catch (ResourceRegistryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

View File

@ -47,7 +47,6 @@ final class Queries {
try {
return client(registryClient).getInstance(Context.class, uuid);
} catch (ResourceRegistryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;

View File

@ -56,8 +56,10 @@ public class RMContext {
}
@DELETE
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public Response delete(String json, @QueryParam(FORCE_RRURL_PARAM) String rrURL) {
public Response delete(String uuid, @QueryParam(FORCE_RRURL_PARAM) String rrURL) {
CalledMethodProvider.instance.set(String.format("DELETE /%s/%s/ID", APPLICATION_PATH, CONTEXT_ROOT));
logger.info("Requested to delete context {} with id {}", Context.NAME, uuid);
logger.info("Force URL: " + rrURL);
Response response = null;
return response;