Added targetToken to DMF update message.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-05-03 09:25:07 +02:00
parent 26b581e904
commit dbc70ae374
8 changed files with 47 additions and 24 deletions

View File

@@ -16,8 +16,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
/**
* Event that gets sent when a distribution set gets assigned to a target.
*
*
*
*/
public class TargetAssignDistributionSetEvent extends AbstractEvent {
@@ -25,6 +23,7 @@ public class TargetAssignDistributionSetEvent extends AbstractEvent {
private final String controllerId;
private final Long actionId;
private final URI targetAdress;
private final String targetToken;
/**
* Creates a new {@link TargetAssignDistributionSetEvent}.
@@ -41,14 +40,18 @@ public class TargetAssignDistributionSetEvent extends AbstractEvent {
* the software modules which have been assigned to the target
* @param targetAdress
* the targetAdress of the target
* @param targetToken
* the authentication token of the target
*/
public TargetAssignDistributionSetEvent(final long revision, final String tenant, final String controllerId,
final Long actionId, final Collection<SoftwareModule> softwareModules, final URI targetAdress) {
final Long actionId, final Collection<SoftwareModule> softwareModules, final URI targetAdress,
final String targetToken) {
super(revision, tenant);
this.controllerId = controllerId;
this.actionId = actionId;
this.softwareModules = softwareModules;
this.targetAdress = targetAdress;
this.targetToken = targetToken;
}
/**
@@ -77,4 +80,7 @@ public class TargetAssignDistributionSetEvent extends AbstractEvent {
return targetAdress;
}
public String getTargetToken() {
return targetToken;
}
}

View File

@@ -389,8 +389,8 @@ public class DeploymentManagement {
softwareModules));
}
private Action createTargetAction(final Map<String, TargetWithActionType> targetsWithActionMap, final Target target,
final DistributionSet set, final Rollout rollout, final RolloutGroup rolloutGroup) {
private static Action createTargetAction(final Map<String, TargetWithActionType> targetsWithActionMap,
final Target target, final DistributionSet set, final Rollout rollout, final RolloutGroup rolloutGroup) {
final Action actionForTarget = new Action();
final TargetWithActionType targetWithActionType = targetsWithActionMap.get(target.getControllerId());
actionForTarget.setActionType(targetWithActionType.getActionType());
@@ -421,13 +421,14 @@ public class DeploymentManagement {
afterCommit.afterCommit(() -> {
eventBus.post(new TargetInfoUpdateEvent(target.getTargetInfo()));
eventBus.post(new TargetAssignDistributionSetEvent(target.getOptLockRevision(), target.getTenant(),
target.getControllerId(), actionId, softwareModules, target.getTargetInfo().getAddress()));
target.getControllerId(), actionId, softwareModules, target.getTargetInfo().getAddress(),
target.getSecurityToken()));
});
}
/**
* Removes {@link UpdateAction}s that are no longer necessary and sends
* cancelations to the controller.
* cancellations to the controller.
*
* @param myTarget
* to override {@link UpdateAction}s