Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository API query signatures Entity free #403

Merged
merged 16 commits into from
Jan 11, 2017
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ https://hawkbit.eu-gb.mybluemix.net/UI/

We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](https://github.com/eclipse/hawkbit/wiki/Run-hawkBit) for setting up a complete landscape.

# API stability

hawkBit is currently in '0.X' semantic version. That is due to the need that there is still content in hawkBit that is in need for refactoring. That includes the maven module structure, Spring Boot Properties, Spring Boot auto configuration as well as internal Java APIs (e.g. the [repository API](https://github.com/eclipse/hawkbit/issues/197) ).

However, the external APIs (i.e. [Management API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-mgmt-api), [DDI API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-api), [DDI Artifact Download API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-dl-api) and [DMF API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-dmf-api) are on major version 'v1' and will be kept stable.

# hawkBit (Spring boot) starters

Next to the [Example Application](examples/hawkbit-example-app) we are also providing a set of [Spring Boot Starters](hawkbit-starters) to quick start your own [Spring Boot](https://projects.spring.io/spring-boot/) based application.
Expand Down
6 changes: 5 additions & 1 deletion hawkbit-ddi-api/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Eclipse.IoT hawkBit - DDI API
# Eclipse.IoT hawkBit - Direct Device Integration API - Model and Resources

The Direct Device Integration (DDI) API is used by devices for communicating with the HawkBit Update Server through HTTP.

# Version 1

The model follows [semantic versioning](http://semver.org) with MAJOR version, i.e. breaking changes will result in a new MAJOR version.

# Compile

#### Build hawkbit-ddi-api
Expand Down
6 changes: 5 additions & 1 deletion hawkbit-ddi-dl-api/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Eclipse.IoT hawkBit - DDI Download API
# Eclipse.IoT hawkBit - DDI Artifact Download API - Resources

This module is part of the Direct Device Integration (DDI) API and is used by devices/targets for downloading artifacts through HTTP.

# Version 1

The model follows [semantic versioning](http://semver.org) with MAJOR version, i.e. breaking changes will result in a new MAJOR version.

# Compile

#### Build hawkbit-ddi-dl-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("ten
if (ifMatch != null && !RestResourceConversionHelper.matchesHttpHeader(ifMatch, artifact.getSha1Hash())) {
result = new ResponseEntity<>(HttpStatus.PRECONDITION_FAILED);
} else {
final DbArtifact file = artifactManagement.loadArtifactBinary(artifact);
final DbArtifact file = artifactManagement.loadArtifactBinary(artifact.getId());

// we set a download status only if we are aware of the
// targetid, i.e. authenticated and not anonymous
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ public ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("tenant

final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(controllerId, IpUtil
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
return new ResponseEntity<>(
DataConversionHelper.fromTarget(target, controllerManagement.findOldestActiveActionByTarget(target),
controllerManagement.getPollingTime(), tenantAware),
HttpStatus.OK);
return new ResponseEntity<>(DataConversionHelper.fromTarget(target,
controllerManagement.findOldestActiveActionByTarget(controllerId),
controllerManagement.getPollingTime(), tenantAware), HttpStatus.OK);
}

@Override
Expand All @@ -158,7 +157,7 @@ public ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") fina
@SuppressWarnings("squid:S3655")
final Artifact artifact = module.getArtifactByFilename(fileName).get();

final DbArtifact file = artifactManagement.loadArtifactBinary(artifact);
final DbArtifact file = artifactManagement.loadArtifactBinary(artifact.getId());

final String ifMatch = requestResponseContextHolder.getHttpServletRequest().getHeader("If-Match");
if (ifMatch != null && !RestResourceConversionHelper.matchesHttpHeader(ifMatch, artifact.getSha1Hash())) {
Expand Down Expand Up @@ -254,7 +253,7 @@ public ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(

LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", controllerId, base);

controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
controllerManagement.registerRetrieved(action.getId(), RepositoryConstants.SERVER_MESSAGE_PREFIX
+ "Target retrieved update action and should start now the download.");

return new ResponseEntity<>(base, HttpStatus.OK);
Expand Down Expand Up @@ -388,7 +387,7 @@ public ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant

LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", controllerId, cancel);

controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
controllerManagement.registerRetrieved(action.getId(), RepositoryConstants.SERVER_MESSAGE_PREFIX
+ "Target retrieved cancel action and should start now the cancelation.");

return new ResponseEntity<>(cancel, HttpStatus.OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,15 @@ public void downloadArtifactByNameByNamedController() throws Exception {
Arrays.equals(result.getResponse().getContentAsByteArray(), random));

// one (update) action
assertThat(deploymentManagement.findActionsByTarget(target)).hasSize(1);
final Action action = deploymentManagement.findActionsByTarget(target).get(0);
assertThat(deploymentManagement.countActionsByTarget(target.getControllerId())).isEqualTo(1);
final Action action = deploymentManagement.findActionsByTarget(target.getControllerId(), pageReq).getContent()
.get(0);

// one status - download
assertThat(action.getActionStatus()).hasSize(2);
assertThat(deploymentManagement.findActionStatusByAction(new PageRequest(0, 400, Direction.DESC, "id"), action)
.getContent().get(0).getStatus()).isEqualTo(Status.DOWNLOAD);
assertThat(deploymentManagement
.findActionStatusByAction(new PageRequest(0, 400, Direction.DESC, "id"), action.getId()).getContent()
.get(0).getStatus()).isEqualTo(Status.DOWNLOAD);

// download complete
assertThat(downLoadProgress).isEqualTo(10);
Expand Down
Loading