Documented differences between system wide properties and the veritable by tenant

This commit is contained in:
Kai Zimmermann
2016-03-14 15:39:01 +01:00
parent 57c722ea11
commit 4c282d8ee3
2 changed files with 25 additions and 31 deletions

View File

@@ -8,11 +8,19 @@
*/ */
package org.eclipse.hawkbit; package org.eclipse.hawkbit;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Defines the polling time for the controllers in HH:MM:SS notation. * Defines global configuration for the controllers/clients on the provisioning
* targets/devices.
*
*
* Note: many of the controller related properties can be overridden on tenant
* level. As a result they are not defined here but in
* {@link TenantConfigurationKey} and injected using {@link EnvironmentAware}.
* *
*/ */
@Component @Component
@@ -20,17 +28,15 @@ import org.springframework.stereotype.Component;
public class ControllerPollProperties { public class ControllerPollProperties {
/** /**
* Recommended target polling time for DDI API. Final choice is up to the * Maximum polling time that can be configured by a tenant in HH:MM:SS
* target. * notation.
*/ */
private String pollingTime; private String maxPollingTime = "23:59:00";
/** /**
* Assumed time frame where the target is considered overdue when no DDI * Minimum polling time that can be configured by a tenant in HH:MM:SS
* polling has been registered by the update server. * notation.
*/ */
private String pollingOverdueTime;
private String maxPollingTime = "23:59:00";
private String minPollingTime = "00:00:30"; private String minPollingTime = "00:00:30";
public String getMaxPollingTime() { public String getMaxPollingTime() {

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.tenancy.configuration;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
import org.eclipse.hawkbit.ControllerPollProperties;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator; import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationPollingDurationValidator; import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationPollingDurationValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationStringValidator; import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationStringValidator;
@@ -20,7 +21,8 @@ import org.springframework.context.ApplicationContext;
/** /**
* An enum which defines the tenant specific configurations which can be * An enum which defines the tenant specific configurations which can be
* configured for each tenant seperately. * configured for each tenant separately. The non overridable properties are
* configured in {@link ControllerPollProperties} instead.
* *
*/ */
public enum TenantConfigurationKey { public enum TenantConfigurationKey {
@@ -28,54 +30,40 @@ public enum TenantConfigurationKey {
/** /**
* boolean value {@code true} {@code false}. * boolean value {@code true} {@code false}.
*/ */
AUTHENTICATION_MODE_HEADER_ENABLED("authentication.header.enabled", AUTHENTICATION_MODE_HEADER_ENABLED("authentication.header.enabled", "hawkbit.server.ddi.security.authentication.header.enabled", Boolean.class, Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class),
"hawkbit.server.ddi.security.authentication.header.enabled", Boolean.class, Boolean.FALSE.toString(),
TenantConfigurationBooleanValidator.class),
/** /**
* *
*/ */
AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME("authentication.header.authority", AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME("authentication.header.authority", "hawkbit.server.ddi.security.authentication.header.authority", String.class, Boolean.FALSE.toString(), TenantConfigurationStringValidator.class),
"hawkbit.server.ddi.security.authentication.header.authority", String.class, Boolean.FALSE.toString(),
TenantConfigurationStringValidator.class),
/** /**
* boolean value {@code true} {@code false}. * boolean value {@code true} {@code false}.
*/ */
AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED("authentication.targettoken.enabled", AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED("authentication.targettoken.enabled", "hawkbit.server.ddi.security.authentication.targettoken.enabled", Boolean.class, Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class),
"hawkbit.server.ddi.security.authentication.targettoken.enabled", Boolean.class, Boolean.FALSE.toString(),
TenantConfigurationBooleanValidator.class),
/** /**
* boolean value {@code true} {@code false}. * boolean value {@code true} {@code false}.
*/ */
AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED("authentication.gatewaytoken.enabled", AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED("authentication.gatewaytoken.enabled", "hawkbit.server.ddi.security.authentication.gatewaytoken.enabled", Boolean.class, Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class),
"hawkbit.server.ddi.security.authentication.gatewaytoken.enabled", Boolean.class, Boolean.FALSE.toString(),
TenantConfigurationBooleanValidator.class),
/** /**
* string value which holds the name of the security token key. * string value which holds the name of the security token key.
*/ */
AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_NAME("authentication.gatewaytoken.name", AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_NAME("authentication.gatewaytoken.name", "hawkbit.server.ddi.security.authentication.gatewaytoken.name", String.class, null, TenantConfigurationStringValidator.class),
"hawkbit.server.ddi.security.authentication.gatewaytoken.name", String.class, null,
TenantConfigurationStringValidator.class),
/** /**
* string value which holds the actual security-key of the gateway security * string value which holds the actual security-key of the gateway security
* token. * token.
*/ */
AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY("authentication.gatewaytoken.key", AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY("authentication.gatewaytoken.key", "hawkbit.server.ddi.security.authentication.gatewaytoken.key", String.class, null, TenantConfigurationStringValidator.class),
"hawkbit.server.ddi.security.authentication.gatewaytoken.key", String.class, null,
TenantConfigurationStringValidator.class),
/** /**
* string value which holds the polling time interval in the format HH:mm:ss * string value which holds the polling time interval in the format HH:mm:ss
*/ */
POLLING_TIME_INTERVAL("pollingOverdueTime", "hawkbit.controller.pollingOverdueTime", String.class, null, POLLING_TIME_INTERVAL("pollingOverdueTime", "hawkbit.controller.pollingOverdueTime", String.class, null, TenantConfigurationPollingDurationValidator.class),
TenantConfigurationPollingDurationValidator.class),
/** /**
* string value which holds the polling time interval in the format HH:mm:ss * string value which holds the polling time interval in the format HH:mm:ss
*/ */
POLLING_OVERDUE_TIME_INTERVAL("pollingTime", "hawkbit.controller.pollingTime", String.class, null, POLLING_OVERDUE_TIME_INTERVAL("pollingTime", "hawkbit.controller.pollingTime", String.class, null, TenantConfigurationPollingDurationValidator.class);
TenantConfigurationPollingDurationValidator.class);
private final String keyName; private final String keyName;
private final String defaultKeyName; private final String defaultKeyName;