Merge branch 'Feature/Add_Rest_Api_with_Java_client' of https://github.com/bsinno/hawkbit.git into Feature/Add_Rest_Api_with_Java_client

This commit is contained in:
Jonathan Philip Knoblauch
2016-04-28 07:40:07 +02:00
5 changed files with 79 additions and 17 deletions

View File

@@ -24,6 +24,7 @@ public class DistributionSetBuilder {
private String name;
private String version;
private String type;
private String description;
private final List<MgmtSoftwareModuleAssigment> modules = new ArrayList<>();
/**
@@ -63,10 +64,20 @@ public class DistributionSetBuilder {
return this;
}
/**
* @param description
* the description
* @return the builder itself
*/
public DistributionSetBuilder description(final String description) {
this.description = description;
return this;
}
/**
* Builds a list with a single entry of
* {@link MgmtDistributionSetRequestBodyPost} which can directly be used to post
* on the RESTful-API.
* {@link MgmtDistributionSetRequestBodyPost} which can directly be used to
* post on the RESTful-API.
*
* @return a single entry list of {@link MgmtDistributionSetRequestBodyPost}
*/
@@ -98,6 +109,7 @@ public class DistributionSetBuilder {
body.setName(prefixName);
body.setVersion(version);
body.setType(type);
body.setDescription(description);
body.setModules(modules);
return body;
}

View File

@@ -25,6 +25,7 @@ public class DistributionSetTypeBuilder {
private String key;
private String name;
private String description;
private final List<MgmtSoftwareModuleTypeAssigment> mandatorymodules = Lists.newArrayList();
private final List<MgmtSoftwareModuleTypeAssigment> optionalmodules = Lists.newArrayList();
@@ -48,6 +49,16 @@ public class DistributionSetTypeBuilder {
return this;
}
/**
* @param description
* the description
* @return the builder itself
*/
public DistributionSetTypeBuilder description(final String description) {
this.description = description;
return this;
}
/**
* @param softwareModuleTypeIds
* the IDs of the software module types which should be mandatory
@@ -81,20 +92,21 @@ public class DistributionSetTypeBuilder {
/**
* Builds a list with a single entry of
* {@link MgmtDistributionSetTypeRequestBodyPost} which can directly be used in
* the RESTful-API.
* {@link MgmtDistributionSetTypeRequestBodyPost} which can directly be used
* in the RESTful-API.
*
* @return a single entry list of {@link MgmtDistributionSetTypeRequestBodyPost}
* @return a single entry list of
* {@link MgmtDistributionSetTypeRequestBodyPost}
*/
public List<MgmtDistributionSetTypeRequestBodyPost> build() {
return Lists.newArrayList(doBuild(name, key));
}
/**
* Builds a list of multiple {@link MgmtDistributionSetTypeRequestBodyPost} to
* create multiple distribution set types at once. An increasing number will
* be added to the name and key of the distribution set type. The optional
* and mandatory software module types will remain the same.
* Builds a list of multiple {@link MgmtDistributionSetTypeRequestBodyPost}
* to create multiple distribution set types at once. An increasing number
* will be added to the name and key of the distribution set type. The
* optional and mandatory software module types will remain the same.
*
* @param count
* the amount of distribution sets type body which should be
@@ -114,6 +126,7 @@ public class DistributionSetTypeBuilder {
final MgmtDistributionSetTypeRequestBodyPost body = new MgmtDistributionSetTypeRequestBodyPost();
body.setKey(prefixKey);
body.setName(prefixName);
body.setDescription(description);
body.setMandatorymodules(mandatorymodules);
body.setOptionalmodules(optionalmodules);
return body;

View File

@@ -9,8 +9,8 @@
package org.eclipse.hawkbit.mgmt.client.resource.builder;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutCondition;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutRestRequestBody;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutCondition.Condition;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutRestRequestBody;
/**
*
@@ -25,6 +25,7 @@ public class RolloutBuilder {
private long distributionSetId;
private String successThreshold;
private String errorThreshold;
private String description;
/**
* @param name
@@ -57,6 +58,16 @@ public class RolloutBuilder {
return this;
}
/**
* @param description
* the description
* @return the builder itself
*/
public RolloutBuilder description(final String description) {
this.description = description;
return this;
}
/**
* @param distributionSetId
* the ID of the distribution set to assign to the target in the
@@ -105,6 +116,7 @@ public class RolloutBuilder {
body.setAmountGroups(groupSize);
body.setTargetFilterQuery(targetFilterQuery);
body.setDistributionSetId(distributionSetId);
body.setDescription(description);
body.setSuccessCondition(new MgmtRolloutCondition(Condition.THRESHOLD, successThreshold));
body.setErrorCondition(new MgmtRolloutCondition(Condition.THRESHOLD, errorThreshold));
return body;

View File

@@ -26,6 +26,8 @@ public class SoftwareModuleBuilder {
private String name;
private String version;
private String type;
private String vendor;
private String description;
/**
* @param name
@@ -58,10 +60,30 @@ public class SoftwareModuleBuilder {
return this;
}
/**
* @param vendor
* the vendor
* @return the builder itself
*/
public SoftwareModuleBuilder vendor(final String vendor) {
this.vendor = vendor;
return this;
}
/**
* @param description
* the description
* @return the builder itself
*/
public SoftwareModuleBuilder description(final String description) {
this.description = description;
return this;
}
/**
* Builds a list with a single entry of
* {@link MgmtSoftwareModuleRequestBodyPost} which can directly be used in the
* RESTful-API.
* {@link MgmtSoftwareModuleRequestBodyPost} which can directly be used in
* the RESTful-API.
*
* @return a single entry list of {@link MgmtSoftwareModuleRequestBodyPost}
*/
@@ -70,10 +92,10 @@ public class SoftwareModuleBuilder {
}
/**
* Builds a list of multiple {@link MgmtSoftwareModuleRequestBodyPost} to create
* multiple software module at once. An increasing number will be added to
* the name of the software module. The version and type will remain the
* same.
* Builds a list of multiple {@link MgmtSoftwareModuleRequestBodyPost} to
* create multiple software module at once. An increasing number will be
* added to the name of the software module. The version and type will
* remain the same.
*
* @param count
* the amount of software module body which should be created
@@ -93,6 +115,8 @@ public class SoftwareModuleBuilder {
body.setName(prefixName);
body.setVersion(version);
body.setType(type);
body.setVendor(vendor);
body.setDescription(description);
return body;
}

View File

@@ -53,7 +53,8 @@ public interface MgmtSoftwareModuleRestApi {
* failure the JsonResponseExceptionHandler is handling the
* response.
*/
@RequestMapping(method = RequestMethod.POST, value = "/{softwareModuleId}/artifacts")
@RequestMapping(method = RequestMethod.POST, value = "/{softwareModuleId}/artifacts", produces = {
"application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtArtifact> uploadArtifact(@PathVariable("softwareModuleId") final Long softwareModuleId,
@RequestParam("file") final MultipartFile file,
@RequestParam(value = "filename", required = false) final String optionalFileName,