in bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/helper/ComponentStageHelper.java [57:116]
public static List<Stage> createComponentStages(
Map<String, List<String>> componentHosts, List<Command> commands, CommandDTO commandDTO) {
List<Stage> stages = new ArrayList<>();
List<String> componentNames = new ArrayList<>(componentHosts.keySet());
List<String> todoList = getTodoList(componentNames, commands);
for (String componentCommand : todoList) {
String[] split = componentCommand.split("-");
String componentName = split[0].toLowerCase();
Command command = Command.valueOf(split[1].toUpperCase());
List<String> hostnames = componentHosts.get(componentName);
if (CollectionUtils.isEmpty(hostnames)) {
continue;
}
StageContext stageContext;
switch (command) {
case ADD:
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentAddStage(stageContext));
break;
case START:
if (!StackUtils.isClientComponent(componentName)) {
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentStartStage(stageContext));
}
break;
case STOP:
if (!StackUtils.isClientComponent(componentName)) {
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentStopStage(stageContext));
}
break;
case CHECK:
if (!StackUtils.isClientComponent(componentName)) {
stageContext = createStageContext(componentName, List.of(hostnames.get(0)), commandDTO);
stages.add(new ComponentCheckStage(stageContext));
}
break;
case CONFIGURE:
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentConfigureStage(stageContext));
break;
case INIT:
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentInitStage(stageContext));
break;
case PREPARE:
// Prepare phase runs after component started, client component shouldn't create this.
if (!StackUtils.isClientComponent(componentName)) {
stageContext = createStageContext(componentName, hostnames, commandDTO);
stages.add(new ComponentPrepareStage(stageContext));
}
break;
}
}
return stages;
}