Package org.deepsymmetry.libcarabiner
Class Runner
- java.lang.Object
-
- org.deepsymmetry.libcarabiner.Runner
-
public class Runner extends Object
Manages the extraction of a compatible version of the Carabiner executable for the current platform, as well as starting and stopping the process when needed, with appropriate command-line arguments, and logs any output or errors produced by the process.
Created by James Elliott on 2020-01-18.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRunCarabiner()
Checks whether it will be possible to run Carabiner on the current computer.String
getExecutableName()
Determines the name by which a Carabiner binary compatible with the current operating system and processor architecture would be identified.static Runner
getInstance()
Get the singleton instance of this class.void
setPort(int carabinerPort)
Set the port on which the managed Carabiner instance should listen.void
setUpdateInterval(int interval)
Set the minimum interval between updates delivered by Carabiner when changes are occurring on the Link session.void
start()
Start our managed Carabiner instance running if it isn't already.void
stop()
Shut down our managed Carabiner instance if it is running.
-
-
-
Method Detail
-
getInstance
public static Runner getInstance()
Get the singleton instance of this class.- Returns:
- the only instance of this class that exists.
-
getExecutableName
public String getExecutableName()
Determines the name by which a Carabiner binary compatible with the current operating system and processor architecture would be identified.- Returns:
- the name of the resource holding the compatible binary, if one can be found.
-
canRunCarabiner
public boolean canRunCarabiner()
Checks whether it will be possible to run Carabiner on the current computer.- Returns:
true
if we expect to be able to extract and run a compatible Carabiner binary.
-
setPort
public void setPort(int carabinerPort)
Set the port on which the managed Carabiner instance should listen. The default value is 17000.- Parameters:
carabinerPort
- the TCP port that we will attempt to configure Carabiner to use.- Throws:
IllegalArgumentException
- ifcarabinerPort
is less than 1 or greater than 32767IllegalStateException
- if our Carabiner instance is already running when this method is called
-
setUpdateInterval
public void setUpdateInterval(int interval)
Set the minimum interval between updates delivered by Carabiner when changes are occurring on the Link session. The default value is 20, to deliver updates up to fifty times per second.- Parameters:
interval
- the number of milliseconds carabiner will wait from the last time it delivered a session update message to send the next if there has been another change.- Throws:
IllegalArgumentException
- ifinterval
is less than 1 or greater than 1000IllegalStateException
- if our Carabiner instance is already running when this method is called
-
start
public void start() throws IOException
Start our managed Carabiner instance running if it isn't already.- Throws:
IOException
- if there is a problem creating the Carabiner process.
-
stop
public void stop()
Shut down our managed Carabiner instance if it is running.
-
-