Class StayOpenStrategy
java.lang.Object
com.thebuzzmedia.exiftool.core.strategies.StayOpenStrategy
- All Implemented Interfaces:
ExecutionStrategy
,AutoCloseable
Execution strategy that use
exiftool
with the stay_open
feature.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 toExecutionStrategy.execute(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.protected void
finalize()
boolean
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.
-
Constructor Details
-
StayOpenStrategy
Create strategy. Scheduler provided in parameter will be used to clean resources (exiftool process).- Parameters:
scheduler
- Delay between automatic cleanup.
-
-
Method Details
-
execute
public void execute(CommandExecutor executor, String exifTool, List<String> arguments, OutputHandler handler) throws IOException Description copied from interface:ExecutionStrategy
Execute exiftool command.- Specified by:
execute
in interfaceExecutionStrategy
- 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
public boolean isRunning()Description copied from interface:ExecutionStrategy
Check if exiftool process is currently running. This method is important especially ifstay_open
flag has been enabled.- Specified by:
isRunning
in interfaceExecutionStrategy
- Returns:
true
ifexiftool
process is currently open,false
otherwise.
-
isSupported
Description copied from interface:ExecutionStrategy
Check if this strategy should is supported with this specific version.- Specified by:
isSupported
in interfaceExecutionStrategy
- Parameters:
version
- ExifTool Version.- Returns:
true
if this strategy may be used safely with this specific version,false
otherwise.
-
close
Description copied from interface:ExecutionStrategy
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.
ExecutionStrategy.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
- Specified by:
close
in interfaceExecutionStrategy
- Throws:
Exception
- If an error occurred while stopping exiftool client.
-
shutdown
Description copied from interface:ExecutionStrategy
Shutdown the strategy.- Specified by:
shutdown
in interfaceExecutionStrategy
- Throws:
Exception
- If an error occurred while stopping exiftool client.
-
finalize
-