001/* 002 * (C) Copyright 2006-2013 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 */ 018 019package org.nuxeo.ecm.platform.commandline.executor.service.executors; 020 021import org.nuxeo.ecm.platform.commandline.executor.api.CmdParameters; 022import org.nuxeo.ecm.platform.commandline.executor.api.ExecResult; 023import org.nuxeo.ecm.platform.commandline.executor.service.CommandLineDescriptor; 024import org.nuxeo.ecm.platform.commandline.executor.service.EnvironmentDescriptor; 025 026/** 027 * Interface for class that provide a way to execute a {@link CommandLineDescriptor}. 028 * 029 * @author tiry 030 */ 031public interface Executor { 032 033 /** 034 * No exception is thrown but the returned {@link ExecResult} contains everything about the command execution, 035 * including an optional exception. 036 * 037 * @param cmdDesc Command to run. Cannot be null. 038 * @param params Parameters passed to the command. Cannot be null. 039 * @return Result of the execution 040 * @deprecated Since 7.4. Prefer use of {@link #exec(CommandLineDescriptor, CmdParameters, EnvironmentDescriptor)} 041 */ 042 @Deprecated 043 ExecResult exec(CommandLineDescriptor cmdDesc, CmdParameters params); 044 045 /** 046 * No exception is thrown but the returned {@link ExecResult} contains everything about the command execution, 047 * including an optional exception. 048 * 049 * @param cmdDesc Command to run. Cannot be null. 050 * @param params Parameters passed to the command. Cannot be null. 051 * @param env Environment context (variable and working directory) 052 * @return Result of the execution 053 * @since 7.4 054 */ 055 ExecResult exec(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env); 056 057}