Package com.thebuzzmedia.exiftool
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.
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. Callingclose()
method should not prevent instances to be used for a next execution.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
This method should be used to: Close remaining process (if any). Clean previous executions. For instance, with thestay_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 toexecute(com.thebuzzmedia.exiftool.process.CommandExecutor, java.lang.String, java.util.List<java.lang.String>, com.thebuzzmedia.exiftool.process.OutputHandler)
is made.void
execute(CommandExecutor executor, String exifTool, List<String> arguments, OutputHandler handler)
Execute exiftool command.boolean
isRunning()
Check if exiftool process is currently running.boolean
isSupported(Version version)
Check if this strategy should is supported with this specific version.void
shutdown()
Shutdown the strategy.
-
-
-
Method Detail
-
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 ifstay_open
flag has been enabled.- Returns:
true
ifexiftool
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.
stay_open
flag, this method should:- Close opened process.
- Stop task used to automatically close process.
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 interfaceAutoCloseable
- Throws:
Exception
- If an error occurred while stopping exiftool client.
-
-