Configurable download URL generation (#296)

Configurable download URL generation.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-09-28 09:18:03 +02:00
committed by GitHub
parent 0cc1cfcc8c
commit 5c53bef164
77 changed files with 2114 additions and 1110 deletions

View File

@@ -25,7 +25,6 @@ public class DdiCancelActionToStop {
* ID of the action to be stoppedW
*/
public DdiCancelActionToStop(final String stopId) {
super();
this.stopId = stopId;
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections;
import java.util.List;
import javax.validation.constraints.NotNull;
@@ -65,7 +66,11 @@ public class DdiChunk {
}
public List<DdiArtifact> getArtifacts() {
return artifacts;
if (artifacts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(artifacts);
}
}

View File

@@ -30,7 +30,6 @@ public class DdiConfig {
* configuration of the SP target
*/
public DdiConfig(final DdiPolling polling) {
super();
this.polling = polling;
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -41,7 +42,6 @@ public class DdiDeployment {
* to handle.
*/
public DdiDeployment(final HandlingType download, final HandlingType update, final List<DdiChunk> chunks) {
super();
this.download = download;
this.update = update;
this.chunks = chunks;
@@ -56,7 +56,11 @@ public class DdiDeployment {
}
public List<DdiChunk> getChunks() {
return chunks;
if (chunks == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(chunks);
}
/**
@@ -81,7 +85,7 @@ public class DdiDeployment {
private String name;
private HandlingType(final String name) {
HandlingType(final String name) {
this.name = name;
}

View File

@@ -71,7 +71,7 @@ public class DdiResult {
private String name;
private FinalResult(final String name) {
FinalResult(final String name) {
this.name = name;
}

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ddi.json.model;
import java.util.Collections;
import java.util.List;
import javax.validation.constraints.NotNull;
@@ -57,7 +58,11 @@ public class DdiStatus {
}
public List<String> getDetails() {
return details;
if (details == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(details);
}
/**
@@ -98,7 +103,7 @@ public class DdiStatus {
private String name;
private ExecutionStatus(final String name) {
ExecutionStatus(final String name) {
this.name = name;
}

View File

@@ -39,17 +39,17 @@ public interface DdiRootControllerRestApi {
* Returns all artifacts of a given software module and target.
*
* @param tenant
* of the request
* @param targetid
* of the client
* @param controllerId
* of the target that matches to controller id
* @param softwareModuleId
* of the software module
* @return the response
*/
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts", produces = {
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts", produces = {
"application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<org.eclipse.hawkbit.ddi.json.model.DdiArtifact>> getSoftwareModulesArtifacts(
@PathVariable("tenant") final String tenant, @PathVariable("targetid") final String targetid,
ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts(@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") final String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId);
/**
@@ -57,16 +57,16 @@ public interface DdiRootControllerRestApi {
*
* @param tenant
* of the request
* @param targetid
* @param controllerId
* of the target that matches to controller id
* @param request
* the HTTP request injected by spring
* @return the response
*/
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}", produces = { "application/hal+json",
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}", produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("tenant") final String tenant,
@PathVariable("targetid") final String targetid);
@PathVariable("controllerId") final String controllerId);
/**
* Handles GET {@link DdiArtifact} download request. This could be full or
@@ -74,8 +74,8 @@ public interface DdiRootControllerRestApi {
*
* @param tenant
* of the request
* @param targetid
* of the related target
* @param controllerId
* of the target
* @param softwareModuleId
* of the parent software module
* @param fileName
@@ -89,9 +89,9 @@ public interface DdiRootControllerRestApi {
* {@link HttpStatus#OK} or in case of partial download
* {@link HttpStatus#PARTIAL_CONTENT}.
*/
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant,
@PathVariable("targetid") final String targetid,
@PathVariable("controllerId") final String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("fileName") final String fileName);
@@ -100,8 +100,8 @@ public interface DdiRootControllerRestApi {
*
* @param tenant
* of the request
* @param targetid
* of the related target
* @param controllerId
* of the target
* @param softwareModuleId
* of the parent software module
* @param fileName
@@ -114,10 +114,10 @@ public interface DdiRootControllerRestApi {
* @return {@link ResponseEntity} with status {@link HttpStatus#OK} if
* successful
*/
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
@RequestMapping(method = RequestMethod.GET, value = "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
+ DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
ResponseEntity<Void> downloadArtifactMd5(@PathVariable("tenant") final String tenant,
@PathVariable("targetid") final String targetid,
@PathVariable("controllerId") final String controllerId,
@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("fileName") final String fileName);
@@ -126,8 +126,8 @@ public interface DdiRootControllerRestApi {
*
* @param tenant
* of the request
* @param targetid
* of the target that matches to controller id
* @param controllerId
* of the target
* @param actionId
* of the {@link DdiDeploymentBase} that matches to active
* actions.
@@ -139,10 +139,10 @@ public interface DdiRootControllerRestApi {
* the HTTP request injected by spring
* @return the response
*/
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(@PathVariable("tenant") final String tenant,
@PathVariable("targetid") @NotEmpty final String targetid,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId,
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource);
@@ -150,10 +150,10 @@ public interface DdiRootControllerRestApi {
* This is the feedback channel for the {@link DdiDeploymentBase} action.
*
* @param tenant
* of the request
* of the client
* @param feedback
* to provide
* @param targetid
* @param controllerId
* of the target that matches to controller id
* @param actionId
* of the action we have feedback for
@@ -162,37 +162,37 @@ public interface DdiRootControllerRestApi {
*
* @return the response
*/
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> postBasedeploymentActionFeedback(@PathVariable("tenant") final String tenant,
@Valid final DdiActionFeedback feedback, @PathVariable("targetid") final String targetid,
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId);
/**
* This is the feedback channel for the config data action.
*
* @param tenant
* of the request
* of the client
* @param configData
* as body
* @param targetid
* @param controllerId
* to provide data for
* @param request
* the HTTP request injected by spring
*
* @return status of the request
*/
@RequestMapping(value = "/{targetid}/"
@RequestMapping(value = "/{controllerId}/"
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> putConfigData(@PathVariable("tenant") final String tenant,
@Valid final DdiConfigData configData, @PathVariable("targetid") final String targetid);
ResponseEntity<Void> putConfigData(@Valid final DdiConfigData configData,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId);
/**
* RequestMethod.GET method for the {@link DdiCancel} action.
*
* @param tenant
* of the request
* @param targetid
* @param controllerId
* ID of the calling target
* @param actionId
* of the action
@@ -201,10 +201,10 @@ public interface DdiRootControllerRestApi {
*
* @return the {@link DdiCancel} response
*/
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant") final String tenant,
@PathVariable("targetid") @NotEmpty final String targetid,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId);
/**
@@ -212,10 +212,10 @@ public interface DdiRootControllerRestApi {
* the target.
*
* @param tenant
* of the request
* of the client
* @param feedback
* the {@link DdiActionFeedback} from the target.
* @param targetid
* @param controllerId
* the ID of the calling target
* @param actionId
* of the action we have feedback for
@@ -225,10 +225,11 @@ public interface DdiRootControllerRestApi {
* @return the {@link DdiActionFeedback} response
*/
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
@RequestMapping(value = "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Void> postCancelActionFeedback(@PathVariable("tenant") final String tenant,
@Valid final DdiActionFeedback feedback, @PathVariable("targetid") @NotEmpty final String targetid,
ResponseEntity<Void> postCancelActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant,
@PathVariable("controllerId") @NotEmpty final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId);
}