Search in sources :

Example 1 with ProgressStatusBase

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);
    }
}
Also used : ProgressStatus(org.glassfish.api.admin.ProgressStatus) ProgressStatusBase(org.glassfish.api.admin.progress.ProgressStatusBase)

Example 2 with ProgressStatusBase

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);
        }
    });
}
Also used : ProgressStatusEvent(org.glassfish.api.admin.progress.ProgressStatusEvent) ProgressStatusBase(org.glassfish.api.admin.progress.ProgressStatusBase) ProgressStatusClient(com.sun.enterprise.admin.progress.ProgressStatusClient)

Aggregations

ProgressStatusBase (org.glassfish.api.admin.progress.ProgressStatusBase)2 ProgressStatusClient (com.sun.enterprise.admin.progress.ProgressStatusClient)1 ProgressStatus (org.glassfish.api.admin.ProgressStatus)1 ProgressStatusEvent (org.glassfish.api.admin.progress.ProgressStatusEvent)1