Merge branch 'feature_split_repo_into_api_impl' of https://github.com/bsinno/hawkbit.git into feature_split_repo_into_api_impl
This commit is contained in:
@@ -124,11 +124,9 @@ public class ArtifactStore implements ArtifactRepository {
|
|||||||
try {
|
try {
|
||||||
LOGGER.debug("storing file {} of content {}", filename, contentType);
|
LOGGER.debug("storing file {} of content {}", filename, contentType);
|
||||||
tempFile = File.createTempFile("uploadFile", null);
|
tempFile = File.createTempFile("uploadFile", null);
|
||||||
try (final FileOutputStream os = new FileOutputStream(tempFile)) {
|
try (final BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(tempFile))) {
|
||||||
try (BufferedOutputStream bos = new BufferedOutputStream(os)) {
|
try (BufferedInputStream bis = new BufferedInputStream(content)) {
|
||||||
try (BufferedInputStream bis = new BufferedInputStream(content)) {
|
return store(bis, contentType, bos, tempFile, hash);
|
||||||
return store(content, contentType, bos, tempFile, hash);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final IOException | MongoException e1) {
|
} catch (final IOException | MongoException e1) {
|
||||||
|
|||||||
@@ -30,60 +30,45 @@ 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("pollingTime", "hawkbit.controller.pollingTime", String.class, null,
|
POLLING_TIME_INTERVAL("pollingTime", "hawkbit.controller.pollingTime", 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("pollingOverdueTime", "hawkbit.controller.pollingOverdueTime", String.class, null,
|
POLLING_OVERDUE_TIME_INTERVAL("pollingOverdueTime", "hawkbit.controller.pollingOverdueTime", String.class, null, TenantConfigurationPollingDurationValidator.class),
|
||||||
TenantConfigurationPollingDurationValidator.class),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* boolean value {@code true} {@code false}.
|
* boolean value {@code true} {@code false}.
|
||||||
*/
|
*/
|
||||||
ANONYMOUS_DOWNLOAD_MODE_ENABLED("anonymous.download.enabled", "hawkbit.server.download.anonymous.enabled",
|
ANONYMOUS_DOWNLOAD_MODE_ENABLED("anonymous.download.enabled", "hawkbit.server.download.anonymous.enabled", Boolean.class, Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class);
|
||||||
Boolean.class, Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class);
|
|
||||||
|
|
||||||
private final String keyName;
|
private final String keyName;
|
||||||
private final String defaultKeyName;
|
private final String defaultKeyName;
|
||||||
@@ -140,8 +125,9 @@ public enum TenantConfigurationKey {
|
|||||||
* @return the data type of the tenant configuration value. (e.g.
|
* @return the data type of the tenant configuration value. (e.g.
|
||||||
* Integer.class, String.class)
|
* Integer.class, String.class)
|
||||||
*/
|
*/
|
||||||
public Class<?> getDataType() {
|
@SuppressWarnings("unchecked")
|
||||||
return dataType;
|
public <T> Class<T> getDataType() {
|
||||||
|
return (Class<T>) dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.Constants;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
||||||
@@ -149,10 +149,10 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
|||||||
actionStatus.setStatus(Status.DOWNLOAD);
|
actionStatus.setStatus(Status.DOWNLOAD);
|
||||||
|
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
||||||
+ request.getRequestURI());
|
+ request.getRequestURI());
|
||||||
} else {
|
} else {
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
|
||||||
}
|
}
|
||||||
controllerManagement.addInformationalActionStatus(actionStatus);
|
controllerManagement.addInformationalActionStatus(actionStatus);
|
||||||
return action;
|
return action;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
|
|||||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
|
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
|
||||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.Constants;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
@@ -185,10 +185,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
statusMessage.setStatus(Status.DOWNLOAD);
|
statusMessage.setStatus(Status.DOWNLOAD);
|
||||||
|
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
statusMessage.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
||||||
+ request.getRequestURI());
|
+ request.getRequestURI());
|
||||||
} else {
|
} else {
|
||||||
statusMessage.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
|
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
|
||||||
}
|
}
|
||||||
controllerManagement.addInformationalActionStatus(statusMessage);
|
controllerManagement.addInformationalActionStatus(statusMessage);
|
||||||
return action;
|
return action;
|
||||||
@@ -251,7 +251,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
|
|
||||||
LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", targetid, base);
|
LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", targetid, base);
|
||||||
|
|
||||||
controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
|
controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
|
||||||
+ "Target retrieved update action and should start now the download.");
|
+ "Target retrieved update action and should start now the download.");
|
||||||
|
|
||||||
return new ResponseEntity<>(base, HttpStatus.OK);
|
return new ResponseEntity<>(base, HttpStatus.OK);
|
||||||
@@ -306,13 +306,13 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
||||||
targetid, feedback.getStatus().getExecution());
|
targetid, feedback.getStatus().getExecution());
|
||||||
actionStatus.setStatus(Status.CANCELED);
|
actionStatus.setStatus(Status.CANCELED);
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation.");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation.");
|
||||||
break;
|
break;
|
||||||
case REJECTED:
|
case REJECTED:
|
||||||
LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
||||||
targetid, feedback.getStatus().getExecution());
|
targetid, feedback.getStatus().getExecution());
|
||||||
actionStatus.setStatus(Status.WARNING);
|
actionStatus.setStatus(Status.WARNING);
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
|
||||||
break;
|
break;
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus);
|
handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus);
|
||||||
@@ -340,7 +340,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
targetid, feedback.getStatus().getExecution());
|
targetid, feedback.getStatus().getExecution());
|
||||||
actionStatus.setStatus(Status.RUNNING);
|
actionStatus.setStatus(Status.RUNNING);
|
||||||
actionStatus
|
actionStatus
|
||||||
.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
|
.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
|
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
|
||||||
@@ -349,10 +349,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
feedback.getStatus().getExecution());
|
feedback.getStatus().getExecution());
|
||||||
if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) {
|
if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) {
|
||||||
actionStatus.setStatus(Status.ERROR);
|
actionStatus.setStatus(Status.ERROR);
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
|
||||||
} else {
|
} else {
|
||||||
actionStatus.setStatus(Status.FINISHED);
|
actionStatus.setStatus(Status.FINISHED);
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
|
|
||||||
LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", targetid, cancel);
|
LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", targetid, cancel);
|
||||||
|
|
||||||
controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
|
controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
|
||||||
+ "Target retrieved cancel action and should start now the cancelation.");
|
+ "Target retrieved cancel action and should start now the cancelation.");
|
||||||
|
|
||||||
return new ResponseEntity<>(cancel, HttpStatus.OK);
|
return new ResponseEntity<>(cancel, HttpStatus.OK);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.Action;
|
|||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.Constants;
|
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
@@ -113,7 +113,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
|
|||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
|
||||||
|
|
||||||
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.FORCED,
|
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.FORCED,
|
||||||
Constants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
|
RepositoryModelConstants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
|
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
|
||||||
|
|
||||||
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
|
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
|
||||||
@@ -250,7 +250,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
|
|||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
|
||||||
|
|
||||||
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.SOFT,
|
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.SOFT,
|
||||||
Constants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
|
RepositoryModelConstants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
|
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
|
||||||
|
|
||||||
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
|
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
|||||||
import org.eclipse.hawkbit.dmf.json.model.SoftwareModule;
|
import org.eclipse.hawkbit.dmf.json.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.eventbus.EventSubscriber;
|
import org.eclipse.hawkbit.eventbus.EventSubscriber;
|
||||||
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
|
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.util.IpUtil;
|
import org.eclipse.hawkbit.util.IpUtil;
|
||||||
@@ -53,14 +52,11 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AmqpSenderService amqpSenderService;
|
private AmqpSenderService amqpSenderService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SoftwareManagement softwareManagement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param messageConverter
|
* @param rabbitTemplate
|
||||||
* message converter
|
* the rabbitTemplate
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public AmqpMessageDispatcherService(final RabbitTemplate rabbitTemplate) {
|
public AmqpMessageDispatcherService(final RabbitTemplate rabbitTemplate) {
|
||||||
@@ -118,7 +114,7 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessageProperties createConnectorMessageProperties(final String tenant, final String controllerId,
|
private static MessageProperties createConnectorMessageProperties(final String tenant, final String controllerId,
|
||||||
final EventTopic topic) {
|
final EventTopic topic) {
|
||||||
final MessageProperties messageProperties = createMessageProperties();
|
final MessageProperties messageProperties = createMessageProperties();
|
||||||
messageProperties.setHeader(MessageHeaderKey.TOPIC, topic);
|
messageProperties.setHeader(MessageHeaderKey.TOPIC, topic);
|
||||||
|
|||||||
@@ -60,9 +60,17 @@ public interface ArtifactManagement {
|
|||||||
ExternalArtifact createExternalArtifact(@NotNull ExternalArtifactProvider externalRepository, String urlSuffix,
|
ExternalArtifact createExternalArtifact(@NotNull ExternalArtifactProvider externalRepository, String urlSuffix,
|
||||||
@NotNull Long moduleId);
|
@NotNull Long moduleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the total amount of local artifacts stored in the artifact
|
||||||
|
* management
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
Long countLocalArtifactsAll();
|
Long countLocalArtifactsAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the total amount of external artifacts stored in the artifact
|
||||||
|
* management
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||||
Long countExternalArtifactsAll();
|
Long countExternalArtifactsAll();
|
||||||
|
|
||||||
|
|||||||
@@ -187,9 +187,15 @@ public interface DeploymentManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Long countActionsByTarget(@NotNull String rsqlParam, @NotNull Target target);
|
Long countActionsByTarget(@NotNull String rsqlParam, @NotNull Target target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the total amount of stored action status
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Long countActionStatusAll();
|
Long countActionStatusAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the total amount of stored actions
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Long countActionsAll();
|
Long countActionsAll();
|
||||||
|
|
||||||
@@ -280,8 +286,20 @@ public interface DeploymentManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Slice<Action> findActionsByTarget(@NotNull Pageable pageable, @NotNull Target target);
|
Slice<Action> findActionsByTarget(@NotNull Pageable pageable, @NotNull Target target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all {@link Action} which assigned to a specific
|
||||||
|
* {@link DistributionSet}.
|
||||||
|
*
|
||||||
|
* @param pageable
|
||||||
|
* the page request parameter for paging and sorting the result
|
||||||
|
* @param distributionSet
|
||||||
|
* the distribution set which should be assigned to the actions
|
||||||
|
* in the result
|
||||||
|
* @return a list of {@link Action} which are assigned to a specific
|
||||||
|
* {@link DistributionSet}
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Slice<Action> findActionsByDistributionSet(@NotNull Pageable pageable, @NotNull DistributionSet ds);
|
Slice<Action> findActionsByDistributionSet(@NotNull Pageable pageable, @NotNull DistributionSet distributionSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s assigned to a specific {@link Target} and a
|
* Retrieves all {@link Action}s assigned to a specific {@link Target} and a
|
||||||
@@ -345,8 +363,18 @@ public interface DeploymentManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Action action);
|
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Action action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all {@link ActionStatus} inclusive their messages by a specific
|
||||||
|
* {@link Action}.
|
||||||
|
*
|
||||||
|
* @param pageable
|
||||||
|
* the page request parameter for paging and sorting the result
|
||||||
|
* @param action
|
||||||
|
* the {@link Action} to retrieve the {@link ActionStatus} from
|
||||||
|
* @return a page of {@link ActionStatus} by a speciifc {@link Action}
|
||||||
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Page<ActionStatus> findActionStatusByActionWithMessages(@NotNull Pageable pageReq, @NotNull Action action);
|
Page<ActionStatus> findActionStatusByActionWithMessages(@NotNull Pageable pageable, @NotNull Action action);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all {@link Action}s of a specific target ordered by action ID.
|
* Retrieves all {@link Action}s of a specific target ordered by action ID.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
|||||||
* Repository constants.
|
* Repository constants.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class Constants {
|
public final class RepositoryConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefix that the server puts in front of
|
* Prefix that the server puts in front of
|
||||||
@@ -30,7 +30,7 @@ public final class Constants {
|
|||||||
*/
|
*/
|
||||||
public static final int DEFAULT_DS_TYPES_IN_TENANT = 2;
|
public static final int DEFAULT_DS_TYPES_IN_TENANT = 2;
|
||||||
|
|
||||||
private Constants() {
|
private RepositoryConstants() {
|
||||||
// Utility class.
|
// Utility class.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,8 +18,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
|||||||
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||||
import org.eclipse.hawkbit.repository.report.model.SystemUsageReport;
|
import org.eclipse.hawkbit.repository.report.model.SystemUsageReport;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.springframework.cache.interceptor.KeyGenerator;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,14 +65,10 @@ public interface SystemManagement {
|
|||||||
*/
|
*/
|
||||||
TenantMetaData getTenantMetadata();
|
TenantMetaData getTenantMetadata();
|
||||||
|
|
||||||
// TODO figure out why this is necessary and clean this up
|
|
||||||
@Bean
|
|
||||||
KeyGenerator currentTenantKeyGenerator();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@link TenantMetaData} of given and current tenant. Creates for
|
* Returns {@link TenantMetaData} of given and current tenant. Creates for
|
||||||
* new tenants also two {@link SoftwareModuleType} (os and app) and
|
* new tenants also two {@link SoftwareModuleType} (os and app) and
|
||||||
* {@link Constants#DEFAULT_DS_TYPES_IN_TENANT} {@link DistributionSetType}s
|
* {@link RepositoryConstants#DEFAULT_DS_TYPES_IN_TENANT} {@link DistributionSetType}s
|
||||||
* (os and os_app).
|
* (os and os_app).
|
||||||
*
|
*
|
||||||
* DISCLAIMER: this variant is used during initial login (where the tenant
|
* DISCLAIMER: this variant is used during initial login (where the tenant
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public interface TenantConfigurationManagement {
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION + SpringEvalExpressions.HAS_AUTH_OR
|
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION + SpringEvalExpressions.HAS_AUTH_OR
|
||||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||||
TenantConfigurationValue<?> getConfigurationValue(TenantConfigurationKey configurationKey);
|
<T> TenantConfigurationValue<T> getConfigurationValue(TenantConfigurationKey configurationKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a configuration value from the e.g. tenant overwritten
|
* Retrieves a configuration value from the e.g. tenant overwritten
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
* Repository model constants.
|
* Repository model constants.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class Constants {
|
public final class RepositoryModelConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indicating that target action has no force time which is only needed in
|
* indicating that target action has no force time which is only needed in
|
||||||
@@ -20,7 +20,7 @@ public final class Constants {
|
|||||||
*/
|
*/
|
||||||
public static final Long NO_FORCE_TIME = 0L;
|
public static final Long NO_FORCE_TIME = 0L;
|
||||||
|
|
||||||
private Constants() {
|
private RepositoryModelConstants() {
|
||||||
// Utility class.
|
// Utility class.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,44 +16,145 @@ package org.eclipse.hawkbit.repository.model;
|
|||||||
*/
|
*/
|
||||||
public interface RolloutGroup extends NamedEntity {
|
public interface RolloutGroup extends NamedEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the corresponding {@link Rollout} of this group
|
||||||
|
*/
|
||||||
Rollout getRollout();
|
Rollout getRollout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rollout
|
||||||
|
* sets the {@link Rollout} for this group
|
||||||
|
*/
|
||||||
void setRollout(Rollout rollout);
|
void setRollout(Rollout rollout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the current {@link RolloutGroupStatus} for this group
|
||||||
|
*/
|
||||||
RolloutGroupStatus getStatus();
|
RolloutGroupStatus getStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status
|
||||||
|
* the {@link RolloutGroupStatus} to set for this group
|
||||||
|
*/
|
||||||
void setStatus(RolloutGroupStatus status);
|
void setStatus(RolloutGroupStatus status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
RolloutGroup getParent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link RolloutGroupSuccessCondition} for this group to
|
||||||
|
* indicate when a group is successful
|
||||||
|
*/
|
||||||
RolloutGroupSuccessCondition getSuccessCondition();
|
RolloutGroupSuccessCondition getSuccessCondition();
|
||||||
|
|
||||||
void setSuccessCondition(RolloutGroupSuccessCondition finishCondition);
|
/**
|
||||||
|
* @param successCondition
|
||||||
|
* the {@link RolloutGroupSuccessCondition} to be set for this
|
||||||
|
* group to indicate when a group is successfully and a next
|
||||||
|
* group might be started
|
||||||
|
*/
|
||||||
|
void setSuccessCondition(RolloutGroupSuccessCondition successCondition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
String getSuccessConditionExp();
|
||||||
|
|
||||||
void setSuccessConditionExp(String finishExp);
|
/**
|
||||||
|
* @param successConditionExp
|
||||||
|
* sets a String represented expression which is evaluated by the
|
||||||
|
* {@link RolloutGroupSuccessCondition}, might be {@code null} if
|
||||||
|
* the set {@link RolloutGroupSuccessCondition} can handle
|
||||||
|
* {@code null} value
|
||||||
|
*/
|
||||||
|
void setSuccessConditionExp(String successConditionExp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link RolloutGroupErrorCondition} for this group to indicate
|
||||||
|
* when a group should marked as failed
|
||||||
|
*/
|
||||||
RolloutGroupErrorCondition getErrorCondition();
|
RolloutGroupErrorCondition getErrorCondition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param errorCondition
|
||||||
|
* the {@link RolloutGroupErrorCondition} to be set for this
|
||||||
|
* group to indicate when a group is marked as failed and the
|
||||||
|
* corresponding {@link RolloutGroupErrorAction} should be
|
||||||
|
* executed
|
||||||
|
*/
|
||||||
void setErrorCondition(RolloutGroupErrorCondition errorCondition);
|
void setErrorCondition(RolloutGroupErrorCondition errorCondition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
String getErrorConditionExp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param errorExp
|
||||||
|
* sets a String represented expression which is evaluated by the
|
||||||
|
* {@link RolloutGroupErrorCondition}, might be {@code null} if
|
||||||
|
* the set {@link RolloutGroupErrorCondition} can handle
|
||||||
|
* {@code null} value
|
||||||
|
*/
|
||||||
void setErrorConditionExp(String errorExp);
|
void setErrorConditionExp(String errorExp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
RolloutGroupErrorAction getErrorAction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param errorAction
|
||||||
|
* the {@link RolloutGroupErrorAction} to be set which should be
|
||||||
|
* executed if the {@link RolloutGroupErrorCondition} is met,
|
||||||
|
* might be {@code null} if no error action should be executed
|
||||||
|
*/
|
||||||
void setErrorAction(RolloutGroupErrorAction errorAction);
|
void setErrorAction(RolloutGroupErrorAction errorAction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
String getErrorActionExp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param errorActionExp
|
||||||
|
* sets a String represented expression which is evaluated by the
|
||||||
|
* {@link RolloutGroupErrorAction}, might be {@code null} if the
|
||||||
|
* set {@link RolloutGroupErrorAction} can handle {@code null}
|
||||||
|
* value
|
||||||
|
*/
|
||||||
void setErrorActionExp(String errorActionExp);
|
void setErrorActionExp(String errorActionExp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link RolloutGroupSuccessAction} which is executed if the
|
||||||
|
* {@link RolloutGroupSuccessCondition} is met
|
||||||
|
*/
|
||||||
RolloutGroupSuccessAction getSuccessAction();
|
RolloutGroupSuccessAction getSuccessAction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
String getSuccessActionExp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the total amount of targets containing in this group
|
||||||
|
*/
|
||||||
long getTotalTargets();
|
long getTotalTargets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class TargetWithActionStatus {
|
|||||||
|
|
||||||
private Target target;
|
private Target target;
|
||||||
|
|
||||||
private Status status = null;
|
private Status status;
|
||||||
|
|
||||||
public TargetWithActionStatus(final Target target) {
|
public TargetWithActionStatus(final Target target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class TargetWithActionType {
|
|||||||
if (actionType == ActionType.TIMEFORCED) {
|
if (actionType == ActionType.TIMEFORCED) {
|
||||||
return forceTime;
|
return forceTime;
|
||||||
}
|
}
|
||||||
return Constants.NO_FORCE_TIME;
|
return RepositoryModelConstants.NO_FORCE_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
http://www.eclipse.org/legal/epl-v10.html
|
http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
@@ -36,16 +35,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Hawkbit -->
|
<!-- Hawkbit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
@@ -95,6 +84,10 @@
|
|||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cz.jirutka.rsql</groupId>
|
||||||
|
<artifactId>rsql-parser</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -103,6 +96,16 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
@@ -158,10 +161,6 @@
|
|||||||
<artifactId>spring-security-web</artifactId>
|
<artifactId>spring-security-web</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>cz.jirutka.rsql</groupId>
|
|
||||||
<artifactId>rsql-parser</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.repository.jpa;
|
||||||
|
|
||||||
|
import org.springframework.cache.interceptor.KeyGenerator;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the interfaces to register the {@link KeyGenerator} as bean which is
|
||||||
|
* used by spring caching framework to resolve the key-generator. The
|
||||||
|
* key-generator must registered as bean so spring can resolve the key-generator
|
||||||
|
* by its name.
|
||||||
|
*
|
||||||
|
* When using the {@link Service} annotation e.g. by {@link JpaSystemManagement}
|
||||||
|
* the bean registration must be declared by the interface due spring registers
|
||||||
|
* the bean by the implemented interfaces. So introduce a single interface for
|
||||||
|
* the {@link JpaSystemManagement} implementation to allow it to register the
|
||||||
|
* key-generator bean.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface CurrentTenantCacheKeyGenerator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean declaration to register a {@code currentTenantKeyGenerator} bean
|
||||||
|
* which is used by the caching framework.
|
||||||
|
*
|
||||||
|
* @return the {@link KeyGenerator} to be used to cache the values of the
|
||||||
|
* current used tenant in the {@link JpaSystemManagement}
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
KeyGenerator currentTenantKeyGenerator();
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ import javax.persistence.criteria.CriteriaQuery;
|
|||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.Constants;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
@@ -216,7 +216,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
handleFinishedCancelation(actionStatus, action);
|
handleFinishedCancelation(actionStatus, action);
|
||||||
break;
|
break;
|
||||||
case RETRIEVED:
|
case RETRIEVED:
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// do nothing
|
// do nothing
|
||||||
@@ -230,7 +230,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
|
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
|
||||||
// in case of successful cancellation we also report the success at
|
// in case of successful cancellation we also report the success at
|
||||||
// the canceled action itself.
|
// the canceled action itself.
|
||||||
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
|
||||||
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
|
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
|
||||||
entityManager);
|
entityManager);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
|
|
||||||
return assignDistributionSetByTargetId((JpaDistributionSet) pset,
|
return assignDistributionSetByTargetId((JpaDistributionSet) pset,
|
||||||
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()),
|
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()),
|
||||||
ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME);
|
ActionType.FORCED, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
|||||||
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
|
||||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
|
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
|
||||||
return assignDistributionSet(dsID, ActionType.FORCED,
|
return assignDistributionSet(dsID, ActionType.FORCED,
|
||||||
org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME, targetIDs);
|
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME, targetIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
|
||||||
@Validated
|
@Validated
|
||||||
@Service
|
@Service
|
||||||
public class JpaSystemManagement implements SystemManagement {
|
public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, SystemManagement {
|
||||||
@Autowired
|
@Autowired
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class JpaTenantConfigurationManagement implements EnvironmentAware, Tenan
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TenantConfigurationValue<?> getConfigurationValue(final TenantConfigurationKey configurationKey) {
|
public <T> TenantConfigurationValue<T> getConfigurationValue(final TenantConfigurationKey configurationKey) {
|
||||||
return getConfigurationValue(configurationKey, configurationKey.getDataType());
|
return getConfigurationValue(configurationKey, configurationKey.getDataType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +147,7 @@ public class JpaTenantConfigurationManagement implements EnvironmentAware, Tenan
|
|||||||
final JpaTenantConfiguration updatedTenantConfiguration = tenantConfigurationRepository
|
final JpaTenantConfiguration updatedTenantConfiguration = tenantConfigurationRepository
|
||||||
.save(tenantConfiguration);
|
.save(tenantConfiguration);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
final Class<T> clazzT = (Class<T>) value.getClass();
|
final Class<T> clazzT = (Class<T>) value.getClass();
|
||||||
|
|
||||||
return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy())
|
return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy())
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository.jpa.cache;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
|
import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants for cache keys used in multiple classes.
|
* RepositoryConstants for cache keys used in multiple classes.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -842,7 +842,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
||||||
// assign ds to create an action
|
// assign ds to create an action
|
||||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
||||||
ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
|
ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||||
target.getControllerId());
|
target.getControllerId());
|
||||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||||
// verify preparation
|
// verify preparation
|
||||||
@@ -865,7 +865,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
||||||
// assign ds to create an action
|
// assign ds to create an action
|
||||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
||||||
ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
|
ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||||
target.getControllerId());
|
target.getControllerId());
|
||||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||||
// verify perparation
|
// verify perparation
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.repository.util;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.Constants;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
@@ -74,7 +74,7 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and two
|
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and two
|
||||||
* {@link SystemManagement#getTenantMetadata()};
|
* {@link SystemManagement#getTenantMetadata()};
|
||||||
*/
|
*/
|
||||||
protected static final int DEFAULT_DS_TYPES = Constants.DEFAULT_DS_TYPES_IN_TENANT + 1;
|
protected static final int DEFAULT_DS_TYPES = RepositoryConstants.DEFAULT_DS_TYPES_IN_TENANT + 1;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected EntityFactory entityFactory;
|
protected EntityFactory entityFactory;
|
||||||
|
|||||||
@@ -32,6 +32,14 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
|
|||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.eclipse.hawkbit.repository.model.Constants;
|
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||||
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
|
||||||
@@ -148,7 +148,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
|
|||||||
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
|
||||||
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
|
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
|
||||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||||
: Constants.NO_FORCE_TIME;
|
: RepositoryModelConstants.NO_FORCE_TIME;
|
||||||
|
|
||||||
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();
|
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
|||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.eclipse.hawkbit.repository.model.Constants;
|
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
@@ -465,7 +465,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
|
|||||||
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
|
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
|
||||||
.getValue()) == ActionTypeOption.AUTO_FORCED)
|
.getValue()) == ActionTypeOption.AUTO_FORCED)
|
||||||
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
|
||||||
: Constants.NO_FORCE_TIME;
|
: RepositoryModelConstants.NO_FORCE_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ActionType getActionType() {
|
private ActionType getActionType() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.utils;
|
package org.eclipse.hawkbit.ui.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants required for Button.
|
* RepositoryConstants required for Button.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.utils;
|
|||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants required for Label.
|
* RepositoryConstants required for Label.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.utils;
|
package org.eclipse.hawkbit.ui.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants required for Style.
|
* RepositoryConstants required for Style.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.utils;
|
package org.eclipse.hawkbit.ui.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants required for Target.
|
* RepositoryConstants required for Target.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user