Search in sources :

Example 1 with ScriptExecutedEvent

use of com.cognifide.apm.core.services.event.ApmEvent.ScriptExecutedEvent in project APM by Cognifide.

the class ScriptManagerImpl method process.

@Override
public Progress process(Script script, final ExecutionMode mode, final Map<String, String> customDefinitions, ResourceResolver resolver) throws RepositoryException, PersistenceException {
    Progress progress;
    try {
        progress = execute(script, mode, customDefinitions, resolver);
    } catch (ExecutionException e) {
        progress = new ProgressImpl(resolver.getUserID());
        progress.addEntry(Status.ERROR, e.getMessage());
    }
    updateScriptProperties(script, mode, progress.isSuccess());
    versionService.updateVersionIfNeeded(resolver, script);
    saveHistory(script, mode, progress);
    eventManager.trigger(new ScriptExecutedEvent(script, mode, progress.isSuccess()));
    return progress;
}
Also used : ProgressImpl(com.cognifide.apm.core.progress.ProgressImpl) Progress(com.cognifide.apm.core.logger.Progress) ScriptExecutedEvent(com.cognifide.apm.core.services.event.ApmEvent.ScriptExecutedEvent) ExecutionException(com.cognifide.apm.api.exceptions.ExecutionException)

Aggregations

ExecutionException (com.cognifide.apm.api.exceptions.ExecutionException)1 Progress (com.cognifide.apm.core.logger.Progress)1 ProgressImpl (com.cognifide.apm.core.progress.ProgressImpl)1 ScriptExecutedEvent (com.cognifide.apm.core.services.event.ApmEvent.ScriptExecutedEvent)1