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

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,8 @@ public interface MgmtSoftwareModuleRestApi {
* failure the JsonResponseExceptionHandler is handling the * failure the JsonResponseExceptionHandler is handling the
* response. * 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, ResponseEntity<MgmtArtifact> uploadArtifact(@PathVariable("softwareModuleId") final Long softwareModuleId,
@RequestParam("file") final MultipartFile file, @RequestParam("file") final MultipartFile file,
@RequestParam(value = "filename", required = false) final String optionalFileName, @RequestParam(value = "filename", required = false) final String optionalFileName,