Add download server api

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-05-03 12:52:53 +02:00
parent 37e576103a
commit f33c8c05e2
351 changed files with 101 additions and 54 deletions

View File

@@ -1,66 +0,0 @@
/**
* Copyright (c) 2011-2016 Bosch Software Innovations GmbH, Germany. All rights reserved.
*
* 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.rest.api;
import java.io.InputStream;
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;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* REST resource handling for artifact download operations.
*/
@RequestMapping(DdiRestConstants.ARTIFACTS_V1_REQUEST_MAPPING)
public interface DdiArtifactStoreControllerRestApi {
/**
* Handles GET {@link DdiArtifact} download request. This could be full or
* partial download request.
*
* @param fileName
* to search for
* @param response
* to write to
* @param request
* from the client
* @param targetid
* of authenticated target
*
* @return response of the servlet which in case of success is status code
* {@link HttpStatus#OK} or in case of partial download
* {@link HttpStatus#PARTIAL_CONTENT}.
*/
@RequestMapping(method = RequestMethod.GET, value = DdiRestConstants.ARTIFACT_DOWNLOAD_BY_FILENAME + "/{fileName}")
@ResponseBody
public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("fileName") final String fileName,
@AuthenticationPrincipal final String targetid);
/**
* Handles GET {@link DdiArtifact} MD5 checksum file download request.
*
* @param fileName
* to search for
* @param response
* to write to
*
* @return response of the servlet
*/
@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);
}

View File

@@ -18,11 +18,6 @@ public final class DdiRestConstants {
*/
public static final String BASE_V1_REQUEST_MAPPING = "/{tenant}/controller/v1";
/**
* The base URL mapping of the artifact repository rest resources.
*/
public static final String ARTIFACTS_V1_REQUEST_MAPPING = "/{tenant}/controller/artifacts/v1";
/**
* Deployment action resources.
*/
@@ -38,28 +33,17 @@ public final class DdiRestConstants {
*/
public static final String FEEDBACK = "feedback";
/**
* Config data action resources.
*/
public static final String CONFIG_DATA_ACTION = "configData";
/**
* The artifact URL mapping rest resource.
*/
public static final String ARTIFACT_DOWNLOAD = "artifact";
/**
* The artifact by filename URL mapping rest resource.
*/
public static final String ARTIFACT_DOWNLOAD_BY_FILENAME = "/filename";
/**
* File suffix for MDH hash download (see Linux md5sum).
*/
public static final String ARTIFACT_MD5_DWNL_SUFFIX = ".MD5SUM";
// constant class, private constructor.
private DdiRestConstants() {
/**
* Config data action resources.
*/
public static final String CONFIG_DATA_ACTION = "configData";
private DdiRestConstants() {
// constant class, private constructor.
}
}