com.anrisoftware.globalpom.exec.scriptprocess.ScriptExecFactory Maven / Gradle / Ivy
/*
* Copyright 2014-2015 Erwin Müller
*
* This file is part of globalpomutils-exec.
*
* globalpomutils-exec is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* globalpomutils-exec is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with globalpomutils-exec. If not, see .
*/
package com.anrisoftware.globalpom.exec.scriptprocess;
import java.util.Map;
import org.joda.time.Duration;
import com.anrisoftware.globalpom.exec.api.ProcessTask;
import com.anrisoftware.globalpom.exec.runcommands.RunCommands;
import com.anrisoftware.globalpom.threads.api.Threads;
import com.anrisoftware.resources.templates.api.TemplateResource;
/**
* Factory to create the script exec.
*
* @author Erwin Mueller, [email protected]
* @since 2.3
*/
public interface ScriptExecFactory {
/**
* Create the script exec.
*
* @param args
* the {@link Map} arguments:
*
*
* - {@code log} the logger that logs the command output;
*
*
- {@code runCommands} optionally, set to the
* {@link RunCommands} to record the command.
*
*
- {@code outString} optionally, set to {@code true} to save
* the output in a {@link String} for later parsing, see
* {@link ProcessTask#getOut()};
*
*
- {@code errString} optionally, set to {@code true} to save
* the error output in a {@link String} for later parsing, see
* {@link ProcessTask#getErr()}. Per default it is set to
* {@link AbstractProcessExec#ERR_STRING_DEFAULT}.
*
*
- {@code timeout} optionally, set the timeout
* {@link Duration};
*
*
- {@code destroyOnTimeout} optionally, set to {@code true}
* to destroy the process on timeout;
*
*
- {@code checkExitCodes} optionally, set to {@code true} to
* check the exit code(s) of the process;
*
*
- {@code exitCodes} optionally, set an int-array of success
* exit codes;
*
*
- {@code exitCode} optionally, set the success exit code of
* the process;
*
*
* @param parent
* the {@link Object} parent script.
*
* @param threads
* the {@link Threads} pool.
*
* @param templateResource
* the {@link TemplateResource}.
*
* @param name
* the {@link String} name.
*
* @return the {@link ScriptExec}.
*/
ScriptExec create(Map args, Object parent, Threads threads,
TemplateResource templateResource, String name);
}