Class 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

    • 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 server
        username - The username with which to connect
        password - 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 level
        output - The output to print
        variables - Any variables to substitute into the output
      • 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