use of org.glassfish.api.admin.progress.ProgressStatusBase 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.progress.ProgressStatusBase in project Payara by payara.
the class CommandRunnerProgressHelper method connectWithClientProgressStatus.
private void connectWithClientProgressStatus(Job commandInstance, ProgressStatus clientProgressStatus) {
if (clientProgressStatus == null) {
return;
}
final ProgressStatusClient psc = new ProgressStatusClient(clientProgressStatus);
commandInstance.getEventBroker().registerListener(CommandProgress.EVENT_PROGRESSSTATUS_STATE, new AdminCommandEventBroker.AdminCommandListener<ProgressStatusBase>() {
@Override
public void onAdminCommandEvent(String name, ProgressStatusBase event) {
psc.mirror(event);
}
});
commandInstance.getEventBroker().registerListener(CommandProgress.EVENT_PROGRESSSTATUS_CHANGE, new AdminCommandEventBroker.AdminCommandListener<ProgressStatusEvent>() {
@Override
public void onAdminCommandEvent(String name, ProgressStatusEvent event) {
psc.mirror(event);
}
});
}
Aggregations