public abstract class ExecutionSystemProvider extends Object implements com.palantir.giraffe.internal.SchemeIdentifiable
Commands
class will typically
delegate to an instance of this class.
An execution system provider is a concrete implementation of this class that
has a zero argument constructor. Providers are identified by their
URI
scheme
. URI schemes are case-insensitive.
The default provider is identified by the URI scheme "exec". It creates the
ExecutionSystem
that executes commands on the host running the Java
Virtual Machine.
A provider is a factory for one or more ExecutionSystem
instances.
Each system is identified by a URI
with a scheme that matches this
provider's scheme. For example, the default execution system is identified by
the URI exec:///
. Other providers may define more complex URI schemes
that include host information or query strings.
Providers are loaded using the standard service-loading functionality
implemented by the ServiceLoader
class. Providers are loaded using
the system class loader. If the system class loader cannot be found then the
extension class loader is used; if there is no extension class loader then
the bootstrap class loader is used. Providers are typically installed by
adding a JAR file to the application's classpath. The JAR file contains a
configuration file named
com.palantir.giraffe.command.spi.ExecutionSystemProvider
in the
resource directory META-INF/services
. This file lists one or more
fully qualified names of concrete implementations of this class. The order of
loaded providers is implementation specific. If two providers have the same
URI scheme the most recently loaded duplicate is discarded.
All of the methods in this class are safe for use by multiple threads.
Constructor and Description |
---|
ExecutionSystemProvider() |
Modifier and Type | Method and Description |
---|---|
abstract CommandFuture |
execute(Command command,
CommandContext context) |
abstract ExecutionSystem |
getExecutionSystem(URI uri) |
static List<ExecutionSystemProvider> |
installedProviders() |
abstract ExecutionSystem |
newExecutionSystem(URI uri,
Map<String,?> env) |
public static List<ExecutionSystemProvider> installedProviders()
public abstract ExecutionSystem newExecutionSystem(URI uri, Map<String,?> env) throws IOException
IOException
public abstract ExecutionSystem getExecutionSystem(URI uri)
public abstract CommandFuture execute(Command command, CommandContext context)