Class AbstractMagickCommand

java.lang.Object
org.onehippo.forge.gallerymagick.core.command.AbstractMagickCommand
Direct Known Subclasses:
GraphicsMagickCommand, ImageMagickCommand

public abstract class AbstractMagickCommand extends Object
Abstract *Magick Command.
  • Field Details

    • DEFAULT_SUBCOMMAND_CONVERT

      public static final String DEFAULT_SUBCOMMAND_CONVERT
      Default Graphics Magick command executable.
      See Also:
    • PROP_TIMEOUT

      public static final String PROP_TIMEOUT
      System property name for Graphics Magick command executable.
      See Also:
  • Constructor Details

    • AbstractMagickCommand

      public AbstractMagickCommand(String executable, String subCommand)
      Constructor with a sub-command.
      Parameters:
      executable - executable of Magick command
      subCommand - sub-command
  • Method Details

    • getWorkingDirectory

      public File getWorkingDirectory()
      Returns working directory.
      Returns:
      working directory
    • setWorkingDirectory

      public void setWorkingDirectory(File workingDirectory)
      Sets working directory
      Parameters:
      workingDirectory - working directory
    • getExecutable

      public String getExecutable()
      Returns the executable of Magick command.
      Returns:
      the executable of Magick command
    • getSubCommand

      public String getSubCommand()
      Returns the sub-command of Graphics Magick command.
      Returns:
      the sub-command of Graphics Magick command
    • getArguments

      public List<String> getArguments()
      Returns the command line arguments after the sub-command.
      Returns:
      the command line arguments after the sub-command
    • addArgument

      public void addArgument(String argument)
      Add a command line argument to Magick command.
      Parameters:
      argument - a command line argument to Magick command
    • clearArguments

      public void clearArguments()
      Remove all the Magick command line arguments.
    • execute

      public void execute() throws IOException
      Execute the Magick command with the sub-command and arguments.
      Throws:
      MagickExecuteException - if an execution exception occurs
      IOException - if IO exception occurs
    • execute

      public void execute(OutputStream stdOut) throws IOException
      Execute the Magick command with the sub-command and arguments.
      Parameters:
      stdOut - standard output stream
      Throws:
      MagickExecuteException - if an execution exception occurs
      IOException - if IO exception occurs
    • createCommandLine

      protected abstract org.apache.commons.exec.CommandLine createCommandLine()
      Create a CommandLine from executable and arguments.
      Returns:
      a CommandLine from executable and arguments