Interface InstallHook

  • All Known Implementing Classes:
    ExampleHook, ExampleOsgiHook

    @ConsumerType
    public interface InstallHook
    An install hook is used to do some pre and post work during a package install. the hooks need to have at least one class that implements this interface. the class is identified by the normal "Main-Class" manifest property and needs to be instantiatable. The instantiated hook class is used for the entire life-cycle of the installation process until the InstallContext.Phase.END phase. The hook jars need to be placed in the "META-INF/vault/hooks" directory and are executed in alphabetical sequence for each installation phase. A hook can throw a PackageException to abort the current phase, but this has currently only an effect in the InstallContext.Phase.PREPARE and InstallContext.Phase.INSTALLED phase. If a hook fails, the current phase is aborted and all hooks (also the failing one) are called again with the respective "fail" phase.
    • Method Detail

      • execute

        void execute​(InstallContext context)
              throws PackageException
        Executes hook specific code. This is called for each installation phase.
        Parameters:
        context - the installation context
        Throws:
        PackageException - if the hook desires to abort the current phase.