Interface ExtensionValidator


  • @Role
    public interface ExtensionValidator
    Check if executing a given action on a passed extension is allowed.

    Mostly used for default behavior when ExtensionHandler does not have any special check for its type. The goal is to make easy for any environment using commons-extension module to have a default restriction on all extensions types (for example in XWiki unless the type has special checking you need programming right to install an extension).

    Since:
    4.2M2
    Version:
    $Id: dfa9ed14ccebd50bbf7305a1067f58dde656222f $
    • Method Detail

      • checkInstall

        void checkInstall​(Extension extension,
                          String namespace,
                          org.xwiki.job.Request request)
                   throws InstallException
        Check if installing the passed extension is allowed.

        It is generally used to do some non generic checking of whether or not it is possible to install the passed extension (not the right environment, not enough rights, etc.).

        Parameters:
        extension - the extension to install
        namespace - the namespace from where to install
        request - extra parameters
        Throws:
        InstallException - installing the extension will fail
      • checkUninstall

        void checkUninstall​(InstalledExtension extension,
                            String namespace,
                            org.xwiki.job.Request request)
                     throws UninstallException
        Check if uninstalling the passed extension is allowed.

        It is generally used to do some non generic checking of whether or not it is possible to uninstall the passed extension (not the right environment, not enough rights, etc.).

        Parameters:
        extension - the extension to uninstall
        namespace - the namespace from where to uninstall
        request - extra parameters
        Throws:
        UninstallException - uninstalling the extension will fail