Class RemotePluginInstaller
- java.lang.Object
-
- com.identityworksllc.iiq.common.plugin.RemotePluginInstaller
-
public class RemotePluginInstaller extends Object
A utility to install plugins remotely using the IIQ REST API.This class can has no external dependencies, so can be isolated.
Usage: java com.identityworksllc.iiq.common.plugin.RemotePluginInstaller -p /path/to/properties install /path/to/file
Commands exit with a non-zero exit code when problems occur.
TODO when we migrate this library to minimum JDK 11, use the JDK HTTP client class
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRemotePluginInstaller.OutputLevelThe output level at which to print a messagestatic classRemotePluginInstaller.PluginA class representing the metadata of an installed plugin
-
Constructor Summary
Constructors Constructor Description RemotePluginInstaller(URI iiq, String username, char[] password)Constructs a new RemotePluginInstaller with the given connection info
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<RemotePluginInstaller.Plugin>getPlugin(String name)Gets the Plugin metadata for the plugin of the given namevoidinstallPlugin(Path toUpload)Installs a plugin remotely using base Java8 classesbooleanisPluginInstalled(String pluginName)Makes a query to the Suggest Service to check whether the plugin is installed.static voidmain(String[] args)The main method for this utility.static voidoutput(RemotePluginInstaller.OutputLevel level, String output, Object... variables)Outputs the message in question at the given output level.voiduninstallPlugin(String pluginName)Uninstall the plugin with the given name
-
-
-
Constructor Detail
-
RemotePluginInstaller
public RemotePluginInstaller(URI iiq, String username, char[] password)
Constructs a new RemotePluginInstaller with the given connection info- Parameters:
iiq- The URI of the IIQ serverusername- The username with which to connectpassword- The password belonging to that uer
-
-
Method Detail
-
main
public static void main(String[] args) throws Exception
The main method for this utility.Parses the command line arguments, validates them, and optionally prompts the user for a password. Then, executes the command specified if the inputs are valid.
- Parameters:
args- The arguments to the main method- Throws:
Exception- on any failures at all
-
output
public static void output(RemotePluginInstaller.OutputLevel level, String output, Object... variables)
Outputs the message in question at the given output level.The output level determines the prefix used.
- Parameters:
level- The output leveloutput- The output to printvariables- Any variables to substitute into the output
-
getPlugin
public Optional<RemotePluginInstaller.Plugin> getPlugin(String name) throws IOException
Gets the Plugin metadata for the plugin of the given name- Parameters:
name- The name of the plugin- Returns:
- The resulting plugin metadata, if it exists, or an empty Optional
- Throws:
IOException- if reading from the server fails
-
installPlugin
public void installPlugin(Path toUpload) throws IOException
Installs a plugin remotely using base Java8 classes- Parameters:
toUpload- The file to upload as a plugin- Throws:
IOException- on any send failures
-
isPluginInstalled
public boolean isPluginInstalled(String pluginName) throws IOException
Makes a query to the Suggest Service to check whether the plugin is installed.The Suggest service is used because the basic plugin query API does not support names or display names, whereas the Suggester can take a filter.
- Parameters:
pluginName- The plugin name- Returns:
- The suggest service
- Throws:
IOException- if any failures occur
-
uninstallPlugin
public void uninstallPlugin(String pluginName) throws IOException
Uninstall the plugin with the given name- Parameters:
pluginName- The name of the plugin- Throws:
IOException- If the de-installation operation fails
-
-