Search in sources :

Example 1 with ProgressStatusEventCreateChild

use of org.glassfish.api.admin.progress.ProgressStatusEventCreateChild in project Payara by payara.

the class CommandProgressImpl method createMirroringChild.

@Override
public synchronized ProgressStatusMirroringImpl createMirroringChild(int allocatedSteps) {
    allocateStapsForChildProcess(allocatedSteps);
    String childId = (id == null ? "" : id) + "." + (children.size() + 1);
    ProgressStatusMirroringImpl result = new ProgressStatusMirroringImpl(null, this, childId);
    children.add(new ChildProgressStatus(allocatedSteps, result));
    fireEvent(new ProgressStatusEventCreateChild(id, null, result.getId(), allocatedSteps, -1));
    return result;
}
Also used : ProgressStatusEventCreateChild(org.glassfish.api.admin.progress.ProgressStatusEventCreateChild) ProgressStatusMirroringImpl(org.glassfish.api.admin.progress.ProgressStatusMirroringImpl)

Example 2 with ProgressStatusEventCreateChild

use of org.glassfish.api.admin.progress.ProgressStatusEventCreateChild in project Payara by payara.

the class ProgressStatusEventJsonProprietaryReader method readProgressStatusEvent.

public static ProgressStatusEvent readProgressStatusEvent(JsonParser jp) throws IOException {
    String id = null;
    JsonToken token = null;
    ProgressStatusEvent result = null;
    while ((token = jp.nextToken()) != JsonToken.END_OBJECT) {
        if (token == JsonToken.START_OBJECT) {
            String nm = jp.getCurrentName();
            if ("set".equals(nm)) {
                result = new ProgressStatusEventSet(id);
                readToPSEventSet((ProgressStatusEventSet) result, jp);
            } else if ("progres".equals(nm)) {
                result = new ProgressStatusEventProgress(id);
                readToPSEventProgress((ProgressStatusEventProgress) result, jp);
            } else if ("complete".equals(nm)) {
                result = new ProgressStatusEventComplete(id);
                readToPSEventComplete((ProgressStatusEventComplete) result, jp);
            } else if ("create-child".equals(nm)) {
                result = new ProgressStatusEventCreateChild(id);
                readToPSEventCreateChild((ProgressStatusEventCreateChild) result, jp);
            }
        } else {
            String fieldname = jp.getCurrentName();
            if ("id".equals(fieldname)) {
                // move to value
                jp.nextToken();
                id = jp.getText();
            }
        }
    }
    return result;
}
Also used : ProgressStatusEventComplete(org.glassfish.api.admin.progress.ProgressStatusEventComplete) ProgressStatusEventCreateChild(org.glassfish.api.admin.progress.ProgressStatusEventCreateChild) ProgressStatusEvent(org.glassfish.api.admin.progress.ProgressStatusEvent) JsonToken(com.fasterxml.jackson.core.JsonToken) ProgressStatusEventProgress(org.glassfish.api.admin.progress.ProgressStatusEventProgress) ProgressStatusEventSet(org.glassfish.api.admin.progress.ProgressStatusEventSet)

Example 3 with ProgressStatusEventCreateChild

use of org.glassfish.api.admin.progress.ProgressStatusEventCreateChild in project Payara by payara.

the class ProgressStatusClient method mirror.

/**
 * Applies event on existing structures. If not appliable do nothing.
 */
public synchronized void mirror(ProgressStatusEvent event) {
    if (event == null) {
        return;
    }
    ProgressStatus effected = map.get(event.getSourceId());
    ProgressStatus result = event.apply(effected);
    if (event instanceof ProgressStatusEventCreateChild) {
        map.put(((ProgressStatusEventCreateChild) event).getChildId(), result);
    }
}
Also used : ProgressStatusEventCreateChild(org.glassfish.api.admin.progress.ProgressStatusEventCreateChild) ProgressStatus(org.glassfish.api.admin.ProgressStatus)

Aggregations

ProgressStatusEventCreateChild (org.glassfish.api.admin.progress.ProgressStatusEventCreateChild)3 JsonToken (com.fasterxml.jackson.core.JsonToken)1 ProgressStatus (org.glassfish.api.admin.ProgressStatus)1 ProgressStatusEvent (org.glassfish.api.admin.progress.ProgressStatusEvent)1 ProgressStatusEventComplete (org.glassfish.api.admin.progress.ProgressStatusEventComplete)1 ProgressStatusEventProgress (org.glassfish.api.admin.progress.ProgressStatusEventProgress)1 ProgressStatusEventSet (org.glassfish.api.admin.progress.ProgressStatusEventSet)1 ProgressStatusMirroringImpl (org.glassfish.api.admin.progress.ProgressStatusMirroringImpl)1