use of org.glassfish.api.admin.ProgressStatus in project Payara by payara.
the class ProgressStatusClient method mirror.
private void mirror(ProgressStatusDTO dto, ProgressStatus stat) {
// TODO: copy-paste problem because of ProgressStatusDTO and ProgressStatusBase we have to create shared interface
stat.setTotalStepCount(dto.getTotalStepCount());
stat.setCurrentStepCount(dto.getCurrentStepCount());
if (dto.isCompleted()) {
stat.complete();
}
for (ProgressStatusDTO.ChildProgressStatusDTO chld : dto.getChildren()) {
ProgressStatus dst = map.get(chld.getProgressStatus().getId());
if (dst == null) {
dst = stat.createChild(chld.getProgressStatus().getName(), chld.getAllocatedSteps());
map.put(chld.getProgressStatus().getId(), dst);
}
mirror(chld.getProgressStatus(), dst);
}
}
use of org.glassfish.api.admin.ProgressStatus in project Payara by payara.
the class ProgressStatusClient method mirror.
private void mirror(ProgressStatusBase source, ProgressStatus stat) {
stat.setTotalStepCount(source.getTotalStepCount());
stat.setCurrentStepCount(source.getCurrentStepCount());
if (source.isComplete()) {
stat.complete();
}
for (ProgressStatusBase.ChildProgressStatus chld : source.getChildProgressStatuses()) {
ProgressStatus dst = map.get(chld.getProgressStatus().getId());
if (dst == null) {
dst = stat.createChild(chld.getProgressStatus().getName(), chld.getAllocatedSteps());
map.put(chld.getProgressStatus().getId(), dst);
}
mirror(chld.getProgressStatus(), dst);
}
}
use of org.glassfish.api.admin.ProgressStatus in project Payara by payara.
the class ProgressStepBackCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ProgressStatus ps = context.getProgressStatus();
ps.progress("Parsing");
doSomeLogic();
ps.progress(1, "Working on main part");
for (int i = 0; i < 3; i++) {
doSomeLogic();
ps.progress(1);
}
ps.progress("Error in processing - next try");
ps.setCurrentStepCount(2);
for (int i = 0; i < 2; i++) {
doSomeLogic();
ps.progress(1);
}
doSomeLogic();
ps.progress(1);
ps.complete("Finished");
context.getActionReport().appendMessage("All done");
}
use of org.glassfish.api.admin.ProgressStatus in project Payara by payara.
the class SupplementAfter method execute.
@Override
public void execute(AdminCommandContext context) {
ProgressStatus ps = context.getProgressStatus();
ps.progress("3 seconds supplemental");
for (int i = 0; i < 6; i++) {
try {
Thread.sleep(500L);
} catch (InterruptedException ex) {
}
ps.progress(1);
}
context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS);
ps.complete();
}
use of org.glassfish.api.admin.ProgressStatus in project Payara by payara.
the class ProgressSimpleCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ProgressStatus ps = context.getProgressStatus();
if (!noTotalSteps) {
ps.setTotalStepCount(10);
}
ps.progress("Parsing");
doSomeLogic();
ps.progress(1, "Working on main part");
for (int i = 0; i < 7; i++) {
doSomeLogic();
ps.progress(1);
}
ps.progress(1, "Cleaning");
doSomeLogic();
ps.complete("Finished");
context.getActionReport().appendMessage("All done");
}
Aggregations