Interface ExecutionStrategy

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DefaultStrategy, PoolStrategy, StayOpenStrategy

public interface ExecutionStrategy extends AutoCloseable
ExifTool execution strategy.
For instance:
  • Execution using a one-shot process.
  • Execution using stay_open flag: this strategy means that a process is started and re-used for next executions.
Each implementation will define the main logic for reading and writing metadata (this is the main purpose for the execute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler) method.
Implementation should also define a close method: this method will be used to stop remaining process and clean previous execution. Calling close() method should not prevent instances to be used for a next execution.
  • Method Details

    • execute

      void execute(CommandExecutor executor, String exifTool, List<String> arguments, OutputHandler handler) throws IOException
      Execute exiftool command.
      Parameters:
      executor - ExifTool withExecutor.
      exifTool - ExifTool withPath.
      arguments - Command line arguments.
      handler - Handler to read command output.
      Throws:
      IOException - If an error occurred during execution.
    • isRunning

      boolean isRunning()
      Check if exiftool process is currently running. This method is important especially if stay_open flag has been enabled.
      Returns:
      true if exiftool process is currently open, false otherwise.
    • isSupported

      boolean isSupported(Version version)
      Check if this strategy should is supported with this specific version.
      Parameters:
      version - ExifTool Version.
      Returns:
      true if this strategy may be used safely with this specific version, false otherwise.
    • close

      void close() throws Exception
      This method should be used to:
      • Close remaining process (if any).
      • Clean previous executions.
      For instance, with the stay_open flag, this method should:
      • Close opened process.
      • Stop task used to automatically close process.
      Once closed, ExifTool should still be able to use this strategy if a call to execute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler) is made.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception - If an error occurred while stopping exiftool client.
    • shutdown

      void shutdown() throws Exception
      Shutdown the strategy.
      Throws:
      Exception - If an error occurred while stopping exiftool client.