use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class StartFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(STACK_START_EVENT.event(), event.getStackId(), event.accepted()));
flowEventChain.add(new StackEvent(CLUSTER_START_EVENT.event(), event.getStackId()));
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class StopFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(CLUSTER_STOP_EVENT.event(), event.getStackId(), event.accepted()));
flowEventChain.add(new StackEvent(STACK_STOP_EVENT.event(), event.getStackId()));
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class TerminationFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(TerminationEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(ClusterTerminationEvent.TERMINATION_EVENT.event(), event.getStackId(), null));
flowEventChain.add(new TerminationEvent(StackTerminationEvent.TERMINATION_EVENT.event(), event.getStackId(), event.getForced(), event.getDeleteDependencies()));
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class UpgradeFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(CLUSTER_STOP_EVENT.event(), event.getStackId()));
flowEventChain.add(new StackEvent(CLUSTER_UPGRADE_EVENT.event(), event.getStackId()));
flowEventChain.add(new StackEvent(CLUSTER_START_EVENT.event(), event.getStackId()));
return flowEventChain;
}
use of com.sequenceiq.cloudbreak.cloud.event.Selectable in project cloudbreak by hortonworks.
the class DownscaleFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public Queue<Selectable> createFlowTriggerEventQueue(ClusterAndStackDownscaleTriggerEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
ClusterScaleTriggerEvent cste;
cste = event.getHostNames() == null ? new ClusterDownscaleTriggerEvent(DECOMMISSION_EVENT.event(), event.getStackId(), event.getHostGroupName(), event.getAdjustment(), event.accepted()) : new ClusterDownscaleTriggerEvent(DECOMMISSION_EVENT.event(), event.getStackId(), event.getHostGroupName(), event.getHostNames(), event.accepted());
flowEventChain.add(cste);
if (event.getScalingType() == ScalingType.DOWNSCALE_TOGETHER) {
StackView stackView = stackService.getByIdView(event.getStackId());
HostGroup hostGroup = hostGroupService.getByClusterIdAndName(stackView.getClusterView().getId(), event.getHostGroupName());
Constraint hostGroupConstraint = hostGroup.getConstraint();
String instanceGroupName = Optional.ofNullable(hostGroupConstraint.getInstanceGroup()).map(InstanceGroup::getGroupName).orElse(null);
StackScaleTriggerEvent sste;
sste = event.getHostNames() == null ? new StackDownscaleTriggerEvent(STACK_DOWNSCALE_EVENT.event(), event.getStackId(), instanceGroupName, event.getAdjustment()) : new StackDownscaleTriggerEvent(STACK_DOWNSCALE_EVENT.event(), event.getStackId(), instanceGroupName, event.getHostNames());
flowEventChain.add(sste);
}
return flowEventChain;
}
Aggregations