Redesigning REST interface

This commit is contained in:
Luca Frosini 2019-08-02 18:57:17 +02:00
parent 72db4cbf53
commit efbadb71b0
2 changed files with 9 additions and 9 deletions

View File

@ -79,7 +79,7 @@ public abstract class SmartExecutorPersistenceConnector extends PluginStateNotif
try {
SmartExecutor smartExecutor = SmartExecutorClientFactory.create(pluginName, address);
smartExecutor.getPluginStateEvolution(pluginName, uuid.toString(), null);
smartExecutor.getLaunchState(pluginName, uuid.toString(), null);
logger.trace("{} is not orphan.", SEMapper
.getObjectMapper().writeValueAsString(scheduledTask));
return false;

View File

@ -55,12 +55,12 @@ public class RestSmartExecutor implements SmartExecutor {
protected void setCalledMethod(String method) {
logger.trace("Going to set calledMethod as {}", method);
CalledMethodProvider.instance.set(method);
logger.info("{}", uriInfo.getAbsolutePath());
logger.info("Arrived request at /{}", uriInfo.getPath());
}
protected ResponseBuilder addLocation(ResponseBuilder responseBuilder, String id) {
return responseBuilder.header(LOCATION_HEADER,
String.format("%s/%s", uriInfo.getAbsolutePath().toString(), id));
String.format("%s %s/%s", uriInfo.getAbsolutePath().toString(), id));
}
@GET
@ -68,7 +68,7 @@ public class RestSmartExecutor implements SmartExecutor {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
@Override
public String getAvailablePlugins() throws ExecutorException {
setCalledMethod(HttpMethod.GET.getClass().getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART);
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART);
return "[]";
}
@ -77,7 +77,7 @@ public class RestSmartExecutor implements SmartExecutor {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
@Override
public String getLaunches(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName) throws ExecutorException {
setCalledMethod(HttpMethod.GET.getClass().getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/"
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
return "[]";
}
@ -89,7 +89,7 @@ public class RestSmartExecutor implements SmartExecutor {
@Override
public String launch(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName, String launchParameterString)
throws ExecutorException {
setCalledMethod(HttpMethod.POST.getClass().getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
setCalledMethod(HttpMethod.POST + " /" + RestConstants.PLUGINS_PATH_PART + "/"
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART);
try {
@ -125,11 +125,11 @@ public class RestSmartExecutor implements SmartExecutor {
@Path("/{" + PLUGIN_NAME_PATH_PARAM + "}/" + RestConstants.EXECUTIONS_PATH_PART + "/" + "{" + UUID_PATH_PARAM + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
@Override
public String getPluginStateEvolution(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
public String getLaunchState(@PathParam(PLUGIN_NAME_PATH_PARAM) String pluginName,
@PathParam(UUID_PATH_PARAM) String executionIdentifier,
@QueryParam(RestConstants.ITERATION_PARAM) Integer iteration) throws ExecutorException {
setCalledMethod(HttpMethod.GET.getClass().getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
setCalledMethod(HttpMethod.GET + " /" + RestConstants.PLUGINS_PATH_PART + "/"
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
PluginStateEvolution pluginStateEvolution = null;
@ -171,7 +171,7 @@ public class RestSmartExecutor implements SmartExecutor {
setCalledMethod(PURGE.class.getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/" + pluginName
+ "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
} else {
setCalledMethod(HttpMethod.DELETE.getClass().getSimpleName() + " /" + RestConstants.PLUGINS_PATH_PART + "/"
setCalledMethod(HttpMethod.DELETE + " /" + RestConstants.PLUGINS_PATH_PART + "/"
+ pluginName + "/" + RestConstants.EXECUTIONS_PATH_PART + "/{" + UUID_PATH_PARAM + "}");
}
try {