Refactor tenancy classes (#1972)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-08 16:12:18 +02:00
committed by GitHub
parent 590dbc06ff
commit 3effa996dd
27 changed files with 43 additions and 206 deletions

View File

@@ -23,7 +23,7 @@ import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidatorException;
import org.eclipse.hawkbit.repository.exception.TenantConfigurationValidatorException;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.env.Environment;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
@@ -18,42 +20,12 @@ import org.eclipse.hawkbit.exception.SpServerError;
*/
public class InvalidTenantConfigurationKeyException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_KEY_INVALID;
/**
* Default constructor.
*/
public InvalidTenantConfigurationKeyException() {
super(THIS_ERROR);
}
/**
* Parameterized constructor.
*
* @param cause of the exception
*/
public InvalidTenantConfigurationKeyException(final Throwable cause) {
super(THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message of the exception
* @param cause of the exception
*/
public InvalidTenantConfigurationKeyException(final String message, final Throwable cause) {
super(message, THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message of the exception
*/
public InvalidTenantConfigurationKeyException(final String message) {
super(message, THIS_ERROR);
}
}
}

View File

@@ -7,7 +7,9 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.tenancy.configuration.validator;
package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
@@ -18,35 +20,11 @@ import org.eclipse.hawkbit.exception.SpServerError;
*/
public class TenantConfigurationValidatorException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_VALUE_INVALID;
/**
* Default constructor.
*/
public TenantConfigurationValidatorException() {
super(THIS_ERROR);
}
/**
* Parameterized constructor.
*
* @param cause of the exception
*/
public TenantConfigurationValidatorException(final Throwable cause) {
super(THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
* @param message of the exception
* @param cause of the exception
*/
public TenantConfigurationValidatorException(final String message, final Throwable cause) {
super(message, THIS_ERROR, cause);
}
/**
* Parameterized constructor.
*
@@ -55,5 +33,4 @@ public class TenantConfigurationValidatorException extends AbstractServerRtExcep
public TenantConfigurationValidatorException(final String message) {
super(message, THIS_ERROR);
}
}
}

View File

@@ -19,9 +19,9 @@ import lombok.ToString;
import org.eclipse.hawkbit.ControllerPollProperties;
import org.eclipse.hawkbit.HawkbitServerProperties.Anonymous.Download;
import org.eclipse.hawkbit.repository.exception.InvalidTenantConfigurationKeyException;
import org.eclipse.hawkbit.repository.exception.TenantConfigurationValidatorException;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationStringValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidatorException;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ApplicationContext;

View File

@@ -14,6 +14,7 @@ import java.time.format.DateTimeParseException;
import org.eclipse.hawkbit.ControllerPollProperties;
import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
import org.eclipse.hawkbit.repository.exception.TenantConfigurationValidatorException;
import org.springframework.beans.factory.annotation.Autowired;
/**

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.tenancy.configuration.validator;
import org.eclipse.hawkbit.repository.exception.TenantConfigurationValidatorException;
/**
* base interface for clases which can validate tenant configuration values.
*/