Rename Ddi classes
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* Annotation to enable {@link ComponentScan} in the resource package to setup
|
||||
* all {@link Controller} annotated classes and setup the Direct Device API.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public @interface EnableDdiApi {
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -35,12 +35,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
*
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ActionFeedback {
|
||||
public class DdiActionFeedback {
|
||||
private final Long id;
|
||||
private final String time;
|
||||
|
||||
@NotNull
|
||||
private final Status status;
|
||||
private final DdiStatus status;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -53,8 +53,8 @@ public class ActionFeedback {
|
||||
* is the feedback itself
|
||||
*/
|
||||
@JsonCreator
|
||||
public ActionFeedback(@JsonProperty("id") final Long id, @JsonProperty("time") final String time,
|
||||
@JsonProperty("status") final Status status) {
|
||||
public DdiActionFeedback(@JsonProperty("id") final Long id, @JsonProperty("time") final String time,
|
||||
@JsonProperty("status") final DdiStatus status) {
|
||||
this.id = id;
|
||||
this.time = time;
|
||||
this.status = status;
|
||||
@@ -68,7 +68,7 @@ public class ActionFeedback {
|
||||
return time;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
public DdiStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -16,9 +16,9 @@ import org.springframework.hateoas.ResourceSupport;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Download information for all artifacts related to a specific {@link Chunk}.
|
||||
* Download information for all artifacts related to a specific {@link DdiChunk}.
|
||||
*/
|
||||
public class Artifact extends ResourceSupport {
|
||||
public class DdiArtifact extends ResourceSupport {
|
||||
|
||||
@NotNull
|
||||
@JsonProperty
|
||||
@@ -6,19 +6,19 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Cancel action to be provided to the target.
|
||||
*/
|
||||
public class Cancel {
|
||||
public class DdiCancel {
|
||||
|
||||
private final String id;
|
||||
|
||||
@NotNull
|
||||
private final CancelActionToStop cancelAction;
|
||||
private final DdiCancelActionToStop cancelAction;
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
@@ -28,7 +28,7 @@ public class Cancel {
|
||||
* @param cancelAction
|
||||
* the action
|
||||
*/
|
||||
public Cancel(final String id, final CancelActionToStop cancelAction) {
|
||||
public DdiCancel(final String id, final DdiCancelActionToStop cancelAction) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.cancelAction = cancelAction;
|
||||
@@ -38,7 +38,7 @@ public class Cancel {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CancelActionToStop getCancelAction() {
|
||||
public DdiCancelActionToStop getCancelAction() {
|
||||
return cancelAction;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* The {@link Action} that has to be stopped by the target.
|
||||
*/
|
||||
public class CancelActionToStop {
|
||||
public class DdiCancelActionToStop {
|
||||
|
||||
@NotNull
|
||||
private final String stopId;
|
||||
@@ -24,7 +24,7 @@ public class CancelActionToStop {
|
||||
* @param stopId
|
||||
* ID of the {@link Action} to be stoppedW
|
||||
*/
|
||||
public CancelActionToStop(final String stopId) {
|
||||
public DdiCancelActionToStop(final String stopId) {
|
||||
super();
|
||||
this.stopId = stopId;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,7 +15,7 @@ import javax.validation.constraints.NotNull;
|
||||
/**
|
||||
* Deployment chunks.
|
||||
*/
|
||||
public class Chunk {
|
||||
public class DdiChunk {
|
||||
|
||||
@NotNull
|
||||
private final String part;
|
||||
@@ -26,7 +26,7 @@ public class Chunk {
|
||||
@NotNull
|
||||
private final String name;
|
||||
|
||||
private final List<Artifact> artifacts;
|
||||
private final List<DdiArtifact> artifacts;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -40,7 +40,7 @@ public class Chunk {
|
||||
* @param artifacts
|
||||
* download information
|
||||
*/
|
||||
public Chunk(final String part, final String version, final String name, final List<Artifact> artifacts) {
|
||||
public DdiChunk(final String part, final String version, final String name, final List<DdiArtifact> artifacts) {
|
||||
super();
|
||||
this.part = part;
|
||||
this.version = version;
|
||||
@@ -60,7 +60,7 @@ public class Chunk {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Artifact> getArtifacts() {
|
||||
public List<DdiArtifact> getArtifacts() {
|
||||
return artifacts;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
/**
|
||||
* Standard configuration for the target.
|
||||
*/
|
||||
public class Config {
|
||||
public class DdiConfig {
|
||||
|
||||
private final Polling polling;
|
||||
private final DdiPolling polling;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -21,12 +21,12 @@ public class Config {
|
||||
* @param polling
|
||||
* configuration of the SP target
|
||||
*/
|
||||
public Config(final Polling polling) {
|
||||
public DdiConfig(final DdiPolling polling) {
|
||||
super();
|
||||
this.polling = polling;
|
||||
}
|
||||
|
||||
public Polling getPolling() {
|
||||
public DdiPolling getPolling() {
|
||||
return polling;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
/**
|
||||
* Feedback channel for ConfigData action.
|
||||
*/
|
||||
public class ConfigData extends ActionFeedback {
|
||||
public class DdiConfigData extends DdiActionFeedback {
|
||||
|
||||
@NotEmpty
|
||||
private final Map<String, String> data;
|
||||
@@ -36,8 +36,8 @@ public class ConfigData extends ActionFeedback {
|
||||
* contains the attributes.
|
||||
*/
|
||||
@JsonCreator
|
||||
public ConfigData(@JsonProperty(value = "id") final Long id, @JsonProperty(value = "time") final String time,
|
||||
@JsonProperty(value = "status") final Status status,
|
||||
public DdiConfigData(@JsonProperty(value = "id") final Long id, @JsonProperty(value = "time") final String time,
|
||||
@JsonProperty(value = "status") final DdiStatus status,
|
||||
@JsonProperty(value = "data") final Map<String, String> data) {
|
||||
super(id, time, status);
|
||||
this.data = data;
|
||||
@@ -6,16 +6,16 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import org.springframework.hateoas.ResourceSupport;
|
||||
|
||||
/**
|
||||
* {@link ControllerBase} resource content.
|
||||
* {@link DdiControllerBase} resource content.
|
||||
*/
|
||||
public class ControllerBase extends ResourceSupport {
|
||||
public class DdiControllerBase extends ResourceSupport {
|
||||
|
||||
private final Config config;
|
||||
private final DdiConfig config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -23,12 +23,12 @@ public class ControllerBase extends ResourceSupport {
|
||||
* @param config
|
||||
* configuration of the SP target
|
||||
*/
|
||||
public ControllerBase(final Config config) {
|
||||
public DdiControllerBase(final DdiConfig config) {
|
||||
super();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
public DdiConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,13 +15,13 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* Detailed {@link UpdateAction} information.
|
||||
*/
|
||||
public class Deployment {
|
||||
public class DdiDeployment {
|
||||
|
||||
private final HandlingType download;
|
||||
|
||||
private final HandlingType update;
|
||||
|
||||
private final List<Chunk> chunks;
|
||||
private final List<DdiChunk> chunks;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -33,7 +33,7 @@ public class Deployment {
|
||||
* @param chunks
|
||||
* to handle.
|
||||
*/
|
||||
public Deployment(final HandlingType download, final HandlingType update, final List<Chunk> chunks) {
|
||||
public DdiDeployment(final HandlingType download, final HandlingType update, final List<DdiChunk> chunks) {
|
||||
super();
|
||||
this.download = download;
|
||||
this.update = update;
|
||||
@@ -48,7 +48,7 @@ public class Deployment {
|
||||
return update;
|
||||
}
|
||||
|
||||
public List<Chunk> getChunks() {
|
||||
public List<DdiChunk> getChunks() {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -17,14 +17,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
/**
|
||||
* {@link UpdateAction} resource.
|
||||
*/
|
||||
public class DeploymentBase extends ResourceSupport {
|
||||
public class DdiDeploymentBase extends ResourceSupport {
|
||||
|
||||
@JsonProperty("id")
|
||||
@NotNull
|
||||
private final String deplyomentId;
|
||||
|
||||
@NotNull
|
||||
private final Deployment deployment;
|
||||
private final DdiDeployment deployment;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -34,12 +34,12 @@ public class DeploymentBase extends ResourceSupport {
|
||||
* @param deployment
|
||||
* details.
|
||||
*/
|
||||
public DeploymentBase(final String id, final Deployment deployment) {
|
||||
public DdiDeploymentBase(final String id, final DdiDeployment deployment) {
|
||||
deplyomentId = id;
|
||||
this.deployment = deployment;
|
||||
}
|
||||
|
||||
public Deployment getDeployment() {
|
||||
public DdiDeployment getDeployment() {
|
||||
return deployment;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
/**
|
||||
* Polling interval for the SP target.
|
||||
*/
|
||||
public class Polling {
|
||||
public class DdiPolling {
|
||||
|
||||
private final String sleep;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Polling {
|
||||
* @param sleep
|
||||
* between polls
|
||||
*/
|
||||
public Polling(final String sleep) {
|
||||
public DdiPolling(final String sleep) {
|
||||
super();
|
||||
this.sleep = sleep;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
* Action fulfillment progress by means of gives the achieved amount of maximal
|
||||
* of possible levels.
|
||||
*/
|
||||
public class Progress {
|
||||
public class DdiProgress {
|
||||
|
||||
@NotNull
|
||||
private final Integer cnt;
|
||||
@@ -33,7 +33,7 @@ public class Progress {
|
||||
* maximum levels
|
||||
*/
|
||||
@JsonCreator
|
||||
public Progress(@JsonProperty("cnt") final Integer cnt, @JsonProperty("of") final Integer of) {
|
||||
public DdiProgress(@JsonProperty("cnt") final Integer cnt, @JsonProperty("of") final Integer of) {
|
||||
super();
|
||||
this.cnt = cnt;
|
||||
this.of = of;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
@@ -18,12 +18,12 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
* Result information of the action progress which can by an intermediate or
|
||||
* final update.
|
||||
*/
|
||||
public class Result {
|
||||
public class DdiResult {
|
||||
|
||||
@NotEmpty
|
||||
private final FinalResult finished;
|
||||
|
||||
private final Progress progress;
|
||||
private final DdiProgress progress;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -34,8 +34,8 @@ public class Result {
|
||||
* if not yet finished
|
||||
*/
|
||||
@JsonCreator
|
||||
public Result(@JsonProperty("finished") final FinalResult finished,
|
||||
@JsonProperty("progress") final Progress progress) {
|
||||
public DdiResult(@JsonProperty("finished") final FinalResult finished,
|
||||
@JsonProperty("progress") final DdiProgress progress) {
|
||||
super();
|
||||
this.finished = finished;
|
||||
this.progress = progress;
|
||||
@@ -45,7 +45,7 @@ public class Result {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public Progress getProgress() {
|
||||
public DdiProgress getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.model;
|
||||
package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,13 +19,13 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* Details status information concerning the action processing.
|
||||
*/
|
||||
public class Status {
|
||||
public class DdiStatus {
|
||||
|
||||
@NotNull
|
||||
private final ExecutionStatus execution;
|
||||
|
||||
@NotNull
|
||||
private final Result result;
|
||||
private final DdiResult result;
|
||||
|
||||
private final List<String> details;
|
||||
|
||||
@@ -40,8 +40,8 @@ public class Status {
|
||||
* as optional addition
|
||||
*/
|
||||
@JsonCreator
|
||||
public Status(@JsonProperty("execution") final ExecutionStatus execution,
|
||||
@JsonProperty("result") final Result result, @JsonProperty("details") final List<String> details) {
|
||||
public DdiStatus(@JsonProperty("execution") final ExecutionStatus execution,
|
||||
@JsonProperty("result") final DdiResult result, @JsonProperty("details") final List<String> details) {
|
||||
super();
|
||||
this.execution = execution;
|
||||
this.result = result;
|
||||
@@ -52,7 +52,7 @@ public class Status {
|
||||
return execution;
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
public DdiResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.api;
|
||||
package org.eclipse.hawkbit.ddi.rest.api;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.hawkbit.ddi.ControllerConstants;
|
||||
import org.eclipse.hawkbit.ddi.model.Artifact;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiArtifact;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
|
||||
@@ -24,11 +23,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
/**
|
||||
* REST resource handling for artifact download operations.
|
||||
*/
|
||||
@RequestMapping(ControllerConstants.ARTIFACTS_V1_REQUEST_MAPPING)
|
||||
public interface ArtifactStoreControllerDdiApi {
|
||||
@RequestMapping(DdiRestConstants.ARTIFACTS_V1_REQUEST_MAPPING)
|
||||
public interface DdiArtifactStoreControllerRestApi {
|
||||
|
||||
/**
|
||||
* Handles GET {@link Artifact} download request. This could be full or
|
||||
* Handles GET {@link DdiArtifact} download request. This could be full or
|
||||
* partial download request.
|
||||
*
|
||||
* @param fileName
|
||||
@@ -44,7 +43,7 @@ public interface ArtifactStoreControllerDdiApi {
|
||||
* {@link HttpStatus#OK} or in case of partial download
|
||||
* {@link HttpStatus#PARTIAL_CONTENT}.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = ControllerConstants.ARTIFACT_DOWNLOAD_BY_FILENAME
|
||||
@RequestMapping(method = RequestMethod.GET, value = DdiRestConstants.ARTIFACT_DOWNLOAD_BY_FILENAME
|
||||
+ "/{fileName}")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Void> downloadArtifactByFilename(@PathVariable("fileName") final String fileName,
|
||||
@@ -52,7 +51,7 @@ public interface ArtifactStoreControllerDdiApi {
|
||||
@AuthenticationPrincipal final String targetid);
|
||||
|
||||
/**
|
||||
* Handles GET {@link Artifact} MD5 checksum file download request.
|
||||
* Handles GET {@link DdiArtifact} MD5 checksum file download request.
|
||||
*
|
||||
* @param fileName
|
||||
* to search for
|
||||
@@ -61,8 +60,8 @@ public interface ArtifactStoreControllerDdiApi {
|
||||
*
|
||||
* @return response of the servlet
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = ControllerConstants.ARTIFACT_DOWNLOAD_BY_FILENAME
|
||||
+ "/{fileName}" + ControllerConstants.ARTIFACT_MD5_DWNL_SUFFIX)
|
||||
@RequestMapping(method = RequestMethod.GET, value = DdiRestConstants.ARTIFACT_DOWNLOAD_BY_FILENAME
|
||||
+ "/{fileName}" + DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Void> downloadArtifactMD5ByFilename(@PathVariable("fileName") final String fileName,
|
||||
final HttpServletResponse response);
|
||||
@@ -6,12 +6,12 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi;
|
||||
package org.eclipse.hawkbit.ddi.rest.api;
|
||||
|
||||
/**
|
||||
* Constants for the direct device integration rest resources.
|
||||
*/
|
||||
public final class ControllerConstants {
|
||||
public final class DdiRestConstants {
|
||||
|
||||
/**
|
||||
* The base URL mapping of the direct device integration rest resources.
|
||||
@@ -59,7 +59,7 @@ public final class ControllerConstants {
|
||||
public static final String ARTIFACT_MD5_DWNL_SUFFIX = ".MD5SUM";
|
||||
|
||||
// constant class, private constructor.
|
||||
private ControllerConstants() {
|
||||
private DdiRestConstants() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2016 Bosch Software Innovations GmbH, Germany. All rights reserved.
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.api;
|
||||
package org.eclipse.hawkbit.ddi.rest.api;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.List;
|
||||
@@ -10,13 +10,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.eclipse.hawkbit.ddi.ControllerConstants;
|
||||
import org.eclipse.hawkbit.ddi.model.ActionFeedback;
|
||||
import org.eclipse.hawkbit.ddi.model.Artifact;
|
||||
import org.eclipse.hawkbit.ddi.model.Cancel;
|
||||
import org.eclipse.hawkbit.ddi.model.ConfigData;
|
||||
import org.eclipse.hawkbit.ddi.model.ControllerBase;
|
||||
import org.eclipse.hawkbit.ddi.model.DeploymentBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiActionFeedback;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiArtifact;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiCancel;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiConfigData;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -30,8 +29,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
/**
|
||||
* REST resource handling for root controller CRUD operations.
|
||||
*/
|
||||
@RequestMapping(ControllerConstants.BASE_V1_REQUEST_MAPPING)
|
||||
public interface RootControllerDdiApi {
|
||||
@RequestMapping(DdiRestConstants.BASE_V1_REQUEST_MAPPING)
|
||||
public interface DdiRootControllerRestApi {
|
||||
|
||||
/**
|
||||
* Returns all artifacts of a given software module and target.
|
||||
@@ -45,7 +44,7 @@ public interface RootControllerDdiApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts", produces = {
|
||||
"application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||
public ResponseEntity<List<org.eclipse.hawkbit.ddi.model.Artifact>> getSoftwareModulesArtifacts(
|
||||
ResponseEntity<List<org.eclipse.hawkbit.ddi.json.model.DdiArtifact>> getSoftwareModulesArtifacts(
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId);
|
||||
|
||||
@@ -61,11 +60,11 @@ public interface RootControllerDdiApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
public ResponseEntity<ControllerBase> getControllerBase(@PathVariable("targetid") final String targetid,
|
||||
ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("targetid") final String targetid,
|
||||
final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* Handles GET {@link Artifact} download request. This could be full or
|
||||
* Handles GET {@link DdiArtifact} download request. This could be full or
|
||||
* partial (as specified by RFC7233 (Range Requests)) download request.
|
||||
*
|
||||
* @param targetid
|
||||
@@ -84,13 +83,13 @@ public interface RootControllerDdiApi {
|
||||
* {@link HttpStatus#PARTIAL_CONTENT}.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
|
||||
public ResponseEntity<Void> downloadArtifact(@PathVariable("targetid") final String targetid,
|
||||
ResponseEntity<Void> downloadArtifact(@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName, final HttpServletResponse response,
|
||||
final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* Handles GET {@link Artifact} MD5 checksum file download request.
|
||||
* Handles GET {@link DdiArtifact} MD5 checksum file download request.
|
||||
*
|
||||
* @param targetid
|
||||
* of the related
|
||||
@@ -107,8 +106,8 @@ public interface RootControllerDdiApi {
|
||||
* successful
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
|
||||
+ ControllerConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
public ResponseEntity<Void> downloadArtifactMd5(@PathVariable("targetid") final String targetid,
|
||||
+ DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
ResponseEntity<Void> downloadArtifactMd5(@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName, final HttpServletResponse response,
|
||||
final HttpServletRequest request);
|
||||
@@ -120,7 +119,7 @@ public interface RootControllerDdiApi {
|
||||
* of the {@link Target} that matches to
|
||||
* {@link Target#getControllerId()}
|
||||
* @param actionId
|
||||
* of the {@link DeploymentBase} that matches to
|
||||
* of the {@link DdiDeploymentBase} that matches to
|
||||
* {@link Target#getActiveActions()}
|
||||
* @param resource
|
||||
* an hashcode of the resource which indicates if the action has
|
||||
@@ -130,16 +129,16 @@ public interface RootControllerDdiApi {
|
||||
* the HTTP request injected by spring
|
||||
* @return the response
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + ControllerConstants.DEPLOYMENT_BASE_ACTION
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION
|
||||
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<DeploymentBase> getControllerBasedeploymentAction(
|
||||
ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId,
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource,
|
||||
final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* This is the feedback channel for the {@link DeploymentBase} action.
|
||||
* This is the feedback channel for the {@link DdiDeploymentBase} action.
|
||||
*
|
||||
* @param feedback
|
||||
* to provide
|
||||
@@ -153,9 +152,9 @@ public interface RootControllerDdiApi {
|
||||
*
|
||||
* @return the response
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + ControllerConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
|
||||
+ ControllerConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final ActionFeedback feedback,
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
|
||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId,
|
||||
final HttpServletRequest request);
|
||||
|
||||
@@ -172,12 +171,12 @@ public interface RootControllerDdiApi {
|
||||
* @return status of the request
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/"
|
||||
+ ControllerConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Void> putConfigData(@Valid @RequestBody final ConfigData configData,
|
||||
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData,
|
||||
@PathVariable("targetid") final String targetid, final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* {@link RequestMethod.GET} method for the {@link Cancel} action.
|
||||
* {@link RequestMethod.GET} method for the {@link DdiCancel} action.
|
||||
*
|
||||
* @param targetid
|
||||
* ID of the calling target
|
||||
@@ -186,19 +185,19 @@ public interface RootControllerDdiApi {
|
||||
* @param request
|
||||
* the HTTP request injected by spring
|
||||
*
|
||||
* @return the {@link Cancel} response
|
||||
* @return the {@link DdiCancel} response
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + ControllerConstants.CANCEL_ACTION
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION
|
||||
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Cancel> getControllerCancelAction(@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId, final HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* {@link RequestMethod.POST} method receiving the {@link ActionFeedback}
|
||||
* {@link RequestMethod.POST} method receiving the {@link DdiActionFeedback}
|
||||
* from the target.
|
||||
*
|
||||
* @param feedback
|
||||
* the {@link ActionFeedback} from the target.
|
||||
* the {@link DdiActionFeedback} from the target.
|
||||
* @param targetid
|
||||
* the ID of the calling target
|
||||
* @param actionId
|
||||
@@ -206,12 +205,12 @@ public interface RootControllerDdiApi {
|
||||
* @param request
|
||||
* the HTTP request injected by spring
|
||||
*
|
||||
* @return the {@link ActionFeedback} response
|
||||
* @return the {@link DdiActionFeedback} response
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/{targetid}/" + ControllerConstants.CANCEL_ACTION + "/{actionId}/"
|
||||
+ ControllerConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Void> postCancelActionFeedback(@Valid @RequestBody final ActionFeedback feedback,
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
|
||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> postCancelActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId, final HttpServletRequest request);
|
||||
|
||||
Reference in New Issue
Block a user