001/*
002 * (C) Copyright 2006-2015 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 */
018package org.nuxeo.ecm.platform.picture.magick;
019
020import org.nuxeo.ecm.platform.commandline.executor.api.CmdParameters;
021import org.nuxeo.ecm.platform.commandline.executor.api.CommandLineExecutorService;
022import org.nuxeo.ecm.platform.commandline.executor.api.CommandNotAvailable;
023import org.nuxeo.ecm.platform.commandline.executor.api.ExecResult;
024import org.nuxeo.runtime.api.Framework;
025
026/**
027 * Helper class to execute an ImageMagic command. Depends on the {@link CommandLineExecutorService} to run external
028 * processes.
029 *
030 * @author tiry
031 */
032public class MagickExecutor {
033
034    /**
035     * @deprecated Since 7.4. Useless.
036     */
037    @Deprecated
038    protected static ExecResult execCommand(String commandName, CmdParameters params) throws CommandNotAvailable {
039        CommandLineExecutorService cles = Framework.getLocalService(CommandLineExecutorService.class);
040        return cles.execCommand(commandName, params);
041    }
042
043    /**
044     * @deprecated since 5.6. Quoting file paths is done by {@link CmdParameters}.
045     */
046    @Deprecated
047    protected static String formatFilePath(String filePath) {
048        return String.format("\"%s\"", filePath);
049    }
050
051}