com.anrisoftware.globalpom.exec.external.scriptprocess.ScriptExecFactory Maven / Gradle / Ivy
/*
* Copyright 2016 Erwin Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.anrisoftware.globalpom.exec.external.scriptprocess;
import java.util.Map;
import org.joda.time.Duration;
import com.anrisoftware.globalpom.exec.external.core.ProcessTask;
import com.anrisoftware.globalpom.exec.internal.runcommands.RunCommands;
import com.anrisoftware.globalpom.exec.internal.scriptprocess.AbstractProcessExec;
import com.anrisoftware.globalpom.threads.external.core.Threads;
import com.anrisoftware.resources.templates.external.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);
}