@@ -14,13 +14,15 @@ import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.exception.ArtifactUploadFailedException;
|
||||
import org.eclipse.hawkbit.artifact.model.ArtifactStream;
|
||||
import org.eclipse.hawkbit.artifact.model.StoredArtifactInfo;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.repository.artifact.model.DbArtifact;
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidMD5HashException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidSHA1HashException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidMd5HashException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidSha1HashException;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.ArtifactUpload;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
@@ -44,24 +46,24 @@ public interface ArtifactManagement extends PermissionSupport {
|
||||
* @return uploaded {@link Artifact}
|
||||
* @throws EntityNotFoundException if given software module does not exist
|
||||
* @throws EntityAlreadyExistsException if File with that name already exists in the Software Module
|
||||
* @throws org.eclipse.hawkbit.repository.artifact.exception.ArtifactUploadFailedException if upload fails with internal server errors
|
||||
* @throws InvalidMD5HashException if check against provided MD5 checksum failed
|
||||
* @throws InvalidSHA1HashException if check against provided SHA1 checksum failed
|
||||
* @throws ArtifactUploadFailedException if upload fails with internal server errors
|
||||
* @throws InvalidMd5HashException if check against provided MD5 checksum failed
|
||||
* @throws InvalidSha1HashException if check against provided SHA1 checksum failed
|
||||
* @throws ConstraintViolationException if {@link ArtifactUpload} contains invalid values
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_CREATE_REPOSITORY)
|
||||
Artifact create(@NotNull @Valid ArtifactUpload artifactUpload);
|
||||
|
||||
/**
|
||||
* Loads {@link DbArtifact} from store for given {@link Artifact}.
|
||||
* Loads {@link StoredArtifactInfo} from store for given {@link Artifact}.
|
||||
*
|
||||
* @param sha1Hash to search for
|
||||
* @param softwareModuleId software module id.
|
||||
* @param isEncrypted flag to indicate if artifact is encrypted.
|
||||
* @return loaded {@link DbArtifact}
|
||||
* @return loaded {@link StoredArtifactInfo}
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('" + SpPermission.DOWNLOAD_REPOSITORY_ARTIFACT + "')" + " or " + SpringEvalExpressions.IS_CONTROLLER)
|
||||
DbArtifact loadArtifactBinary(@NotEmpty String sha1Hash, long softwareModuleId, final boolean isEncrypted);
|
||||
ArtifactStream getArtifactStream(@NotEmpty String sha1Hash, long softwareModuleId, final boolean isEncrypted);
|
||||
|
||||
/**
|
||||
* Deletes {@link Artifact} based on given id.
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface ConfirmationManagement extends PermissionSupport {
|
||||
* @return instance of {@link AutoConfirmationStatus} wrapped in an {@link Optional}. Present if active and empty if disabled.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY + " or " + SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<AutoConfirmationStatus> getStatus(@NotEmpty String controllerId);
|
||||
Optional<AutoConfirmationStatus> findStatus(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Find active actions in the {@link Action.Status#WAIT_FOR_CONFIRMATION} state for a specific target with a specified controllerId.
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface ControllerManagement {
|
||||
* @return {@link SoftwareModule} identified by ID
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<SoftwareModule> getSoftwareModule(long moduleId);
|
||||
SoftwareModule getSoftwareModule(long moduleId);
|
||||
|
||||
/**
|
||||
* Retrieves software module metadata where isTargetVisible.
|
||||
@@ -115,8 +115,7 @@ public interface ControllerManagement {
|
||||
Optional<Action> findActiveActionWithHighestWeight(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Retrieves active {@link Action}s with highest weight that are assigned to
|
||||
* a {@link Target}.
|
||||
* Retrieves active {@link Action}s with the highest weight that are assigned to a {@link Target}.
|
||||
*
|
||||
* @param controllerId identifies the target to retrieve the action from
|
||||
* @param maxActionCount max size of returned list
|
||||
@@ -182,7 +181,7 @@ public interface ControllerManagement {
|
||||
* @throws EntityNotFoundException if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId, long moduleId);
|
||||
Action getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId, long moduleId);
|
||||
|
||||
/**
|
||||
* Returns configured polling interval at which the controller polls hawkBit server.
|
||||
@@ -317,15 +316,6 @@ public interface ControllerManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
void updateActionExternalRef(long actionId, @NotEmpty String externalRef);
|
||||
|
||||
/**
|
||||
* Retrieves an {@link Action} using {@link Action#getExternalRef()}
|
||||
*
|
||||
* @param externalRef of the action. See {@link Action#getExternalRef()}
|
||||
* @return {@link Action} or {@code null} if it does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> getActionByExternalRef(@NotEmpty String externalRef);
|
||||
|
||||
/**
|
||||
* Delete a single target.
|
||||
*
|
||||
@@ -340,7 +330,7 @@ public interface ControllerManagement {
|
||||
* @param target the target the action is assigned to
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> getInstalledActionByTarget(@NotNull Target target);
|
||||
Optional<Action> findInstalledActionByTarget(@NotNull Target target);
|
||||
|
||||
/**
|
||||
* Activate auto confirmation for a given controllerId
|
||||
|
||||
@@ -351,7 +351,7 @@ public interface DeploymentManagement extends PermissionSupport {
|
||||
* @throws EntityNotFoundException if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<DistributionSet> getAssignedDistributionSet(@NotEmpty String controllerId);
|
||||
Optional<DistributionSet> findAssignedDistributionSet(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Returns {@link DistributionSet} that is installed on given {@link Target}.
|
||||
@@ -361,7 +361,7 @@ public interface DeploymentManagement extends PermissionSupport {
|
||||
* @throws EntityNotFoundException if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<DistributionSet> getInstalledDistributionSet(@NotEmpty String controllerId);
|
||||
Optional<DistributionSet> findInstalledDistributionSet(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Deletes actions which match one of the given action status and which have not been modified since the given (absolute) time-stamp.
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface DistributionSetManagement<T extends DistributionSet>
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<T> getWithDetails(long id);
|
||||
T getWithDetails(long id);
|
||||
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
boolean shouldLockImplicitly(final DistributionSet distributionSet);
|
||||
@@ -169,7 +169,7 @@ public interface DistributionSetManagement<T extends DistributionSet>
|
||||
* @return the page with the found {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<T> findByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||
T findByNameAndVersion(@NotEmpty String distributionName, @NotEmpty String version);
|
||||
|
||||
/**
|
||||
* Retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
|
||||
@@ -47,9 +47,6 @@ public interface DistributionSetTypeManagement<T extends DistributionSetType>
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByKey(@NotEmpty String key);
|
||||
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByName(@NotEmpty String name);
|
||||
|
||||
/**
|
||||
* Assigns {@link DistributionSetType#getMandatoryModuleTypes()}.
|
||||
*
|
||||
|
||||
@@ -55,7 +55,16 @@ public interface RolloutGroupManagement extends PermissionSupport {
|
||||
* @return the found {@link RolloutGroup} by its ID or {@code null} if it does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<RolloutGroup> get(long rolloutGroupId);
|
||||
RolloutGroup get(long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Get {@link RolloutGroup} by id.
|
||||
*
|
||||
* @param rolloutGroupId rollout group id
|
||||
* @return rolloutGroup with details of targets count for different statuses
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
RolloutGroup getWithDetailedStatus(long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given {@link Rollout} and an RSQL filter.
|
||||
@@ -120,15 +129,6 @@ public interface RolloutGroupManagement extends PermissionSupport {
|
||||
@PreAuthorize(HAS_READ_ROLLOUT_AND_READ_TARGET)
|
||||
Page<Target> findTargetsOfRolloutGroupByRsql(long rolloutGroupId, @NotNull String rsql, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Get {@link RolloutGroup} by id.
|
||||
*
|
||||
* @param rolloutGroupId rollout group id
|
||||
* @return rolloutGroup with details of targets count for different statuses
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<RolloutGroup> getWithDetailedStatus(long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Count targets of rollout group.
|
||||
*
|
||||
|
||||
@@ -208,6 +208,15 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
List<Long> findActiveRollouts();
|
||||
|
||||
/**
|
||||
* Retrieves a specific rollout by its ID. Throws exception if not found.
|
||||
*
|
||||
* @param rolloutId the ID of the rollout to retrieve
|
||||
* @return the found rollout or empty if rollout with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Rollout get(long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a specific rollout by its ID.
|
||||
*
|
||||
@@ -217,15 +226,6 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<Rollout> find(long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a specific rollout by its name.
|
||||
*
|
||||
* @param rolloutName the name of the rollout to retrieve
|
||||
* @return the found rollout or empty if rollout with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<Rollout> getByName(@NotEmpty String rolloutName);
|
||||
|
||||
/**
|
||||
* Get count of targets in different status in rollout.
|
||||
*
|
||||
@@ -233,7 +233,7 @@ public interface RolloutManagement extends PermissionSupport {
|
||||
* @return rollout details of targets count for different statuses
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<Rollout> getWithDetailedStatus(long rolloutId);
|
||||
Rollout getWithDetailedStatus(long rolloutId);
|
||||
|
||||
/**
|
||||
* Checks if rollout with given ID exists.
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2019 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
/**
|
||||
* Helper class that provides simple conversion of byte values to readable
|
||||
* strings
|
||||
*/
|
||||
public final class SizeConversionHelper {
|
||||
|
||||
private static final String KB = "KB";
|
||||
private static final String MB = "MB";
|
||||
|
||||
// do not allow to create instances
|
||||
private SizeConversionHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert byte values to human readable strings with units
|
||||
*
|
||||
* @param byteValue Value to convert in bytes
|
||||
*/
|
||||
public static String byteValueToReadableString(final long byteValue) {
|
||||
double outputValue = byteValue / 1024.0;
|
||||
String unit = KB;
|
||||
if (outputValue >= 1024) {
|
||||
outputValue = outputValue / 1024.0;
|
||||
unit = MB;
|
||||
}
|
||||
// We cut decimal places to avoid localization handling
|
||||
return (long) outputValue + " " + unit;
|
||||
}
|
||||
}
|
||||
@@ -45,13 +45,6 @@ public interface SoftwareModuleTypeManagement<T extends SoftwareModuleType>
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param name to search for
|
||||
* @return all {@link SoftwareModuleType}s in the repository with given {@link SoftwareModuleType#getName()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY)
|
||||
Optional<T> findByName(@NotEmpty String name);
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
@@ -18,8 +18,8 @@ import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||
import org.eclipse.hawkbit.repository.report.model.SystemUsageReport;
|
||||
import org.eclipse.hawkbit.repository.report.model.SystemUsageReportWithTenants;
|
||||
import org.eclipse.hawkbit.repository.model.report.SystemUsageReport;
|
||||
import org.eclipse.hawkbit.repository.model.report.SystemUsageReportWithTenants;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -91,6 +91,18 @@ public interface TargetManagement<T extends Target>
|
||||
boolean isTargetMatchingQueryAndDSNotAssignedAndCompatibleAndUpdatable(
|
||||
@NotNull String controllerId, long distributionSetId, @NotNull String targetFilterQuery);
|
||||
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Target getByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Find a {@link Target} based a given ID.
|
||||
*
|
||||
* @param controllerId to look for.
|
||||
* @return {@link Target}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<Target> findByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Find {@link Target}s based a given IDs.
|
||||
*
|
||||
@@ -98,7 +110,7 @@ public interface TargetManagement<T extends Target>
|
||||
* @return List of found{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
List<Target> getByControllerId(@NotEmpty Collection<String> controllerIDs);
|
||||
List<Target> findByControllerId(@NotEmpty Collection<String> controllerIDs);
|
||||
|
||||
/**
|
||||
* Gets a {@link Target} based a given controller id and includes the details specified by the details key.
|
||||
@@ -190,85 +202,14 @@ public interface TargetManagement<T extends Target>
|
||||
* @param rsql the specification to filter the result set
|
||||
* @param pageable page parameter
|
||||
* @return the found {@link Target}s, never {@code null}
|
||||
* @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided
|
||||
* by the given {@code fieldNameProvider}
|
||||
* @throws RSQLParameterUnsupportedFieldException if a field in the RSQL string is used but not provided by the given
|
||||
* {@code fieldNameProvider}
|
||||
* @throws RSQLParameterSyntaxException if the RSQL syntax is wrong
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_DISTRIBUTION_SET)
|
||||
Page<Target> findByAssignedDistributionSetAndRsql(long distributionSetId, @NotNull String rsql, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Count all targets for given {@link TargetFilterQuery} and that are compatible
|
||||
* with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @param distributionSetIdTypeId ID of the {@link DistributionSetType} the targets need to be
|
||||
* compatible with
|
||||
* @return the found number of{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByRsqlAndCompatible(@NotEmpty String rsql, @NotNull Long distributionSetIdTypeId);
|
||||
|
||||
/**
|
||||
* Count all targets with failed actions for specific Rollout and that are compatible with the passed {@link DistributionSetType} and
|
||||
* created after given timestamp
|
||||
*
|
||||
* @param rolloutId rolloutId of the rollout to be retried.
|
||||
* @param dsTypeId ID of the {@link DistributionSetType} the targets need to be compatible with
|
||||
* @return the found number of{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByFailedInRollout(@NotEmpty String rolloutId, @NotNull Long dsTypeId);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and that don't have the specified distribution set in their
|
||||
* action history and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param distributionSetId id of the {@link DistributionSet}
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @return the count of found {@link Target}s
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_DISTRIBUTION_SET)
|
||||
long countByRsqlAndNonDsAndCompatibleAndUpdatable(long distributionSetId, @NotNull String rsql);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and that are not assigned to one of the {@link RolloutGroup}s
|
||||
* and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @param groups the list of {@link RolloutGroup}s
|
||||
* @param distributionSetType type of the {@link DistributionSet} the targets must be compatible with
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByRsqlAndNotInRolloutGroupsAndCompatibleAndUpdatable(
|
||||
@NotNull String rsql, @NotEmpty Collection<Long> groups, @NotNull DistributionSetType distributionSetType);
|
||||
|
||||
/**
|
||||
* Counts all targets with failed actions for specific Rollout and that are not assigned to one of the {@link RolloutGroup}s and are
|
||||
* compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rolloutId rolloutId of the rollout to be retried.
|
||||
* @param groups the list of {@link RolloutGroup}s
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByFailedRolloutAndNotInRolloutGroups(@NotNull String rolloutId, @NotEmpty Collection<Long> groups);
|
||||
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByActionsInRolloutGroup(final long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Find a {@link Target} based a given ID.
|
||||
*
|
||||
* @param controllerId to look for.
|
||||
* @return {@link Target}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<Target> getByControllerId(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}.
|
||||
*
|
||||
@@ -322,6 +263,65 @@ public interface TargetManagement<T extends Target>
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Page<Target> findByRsqlAndTag(@NotNull String rsql, long tagId, @NotNull Pageable pageable);
|
||||
|
||||
/**
|
||||
* Count all targets for given {@link TargetFilterQuery} and that are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @param distributionSetIdTypeId ID of the {@link DistributionSetType} the targets need to be compatible with
|
||||
* @return the found number of{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByRsqlAndCompatible(@NotEmpty String rsql, @NotNull Long distributionSetIdTypeId);
|
||||
|
||||
/**
|
||||
* Count all targets with failed actions for specific Rollout and that are compatible with the passed {@link DistributionSetType} and
|
||||
* created after given timestamp
|
||||
*
|
||||
* @param rolloutId rolloutId of the rollout to be retried.
|
||||
* @param dsTypeId ID of the {@link DistributionSetType} the targets need to be compatible with
|
||||
* @return the found number of{@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
long countByFailedInRollout(@NotEmpty String rolloutId, @NotNull Long dsTypeId);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and that don't have the specified distribution set in their
|
||||
* action history and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param distributionSetId id of the {@link DistributionSet}
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @return the count of found {@link Target}s
|
||||
* @throws EntityNotFoundException if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_DISTRIBUTION_SET)
|
||||
long countByRsqlAndNonDsAndCompatibleAndUpdatable(long distributionSetId, @NotNull String rsql);
|
||||
|
||||
/**
|
||||
* Counts all targets for all the given parameter {@link TargetFilterQuery} and that are not assigned to one of the {@link RolloutGroup}s
|
||||
* and are compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rsql filter definition in RSQL syntax
|
||||
* @param groups the list of {@link RolloutGroup}s
|
||||
* @param distributionSetType type of the {@link DistributionSet} the targets must be compatible with
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByRsqlAndNotInRolloutGroupsAndCompatibleAndUpdatable(
|
||||
@NotNull String rsql, @NotEmpty Collection<Long> groups, @NotNull DistributionSetType distributionSetType);
|
||||
|
||||
/**
|
||||
* Counts all targets with failed actions for specific Rollout and that are not assigned to one of the {@link RolloutGroup}s and are
|
||||
* compatible with the passed {@link DistributionSetType}.
|
||||
*
|
||||
* @param rolloutId rolloutId of the rollout to be retried.
|
||||
* @param groups the list of {@link RolloutGroup}s
|
||||
* @return count of the found {@link Target}s
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByFailedRolloutAndNotInRolloutGroups(@NotNull String rolloutId, @NotEmpty Collection<Long> groups);
|
||||
|
||||
@PreAuthorize(HAS_READ_TARGET_AND_READ_ROLLOUT)
|
||||
long countByActionsInRolloutGroup(final long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Deletes target with the given controller ID.
|
||||
|
||||
@@ -51,14 +51,7 @@ public interface TargetTypeManagement<T extends TargetType>
|
||||
* @return {@link TargetType}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<TargetType> getByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param name as {@link TargetType#getName()}
|
||||
* @return {@link TargetType}
|
||||
*/
|
||||
@PreAuthorize(HAS_READ_REPOSITORY)
|
||||
Optional<TargetType> getByName(@NotEmpty String name);
|
||||
Optional<TargetType> findByKey(@NotEmpty String key);
|
||||
|
||||
/**
|
||||
* @param id Target type ID
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpRole;
|
||||
import org.eclipse.hawkbit.im.authentication.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.report.model.TenantUsage;
|
||||
import org.eclipse.hawkbit.repository.model.report.TenantUsage;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
package org.eclipse.hawkbit.repository.autoassign;
|
||||
|
||||
/**
|
||||
* An interface declaration which contains the check for the auto assignment
|
||||
* logic.
|
||||
* An interface declaration which contains the check for the auto assignment logic.
|
||||
*/
|
||||
public interface AutoAssignExecutor {
|
||||
|
||||
/**
|
||||
* Checks all target filter queries with an auto assign distribution set and
|
||||
* triggers the check and assignment to targets that don't have the design DS
|
||||
* yet
|
||||
* Checks all target filter queries with an auto assign distribution set and triggers the check and assignment to targets that don't have
|
||||
* the design DS yet
|
||||
*/
|
||||
void checkAllTargets();
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
package org.eclipse.hawkbit.repository.event;
|
||||
|
||||
/**
|
||||
* An event declaration which holds an revision for each event so consumers have
|
||||
* the chance to know if they might already retrieved a newer event.
|
||||
* An event declaration which holds a revision for each event so consumers have
|
||||
* the chance to know if they might already have been retrieved a newer event.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TenantAwareEvent {
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
package org.eclipse.hawkbit.repository.event.entity;
|
||||
|
||||
/**
|
||||
* Marker interface to indicate event has created a newly entity.
|
||||
* Marker interface to indicate an event for a newly created entity.
|
||||
*/
|
||||
public interface EntityCreatedEvent extends EntityIdEvent {}
|
||||
@@ -10,6 +10,6 @@
|
||||
package org.eclipse.hawkbit.repository.event.entity;
|
||||
|
||||
/**
|
||||
* Marker interface to indicate event has deleted an entity.
|
||||
* Marker interface to indicate an event for a deleted entity.
|
||||
*/
|
||||
public interface EntityDeletedEvent extends EntityIdEvent {}
|
||||
@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.event.entity;
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
|
||||
/**
|
||||
* Interface to indicate an entity event which contains at least an entity id.
|
||||
* Marker interface to indicate an event which contains at least an entity id.
|
||||
*/
|
||||
public interface EntityIdEvent extends TenantAwareEvent {
|
||||
|
||||
@@ -21,11 +21,6 @@ public interface EntityIdEvent extends TenantAwareEvent {
|
||||
*/
|
||||
String getEntityClass();
|
||||
|
||||
/**
|
||||
* @return the class of entities interface
|
||||
*/
|
||||
String getInterfaceClass();
|
||||
|
||||
/**
|
||||
* @return the ID of the entity of this event.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
package org.eclipse.hawkbit.repository.event.entity;
|
||||
|
||||
/**
|
||||
* Marker interface to indicate event has updated an entity.
|
||||
* Marker interface to indicate an event for an updated entity.
|
||||
*/
|
||||
public interface EntityUpdatedEvent extends EntityIdEvent {}
|
||||
@@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
@@ -25,6 +26,7 @@ public abstract class AbstractRemoteEvent extends ApplicationEvent {
|
||||
|
||||
private final String id;
|
||||
|
||||
// for serialization libs like jackson
|
||||
protected AbstractRemoteEvent() {
|
||||
this("_empty_default_");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
|
||||
/**
|
||||
* Defines the the remote event of delete a {@link DistributionSetTag}.
|
||||
* Defines the remote event of delete a {@link DistributionSetTag}.
|
||||
*/
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
public class DistributionSetTagDeletedEvent extends RemoteIdEvent implements EntityDeletedEvent {
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
@@ -19,14 +20,15 @@ import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
* TenantAwareEvent that contains an updated download progress for a given
|
||||
* ActionStatus that was written for a download request.
|
||||
*/
|
||||
@NoArgsConstructor(force = true) // for serialization libs like jackson
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
public class DownloadProgressEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private long shippedBytesSinceLast;
|
||||
private final long shippedBytesSinceLast;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -39,8 +41,4 @@ public class DownloadProgressEvent extends RemoteTenantAwareEvent {
|
||||
super(tenant, actionStatusId);
|
||||
this.shippedBytesSinceLast = shippedBytesSinceLast;
|
||||
}
|
||||
|
||||
public long getShippedBytesSinceLast() {
|
||||
return shippedBytesSinceLast;
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,9 @@ import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
|
||||
/**
|
||||
* Generic deployment event for the Multi-Assignments feature. The event extends
|
||||
* the {@link MultiActionEvent} and holds a list of controller IDs to identify
|
||||
* the targets which are affected by a deployment action and a list of
|
||||
* actionIds containing the identifiers of the affected actions
|
||||
* as payload. This event is only published in case of an cancellation.
|
||||
* Generic deployment event for the Multi-Assignments feature. The event extends the {@link MultiActionEvent} and holds a list of controller IDs
|
||||
* to identify the targets which are affected by a deployment action and a list of actionIds containing the identifiers of the affected actions
|
||||
* as payload. This event is only published in case of a cancellation.
|
||||
*/
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
public class MultiActionCancelEvent extends MultiActionEvent {
|
||||
|
||||
@@ -18,6 +18,7 @@ import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
@@ -46,6 +47,7 @@ public abstract class MultiActionEvent extends RemoteTenantAwareEvent implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Iterator<String> iterator() {
|
||||
return controllerIds.iterator();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,30 +19,23 @@ import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
|
||||
/**
|
||||
* An base definition class for an event which contains an id.
|
||||
* A base definition class for an event which contains an id.
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RemoteIdEvent extends RemoteTenantAwareEvent {
|
||||
public abstract class RemoteIdEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long entityId;
|
||||
private String entityClass;
|
||||
private String interfaceClass;
|
||||
|
||||
protected RemoteIdEvent(final String tenant, final Long entityId, final Class<? extends TenantAwareBaseEntity> entityClass) {
|
||||
super(tenant, entityId);
|
||||
this.entityClass = entityClass.getName();
|
||||
this.interfaceClass = entityClass.isInterface() ? entityClass.getName() : getInterfaceEntity(entityClass).getName();
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
private static Class<?> getInterfaceEntity(final Class<? extends TenantAwareBaseEntity> baseEntity) {
|
||||
final Class<?>[] interfaces = baseEntity.getInterfaces();
|
||||
return Arrays.stream(interfaces).filter(TenantAwareBaseEntity.class::isAssignableFrom).findFirst().orElse(baseEntity);
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,7 @@ public class TargetAssignDistributionSetEvent extends AbstractAssignmentEvent {
|
||||
*/
|
||||
public TargetAssignDistributionSetEvent(
|
||||
final String tenant, final long distributionSetId, final List<Action> a, final boolean maintenanceWindowAvailable) {
|
||||
super(tenant, distributionSetId,
|
||||
a.stream().filter(action -> action.getDistributionSet().getId().longValue() == distributionSetId).toList());
|
||||
super(tenant, distributionSetId, a.stream().filter(action -> action.getDistributionSet().getId() == distributionSetId).toList());
|
||||
this.distributionSetId = distributionSetId;
|
||||
this.maintenanceWindowAvailable = maintenanceWindowAvailable;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public class TargetPollEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
public TargetPollEvent(final Target target) {
|
||||
this(target.getControllerId(), target.getTenant());
|
||||
this.targetAddress = target.getAddress().toString();
|
||||
this.targetAddress = target.getAddress();
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.lang.Nullable;
|
||||
/**
|
||||
* Defines the remote event of creating a new {@link Action}.
|
||||
*/
|
||||
@NoArgsConstructor(force = true) // for serialization libs like jackson
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@@ -32,15 +34,6 @@ public abstract class AbstractActionEvent extends RemoteEntityEvent<Action> {
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutGroupId;
|
||||
|
||||
/**
|
||||
* Default constructor for serialization libs like jackson.
|
||||
*/
|
||||
protected AbstractActionEvent() {
|
||||
this.targetId = null;
|
||||
this.rolloutId = null;
|
||||
this.rolloutGroupId = null;
|
||||
}
|
||||
|
||||
protected AbstractActionEvent(
|
||||
final Action action, @Nullable final Long targetId, @Nullable final Long rolloutId, @Nullable final Long rolloutGroupId) {
|
||||
super(action);
|
||||
|
||||
@@ -10,13 +10,18 @@
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
/**
|
||||
* Event which is published in case a {@linkplain RolloutGroup} is created or updated
|
||||
*/
|
||||
@NoArgsConstructor(force = true)// for serialization libs like jackson
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public abstract class AbstractRolloutGroupEvent extends RemoteEntityEvent<RolloutGroup> {
|
||||
|
||||
@Serial
|
||||
@@ -24,39 +29,8 @@ public abstract class AbstractRolloutGroupEvent extends RemoteEntityEvent<Rollou
|
||||
|
||||
private final Long rolloutId;
|
||||
|
||||
/**
|
||||
* Default constructor for serialization libs like jackson.
|
||||
*/
|
||||
protected AbstractRolloutGroupEvent() {
|
||||
this.rolloutId = null;
|
||||
}
|
||||
|
||||
protected AbstractRolloutGroupEvent(final RolloutGroup rolloutGroup, final Long rolloutId) {
|
||||
super(rolloutGroup);
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), rolloutId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
final AbstractRolloutGroupEvent that = (AbstractRolloutGroupEvent) o;
|
||||
return Objects.equals(rolloutId, that.rolloutId);
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,7 @@ import org.eclipse.hawkbit.repository.event.entity.EntityCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link RemoteEntityEvent} for creation of a new
|
||||
* {@link DistributionSetTag}.
|
||||
* Defines the {@link RemoteEntityEvent} for creation of a new {@link DistributionSetTag}.
|
||||
*/
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
public class DistributionSetTagCreatedEvent extends RemoteEntityEvent<DistributionSetTag> implements EntityCreatedEvent {
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.eclipse.hawkbit.repository.event.entity.EntityUpdatedEvent;
|
||||
@@ -20,6 +21,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
* Defines the remote event for updating a {@link DistributionSet}.
|
||||
*/
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DistributionSetUpdatedEvent extends RemoteEntityEvent<DistributionSet> implements EntityUpdatedEvent {
|
||||
|
||||
@@ -38,11 +40,4 @@ public class DistributionSetUpdatedEvent extends RemoteEntityEvent<DistributionS
|
||||
super(distributionSet);
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if {@link DistributionSet} is after the update {@link DistributionSet#isComplete()}
|
||||
*/
|
||||
public boolean isComplete() {
|
||||
return complete;
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,12 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.service;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import org.eclipse.hawkbit.repository.event.remote.AbstractRemoteEvent;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public abstract class AbstractServiceRemoteEvent<T extends AbstractRemoteEvent> extends AbstractRemoteEvent {
|
||||
|
||||
private final T remoteEvent;
|
||||
@@ -21,5 +23,4 @@ public abstract class AbstractServiceRemoteEvent<T extends AbstractRemoteEvent>
|
||||
super(remoteEvent == null ? "_empty_source_" : remoteEvent.getSource());
|
||||
this.remoteEvent = remoteEvent;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,89 +25,37 @@ public class AssignmentQuotaExceededException extends AbstractServerRtException
|
||||
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
|
||||
private static final SpServerError errorType = SpServerError.SP_QUOTA_EXCEEDED;
|
||||
|
||||
/**
|
||||
* Creates a new AssignmentQuotaExceededException with
|
||||
* {@link SpServerError#SP_QUOTA_EXCEEDED} error.
|
||||
*/
|
||||
public AssignmentQuotaExceededException() {
|
||||
super(errorType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AssignmentQuotaExceededException with a custom error
|
||||
* message.
|
||||
*
|
||||
* @param message The custom error message.
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final String message) {
|
||||
super(message, errorType);
|
||||
super(errorType, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a AssignmentQuotaExceededException with a custom error message
|
||||
* and a root cause.
|
||||
*
|
||||
* @param message The custom error message.
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final String message, final Throwable cause) {
|
||||
super(message, errorType, cause);
|
||||
super(errorType, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type that hit quota
|
||||
* @param inserted cause for the hit
|
||||
* @param quota that is defined by the repository
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final Class<? extends BaseEntity> type, final long inserted,
|
||||
final int quota) {
|
||||
public AssignmentQuotaExceededException(final Class<? extends BaseEntity> type, final long inserted, final int quota) {
|
||||
this(type.getSimpleName(), inserted, quota);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type that hit quota
|
||||
* @param inserted cause for the hit
|
||||
* @param quota that is defined by the repository
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final String type, final long inserted, final int quota) {
|
||||
super("Request contains too many entries of {" + type + "}. {" + inserted + "} is beyond the permitted {"
|
||||
+ quota + "}.", errorType);
|
||||
super(errorType, "Request contains too many entries of {" + type + "}. {" + inserted + "} is beyond the permitted {" + quota + "}.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a AssignmentQuotaExceededException which is to be thrown when an
|
||||
* assignment quota is exceeded.
|
||||
*
|
||||
* @param type The type of the entities that shall be assigned to the
|
||||
* specified parent entity.
|
||||
* @param parentType The type of the parent entity.
|
||||
* @param parentId The ID of the parent entity.
|
||||
* @param requested The number of entities that shall be assigned to the specified
|
||||
* parent entity.
|
||||
* @param quota The maximum number of entities that can be assigned to the
|
||||
* parent entity.
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final Class<?> type, final Class<?> parentType, final Long parentId,
|
||||
final long requested, final long quota) {
|
||||
this(type.getSimpleName(), parentType.getSimpleName(), parentId, requested, quota);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a AssignmentQuotaExceededException which is to be thrown when an
|
||||
* assignment quota is exceeded.
|
||||
*
|
||||
* @param type The type of the entities that shall be assigned to the
|
||||
* specified parent entity.
|
||||
* @param parentType The type of the parent entity.
|
||||
* @param parentId The ID of the parent entity.
|
||||
* @param requested The number of entities that shall be assigned to the specified
|
||||
* parent entity.
|
||||
* @param quota The maximum number of entities that can be assigned to the
|
||||
* parent entity.
|
||||
*/
|
||||
public AssignmentQuotaExceededException(final String type, final String parentType, final Object parentId,
|
||||
final long requested, final long quota) {
|
||||
super(String.format(ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE, requested, type, parentType,
|
||||
parentId != null ? String.valueOf(parentId) : "<new>", quota), errorType);
|
||||
public AssignmentQuotaExceededException(
|
||||
final String type, final String parentType, final Object parentId, final long requested, final long quota) {
|
||||
super(
|
||||
errorType, String.format(
|
||||
ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE,
|
||||
requested, type, parentType, parentId != null ? String.valueOf(parentId) : "<new>", quota)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,30 +29,7 @@ public class AutoConfirmationAlreadyActiveException extends AbstractServerRtExce
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_AUTO_CONFIRMATION_ALREADY_ACTIVE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public AutoConfirmationAlreadyActiveException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public AutoConfirmationAlreadyActiveException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for auto confirmation is already active for given
|
||||
* controller ID
|
||||
*
|
||||
* @param controllerId of affected device
|
||||
*/
|
||||
public AutoConfirmationAlreadyActiveException(final String controllerId) {
|
||||
super("Auto confirmation is already active for device " + controllerId, THIS_ERROR);
|
||||
super(THIS_ERROR, "Auto confirmation is already active for device " + controllerId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,7 @@ public final class CancelActionNotAllowedException extends AbstractServerRtExcep
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new CancelActionNotAllowed with
|
||||
* {@link SpServerError#SP_ACTION_NOT_CANCELABLE} error.
|
||||
*/
|
||||
public CancelActionNotAllowedException() {
|
||||
super(SpServerError.SP_ACTION_NOT_CANCELABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public CancelActionNotAllowedException(final Throwable cause) {
|
||||
super(SpServerError.SP_ACTION_NOT_CANCELABLE, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public CancelActionNotAllowedException(final String message) {
|
||||
super(message, SpServerError.SP_ACTION_NOT_CANCELABLE);
|
||||
super(SpServerError.SP_ACTION_NOT_CANCELABLE, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* {@link ConcurrentModificationException} is thrown when a given entity in's actual and cannot be stored within the current session.
|
||||
* Reason could be that it has been changed within another session.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ConcurrentModificationException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_CONCURRENT_MODIFICATION;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public ConcurrentModificationException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public ConcurrentModificationException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message custom error message
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public ConcurrentModificationException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message custom error message
|
||||
*/
|
||||
public ConcurrentModificationException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,9 +29,7 @@ public class DeletedException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_DELETED;
|
||||
|
||||
public DeletedException(
|
||||
final Class<? extends BaseEntity> type, final Object entityId) {
|
||||
super(type.getSimpleName() + " with given identifier {" + entityId + "} is soft-deleted!",
|
||||
THIS_ERROR);
|
||||
public DeletedException(final Class<? extends BaseEntity> type, final Object entityId) {
|
||||
super(THIS_ERROR, type.getSimpleName() + " with given identifier {" + entityId + "} is soft-deleted!");
|
||||
}
|
||||
}
|
||||
@@ -28,25 +28,7 @@ public class DistributionSetTypeUndefinedException extends AbstractServerRtExcep
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_DS_TYPE_UNDEFINED} error.
|
||||
*/
|
||||
public DistributionSetTypeUndefinedException() {
|
||||
super(SpServerError.SP_DS_TYPE_UNDEFINED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public DistributionSetTypeUndefinedException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_TYPE_UNDEFINED, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public DistributionSetTypeUndefinedException(final String message) {
|
||||
super(message, SpServerError.SP_DS_TYPE_UNDEFINED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,38 +29,19 @@ public class EntityAlreadyExistsException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_ALREADY_EXISTS;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public EntityAlreadyExistsException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityAlreadyExistsException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityAlreadyExistsException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
super(THIS_ERROR, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public EntityAlreadyExistsException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,77 +39,38 @@ public class EntityNotFoundException extends AbstractServerRtException {
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_NOT_EXISTS;
|
||||
private static final int ENTITY_STRING_MAX_LENGTH = 100;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public EntityNotFoundException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityNotFoundException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityNotFoundException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
super(THIS_ERROR, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
protected EntityNotFoundException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for {@link BaseEntity} not found.
|
||||
*
|
||||
* @param type of the entity that was not found
|
||||
* @param entityId of the {@link BaseEntity}
|
||||
*/
|
||||
public EntityNotFoundException(final String type, final Object entityId) {
|
||||
super(type + " with given identifier {" + entityId + "} does not exist.", THIS_ERROR, Map.of(TYPE, type, ENTITY_ID, entityId));
|
||||
super(THIS_ERROR, type + " with given identifier {" + entityId + "} does not exist.", Map.of(TYPE, type, ENTITY_ID, entityId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for {@link BaseEntity} not found.
|
||||
*
|
||||
* @param type of the entity that was not found
|
||||
* @param entityId of the {@link BaseEntity}
|
||||
*/
|
||||
public EntityNotFoundException(final Class<? extends BaseEntity> type, final Object entityId) {
|
||||
this(type.getSimpleName(), entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor for a list of {@link BaseEntity}s not found.
|
||||
*
|
||||
* @param type of the entity that was not found
|
||||
* @param expected collection of the {@link BaseEntity#getId()}s
|
||||
* @param found collection of the {@link BaseEntity#getId()}s
|
||||
*/
|
||||
public EntityNotFoundException(final Class<? extends BaseEntity> type, final Collection<?> expected, final Collection<?> found) {
|
||||
super(
|
||||
String.format("%ss with given identifiers {%s} do not exist.",
|
||||
THIS_ERROR, String.format("%ss with given identifiers {%s} do not exist.",
|
||||
type.getSimpleName(),
|
||||
toEntityString(expected.stream()
|
||||
.filter(id -> !found.contains(id))
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.joining(",")))),
|
||||
THIS_ERROR,
|
||||
Map.of(TYPE, type.getSimpleName(), ENTITY_ID, expected.stream().filter(id -> !found.contains(id)).map(String::valueOf)));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link EntityReadOnlyException} is thrown when a entity is in read only mode and a user tries to change it.
|
||||
* the {@link EntityReadOnlyException} is thrown when an entity is in read only mode and a user tries to change it.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@@ -28,38 +28,19 @@ public class EntityReadOnlyException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_READ_ONLY;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public EntityReadOnlyException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityReadOnlyException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public EntityReadOnlyException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
super(THIS_ERROR, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public EntityReadOnlyException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2019 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import static org.eclipse.hawkbit.repository.SizeConversionHelper.byteValueToReadableString;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if file size quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FileSizeQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
private static final String MAX_ARTIFACT_SIZE_EXCEEDED = "Maximum artifact size (%s) exceeded.";
|
||||
private static final SpServerError errorType = SpServerError.SP_FILE_SIZE_QUOTA_EXCEEDED;
|
||||
|
||||
private final long exceededQuotaValue;
|
||||
|
||||
/**
|
||||
* Creates a new FileSizeQuotaExceededException with a quota value.
|
||||
*
|
||||
* @param exceededQuotaValue Value by how much the quota was exceeded
|
||||
*/
|
||||
public FileSizeQuotaExceededException(final long exceededQuotaValue) {
|
||||
super(createQuotaErrorMessage(exceededQuotaValue), errorType);
|
||||
this.exceededQuotaValue = exceededQuotaValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a readable string of size quota including unit
|
||||
*
|
||||
* @return file size quota with unit
|
||||
*/
|
||||
public String getExceededQuotaValueString() {
|
||||
return byteValueToReadableString(exceededQuotaValue);
|
||||
}
|
||||
|
||||
private static String createQuotaErrorMessage(final long exceededQuotaValue) {
|
||||
return String.format(MAX_ARTIFACT_SIZE_EXCEEDED, byteValueToReadableString(exceededQuotaValue));
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,7 @@ public final class ForceQuitActionNotAllowedException extends AbstractServerRtEx
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new CancelActionNotAllowed with
|
||||
* {@link SpServerError#SP_ACTION_NOT_CANCELABLE} error.
|
||||
*/
|
||||
public ForceQuitActionNotAllowedException() {
|
||||
super(SpServerError.SP_ACTION_NOT_FORCE_QUITABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public ForceQuitActionNotAllowedException(final Throwable cause) {
|
||||
super(SpServerError.SP_ACTION_NOT_FORCE_QUITABLE, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public ForceQuitActionNotAllowedException(final String message) {
|
||||
super(message, SpServerError.SP_ACTION_NOT_FORCE_QUITABLE);
|
||||
super(SpServerError.SP_ACTION_NOT_FORCE_QUITABLE, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
@@ -25,6 +26,7 @@ import org.eclipse.hawkbit.repository.model.TargetType;
|
||||
* Thrown if user tries to assign a {@link DistributionSet} to a {@link Target} that has an incompatible {@link TargetType}
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Getter
|
||||
@ToString(callSuper = true)
|
||||
public class IncompatibleTargetTypeException extends AbstractServerRtException {
|
||||
|
||||
@@ -34,41 +36,19 @@ public class IncompatibleTargetTypeException extends AbstractServerRtException {
|
||||
private final Collection<String> targetTypeNames;
|
||||
private final Collection<String> distributionSetTypeNames;
|
||||
|
||||
/**
|
||||
* Creates a new IncompatibleTargetTypeException with
|
||||
* {@link SpServerError#SP_TARGET_TYPE_INCOMPATIBLE} error.
|
||||
*
|
||||
* @param targetTypeName Name of the target type
|
||||
* @param distributionSetTypeNames Names of the distribution set types
|
||||
*/
|
||||
public IncompatibleTargetTypeException(final String targetTypeName,
|
||||
final Collection<String> distributionSetTypeNames) {
|
||||
super(String.format("Target of type %s is not compatible with distribution set of types %s", targetTypeName,
|
||||
distributionSetTypeNames), SpServerError.SP_TARGET_TYPE_INCOMPATIBLE);
|
||||
public IncompatibleTargetTypeException(final String targetTypeName, final Collection<String> distributionSetTypeNames) {
|
||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||
String.format("Target of type %s is not compatible with distribution set of types %s", targetTypeName, distributionSetTypeNames)
|
||||
);
|
||||
this.targetTypeNames = Collections.singleton(targetTypeName);
|
||||
this.distributionSetTypeNames = distributionSetTypeNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new IncompatibleTargetTypeException with
|
||||
* {@link SpServerError#SP_TARGET_TYPE_INCOMPATIBLE} error.
|
||||
*
|
||||
* @param targetTypeNames Name of the target types
|
||||
* @param distributionSetTypeName Name of the distribution set type
|
||||
*/
|
||||
public IncompatibleTargetTypeException(final Collection<String> targetTypeNames,
|
||||
final String distributionSetTypeName) {
|
||||
super(String.format("Targets of types %s are not compatible with distribution set of type %s", targetTypeNames,
|
||||
distributionSetTypeName), SpServerError.SP_TARGET_TYPE_INCOMPATIBLE);
|
||||
public IncompatibleTargetTypeException(final Collection<String> targetTypeNames, final String distributionSetTypeName) {
|
||||
super(SpServerError.SP_TARGET_TYPE_INCOMPATIBLE,
|
||||
String.format("Targets of types %s are not compatible with distribution set of type %s", targetTypeNames,
|
||||
distributionSetTypeName));
|
||||
this.targetTypeNames = targetTypeNames;
|
||||
this.distributionSetTypeNames = Collections.singleton(distributionSetTypeName);
|
||||
}
|
||||
|
||||
public Collection<String> getTargetTypeNames() {
|
||||
return targetTypeNames;
|
||||
}
|
||||
|
||||
public Collection<String> getDistributionSetTypeNames() {
|
||||
return distributionSetTypeNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,15 @@ public final class IncompleteDistributionSetException extends AbstractServerRtEx
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new IncompleteDistributionSetException with
|
||||
* {@link SpServerError#SP_DS_INCOMPLETE} error.
|
||||
*/
|
||||
public IncompleteDistributionSetException() {
|
||||
super(SpServerError.SP_DS_INCOMPLETE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public IncompleteDistributionSetException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_INCOMPLETE, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public IncompleteDistributionSetException(final String message) {
|
||||
super(message, SpServerError.SP_DS_INCOMPLETE);
|
||||
super(SpServerError.SP_DS_INCOMPLETE, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class InsufficientPermissionException extends AbstractServerRtException {
|
||||
}
|
||||
|
||||
public InsufficientPermissionException(final String message) {
|
||||
super(message, SpServerError.SP_INSUFFICIENT_PERMISSION);
|
||||
super(SpServerError.SP_INSUFFICIENT_PERMISSION, message);
|
||||
}
|
||||
|
||||
public InsufficientPermissionException() {
|
||||
|
||||
@@ -29,10 +29,7 @@ public class InvalidAutoAssignActionTypeException extends AbstractServerRtExcept
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_AUTO_ASSIGN_ACTION_TYPE_INVALID;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public InvalidAutoAssignActionTypeException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
@@ -20,6 +21,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* This exception is indicating that the confirmation feedback cannot be processed for a specific actions for different reasons which are
|
||||
* listed as enum {@link Reason}.
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidConfirmationFeedbackException extends AbstractServerRtException {
|
||||
@@ -31,21 +33,12 @@ public class InvalidConfirmationFeedbackException extends AbstractServerRtExcept
|
||||
|
||||
private final Reason reason;
|
||||
|
||||
protected InvalidConfirmationFeedbackException(final Reason reason) {
|
||||
super(THIS_ERROR);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public InvalidConfirmationFeedbackException(final Reason reason, final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public enum Reason {
|
||||
ACTION_CLOSED, NOT_AWAITING_CONFIRMATION
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,26 +23,15 @@ public class InvalidDistributionSetException extends AbstractServerRtException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new InvalidDistributionSetException with
|
||||
* {@link SpServerError#SP_DS_INVALID} error.
|
||||
*/
|
||||
public InvalidDistributionSetException() {
|
||||
super(SpServerError.SP_DS_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public InvalidDistributionSetException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_INVALID, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public InvalidDistributionSetException(final String message) {
|
||||
super(message, SpServerError.SP_DS_INVALID);
|
||||
super(SpServerError.SP_DS_INVALID, message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if MD5 checksum check fails.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidMD5HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH} error.
|
||||
*/
|
||||
public InvalidMD5HashException() {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public InvalidMD5HashException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public InvalidMD5HashException(final String message) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package org.eclipse.hawkbit.repository.exception;
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
* schedule, duration and timezone are all null, or are all valid; in which case there should be at least one valid window after the current
|
||||
* time.
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidMaintenanceScheduleException extends AbstractServerRtException {
|
||||
@@ -30,54 +32,21 @@ public class InvalidMaintenanceScheduleException extends AbstractServerRtExcepti
|
||||
|
||||
private final int durationErrorIndex;
|
||||
|
||||
/**
|
||||
* Constructor for {@link InvalidMaintenanceScheduleException}.
|
||||
*
|
||||
* @param message the message for this exception.
|
||||
*/
|
||||
public InvalidMaintenanceScheduleException(final String message) {
|
||||
this(message, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for {@link InvalidMaintenanceScheduleException}.
|
||||
*
|
||||
* @param message the message for this exception.
|
||||
* @param errorIndex the error index of maintenance duration.
|
||||
*/
|
||||
public InvalidMaintenanceScheduleException(final String message, final int errorIndex) {
|
||||
super(message, SpServerError.SP_MAINTENANCE_SCHEDULE_INVALID);
|
||||
super(SpServerError.SP_MAINTENANCE_SCHEDULE_INVALID, message);
|
||||
this.durationErrorIndex = errorIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for {@link InvalidMaintenanceScheduleException}.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception.
|
||||
*/
|
||||
public InvalidMaintenanceScheduleException(final String message, final Throwable cause) {
|
||||
this(message, cause, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for {@link InvalidMaintenanceScheduleException}.
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception.
|
||||
* @param errorIndex the error index of maintenance duration.
|
||||
*/
|
||||
public InvalidMaintenanceScheduleException(final String message, final Throwable cause, final int errorIndex) {
|
||||
super(message, SpServerError.SP_MAINTENANCE_SCHEDULE_INVALID, cause);
|
||||
super(SpServerError.SP_MAINTENANCE_SCHEDULE_INVALID, message, cause);
|
||||
this.durationErrorIndex = errorIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error index position for maintenance window duration.
|
||||
*
|
||||
* @return error index.
|
||||
*/
|
||||
public int getDurationErrorIndex() {
|
||||
return durationErrorIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,27 +17,16 @@ import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is thrown when trying to set an invalid target address.
|
||||
* Thrown if MD5 checksum check fails.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidTargetAddressException extends AbstractServerRtException {
|
||||
public class InvalidMd5HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @param message the message for this exception
|
||||
*/
|
||||
public InvalidTargetAddressException(final String message) {
|
||||
super(message, SpServerError.SP_REPO_INVALID_TARGET_ADDRESS);
|
||||
public InvalidMd5HashException(final String message, final Throwable cause) {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception
|
||||
*/
|
||||
public InvalidTargetAddressException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_REPO_INVALID_TARGET_ADDRESS, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,32 +21,12 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidSHA1HashException extends AbstractServerRtException {
|
||||
public class InvalidSha1HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH} error.
|
||||
*/
|
||||
public InvalidSHA1HashException() {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH);
|
||||
public InvalidSha1HashException(final String message, final Throwable cause) {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public InvalidSHA1HashException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public InvalidSHA1HashException(final String message) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,32 +21,12 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvalidSHA256HashException extends AbstractServerRtException {
|
||||
public class InvalidSha256HashException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH} error.
|
||||
*/
|
||||
public InvalidSHA256HashException() {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH);
|
||||
public InvalidSha256HashException(final String message, final Throwable cause) {
|
||||
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public InvalidSHA256HashException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public InvalidSHA256HashException(final String message) {
|
||||
super(message, SpServerError.SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,7 @@ public class InvalidTargetAttributeException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_TARGET_ATTRIBUTES_INVALID;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public InvalidTargetAttributeException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,6 @@ public class InvalidTenantConfigurationKeyException extends AbstractServerRtExce
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_KEY_INVALID;
|
||||
|
||||
public InvalidTenantConfigurationKeyException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
@@ -29,17 +29,15 @@ public class LockedException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_LOCKED;
|
||||
|
||||
public LockedException(
|
||||
final Class<? extends BaseEntity> type, final Object entityId, final String operation) {
|
||||
super(type.getSimpleName() + " with given identifier {" + entityId + "} is locked and " + operation +
|
||||
" is forbidden!",
|
||||
THIS_ERROR);
|
||||
public LockedException(final Class<? extends BaseEntity> type, final Object entityId, final String operation) {
|
||||
this(type, entityId, operation, null);
|
||||
}
|
||||
|
||||
public LockedException(
|
||||
final Class<? extends BaseEntity> type, final Object entityId, final String operation, final String reason) {
|
||||
super(type.getSimpleName() + " with given identifier {" + entityId + "} is locked and " + operation +
|
||||
" is forbidden! Reason: " + reason,
|
||||
THIS_ERROR);
|
||||
super(
|
||||
THIS_ERROR, type.getSimpleName() + " with given identifier {" + entityId + "} is locked and " + operation + " is forbidden!" +
|
||||
(reason == null ? "" : " Reason: " + reason)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if repository operation is no longer supported.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public final class MethodNotSupportedException extends AbstractServerRtException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new MethodNotSupportedException with
|
||||
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||
*/
|
||||
public MethodNotSupportedException() {
|
||||
super(SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new MethodNotSupportedException with
|
||||
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||
*
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public MethodNotSupportedException(final Throwable cause) {
|
||||
super(SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new MethodNotSupportedException with
|
||||
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||
*
|
||||
* @param message of the error
|
||||
*/
|
||||
public MethodNotSupportedException(final String message) {
|
||||
super(message, SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
@@ -28,38 +28,7 @@ public class MultiAssignmentIsNotEnabledException extends AbstractServerRtExcept
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_MULTIASSIGNMENT_NOT_ENABLED;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public MultiAssignmentIsNotEnabledException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public MultiAssignmentIsNotEnabledException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public MultiAssignmentIsNotEnabledException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public MultiAssignmentIsNotEnabledException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,38 +28,7 @@ public class NoWeightProvidedInMultiAssignmentModeException extends AbstractServ
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_NO_WEIGHT_PROVIDED_IN_MULTIASSIGNMENT_MODE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public NoWeightProvidedInMultiAssignmentModeException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public NoWeightProvidedInMultiAssignmentModeException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public NoWeightProvidedInMultiAssignmentModeException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public NoWeightProvidedInMultiAssignmentModeException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,44 +26,19 @@ public class RSQLParameterSyntaxException extends AbstractServerRtException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new RSQLSyntaxException with
|
||||
* {@link SpServerError#SP_REST_RSQL_SEARCH_PARAM_SYNTAX} error.
|
||||
*/
|
||||
public RSQLParameterSyntaxException() {
|
||||
super(SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterSyntaxException with
|
||||
* {@link SpServerError#SP_REST_RSQL_SEARCH_PARAM_SYNTAX} error.
|
||||
*
|
||||
* @param message the message of the exception
|
||||
*/
|
||||
public RSQLParameterSyntaxException(final String message) {
|
||||
super(message, SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX);
|
||||
super(SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLSyntaxException with
|
||||
* {@link SpServerError#SP_REST_RSQL_SEARCH_PARAM_SYNTAX} error.
|
||||
*
|
||||
* @param cause the cause of this exception
|
||||
*/
|
||||
public RSQLParameterSyntaxException(final Throwable cause) {
|
||||
super(SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterSyntaxException with
|
||||
* {@link SpServerError#SP_REST_RSQL_SEARCH_PARAM_SYNTAX} error.
|
||||
*
|
||||
* @param message the message of the exception
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* getCause() method). (A null value is permitted, and indicates
|
||||
* that the cause is nonexistent or unknown.)
|
||||
*/
|
||||
public RSQLParameterSyntaxException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX, cause);
|
||||
super(SpServerError.SP_REST_RSQL_SEARCH_PARAM_SYNTAX, message, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,46 +26,19 @@ public class RSQLParameterUnsupportedFieldException extends AbstractServerRtExce
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterUnsupportedFieldException with
|
||||
* {@link SpServerError#SP_REST_RSQL_PARAM_INVALID_FIELD} error.
|
||||
*/
|
||||
public RSQLParameterUnsupportedFieldException() {
|
||||
super(SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterUnsupportedFieldException with
|
||||
* {@link SpServerError#SP_REST_RSQL_PARAM_INVALID_FIELD} error.
|
||||
*
|
||||
* @param message the message of the exception
|
||||
*/
|
||||
public RSQLParameterUnsupportedFieldException(final String message) {
|
||||
super(message, SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD);
|
||||
super(SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterUnsupportedFieldException with
|
||||
* {@link SpServerError#SP_REST_RSQL_PARAM_INVALID_FIELD} error.
|
||||
*
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* getCause() method). (A null value is permitted, and indicates
|
||||
* that the cause is nonexistent or unknown.)
|
||||
*/
|
||||
public RSQLParameterUnsupportedFieldException(final Throwable cause) {
|
||||
super(SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RSQLParameterUnsupportedFieldException with
|
||||
* {@link SpServerError#SP_REST_RSQL_PARAM_INVALID_FIELD} error.
|
||||
*
|
||||
* @param message the message of the exception
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* getCause() method). (A null value is permitted, and indicates
|
||||
* that the cause is nonexistent or unknown.)
|
||||
*/
|
||||
public RSQLParameterUnsupportedFieldException(final String message, final Throwable cause) {
|
||||
super(message, SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD, cause);
|
||||
super(SpServerError.SP_REST_RSQL_PARAM_INVALID_FIELD, message, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* the {@link RolloutIllegalStateException} is thrown when a rollout is changing it's state which is not valid. E.g. trying to start an already
|
||||
* running rollout, or trying to resume a already finished rollout.
|
||||
* The {@link RolloutIllegalStateException} is thrown when a rollout is changing its state which is not valid. E.g. trying to start an already
|
||||
* running rollout, or trying to resume an already finished rollout.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@@ -29,38 +29,7 @@ public class RolloutIllegalStateException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_ROLLOUT_ILLEGAL_STATE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public RolloutIllegalStateException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public RolloutIllegalStateException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public RolloutIllegalStateException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public RolloutIllegalStateException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,12 @@
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* the {@link SoftwareModuleNotAssignedToTargetException} is thrown when a {@link SoftwareModule} is requested as part of an {@link Action}
|
||||
@@ -28,14 +28,8 @@ public class SoftwareModuleNotAssignedToTargetException extends EntityNotFoundEx
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param moduleId that is not assigned to given {@link Target}
|
||||
* @param controllerId of the {@link Target} where given {@link SoftwareModule} is not part of
|
||||
*/
|
||||
public SoftwareModuleNotAssignedToTargetException(final Long moduleId, final String controllerId) {
|
||||
super("No assignment found for " + SoftwareModule.class.getSimpleName() + " with id {" + moduleId + "} to "
|
||||
+ Target.class.getSimpleName() + " with id {" + controllerId + "}.");
|
||||
super("No assignment found for " + SoftwareModule.class.getSimpleName() + " with id {" + moduleId + "} to " +
|
||||
Target.class.getSimpleName() + " with id {" + controllerId + "}.");
|
||||
}
|
||||
}
|
||||
@@ -28,15 +28,8 @@ public class SoftwareModuleTypeNotInDistributionSetTypeException extends EntityN
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param moduleTypeId that is not part of given {@link DistributionSetType}
|
||||
* @param distributionSetTypeId of the {@link DistributionSetType} where given {@link SoftwareModuleType} is not part of
|
||||
*/
|
||||
public SoftwareModuleTypeNotInDistributionSetTypeException(final Long moduleTypeId,
|
||||
final Long distributionSetTypeId) {
|
||||
super(SoftwareModuleType.class.getSimpleName() + " with id {" + moduleTypeId + "} is not part of "
|
||||
+ DistributionSetType.class.getSimpleName() + " with id {" + distributionSetTypeId + "}.");
|
||||
public SoftwareModuleTypeNotInDistributionSetTypeException(final Long moduleTypeId, final Long distributionSetTypeId) {
|
||||
super(SoftwareModuleType.class.getSimpleName() + " with id {" + moduleTypeId + "} is not part of " +
|
||||
DistributionSetType.class.getSimpleName() + " with id {" + distributionSetTypeId + "}.");
|
||||
}
|
||||
}
|
||||
@@ -27,31 +27,7 @@ public class StopRolloutException extends AbstractServerRtException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new StopRolloutException with
|
||||
* {@link SpServerError#SP_STOP_ROLLOUT_FAILED} error.
|
||||
*/
|
||||
public StopRolloutException() {
|
||||
super(SpServerError.SP_STOP_ROLLOUT_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StopRolloutException with
|
||||
* {@link SpServerError#SP_STOP_ROLLOUT_FAILED} error.
|
||||
*
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public StopRolloutException(final Throwable cause) {
|
||||
super(SpServerError.SP_STOP_ROLLOUT_FAILED, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new StopRolloutException with
|
||||
* {@link SpServerError#SP_STOP_ROLLOUT_FAILED} error.
|
||||
*
|
||||
* @param message of the error
|
||||
*/
|
||||
public StopRolloutException(final String message) {
|
||||
super(message, SpServerError.SP_STOP_ROLLOUT_FAILED);
|
||||
super(SpServerError.SP_STOP_ROLLOUT_FAILED, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2019 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import static org.eclipse.hawkbit.repository.SizeConversionHelper.byteValueToReadableString;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Thrown if storage quota is exceeded
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class StorageQuotaExceededException extends AbstractServerRtException {
|
||||
|
||||
private static final String MAX_ARTIFACT_SIZE_TOTAL_EXCEEDED = "Storage quota exceeded, %s left.";
|
||||
private static final SpServerError errorType = SpServerError.SP_STORAGE_QUOTA_EXCEEDED;
|
||||
|
||||
private final long exceededQuotaValue;
|
||||
|
||||
/**
|
||||
* Creates a new StorageQuotaExceededException with a quota value.
|
||||
*
|
||||
* @param exceededQuotaValue Value by how much the quota was exceeded
|
||||
*/
|
||||
public StorageQuotaExceededException(final long exceededQuotaValue) {
|
||||
super(createQuotaErrorMessage(exceededQuotaValue), errorType);
|
||||
this.exceededQuotaValue = exceededQuotaValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a readable string of size quota including unit
|
||||
*
|
||||
* @return file size quota with unit
|
||||
*/
|
||||
public String getExceededQuotaValueString() {
|
||||
return byteValueToReadableString(exceededQuotaValue);
|
||||
}
|
||||
|
||||
private static String createQuotaErrorMessage(final long exceededQuotaValue) {
|
||||
return String.format(MAX_ARTIFACT_SIZE_TOTAL_EXCEEDED, byteValueToReadableString(exceededQuotaValue));
|
||||
}
|
||||
}
|
||||
@@ -28,39 +28,7 @@ public class TargetTypeInUseException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_TARGET_TYPE_IN_USE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetTypeInUseException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public TargetTypeInUseException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public TargetTypeInUseException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public TargetTypeInUseException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,11 +28,7 @@ public class TargetTypeKeyOrNameRequiredException extends AbstractServerRtExcept
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_TARGET_TYPE_KEY_OR_NAME_REQUIRED;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetTypeKeyOrNameRequiredException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,12 +28,7 @@ public class TenantConfigurationValidatorException extends AbstractServerRtExcep
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_VALUE_INVALID;
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public TenantConfigurationValidatorException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
@@ -26,24 +26,7 @@ public class TenantConfigurationValueChangeNotAllowedException extends AbstractS
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new exception for the
|
||||
* {@link SpServerError#SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED} error
|
||||
* case.
|
||||
*/
|
||||
public TenantConfigurationValueChangeNotAllowedException() {
|
||||
super(SpServerError.SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception for the
|
||||
* {@link SpServerError#SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED} error
|
||||
* case.
|
||||
*
|
||||
* @param message A custom error message.
|
||||
*/
|
||||
public TenantConfigurationValueChangeNotAllowedException(final String message) {
|
||||
super(message, SpServerError.SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,38 +29,7 @@ public class TenantNotExistException extends AbstractServerRtException {
|
||||
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_TENANT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TenantNotExistException() {
|
||||
super(THIS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public TenantNotExistException(final Throwable cause) {
|
||||
super(THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
* @param cause of the exception
|
||||
*/
|
||||
public TenantNotExistException(final String message, final Throwable cause) {
|
||||
super(message, THIS_ERROR, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameterized constructor.
|
||||
*
|
||||
* @param message of the exception
|
||||
*/
|
||||
public TenantNotExistException(final String message) {
|
||||
super(message, THIS_ERROR);
|
||||
super(THIS_ERROR, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,25 +29,7 @@ public class UnsupportedSoftwareModuleForThisDistributionSetException extends Ab
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new UnsupportedSoftwareModuleForThisDistributionSetException
|
||||
* with {@link SpServerError#SP_DS_MODULE_UNSUPPORTED} error.
|
||||
*/
|
||||
public UnsupportedSoftwareModuleForThisDistributionSetException() {
|
||||
super(SpServerError.SP_DS_MODULE_UNSUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause for the exception
|
||||
*/
|
||||
public UnsupportedSoftwareModuleForThisDistributionSetException(final Throwable cause) {
|
||||
super(SpServerError.SP_DS_MODULE_UNSUPPORTED, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message of the error
|
||||
*/
|
||||
public UnsupportedSoftwareModuleForThisDistributionSetException(final String message) {
|
||||
super(message, SpServerError.SP_DS_MODULE_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,8 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
Target getTarget();
|
||||
|
||||
/**
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} after which
|
||||
* {@link #isForced()} switches to <code>true</code> in case of
|
||||
* {@link ActionType#TIMEFORCED}.
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} after which {@link #isForced()} switches to <code>true</code> in case
|
||||
* of {@link ActionType#TIMEFORCED}.
|
||||
*/
|
||||
long getForcedTime();
|
||||
|
||||
@@ -140,22 +139,17 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
String getInitiatedBy();
|
||||
|
||||
/**
|
||||
* @return the latest action status code. Performance optimization to not
|
||||
* query the action status table for the last action status code.
|
||||
* @return the latest action status code. Performance optimization to not query the action status table for the last action status code.
|
||||
*/
|
||||
Optional<Integer> getLastActionStatusCode();
|
||||
|
||||
/**
|
||||
* checks if the {@link #getForcedTime()} is hit by the given
|
||||
* {@code hitTimeMillis}, by means if the given milliseconds are greater
|
||||
* Checks if the {@link #getForcedTime()} is hit by the given {@code hitTimeMillis}, by means if the given milliseconds are greater
|
||||
* than the forcedTime.
|
||||
*
|
||||
* @param hitTimeMillis the milliseconds, mostly the
|
||||
* {@link System#currentTimeMillis()}
|
||||
* @return {@code true} if this {@link #getActionType()} is in
|
||||
* {@link ActionType#TIMEFORCED} and the given {@code hitTimeMillis}
|
||||
* is greater than the {@link #getForcedTime()} otherwise
|
||||
* {@code false}
|
||||
* @param hitTimeMillis the milliseconds, mostly the {@link System#currentTimeMillis()}
|
||||
* @return {@code true} if this {@link #getActionType()} is in {@link ActionType#TIMEFORCED} and the given {@code hitTimeMillis}
|
||||
* is greater than the {@link #getForcedTime()} otherwise {@code false}
|
||||
*/
|
||||
default boolean isHitAutoForceTime(final long hitTimeMillis) {
|
||||
if (ActionType.TIMEFORCED == getActionType()) {
|
||||
@@ -165,23 +159,17 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if action type is either forced or time-forced <i>and</i> force-time is
|
||||
* exceeded.
|
||||
* Check if action type is either forced or time-forced <i>and</i> force-time is exceeded.
|
||||
*
|
||||
* @return {@code true} if either the {@link #getActionType()} is
|
||||
* {@link ActionType#FORCED} or {@link ActionType#TIMEFORCED} but then
|
||||
* if the {@link #getForcedTime()} has been exceeded otherwise always
|
||||
* {@code false}
|
||||
* @return {@code true} if either the {@link #getActionType()} is {@link ActionType#FORCED} or {@link ActionType#TIMEFORCED} but then
|
||||
* if the {@link #getForcedTime()} has been exceeded otherwise always {@code false}
|
||||
*/
|
||||
default boolean isForcedOrTimeForced() {
|
||||
switch (getActionType()) {
|
||||
case FORCED:
|
||||
return true;
|
||||
case TIMEFORCED:
|
||||
return isHitAutoForceTime(System.currentTimeMillis());
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return switch (getActionType()) {
|
||||
case FORCED -> true;
|
||||
case TIMEFORCED -> isHitAutoForceTime(System.currentTimeMillis());
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,15 +180,14 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true when action is downloadonly, false otherwise
|
||||
* @return true when action is download-only, false otherwise
|
||||
*/
|
||||
default boolean isDownloadOnly() {
|
||||
return ActionType.DOWNLOAD_ONLY == getActionType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start time of next available maintenance window for the
|
||||
* {@link Action} as {@link ZonedDateTime}. If a maintenance window is
|
||||
* Returns the start time of next available maintenance window for the {@link Action} as {@link ZonedDateTime}. If a maintenance window is
|
||||
* already active, the start time of currently active window is returned.
|
||||
*
|
||||
* @return the start time as { @link Optional<ZonedDateTime>}.
|
||||
@@ -208,32 +195,29 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
Optional<ZonedDateTime> getMaintenanceWindowStartTime();
|
||||
|
||||
/**
|
||||
* The method checks whether the action has a maintenance schedule defined
|
||||
* for it. A maintenance schedule defines a set of maintenance windows
|
||||
* during which actual update can be performed. A valid schedule defines at
|
||||
* least one maintenance window.
|
||||
* The method checks whether the action has a maintenance schedule defined for it. A maintenance schedule defines a set of maintenance
|
||||
* windows during which actual update can be performed. A valid schedule defines at least one maintenance window.
|
||||
*
|
||||
* @return true if action has a maintenance schedule, else false.
|
||||
*/
|
||||
boolean hasMaintenanceSchedule();
|
||||
|
||||
/**
|
||||
* The method checks whether the maintenance schedule has already lapsed for
|
||||
* the action, i.e. there are no more windows available for maintenance.
|
||||
* Controller manager uses the method to check if the maintenance schedule
|
||||
* has lapsed, and automatically cancels the action if it is lapsed.
|
||||
* The method checks whether the maintenance schedule has already lapsed for the action, i.e. there are no more windows available for
|
||||
* maintenance.
|
||||
* Controller manager uses the method to check if the maintenance schedule has lapsed, and automatically cancels the action if it is lapsed.
|
||||
*
|
||||
* @return true if maintenance schedule has lapsed, else false.
|
||||
*/
|
||||
boolean isMaintenanceScheduleLapsed();
|
||||
|
||||
/**
|
||||
* The method checks whether a maintenance window is available for the
|
||||
* action to proceed. If it is available, a 'true' value is returned. The
|
||||
* maintenance window is considered available: 1) If there is no maintenance
|
||||
* schedule at all, in which case device can start update any time after
|
||||
* download is finished; or 2) the current time is within a scheduled
|
||||
* maintenance window start and end time.
|
||||
* The method checks whether a maintenance window is available for the action to proceed. If it is available, a 'true' value is returned.
|
||||
* The maintenance window is considered available:
|
||||
* <ol>
|
||||
* <li>if there is no maintenance schedule at all, in which case device can start update any time after download is finished; or</li>
|
||||
* <li>the current time is within a scheduled maintenance window start and end time
|
||||
* </ol>
|
||||
*
|
||||
* @return true if maintenance window is available, else false.
|
||||
*/
|
||||
@@ -248,12 +232,12 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
|
||||
/**
|
||||
* Action status as reported by the controller.
|
||||
*
|
||||
* Be aware that JPA is persisting the ordinal number of the enum by means
|
||||
* the ordered number in the enum. So don't re-order the enums within the
|
||||
* Status enum declaration!
|
||||
* <p/>
|
||||
* Be aware that JPA is persisting the ordinal number of the enum by means the ordered number in the enum. So don't re-order the enums
|
||||
* within the Status enum declaration!
|
||||
*/
|
||||
enum Status {
|
||||
|
||||
/**
|
||||
* Action is finished successfully for this target.
|
||||
*/
|
||||
@@ -285,7 +269,7 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
CANCELING,
|
||||
|
||||
/**
|
||||
* Action has been send to the target.
|
||||
* Action has been sent to the target.
|
||||
*/
|
||||
RETRIEVED,
|
||||
|
||||
@@ -295,8 +279,7 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
DOWNLOAD,
|
||||
|
||||
/**
|
||||
* Action is in waiting state, e.g. the action is scheduled in a rollout
|
||||
* but not yet activated.
|
||||
* Action is in waiting state, e.g. the action is scheduled in a rollout but not yet activated.
|
||||
*/
|
||||
SCHEDULED,
|
||||
|
||||
@@ -306,8 +289,7 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
CANCEL_REJECTED,
|
||||
|
||||
/**
|
||||
* Action has been downloaded by the target and waiting for update to
|
||||
* start.
|
||||
* Action has been downloaded by the target and waiting for update to start.
|
||||
*/
|
||||
DOWNLOADED,
|
||||
|
||||
@@ -321,8 +303,9 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
* The action type for this action relation.
|
||||
*/
|
||||
enum ActionType {
|
||||
|
||||
/**
|
||||
* Forced action execution. Target is advised to executed immediately.
|
||||
* Forced action execution. Target is advised to be executed immediately.
|
||||
*/
|
||||
FORCED,
|
||||
|
||||
@@ -332,9 +315,7 @@ public interface Action extends TenantAwareBaseEntity {
|
||||
SOFT,
|
||||
|
||||
/**
|
||||
* {@link #SOFT} action execution until
|
||||
* {@link Action#isHitAutoForceTime(long)} is reached, {@link #FORCED}
|
||||
* after that.
|
||||
* {@link #SOFT} action execution until {@link Action#isHitAutoForceTime(long)} is reached, {@link #FORCED} after that.
|
||||
*/
|
||||
TIMEFORCED,
|
||||
|
||||
|
||||
@@ -10,19 +10,22 @@
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
/**
|
||||
* Defines if and how actions should be canceled when :
|
||||
* - invalidating a distribution set
|
||||
* - stopping a rollout
|
||||
* - deleting a rollout
|
||||
* Defines if and how actions should be canceled when:
|
||||
* <ul>
|
||||
* <li>invalidating a distribution set</li>
|
||||
* <li>stopping a rollout</li>
|
||||
* <li>deleting a rollout</li>
|
||||
* </ul>
|
||||
*/
|
||||
public enum ActionCancellationType {
|
||||
|
||||
/**
|
||||
* will perform a FORCE action cancellation - will put them in CANCELED state.
|
||||
* Will perform a FORCE action cancellation - will put them in CANCELED state.
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* will perform a SOFT action cancellation - will put them in CANCELING state.
|
||||
* Will perform a SOFT action cancellation - will put them in CANCELING state.
|
||||
*/
|
||||
SOFT,
|
||||
|
||||
@@ -30,4 +33,4 @@ public enum ActionCancellationType {
|
||||
* Used in distribution set invalidation - will ONLY invalidate the DS, will not change action status
|
||||
*/
|
||||
NONE
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,12 @@ import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Holds properties for {@link Action}
|
||||
*/
|
||||
@NoArgsConstructor // for serialization libs like jackson
|
||||
@Data
|
||||
public class ActionProperties implements Serializable {
|
||||
|
||||
@@ -31,9 +33,6 @@ public class ActionProperties implements Serializable {
|
||||
|
||||
private Action.Status status;
|
||||
|
||||
public ActionProperties() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -51,4 +50,4 @@ public class ActionProperties implements Serializable {
|
||||
public boolean isWaitingConfirmation() {
|
||||
return status == Action.Status.WAIT_FOR_CONFIRMATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,7 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
public interface ActionStatus extends TenantAwareBaseEntity {
|
||||
|
||||
/**
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} when the status was
|
||||
* reported.
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} when the status was reported.
|
||||
*/
|
||||
long getOccurredAt();
|
||||
|
||||
@@ -33,7 +32,7 @@ public interface ActionStatus extends TenantAwareBaseEntity {
|
||||
|
||||
/**
|
||||
* @return the {@link Status} of this {@link ActionStatus}. Caused potentially a transition change of the {@link #getAction()} if
|
||||
* different from the previous {@link #getStatus()} call.
|
||||
* different from the previous getStatus call.
|
||||
*/
|
||||
Status getStatus();
|
||||
|
||||
|
||||
@@ -9,12 +9,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import org.eclipse.hawkbit.repository.artifact.model.AbstractDbArtifact;
|
||||
|
||||
/**
|
||||
* Binaries for a {@link SoftwareModule} Note: the decision which artifacts have
|
||||
* to be downloaded are done on the device side. e.g. Full Package, Signatures,
|
||||
* binary deltas
|
||||
* Binaries for a {@link SoftwareModule} Note: the decision which artifacts have to be downloaded are done on the device side. e.g.
|
||||
* Full Package, Signatures, binary deltas
|
||||
*/
|
||||
public interface Artifact extends TenantAwareBaseEntity {
|
||||
|
||||
@@ -34,8 +31,7 @@ public interface Artifact extends TenantAwareBaseEntity {
|
||||
String getMd5Hash();
|
||||
|
||||
/**
|
||||
* @return SHA-1 hash of the artifact in Base16 format that identifies the
|
||||
* {@link AbstractDbArtifact} in the system.
|
||||
* @return SHA-1 hash of the artifact in Base16 format.
|
||||
*/
|
||||
String getSha1Hash();
|
||||
|
||||
|
||||
@@ -14,75 +14,16 @@ import java.io.InputStream;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
import org.eclipse.hawkbit.artifact.model.ArtifactHashes;
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* Use to create a new artifact.
|
||||
*/
|
||||
@Data
|
||||
public class ArtifactUpload {
|
||||
|
||||
@NotNull
|
||||
private final InputStream inputStream;
|
||||
|
||||
private final long moduleId;
|
||||
|
||||
@NotEmpty
|
||||
@ValidString
|
||||
private final String filename;
|
||||
|
||||
private final String providedMd5Sum;
|
||||
|
||||
private final String providedSha1Sum;
|
||||
|
||||
private final String providedSha256Sum;
|
||||
|
||||
private final boolean overrideExisting;
|
||||
|
||||
private final String contentType;
|
||||
|
||||
private final long filesize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param inputStream to read from for artifact binary
|
||||
* @param moduleId to assign the new artifact to
|
||||
* @param filename of the artifact
|
||||
* @param overrideExisting to <code>true</code> if the artifact binary can be overridden
|
||||
* if it already exists
|
||||
* @param filesize the size of the file in bytes.
|
||||
*/
|
||||
public ArtifactUpload(final InputStream inputStream, final long moduleId, final String filename,
|
||||
final boolean overrideExisting, final long filesize) {
|
||||
this(inputStream, moduleId, filename, null, null, null, overrideExisting, null, filesize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param inputStream to read from for artifact binary
|
||||
* @param moduleId to assign the new artifact to
|
||||
* @param filename of the artifact
|
||||
* @param providedSha1Sum optional sha1 checksum to check the new file against
|
||||
* @param providedMd5Sum optional md5 checksum to check the new file against
|
||||
* @param overrideExisting to <code>true</code> if the artifact binary can be overridden if it already exists
|
||||
* @param contentType the contentType of the file
|
||||
* @param filesize the size of the file in bytes.
|
||||
*/
|
||||
@SuppressWarnings("java:S107")
|
||||
public ArtifactUpload(final InputStream inputStream, final long moduleId, final String filename,
|
||||
final String providedMd5Sum, final String providedSha1Sum, final String providedSha256Sum,
|
||||
final boolean overrideExisting, final String contentType, final long filesize) {
|
||||
this.inputStream = inputStream;
|
||||
this.moduleId = moduleId;
|
||||
this.filename = filename;
|
||||
this.providedMd5Sum = providedMd5Sum;
|
||||
this.providedSha1Sum = providedSha1Sum;
|
||||
this.providedSha256Sum = providedSha256Sum;
|
||||
this.overrideExisting = overrideExisting;
|
||||
this.contentType = contentType;
|
||||
this.filesize = filesize;
|
||||
}
|
||||
}
|
||||
public record ArtifactUpload(
|
||||
@NotNull InputStream inputStream,
|
||||
String contentType, long filesize,
|
||||
ArtifactHashes hash,
|
||||
long moduleId,
|
||||
@NotEmpty @ValidString String filename,
|
||||
boolean overrideExisting) {}
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
|
||||
/**
|
||||
* Use to display software modules for the selected distribution.
|
||||
*/
|
||||
@Data
|
||||
public class AssignedSoftwareModule implements Serializable, Identifiable<Long> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final SoftwareModule softwareModule;
|
||||
|
||||
private final boolean assigned;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param softwareModule entity.
|
||||
* @param assigned as true if the software module is assigned and false if not
|
||||
* assigned.
|
||||
*/
|
||||
public AssignedSoftwareModule(final SoftwareModule softwareModule, final boolean assigned) {
|
||||
this.softwareModule = softwareModule;
|
||||
this.assigned = assigned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return softwareModule.getId();
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,8 @@ public interface AutoConfirmationStatus extends BaseEntity {
|
||||
Target getTarget();
|
||||
|
||||
/**
|
||||
* The user who initiated the auto confirmation. Will be set on auto
|
||||
* confirmation activation and could be null. In this case the created_by can be
|
||||
* considered as initiator.
|
||||
* The user who initiated the auto confirmation. Will be set on auto confirmation activation and could be null. In this case the created_by
|
||||
* can be considered as initiator.
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
@@ -47,9 +46,7 @@ public interface AutoConfirmationStatus extends BaseEntity {
|
||||
/**
|
||||
* Construct the action message based on the current status.
|
||||
*
|
||||
* @return the constructed message which can be used for the action status as a
|
||||
* message
|
||||
* @return the constructed message which can be used for the action status as a message
|
||||
*/
|
||||
String constructActionMessage();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,7 @@ public interface BaseEntity extends Serializable, Identifiable<Long> {
|
||||
String getLastModifiedBy();
|
||||
|
||||
/**
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity}
|
||||
* was last time changed.
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity} was last time changed.
|
||||
*/
|
||||
long getLastModifiedAt();
|
||||
|
||||
|
||||
@@ -28,43 +28,34 @@ public class DeploymentRequest {
|
||||
private final TargetWithActionType targetWithActionType;
|
||||
|
||||
/**
|
||||
* Constructor that also accepts maintenance schedule parameters and checks for
|
||||
* validity of the specified maintenance schedule.
|
||||
* Constructor that also accepts maintenance schedule parameters and checks for validity of the specified maintenance schedule.
|
||||
*
|
||||
* @param controllerId for which the action is created.
|
||||
* @param distributionSetId of the distribution set that that should be assigned to the
|
||||
* controller.
|
||||
* @param distributionSetId of the distribution set that that should be assigned to the controller.
|
||||
* @param actionType specified for the action.
|
||||
* @param forceTime at what time the type soft turns into forced.
|
||||
* @param weight the priority of an {@link Action}.
|
||||
* @param maintenanceSchedule is the cron expression to be used for scheduling maintenance
|
||||
* windows. Expression has 6 mandatory fields and 1 last optional
|
||||
* field: "second minute hour dayofmonth month weekday year"
|
||||
* @param maintenanceWindowDuration in HH:mm:ss format specifying the duration of a maintenance
|
||||
* window, for example 00:30:00 for 30 minutes
|
||||
* @param maintenanceWindowTimeZone is the time zone specified as +/-hh:mm offset from UTC, for
|
||||
* example +02:00 for CET summer time and +00:00 for UTC. The start
|
||||
* time of a maintenance window calculated based on the cron
|
||||
* expression is relative to this time zone.
|
||||
* @param confirmationRequired is a flag whether the confirmation should be required for the
|
||||
* resulting {@link Action} or not. In case the confirmation is not
|
||||
* required, the action will be automatically confirmed and put in
|
||||
* the
|
||||
* {@link org.eclipse.hawkbit.repository.model.Action.Status#RUNNING}
|
||||
* state. Otherwise the confirmation flow will be triggered
|
||||
* and the {@link Action} will stay in the
|
||||
* {@link org.eclipse.hawkbit.repository.model.Action.Status#WAIT_FOR_CONFIRMATION}
|
||||
* state until the confirmation is given. (Only considered
|
||||
* with CONFIRMATION_FLOW active via tenant configuration)
|
||||
* @param maintenanceSchedule is the cron expression to be used for scheduling maintenance windows. Expression has 6 mandatory
|
||||
* fields and 1 last optional field: "second minute hour dayofmonth month weekday year"
|
||||
* @param maintenanceWindowDuration in HH:mm:ss format specifying the duration of a maintenance window, for example 00:30:00 for 30 minutes
|
||||
* @param maintenanceWindowTimeZone is the time zone specified as +/-hh:mm offset from UTC, for example +02:00 for CET summer time
|
||||
* and +00:00 for UTC. The start time of a maintenance window calculated based on the cron expression is relative to this time zone.
|
||||
* @param confirmationRequired is a flag whether the confirmation should be required for the resulting {@link Action} or not. In case the
|
||||
* confirmation is not required, the action will be automatically confirmed and put in the
|
||||
* {@link org.eclipse.hawkbit.repository.model.Action.Status#RUNNING} state. Otherwise, the confirmation flow will be triggered
|
||||
* and the {@link Action} will stay in the {@link org.eclipse.hawkbit.repository.model.Action.Status#WAIT_FOR_CONFIRMATION}
|
||||
* state until the confirmation is given. (Only considered with CONFIRMATION_FLOW active via tenant configuration)
|
||||
* @throws InvalidMaintenanceScheduleException if the parameters do not define a valid maintenance schedule.
|
||||
*/
|
||||
@SuppressWarnings("java:S107")
|
||||
public DeploymentRequest(final String controllerId, final Long distributionSetId, final ActionType actionType,
|
||||
final long forceTime, final Integer weight, final String maintenanceSchedule,
|
||||
final String maintenanceWindowDuration, final String maintenanceWindowTimeZone,
|
||||
public DeploymentRequest(
|
||||
final String controllerId, final Long distributionSetId, final ActionType actionType, final long forceTime, final Integer weight,
|
||||
final String maintenanceSchedule, final String maintenanceWindowDuration, final String maintenanceWindowTimeZone,
|
||||
final boolean confirmationRequired) {
|
||||
this.targetWithActionType = new TargetWithActionType(controllerId, actionType, forceTime, weight,
|
||||
maintenanceSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone, confirmationRequired);
|
||||
this.targetWithActionType = new TargetWithActionType(
|
||||
controllerId, actionType, forceTime, weight,
|
||||
maintenanceSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone,
|
||||
confirmationRequired);
|
||||
this.distributionSetId = distributionSetId;
|
||||
}
|
||||
|
||||
@@ -72,13 +63,6 @@ public class DeploymentRequest {
|
||||
return targetWithActionType.getControllerId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a {@link DeploymentRequest} for a target distribution set assignment
|
||||
*
|
||||
* @param controllerId ID of target
|
||||
* @param distributionSetId ID of distribution set
|
||||
* @return the builder
|
||||
*/
|
||||
public static DeploymentRequestBuilder builder(final String controllerId, final long distributionSetId) {
|
||||
return new DeploymentRequestBuilder(controllerId, distributionSetId);
|
||||
}
|
||||
@@ -115,15 +99,11 @@ public class DeploymentRequest {
|
||||
/**
|
||||
* Set a maintenanceWindow
|
||||
*
|
||||
* @param maintenanceSchedule is the cron expression to be used for scheduling maintenance
|
||||
* windows. Expression has 6 mandatory fields and 1 last optional
|
||||
* field: "second minute hour dayofmonth month weekday year"
|
||||
* @param maintenanceWindowDuration in HH:mm:ss format specifying the duration of a maintenance
|
||||
* window, for example 00:30:00 for 30 minutes
|
||||
* @param maintenanceWindowTimeZone is the time zone specified as +/-hh:mm offset from UTC, for
|
||||
* example +02:00 for CET summer time and +00:00 for UTC. The
|
||||
* start time of a maintenance window calculated based on the
|
||||
* cron expression is relative to this time zone.
|
||||
* @param maintenanceSchedule is the cron expression to be used for scheduling maintenance windows. Expression has 6 mandatory fields
|
||||
* and 1 last optional field: "second minute hour dayofmonth month weekday year"
|
||||
* @param maintenanceWindowDuration in HH:mm:ss format specifying the duration of a maintenance window, for example 00:30:00 for 30 minutes
|
||||
* @param maintenanceWindowTimeZone is the time zone specified as +/-hh:mm offset from UTC, for example +02:00 for CET summer time
|
||||
* and +00:00 for UTC. The start time of a maintenance window calculated based on the cron expression is relative to this time zone.
|
||||
* @return builder
|
||||
*/
|
||||
public DeploymentRequestBuilder maintenance(
|
||||
|
||||
@@ -12,13 +12,10 @@ package org.eclipse.hawkbit.repository.model;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A {@link DistributionSet} defines a meta package that combines a set of
|
||||
* {@link SoftwareModule}s which have to be or are provisioned to a
|
||||
* A {@link DistributionSet} defines a meta package that combines a set of {@link SoftwareModule}s which have to be or are provisioned to a
|
||||
* {@link Target}.
|
||||
*
|
||||
* <p>
|
||||
* A {@link Target} has exactly one target {@link DistributionSet} assigned.
|
||||
* </p>
|
||||
*/
|
||||
public interface DistributionSet extends NamedVersionedEntity {
|
||||
|
||||
@@ -43,34 +40,30 @@ public interface DistributionSet extends NamedVersionedEntity {
|
||||
Set<SoftwareModule> getModules();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if all defined
|
||||
* {@link DistributionSetType#getMandatoryModuleTypes()} of
|
||||
* {@link #getType()} are present in this {@link DistributionSet}.
|
||||
* @return <code>true</code> if all defined {@link DistributionSetType#getMandatoryModuleTypes()} of {@link #getType()} are present in
|
||||
* this {@link DistributionSet}.
|
||||
*/
|
||||
boolean isComplete();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this {@link DistributionSet} is locked. If so it's 'functional'
|
||||
* properties (e.g. software modules) could not be modified anymore.
|
||||
* @return <code>true</code> if this {@link DistributionSet} is locked. If so it's 'functional' properties (e.g. software modules) could not
|
||||
* be modified anymore.
|
||||
*/
|
||||
boolean isLocked();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this {@link DistributionSet} is deleted and only kept for history
|
||||
* purposes.
|
||||
* @return <code>true</code> if this {@link DistributionSet} is deleted and only kept for history purposes.
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* @return <code>false</code> if this {@link DistributionSet} is
|
||||
* invalidated.
|
||||
* @return <code>false</code> if this {@link DistributionSet} is invalidated.
|
||||
*/
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if {@link DistributionSet} contains a mandatory
|
||||
* migration step, i.e. unfinished {@link Action}s will kept active
|
||||
* and not automatically canceled if overridden by a newer update.
|
||||
* @return <code>true</code> if {@link DistributionSet} contains a mandatory migration step, i.e. unfinished {@link Action}s will be kept
|
||||
* active and not automatically canceled if overridden by a newer update.
|
||||
*/
|
||||
boolean isRequiredMigrationStep();
|
||||
}
|
||||
@@ -9,24 +9,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* object that holds information about the count of affected rollouts,
|
||||
* auto-assignments and actions, when a list of distribution sets gets
|
||||
* Object that holds information about the count of affected rollouts, auto-assignments and actions, when a list of distribution sets gets
|
||||
* invalidated
|
||||
*/
|
||||
@Data
|
||||
public class DistributionSetInvalidationCount {
|
||||
|
||||
private final long rolloutsCount;
|
||||
private final long autoAssignmentCount;
|
||||
private final long actionCount;
|
||||
|
||||
public DistributionSetInvalidationCount(final long rolloutsCount, final long autoAssignmentCount,
|
||||
final long actionCount) {
|
||||
this.rolloutsCount = rolloutsCount;
|
||||
this.autoAssignmentCount = autoAssignmentCount;
|
||||
this.actionCount = actionCount;
|
||||
}
|
||||
}
|
||||
public record DistributionSetInvalidationCount(long rolloutsCount, long autoAssignmentCount, long actionCount) {}
|
||||
@@ -12,6 +12,4 @@ package org.eclipse.hawkbit.repository.model;
|
||||
/**
|
||||
* {@link Tag} of a {@link DistributionSet}.
|
||||
*/
|
||||
public interface DistributionSetTag extends Tag {
|
||||
|
||||
}
|
||||
public interface DistributionSetTag extends Tag {}
|
||||
|
||||
@@ -11,28 +11,11 @@ package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* The poll time object which holds all the necessary information around the target poll time, e.g. the last poll time, the next poll time and
|
||||
* the overdue poll time.
|
||||
*/
|
||||
@Data
|
||||
public class PollStatus {
|
||||
|
||||
private final LocalDateTime lastPollDate;
|
||||
private final LocalDateTime nextPollDate;
|
||||
private final LocalDateTime overdueDate;
|
||||
private final LocalDateTime currentDate;
|
||||
|
||||
public PollStatus(
|
||||
final LocalDateTime lastPollDate, final LocalDateTime nextPollDate,
|
||||
final LocalDateTime overdueDate, final LocalDateTime currentDate) {
|
||||
this.lastPollDate = lastPollDate;
|
||||
this.nextPollDate = nextPollDate;
|
||||
this.overdueDate = overdueDate;
|
||||
this.currentDate = currentDate;
|
||||
}
|
||||
public record PollStatus(LocalDateTime lastPollDate, LocalDateTime nextPollDate, LocalDateTime overdueDate, LocalDateTime currentDate) {
|
||||
|
||||
/**
|
||||
* Calculates if the target poll time is overdue and the target has not been polled in the configured poll time interval.
|
||||
|
||||
@@ -9,18 +9,16 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Repository model constants.
|
||||
*/
|
||||
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
|
||||
public final class RepositoryModelConstants {
|
||||
|
||||
/**
|
||||
* indicating that target action has no force time which is only needed in
|
||||
* case of {@link Action.ActionType#TIMEFORCED}.
|
||||
* Indicating that target action has no force time which is only needed in case of {@link Action.ActionType#TIMEFORCED}.
|
||||
*/
|
||||
public static final Long NO_FORCE_TIME = 0L;
|
||||
|
||||
private RepositoryModelConstants() {
|
||||
// Utility class.
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,11 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
|
||||
|
||||
/**
|
||||
* Software update operations in large scale IoT scenarios with hundred of
|
||||
* thousands of devices require special handling.
|
||||
*
|
||||
* That includes secure handling of large volumes of devices at rollout creation
|
||||
* time. Monitoring of the rollout progress. Emergency rollout shutdown in case
|
||||
* of problems on to many devices and reporting capabilities for a complete
|
||||
* understanding of the rollout progress at each point in time.
|
||||
* Software update operations in large scale IoT scenarios with hundred of thousands of devices require special handling.
|
||||
* <p/>
|
||||
* That includes secure handling of large volumes of devices at rollout creation time. Monitoring of the rollout progress. Emergency rollout
|
||||
* shutdown in case of problems on to many devices and reporting capabilities for a complete understanding of the rollout progress at each point
|
||||
* in time.
|
||||
*/
|
||||
public interface Rollout extends NamedEntity {
|
||||
|
||||
@@ -48,8 +46,7 @@ public interface Rollout extends NamedEntity {
|
||||
DistributionSet getDistributionSet();
|
||||
|
||||
/**
|
||||
* @return rsql query that identifies the targets that are part of this
|
||||
* rollout.
|
||||
* @return rsql query that identifies the targets that are part of this rollout.
|
||||
*/
|
||||
String getTargetFilterQuery();
|
||||
|
||||
@@ -64,15 +61,13 @@ public interface Rollout extends NamedEntity {
|
||||
ActionType getActionType();
|
||||
|
||||
/**
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} after which
|
||||
* {@link #isForced()} switches to <code>true</code> in case of
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} after which 'is forced' switches to <code>true</code> in case of
|
||||
* {@link ActionType#TIMEFORCED}.
|
||||
*/
|
||||
long getForcedTime();
|
||||
|
||||
/**
|
||||
* @return Timestamp when the rollout should be started automatically. Can
|
||||
* be null.
|
||||
* @return Timestamp when the rollout should be started automatically. Can be null.
|
||||
*/
|
||||
Long getStartAt();
|
||||
|
||||
@@ -123,7 +118,7 @@ public interface Rollout extends NamedEntity {
|
||||
enum RolloutStatus {
|
||||
|
||||
/**
|
||||
* Rollouts is being created.
|
||||
* Rollout is being created.
|
||||
*/
|
||||
CREATING,
|
||||
|
||||
@@ -178,9 +173,8 @@ public interface Rollout extends NamedEntity {
|
||||
DELETING,
|
||||
|
||||
/**
|
||||
* Rollout has been deleted. This state is only set in case of a
|
||||
* soft-deletion of the rollout which keeps references, in case of an
|
||||
* hard-deletion of a rollout the rollout-entry itself is deleted.
|
||||
* Rollout has been deleted. This state is only set in case of a soft-deletion of the rollout which keeps references, in case of
|
||||
* a hard-deletion of a rollout the rollout-entry itself is deleted.
|
||||
*/
|
||||
DELETED
|
||||
}
|
||||
@@ -189,8 +183,9 @@ public interface Rollout extends NamedEntity {
|
||||
* Enum that holds all possible approval workflow decisions.
|
||||
*/
|
||||
enum ApprovalDecision {
|
||||
|
||||
/**
|
||||
* Representing an granted approval for a rollout.
|
||||
* Representing a granted approval for a rollout.
|
||||
*/
|
||||
APPROVED,
|
||||
/**
|
||||
@@ -198,4 +193,4 @@ public interface Rollout extends NamedEntity {
|
||||
*/
|
||||
DENIED
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,8 @@
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
/**
|
||||
* The core functionality of a {@link Rollout} is the cascading processing of
|
||||
* (sub) deployment groups. The group defines under which conditions the
|
||||
* following group is processed.
|
||||
* The core functionality of a {@link Rollout} is the cascading processing of (sub) deployment groups. The group defines under which conditions
|
||||
* the following group is processed.
|
||||
*/
|
||||
public interface RolloutGroup extends NamedEntity {
|
||||
|
||||
@@ -27,8 +26,7 @@ public interface RolloutGroup extends NamedEntity {
|
||||
RolloutGroupStatus getStatus();
|
||||
|
||||
/**
|
||||
* @return the parent group of this group, in case the group is the root
|
||||
* group it does not have a parent and so return {@code null}
|
||||
* @return the parent group of this group, in case the group is the root group it does not have a parent and so return {@code null}
|
||||
*/
|
||||
RolloutGroup getParent();
|
||||
|
||||
@@ -38,56 +36,46 @@ public interface RolloutGroup extends NamedEntity {
|
||||
boolean isDynamic();
|
||||
|
||||
/**
|
||||
* @return the {@link RolloutGroupSuccessCondition} for this group to
|
||||
* indicate when a group is successful
|
||||
* @return the {@link RolloutGroupSuccessCondition} for this group to indicate when a group is successful
|
||||
*/
|
||||
RolloutGroupSuccessCondition getSuccessCondition();
|
||||
|
||||
/**
|
||||
* @return a String representation of the expression to be evaluated by the
|
||||
* {@link RolloutGroupSuccessCondition} to indicate if the condition
|
||||
* is true, might be {@code null} if no expression must be set for
|
||||
* the {@link RolloutGroupSuccessCondition}
|
||||
* @return a String representation of the expression to be evaluated by the {@link RolloutGroupSuccessCondition} to indicate if the
|
||||
* condition is true, might be {@code null} if no expression must be set for the {@link RolloutGroupSuccessCondition}
|
||||
*/
|
||||
String getSuccessConditionExp();
|
||||
|
||||
/**
|
||||
* @return the {@link RolloutGroupErrorCondition} for this group to indicate
|
||||
* when a group should marked as failed
|
||||
* @return the {@link RolloutGroupErrorCondition} for this group to indicate when a group should be marked as failed
|
||||
*/
|
||||
RolloutGroupErrorCondition getErrorCondition();
|
||||
|
||||
/**
|
||||
* @return a String representation of the expression to be evaluated by the
|
||||
* {@link RolloutGroupErrorCondition} to indicate if the condition
|
||||
* is true, might be {@code null} if no expression must be set for
|
||||
* the {@link RolloutGroupErrorCondition}
|
||||
* @return a String representation of the expression to be evaluated by the {@link RolloutGroupErrorCondition} to indicate if the condition
|
||||
* is true, might be {@code null} if no expression must be set for the {@link RolloutGroupErrorCondition}
|
||||
*/
|
||||
String getErrorConditionExp();
|
||||
|
||||
/**
|
||||
* @return a {@link RolloutGroupErrorAction} which is executed when the
|
||||
* given {@link RolloutGroupErrorCondition} is met, might be
|
||||
* @return a {@link RolloutGroupErrorAction} which is executed when the given {@link RolloutGroupErrorCondition} is met, might be
|
||||
* {@code null} if no error action is set
|
||||
*/
|
||||
RolloutGroupErrorAction getErrorAction();
|
||||
|
||||
/**
|
||||
* @return a String representation of the expression to be evaluated by the
|
||||
* {@link RolloutGroupErrorAction} might be {@code null} if no
|
||||
* @return a String representation of the expression to be evaluated by the {@link RolloutGroupErrorAction} might be {@code null} if no
|
||||
* expression must be set for the {@link RolloutGroupErrorAction}
|
||||
*/
|
||||
String getErrorActionExp();
|
||||
|
||||
/**
|
||||
* @return the {@link RolloutGroupSuccessAction} which is executed if the
|
||||
* {@link RolloutGroupSuccessCondition} is met
|
||||
* @return the {@link RolloutGroupSuccessAction} which is executed if the {@link RolloutGroupSuccessCondition} is met
|
||||
*/
|
||||
RolloutGroupSuccessAction getSuccessAction();
|
||||
|
||||
/**
|
||||
* @return a String representation of the expression to be evaluated by the
|
||||
* {@link RolloutGroupSuccessAction} might be {@code null} if no
|
||||
* @return a String representation of the expression to be evaluated by the {@link RolloutGroupSuccessAction} might be {@code null} if no
|
||||
* expression must be set for the {@link RolloutGroupSuccessAction}
|
||||
*/
|
||||
String getSuccessActionExp();
|
||||
@@ -103,20 +91,17 @@ public interface RolloutGroup extends NamedEntity {
|
||||
TotalTargetCountStatus getTotalTargetCountStatus();
|
||||
|
||||
/**
|
||||
* @return the target filter query, that is used to assign Targets to this
|
||||
* Group
|
||||
* @return the target filter query, that is used to assign Targets to this Group
|
||||
*/
|
||||
String getTargetFilterQuery();
|
||||
|
||||
/**
|
||||
* @return the percentage of matching Targets that should be assigned to
|
||||
* this Group
|
||||
* @return the percentage of matching Targets that should be assigned to this Group
|
||||
*/
|
||||
float getTargetPercentage();
|
||||
|
||||
/**
|
||||
* @return if a confirmation is required for the resulting actions (considered
|
||||
* with confirmation flow active only)
|
||||
* @return if a confirmation is required for the resulting actions (considered with confirmation flow active only)
|
||||
*/
|
||||
boolean isConfirmationRequired();
|
||||
|
||||
@@ -158,14 +143,14 @@ public interface RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
* The condition to evaluate if an group is success state.
|
||||
* The condition to evaluate if a group is success state.
|
||||
*/
|
||||
enum RolloutGroupSuccessCondition {
|
||||
THRESHOLD
|
||||
}
|
||||
|
||||
/**
|
||||
* The condition to evaluate if an group is in error state.
|
||||
* The condition to evaluate if a group is in error state.
|
||||
*/
|
||||
enum RolloutGroupErrorCondition {
|
||||
THRESHOLD
|
||||
@@ -186,4 +171,4 @@ public interface RolloutGroup extends NamedEntity {
|
||||
enum RolloutGroupSuccessAction {
|
||||
NEXTGROUP
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,38 +11,13 @@ package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Represents information to validate the correct distribution of targets to
|
||||
* rollout groups.
|
||||
* Represents information to validate the correct distribution of targets into rollout groups.
|
||||
*
|
||||
* @param totalTargets The total amount of targets in a {@link Rollout}
|
||||
* @param targetsPerGroup A list containing the count of targets for each {@link RolloutGroup}
|
||||
*/
|
||||
@Data
|
||||
public class RolloutGroupsValidation {
|
||||
|
||||
/**
|
||||
* The total amount of targets in a {@link Rollout}
|
||||
*/
|
||||
private final long totalTargets;
|
||||
|
||||
/**
|
||||
* A list containing the count of targets for each {@link RolloutGroup}
|
||||
*/
|
||||
private final List<Long> targetsPerGroup;
|
||||
|
||||
/**
|
||||
* Instantiates a new validation result
|
||||
*
|
||||
* @param totalTargets The total amount of targets in a {@link Rollout}
|
||||
* @param targetsPerGroup A list containing the count of targets for each
|
||||
* {@link RolloutGroup}
|
||||
*/
|
||||
public RolloutGroupsValidation(final long totalTargets, @NotNull final List<Long> targetsPerGroup) {
|
||||
this.totalTargets = totalTargets;
|
||||
this.targetsPerGroup = targetsPerGroup;
|
||||
}
|
||||
public record RolloutGroupsValidation(long totalTargets, List<Long> targetsPerGroup) {
|
||||
|
||||
/**
|
||||
* @return the count of targets that are in groups
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
/**
|
||||
* {@link SoftwareModuleType} is an abstract definition used in
|
||||
* {@link DistributionSetType}s and includes additional {@link SoftwareModule}
|
||||
* {@link SoftwareModuleType} is an abstract definition used in {@link DistributionSetType}s and includes additional {@link SoftwareModule}
|
||||
* specific information.
|
||||
*/
|
||||
public interface SoftwareModuleType extends Type {
|
||||
|
||||
/**
|
||||
* @return maximum assignments of an {@link SoftwareModule} of this type to
|
||||
* a {@link DistributionSet}.
|
||||
* @return maximum assignments of an {@link SoftwareModule} of this type to a {@link DistributionSet}.
|
||||
*/
|
||||
int getMaxAssignments();
|
||||
}
|
||||
|
||||
@@ -21,4 +21,4 @@ public interface Statistic {
|
||||
* @return the value of the Statistic entity.
|
||||
*/
|
||||
Object getData();
|
||||
}
|
||||
}
|
||||
@@ -23,5 +23,4 @@ public interface Tag extends NamedEntity {
|
||||
* @return colour code of the tag used in Management UI.
|
||||
*/
|
||||
String getColour();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -66,13 +66,6 @@ public interface Target extends NamedEntity, Identifiable<Long> {
|
||||
*/
|
||||
String getSecurityToken();
|
||||
|
||||
/**
|
||||
* @return {@link TargetWithActionType} with default settings
|
||||
*/
|
||||
default TargetWithActionType getTargetWithActionType() {
|
||||
return new TargetWithActionType(getControllerId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the address under which the target can be reached
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
|
||||
/**
|
||||
* Managed filter entity.
|
||||
*
|
||||
* <p/>
|
||||
* Supported operators.
|
||||
* <ul>
|
||||
* <li>{@code Equal to : ==}</li>
|
||||
@@ -93,4 +93,4 @@ public interface TargetFilterQuery extends TenantAwareBaseEntity {
|
||||
* performing the auto-assignment by the scheduler
|
||||
*/
|
||||
Optional<String> getAccessControlContext();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,4 @@ package org.eclipse.hawkbit.repository.model;
|
||||
/**
|
||||
* Target tag element.
|
||||
*/
|
||||
public interface TargetTag extends Tag {
|
||||
|
||||
}
|
||||
public interface TargetTag extends Tag {}
|
||||
@@ -12,13 +12,12 @@ package org.eclipse.hawkbit.repository.model;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A {@link TargetType} is an abstract definition for
|
||||
* {@link Target}
|
||||
* A {@link TargetType} is an abstract definition for {@link Target}
|
||||
*/
|
||||
public interface TargetType extends Type {
|
||||
|
||||
/**
|
||||
* Target type doesn't support soft-delete so all target type instandces re not deleted.
|
||||
* Target type doesn't support soft-delete so all target type instances are not deleted.
|
||||
*
|
||||
* @return <code>false</code>
|
||||
*/
|
||||
@@ -38,7 +37,6 @@ public interface TargetType extends Type {
|
||||
* Unassigns a {@link DistributionSetType} from {@link TargetType}
|
||||
*
|
||||
* @param dsTypeId that will be removed from {@link TargetType}
|
||||
* @return the resulting target type
|
||||
*/
|
||||
void removeDistributionSetType(final Long dsTypeId);
|
||||
}
|
||||
}
|
||||
@@ -41,4 +41,4 @@ public enum TargetUpdateStatus {
|
||||
* Controller registered at SP but no {@link DistributionSet} assigned.
|
||||
*/
|
||||
REGISTERED
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user