diff --git a/hawkbit-autoconfigure/pom.xml b/hawkbit-autoconfigure/pom.xml index f1e010f8b..4e6b328b7 100644 --- a/hawkbit-autoconfigure/pom.xml +++ b/hawkbit-autoconfigure/pom.xml @@ -17,6 +17,7 @@ hawkbit-parent ${revision} + hawkbit-autoconfigure hawkBit :: Core :: Spring Boot Auto-configurations diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/cache/CacheProperties.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/cache/CacheProperties.java index 5227a353f..e759e93c0 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/cache/CacheProperties.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/cache/CacheProperties.java @@ -11,6 +11,7 @@ package org.eclipse.hawkbit.autoconfigure.cache; import java.util.concurrent.TimeUnit; +import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -18,6 +19,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * is used for the lifetime limit of data in caches. After lifetime the data * gets reloaded out of the database. */ +@Data @ConfigurationProperties("hawkbit.cache.global") public class CacheProperties { @@ -31,23 +33,7 @@ public class CacheProperties { */ private int initialDelay; - public long getInitialDelay() { - return initialDelay; - } - - public void setInitialDelay(final int initialDelay) { - this.initialDelay = initialDelay; - } - - public int getTtl() { - return ttl; - } - - public void setTtl(final int ttl) { - this.ttl = ttl; - } - public final TimeUnit getTtlUnit() { return TimeUnit.MILLISECONDS; } -} +} \ No newline at end of file diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/JpaRepositoryAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/JpaRepositoryAutoConfiguration.java index fad0efbef..5dd99f45e 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/JpaRepositoryAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/JpaRepositoryAutoConfiguration.java @@ -42,4 +42,4 @@ public class JpaRepositoryAutoConfiguration { public LockRegistry lockRegistry() { return new DefaultLockRegistry(); } -} +} \ No newline at end of file diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java index 0f42ca608..3a01ac192 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java @@ -38,7 +38,7 @@ import org.springframework.core.ResolvableType; import org.springframework.messaging.converter.MessageConverter; /** - * Auto configuration for the event bus. + * Autoconfiguration for the event bus. */ @Configuration @RemoteApplicationEventScan(basePackages = "org.eclipse.hawkbit.repository.event.remote") @@ -47,14 +47,12 @@ import org.springframework.messaging.converter.MessageConverter; public class EventPublisherAutoConfiguration { /** - * Server internal event publisher that allows parallel event processing if - * the event listener is marked as so. + * Server internal event publisher that allows parallel event processing if the event listener is marked as so. * * @return publisher bean */ @Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME) - ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor, - final TenantAware tenantAware) { + ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor, final TenantAware tenantAware) { final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher( tenantAware, applicationEventFilter()); simpleApplicationEventMulticaster.setTaskExecutor(executor); @@ -85,26 +83,18 @@ public class EventPublisherAutoConfiguration { private static class TenantAwareApplicationEventPublisher extends SimpleApplicationEventMulticaster { private final TenantAware tenantAware; - private final ApplicationEventFilter applicationEventFilter; @Autowired(required = false) private ServiceMatcher serviceMatcher; - /** - * Constructor. - * - * @param tenantAware the tenant ware - */ - protected TenantAwareApplicationEventPublisher(final TenantAware tenantAware, - final ApplicationEventFilter applicationEventFilter) { + protected TenantAwareApplicationEventPublisher(final TenantAware tenantAware, final ApplicationEventFilter applicationEventFilter) { this.tenantAware = tenantAware; this.applicationEventFilter = applicationEventFilter; } /** - * Was overridden that not every event has to run within a own - * tenantAware. + * Was overridden that not every event has to run within an own tenantAware. */ @Override public void multicastEvent(final ApplicationEvent event, final ResolvableType eventType) { @@ -112,11 +102,10 @@ public class EventPublisherAutoConfiguration { return; } - if (serviceMatcher == null || !(event instanceof RemoteTenantAwareEvent)) { + if (serviceMatcher == null || !(event instanceof final RemoteTenantAwareEvent remoteEvent)) { super.multicastEvent(event, eventType); return; } - final RemoteTenantAwareEvent remoteEvent = (RemoteTenantAwareEvent) event; if (serviceMatcher.isFromSelf(remoteEvent)) { super.multicastEvent(event, eventType); @@ -128,7 +117,6 @@ public class EventPublisherAutoConfiguration { return null; }); } - } @ConditionalOnBusEnabled @@ -142,7 +130,5 @@ public class EventPublisherAutoConfiguration { public MessageConverter busProtoBufConverter() { return new BusProtoStuffMessageConverter(); } - } - -} +} \ No newline at end of file diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerThreadPoolProperties.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerThreadPoolProperties.java index 02e5e2e73..24777fe60 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerThreadPoolProperties.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerThreadPoolProperties.java @@ -44,4 +44,4 @@ public class AsyncConfigurerThreadPoolProperties { * time that excess idle threads will wait for new tasks before terminating. */ private Long idleTimeout = 10000L; -} +} \ No newline at end of file diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityAutoConfiguration.java index bdf6cfc07..5a49cf65b 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityAutoConfiguration.java @@ -57,8 +57,8 @@ import org.springframework.util.CollectionUtils; public class SecurityAutoConfiguration { /** - * Creates a {@link ContextAware} (hence {@link TenantAware}) bean based on the given - * {@link UserAuthoritiesResolver} and {@link SecurityContextSerializer}. + * Creates a {@link ContextAware} (hence {@link TenantAware}) bean based on the given {@link UserAuthoritiesResolver} and + * {@link SecurityContextSerializer}. * * @param authoritiesResolver The user authorities/roles resolver * @param securityContextSerializer The security context serializer. @@ -73,8 +73,7 @@ public class SecurityAutoConfiguration { } /** - * Creates a {@link UserAuthoritiesResolver} bean that is responsible for - * resolving user authorities/roles. + * Creates a {@link UserAuthoritiesResolver} bean that is responsible for resolving user authorities/roles. * * @param securityProperties The Spring {@link SecurityProperties} for the security user * @param tenantAwareUserProperties The {@link TenantAwareUserProperties} for the managed users @@ -82,7 +81,8 @@ public class SecurityAutoConfiguration { */ @Bean @ConditionalOnMissingBean - public UserAuthoritiesResolver inMemoryAuthoritiesResolver(final SecurityProperties securityProperties, + public UserAuthoritiesResolver inMemoryAuthoritiesResolver( + final SecurityProperties securityProperties, final TenantAwareUserProperties tenantAwareUserProperties) { final Map tenantAwareUsers = tenantAwareUserProperties.getUser(); final Map> usersToPermissions; @@ -113,8 +113,7 @@ public class SecurityAutoConfiguration { */ @Bean @ConditionalOnMissingBean - public SystemSecurityContext systemSecurityContext( - final TenantAware tenantAware, final RoleHierarchy roleHierarchy) { + public SystemSecurityContext systemSecurityContext(final TenantAware tenantAware, final RoleHierarchy roleHierarchy) { return new SystemSecurityContext(tenantAware, roleHierarchy); } diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenancyCacheManager.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenancyCacheManager.java index 37d126edc..5805d144a 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenancyCacheManager.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenancyCacheManager.java @@ -18,9 +18,8 @@ import org.springframework.cache.CacheManager; public interface TenancyCacheManager extends CacheManager { /** - * A direct-access for retrieving the cache without including the current - * tenant key. This is necessary e.g. for retrieving caches not for the - * current tenant. + * A direct-access for retrieving the cache without including the current tenant key. This is necessary e.g. for retrieving caches not for + * the current tenant. * * @param name the name of the cache to retrieve directly * @return the cache associated with the name without tenancy separation @@ -28,8 +27,7 @@ public interface TenancyCacheManager extends CacheManager { Cache getDirectCache(String name); /** - * Evicts all caches for a given tenant. All caches under a certain tenant - * gets evicted. + * Evicts all caches for a given tenant. All caches under a certain tenant gets evicted. * * @param tenant the tenant to evict caches */ diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java index d47b84725..e13da73d8 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/cache/TenantAwareCacheManager.java @@ -24,8 +24,7 @@ import org.springframework.cache.CacheManager; * {@link TenantAware#getCurrentTenant()} when accessing a cache, so caches are * seperated. * - * Additionally it also provide functionality to retrieve all caches overall - * tenants at once, for monitoring and system access. + * Additionally, it also provides functionality to retrieve all caches overall tenants at once, for monitoring and system access. */ public class TenantAwareCacheManager implements TenancyCacheManager { @@ -41,41 +40,28 @@ public class TenantAwareCacheManager implements TenancyCacheManager { * @param tenantAware the tenant aware to retrieve the current tenant */ public TenantAwareCacheManager(final CacheManager delegate, final TenantAware tenantAware) { - this.tenantAware = tenantAware; this.delegate = delegate; + this.tenantAware = tenantAware; } @Override public Cache getCache(final String name) { - String currentTenant = tenantAware.getCurrentTenant(); + final String currentTenant = tenantAware.getCurrentTenant(); if (isTenantInvalid(currentTenant)) { return null; } - currentTenant = currentTenant.toUpperCase(); - - return delegate.getCache(buildKey(currentTenant, name)); + return delegate.getCache(buildKey(currentTenant.toUpperCase(), name)); } @Override public Collection getCacheNames() { - String currentTenant = tenantAware.getCurrentTenant(); + final String currentTenant = tenantAware.getCurrentTenant(); if (isTenantInvalid(currentTenant)) { return Collections.emptyList(); } - currentTenant = currentTenant.toUpperCase(); - - return getCacheNames(currentTenant); - } - - /** - * A direct-access for retrieving all cache names overall tenants. - * - * @return all cache names without tenant check - */ - public Collection getDirectCacheNames() { - return delegate.getCacheNames(); + return getCacheNames(currentTenant.toUpperCase()); } @Override @@ -88,6 +74,15 @@ public class TenantAwareCacheManager implements TenancyCacheManager { getCacheNames(tenant).forEach(cacheName -> delegate.getCache(buildKey(tenant, cacheName)).clear()); } + /** + * A direct-access for retrieving all cache names overall tenants. + * + * @return all cache names without tenant check + */ + public Collection getDirectCacheNames() { + return delegate.getCacheNames(); + } + private static boolean isTenantInvalid(final String tenant) { return tenant == null || tenant.contains(TENANT_CACHE_DELIMITER); } diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java index a137ff6a3..1f64ff7ad 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java @@ -12,9 +12,8 @@ package org.eclipse.hawkbit.exception; import java.io.Serial; /** - * {@link GenericSpServerException} 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. + * {@link GenericSpServerException} 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. */ public class GenericSpServerException extends AbstractServerRtException { diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java index 1daf93307..90897a219 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerError.java @@ -17,134 +17,167 @@ import lombok.Getter; @Getter public enum SpServerError { - SP_REPO_GENERIC_ERROR("hawkbit.server.error.repo.genericError", "unknown error occurred"), - SP_REPO_ENTITY_ALREADY_EXISTS("hawkbit.server.error.repo.entitiyAlreayExists", + SP_REPO_GENERIC_ERROR( + "hawkbit.server.error.repo.genericError", + "unknown error occurred"), + SP_REPO_ENTITY_ALREADY_EXISTS( + "hawkbit.server.error.repo.entitiyAlreayExists", "The given entity already exists in database"), - SP_REPO_AUTO_CONFIRMATION_ALREADY_ACTIVE("hawkbit.server.error.repo.autoConfAlreadyActive", + SP_REPO_AUTO_CONFIRMATION_ALREADY_ACTIVE( + "hawkbit.server.error.repo.autoConfAlreadyActive", "Auto confirmation is already active"), - SP_CONFIRMATION_FEEDBACK_INVALID("hawkbit.server.confirmation.feedback.invalid", + SP_CONFIRMATION_FEEDBACK_INVALID( + "hawkbit.server.confirmation.feedback.invalid", "Confirmation feedback is not valid"), - SP_REPO_CONSTRAINT_VIOLATION("hawkbit.server.error.repo.constraintViolation", + SP_REPO_CONSTRAINT_VIOLATION( + "hawkbit.server.error.repo.constraintViolation", "The given entity cannot be saved due to Constraint Violation"), - SP_REPO_INVALID_TARGET_ADDRESS("hawkbit.server.error.repo.invalidTargetAddress", + SP_REPO_INVALID_TARGET_ADDRESS( + "hawkbit.server.error.repo.invalidTargetAddress", "The target address is not well formed"), - SP_REPO_ENTITY_NOT_EXISTS("hawkbit.server.error.repo.entitiyNotFound", + SP_REPO_ENTITY_NOT_EXISTS( + "hawkbit.server.error.repo.entitiyNotFound", "The given entity does not exist in the repository"), - SP_REPO_CONCURRENT_MODIFICATION("hawkbit.server.error.repo.concurrentModification", + SP_REPO_CONCURRENT_MODIFICATION( + "hawkbit.server.error.repo.concurrentModification", "The given entity has been changed by another user/session"), - SP_TARGET_ATTRIBUTES_INVALID("hawkbit.server.error.repo.invalidTargetAttributes", + SP_TARGET_ATTRIBUTES_INVALID( + "hawkbit.server.error.repo.invalidTargetAttributes", "The given target attributes are invalid"), - SP_REST_SORT_PARAM_SYNTAX("hawkbit.server.error.rest.param.sortParamSyntax", + SP_REST_SORT_PARAM_SYNTAX( + "hawkbit.server.error.rest.param.sortParamSyntax", "The given sort parameter is not well formed"), - SP_REST_RSQL_SEARCH_PARAM_SYNTAX("hawkbit.server.error.rest.param.rsqlParamSyntax", + SP_REST_RSQL_SEARCH_PARAM_SYNTAX( + "hawkbit.server.error.rest.param.rsqlParamSyntax", "The given search parameter is not well formed"), - SP_REST_RSQL_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.rsqlInvalidField", + SP_REST_RSQL_PARAM_INVALID_FIELD( + "hawkbit.server.error.rest.param.rsqlInvalidField", "The given search parameter field does not exist"), - SP_REST_SORT_PARAM_INVALID_FIELD("hawkbit.server.error.rest.param.invalidField", + SP_REST_SORT_PARAM_INVALID_FIELD( + "hawkbit.server.error.rest.param.invalidField", "The given sort parameter field does not exist"), - SP_REST_SORT_PARAM_INVALID_DIRECTION("hawkbit.server.error.rest.param.invalidDirection", + SP_REST_SORT_PARAM_INVALID_DIRECTION( + "hawkbit.server.error.rest.param.invalidDirection", "The given sort parameter direction does not exist"), - SP_REST_BODY_NOT_READABLE("hawkbit.server.error.rest.body.notReadable", + SP_REST_BODY_NOT_READABLE( + "hawkbit.server.error.rest.body.notReadable", "The given request body is not well formed"), - SP_ARTIFACT_UPLOAD_FAILED("hawkbit.server.error.artifact.uploadFailed", + SP_ARTIFACT_UPLOAD_FAILED( + "hawkbit.server.error.artifact.uploadFailed", "Upload of artifact failed with internal server error."), - SP_ARTIFACT_ENCRYPTION_NOT_SUPPORTED("hawkbit.server.error.artifact.encryptionNotSupported", + SP_ARTIFACT_ENCRYPTION_NOT_SUPPORTED( + "hawkbit.server.error.artifact.encryptionNotSupported", "Artifact encryption is not supported."), - SP_ARTIFACT_ENCRYPTION_FAILED("hawkbit.server.error.artifact.encryptionFailed", + SP_ARTIFACT_ENCRYPTION_FAILED( + "hawkbit.server.error.artifact.encryptionFailed", "Artifact encryption operation failed."), - SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.md5.match", + SP_ARTIFACT_UPLOAD_FAILED_MD5_MATCH( + "hawkbit.server.error.artifact.uploadFailed.checksum.md5.match", "Upload of artifact failed as the provided MD5 checksum did not match with the provided artifact."), - SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.sha1.match", + SP_ARTIFACT_UPLOAD_FAILED_SHA1_MATCH( + "hawkbit.server.error.artifact.uploadFailed.checksum.sha1.match", "Upload of artifact failed as the provided SHA1 checksum did not match with the provided artifact."), - SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH("hawkbit.server.error.artifact.uploadFailed.checksum.sha256.match", + SP_ARTIFACT_UPLOAD_FAILED_SHA256_MATCH( + "hawkbit.server.error.artifact.uploadFailed.checksum.sha256.match", "Upload of artifact failed as the provided SHA256 checksum did not match with the provided artifact."), - SP_DS_CREATION_FAILED_MISSING_MODULE("hawkbit.server.error.distributionset.creationFailed.missingModule", + SP_DS_CREATION_FAILED_MISSING_MODULE( + "hawkbit.server.error.distributionset.creationFailed.missingModule", "Creation if Distribution Set failed as module is missing that is configured as mandatory."), - SP_INSUFFICIENT_PERMISSION("hawkbit.server.error.insufficientpermission", "Insufficient Permission"), - SP_ARTIFACT_DELETE_FAILED("hawkbit.server.error.artifact.deleteFailed", + SP_INSUFFICIENT_PERMISSION( + "hawkbit.server.error.insufficientpermission", + "Insufficient Permission"), + SP_ARTIFACT_DELETE_FAILED( + "hawkbit.server.error.artifact.deleteFailed", "Deletion of artifact failed with internal server error."), - SP_ARTIFACT_LOAD_FAILED("hawkbit.server.error.artifact.loadFailed", + SP_ARTIFACT_LOAD_FAILED( + "hawkbit.server.error.artifact.loadFailed", "Load of artifact failed with internal server error."), - SP_ARTIFACT_BINARY_DELETED("hawkbit.server.error.artifact.binaryDeleted", + SP_ARTIFACT_BINARY_DELETED( + "hawkbit.server.error.artifact.binaryDeleted", "The artifact binary does not exist anymore."), - SP_QUOTA_EXCEEDED("hawkbit.server.error.quota.tooManyEntries", "Too many entries have been inserted."), - /** - * error that describes that size of uploaded file exceeds size quota - */ - SP_FILE_SIZE_QUOTA_EXCEEDED("hawkbit.server.error.quota.fileSizeExceeded", "File exceeds size quota."), - /** - * error that describes that size of uploaded file exceeds storage quota - */ - SP_STORAGE_QUOTA_EXCEEDED("hawkbit.server.error.quota.storageExceeded", + SP_QUOTA_EXCEEDED( + "hawkbit.server.error.quota.tooManyEntries", + "Too many entries have been inserted."), + SP_FILE_SIZE_QUOTA_EXCEEDED( + "hawkbit.server.error.quota.fileSizeExceeded", + "File exceeds size quota."), + SP_STORAGE_QUOTA_EXCEEDED( + "hawkbit.server.error.quota.storageExceeded", "Storage quota will be exceeded if file is uploaded."), - /** - * error message, which describes that the action can not be canceled cause - * the action is inactive. - */ - SP_ACTION_NOT_CANCELABLE("hawkbit.server.error.action.notcancelable", + SP_ACTION_NOT_CANCELABLE( + "hawkbit.server.error.action.notcancelable", "Only active actions which are in status pending are cancelable."), - /** - * error message, which describes that the action can not be force quit - * cause the action is inactive. - */ - SP_ACTION_NOT_FORCE_QUITABLE("hawkbit.server.error.action.notforcequitable", + SP_ACTION_NOT_FORCE_QUITABLE( + "hawkbit.server.error.action.notforcequitable", "Only active actions which are in status pending can be force quit."), - SP_DS_INCOMPLETE("hawkbit.server.error.distributionset.incomplete", + SP_DS_INCOMPLETE( + "hawkbit.server.error.distributionset.incomplete", "Distribution set is assigned/locked to a target that is incomplete (i.e. mandatory modules are missing)"), - /** - * error message, which describes that an entity is locked and can't be functionally modified - */ - SP_LOCKED("hawkbit.server.error.locked", "Entry is locked. Could not be functionally modified"), - /** - * error message, which describes that an entity is locked and can't be functionally modified - */ - SP_DELETED("hawkbit.server.error.deleted", "Entry is soft deleted"), - SP_DS_INVALID("hawkbit.server.error.distributionset.invalid", "Invalid distribution set is assigned to a target"), - SP_DS_TYPE_UNDEFINED("hawkbit.server.error.distributionset.type.undefined", + SP_LOCKED( + "hawkbit.server.error.locked", + "Entry is locked. Could not be functionally modified"), + SP_DELETED( + "hawkbit.server.error.deleted", + "Entry is soft deleted"), + SP_DS_INVALID( + "hawkbit.server.error.distributionset.invalid", + "Invalid distribution set is assigned to a target"), + SP_DS_TYPE_UNDEFINED( + "hawkbit.server.error.distributionset.type.undefined", "Distribution set type is not yet defined. Modules cannot be added until definition."), - SP_DS_MODULE_UNSUPPORTED("hawkbit.server.error.distributionset.modules.unsupported", + SP_DS_MODULE_UNSUPPORTED( + "hawkbit.server.error.distributionset.modules.unsupported", "Distribution set type does not contain the given module, i.e. is incompatible."), - SP_REPO_TENANT_NOT_EXISTS("hawkbit.server.error.repo.tenantNotExists", + SP_REPO_TENANT_NOT_EXISTS( + "hawkbit.server.error.repo.tenantNotExists", "The entity cannot be inserted due the tenant does not exists"), - SP_ENTITY_LOCKED("hawkbit.server.error.entitiylocked", "The given entity is locked by the server."), - SP_REPO_ENTITY_READ_ONLY("hawkbit.server.error.entityreadonly", + SP_ENTITY_LOCKED( + "hawkbit.server.error.entitiylocked", + "The given entity is locked by the server."), + SP_REPO_ENTITY_READ_ONLY( + "hawkbit.server.error.entityreadonly", "The given entity is read only and the change cannot be completed."), - SP_CONFIGURATION_VALUE_INVALID("hawkbit.server.error.configValueInvalid", + SP_CONFIGURATION_VALUE_INVALID( + "hawkbit.server.error.configValueInvalid", "The given configuration value is invalid."), - SP_CONFIGURATION_KEY_INVALID("hawkbit.server.error.configKeyInvalid", "The given configuration key is invalid."), - SP_ROLLOUT_ILLEGAL_STATE("hawkbit.server.error.rollout.illegalstate", + SP_CONFIGURATION_KEY_INVALID( + "hawkbit.server.error.configKeyInvalid", + "The given configuration key is invalid."), + SP_ROLLOUT_ILLEGAL_STATE( + "hawkbit.server.error.rollout.illegalstate", "The rollout is in the wrong state for the requested operation"), - SP_ROLLOUT_VERIFICATION_FAILED("hawkbit.server.error.rollout.verificationFailed", + SP_ROLLOUT_VERIFICATION_FAILED( + "hawkbit.server.error.rollout.verificationFailed", "The rollout configuration could not be verified successfully"), - SP_REPO_OPERATION_NOT_SUPPORTED("hawkbit.server.error.operation.notSupported", + SP_REPO_OPERATION_NOT_SUPPORTED( + "hawkbit.server.error.operation.notSupported", "Operation or method is (no longer) supported by service."), - /** - * Error message informing that the maintenance schedule is invalid. - */ - SP_MAINTENANCE_SCHEDULE_INVALID("hawkbit.server.error.maintenanceScheduleInvalid", + SP_MAINTENANCE_SCHEDULE_INVALID( + "hawkbit.server.error.maintenanceScheduleInvalid", "Information for schedule, duration or timezone is missing; or there is no valid maintenance window available in future."), - /** - * Error message informing that the action type for auto-assignment is - * invalid. - */ - SP_AUTO_ASSIGN_ACTION_TYPE_INVALID("hawkbit.server.error.repo.invalidAutoAssignActionType", + SP_AUTO_ASSIGN_ACTION_TYPE_INVALID( + "hawkbit.server.error.repo.invalidAutoAssignActionType", "The given action type for auto-assignment is invalid: allowed values are ['forced', 'soft', 'downloadonly']"), - /** - * Error message informing the user that the requested tenant configuration - * change is not allowed. - */ - SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED("hawkbit.server.error.repo.tenantConfigurationValueChangeNotAllowed", + SP_CONFIGURATION_VALUE_CHANGE_NOT_ALLOWED( + "hawkbit.server.error.repo.tenantConfigurationValueChangeNotAllowed", "The requested tenant configuration value modification is not allowed."), - SP_MULTIASSIGNMENT_NOT_ENABLED("hawkbit.server.error.multiassignmentNotEnabled", + SP_MULTIASSIGNMENT_NOT_ENABLED( + "hawkbit.server.error.multiassignmentNotEnabled", "The requested operation requires multi assignments to be enabled."), - SP_NO_WEIGHT_PROVIDED_IN_MULTIASSIGNMENT_MODE("hawkbit.server.error.noWeightProvidedInMultiAssignmentMode", + SP_NO_WEIGHT_PROVIDED_IN_MULTIASSIGNMENT_MODE( + "hawkbit.server.error.noWeightProvidedInMultiAssignmentMode", "The requested operation requires a weight to be specified when multi assignments is enabled."), - SP_TARGET_TYPE_IN_USE("hawkbit.server.error.target.type.used", "Target type is still in use by a target."), - SP_TARGET_TYPE_INCOMPATIBLE("hawkbit.server.error.target.type.incompatible", + SP_TARGET_TYPE_IN_USE( + "hawkbit.server.error.target.type.used", "Target type is still in use by a target."), + SP_TARGET_TYPE_INCOMPATIBLE( + "hawkbit.server.error.target.type.incompatible", "Target type of target is not compatible with distribution set."), - SP_TARGET_TYPE_KEY_OR_NAME_REQUIRED("hawkbit.server.error.target.type.keyOrNameRequired", + SP_TARGET_TYPE_KEY_OR_NAME_REQUIRED( + "hawkbit.server.error.target.type.keyOrNameRequired", "Target type key or name is required."), - SP_STOP_ROLLOUT_FAILED("hawkbit.server.error.stopRolloutFailed", "Stopping the rollout failed."); + SP_STOP_ROLLOUT_FAILED( + "hawkbit.server.error.stopRolloutFailed", + "Stopping the rollout failed."); private final String key; private final String message; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/FieldValueConverter.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/FieldValueConverter.java index 13ac58a94..6bac2f719 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/FieldValueConverter.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/FieldValueConverter.java @@ -26,9 +26,8 @@ public interface FieldValueConverter> { * * @param e the enum to build the value for * @param value the value in string representation - * @return the converted object or {@code null} if conversation fails, if - * given enum does not need to be converted the the unmodified - * {@code value} is returned. + * @return the converted object or {@code null} if conversation fails, if given enum does not need to be converted the + * unmodified {@code value} is returned. */ Object convertValue(final T e, final String value); diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupFields.java index 37582557a..2248bcb4a 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/RolloutGroupFields.java @@ -26,4 +26,4 @@ public enum RolloutGroupFields implements RsqlQueryField { RolloutGroupFields(final String jpaEntityFieldName) { this.jpaEntityFieldName = jpaEntityFieldName; } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/SoftwareModuleMetadataFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/SoftwareModuleMetadataFields.java index 89951601e..3feca26b0 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/SoftwareModuleMetadataFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/SoftwareModuleMetadataFields.java @@ -31,4 +31,4 @@ public enum SoftwareModuleMetadataFields implements RsqlQueryField { public String identifierFieldName() { return KEY.getJpaEntityFieldName(); } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TagFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TagFields.java index 028e679a5..ac39b63e3 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TagFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TagFields.java @@ -27,4 +27,4 @@ public enum TagFields implements RsqlQueryField { TagFields(final String jpaEntityFieldName) { this.jpaEntityFieldName = jpaEntityFieldName; } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetFilterQueryFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetFilterQueryFields.java index 64a1a9257..cbd0b4b28 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetFilterQueryFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetFilterQueryFields.java @@ -39,4 +39,4 @@ public enum TargetFilterQueryFields implements RsqlQueryField { this.jpaEntityFieldName = jpaEntityFieldName; this.subEntityAttributes = subEntityAttribues; } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetMetadataFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetMetadataFields.java index f9bb7ae65..8e25d43bd 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetMetadataFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetMetadataFields.java @@ -30,4 +30,4 @@ public enum TargetMetadataFields implements RsqlQueryField { public String identifierFieldName() { return KEY.getJpaEntityFieldName(); } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetTypeFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetTypeFields.java index 403e9b758..7d8a29c74 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetTypeFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/TargetTypeFields.java @@ -27,4 +27,4 @@ public enum TargetTypeFields implements RsqlQueryField { TargetTypeFields(final String jpaEntityFieldName) { this.jpaEntityFieldName = jpaEntityFieldName; } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAware.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAware.java index 30593cc93..44b75b18e 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAware.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAware.java @@ -15,8 +15,7 @@ package org.eclipse.hawkbit.tenancy; public interface TenantAware { /** - * Implementation might retrieve the current tenant from a session or - * thread-local. + * Implementation might retrieve the current tenant from a session or thread-local. * * @return the current tenant */ @@ -28,11 +27,9 @@ public interface TenantAware { String getCurrentUsername(); /** - * Gives the possibility to run a certain code under a specific given - * {@code tenant}. Only the given {@link TenantRunner} is executed under the - * specific tenant e.g. under control of an {@link ThreadLocal}. After the - * {@link TenantRunner} it must be ensured that the original tenant before - * this invocation is reset. + * Gives the possibility to run a certain code under a specific given {@code tenant}. Only the given {@link TenantRunner} is executed + * under the specific tenant e.g. under control of an {@link ThreadLocal}. After the {@link TenantRunner} it must be ensured that the + * original tenant before this invocation is reset. * * @param tenant the tenant which the specific code should run * @param tenantRunner the runner which is implemented to run this specific code @@ -69,4 +66,4 @@ public interface TenantAware { */ T run(); } -} +} \ No newline at end of file diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAwareAuthenticationDetails.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAwareAuthenticationDetails.java index d69663a1e..533ab4900 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAwareAuthenticationDetails.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/TenantAwareAuthenticationDetails.java @@ -17,10 +17,8 @@ import lombok.ToString; import org.springframework.security.authentication.AbstractAuthenticationToken; /** - * An authentication details object - * {@link AbstractAuthenticationToken#getDetails()} which is stored in the - * spring security authentication token details to transport the principal and - * tenant in the security context session. + * An authentication details object {@link AbstractAuthenticationToken#getDetails()} which is stored in the + * spring security authentication token details to transport the principal and tenant in the security context session. */ @Getter @ToString diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/UserAuthoritiesResolver.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/UserAuthoritiesResolver.java index cbd335383..4a8c23a20 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/UserAuthoritiesResolver.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/UserAuthoritiesResolver.java @@ -12,8 +12,7 @@ package org.eclipse.hawkbit.tenancy; import java.util.Collection; /** - * The service responsible for making the lookup for user authorities/roles - * based on his tenant and username + * The service responsible for making the lookup for user authorities/roles based on his tenant and username */ @FunctionalInterface public interface UserAuthoritiesResolver { @@ -26,4 +25,4 @@ public interface UserAuthoritiesResolver { * @return a {@link Collection} of authorities/roles for this user */ Collection getUserAuthorities(String tenant, String username); -} +} \ No newline at end of file