Class PromaPluginUpdateCheck


  • public class PromaPluginUpdateCheck
    extends Object
    This class has several methods for processing plugin information to get update information about plugins from PROMA and process it further. It is mainly used to generate information for the plugin management ui, as well as to generate update messages.
    • Constructor Detail

      • PromaPluginUpdateCheck

        public PromaPluginUpdateCheck()
    • Method Detail

      • createPluginUpdateMessages

        public static <R> StageChain<List<PluginUpdateCheckResult>,​R> createPluginUpdateMessages​(IPublicPromaInvocationContext pc,
                                                                                                       boolean forceUpdate)
        This method generates all update notifications in the database for all existing client plugins and system plugins that needs an update.

        Note: For security reasons, when sending requests via the user's browser, the update check is restricted to those scopes (system or client) for which the user from the given invocation context has access to the plugin menu.

        Parameters:
        pc - Context to use for accessing the PROMA API.
        forceUpdate - When true, always check for updates. When false, do not check for updates when a check was performed recently.
        Returns:
        A list of results of the plugin update check.
      • createPluginUpdateMessages

        public static <R> StageChain<List<PluginUpdateCheckResult>,​R> createPluginUpdateMessages​(IPublicPromaInvocationContext pc,
                                                                                                       Set<WorkspaceScope> scopes)
        This method generates all update notifications in the database for all existing client plugins and system plugins that needs an update. Note: For security reasons, when sending requests via the user's browser, the update check is restricted to those scopes (system or client) for which the user from the given invocation context has access to the plugin menu.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        scopes - Scopes where to check for plugin updates. When empty, no check is performed.
        Returns:
        A list of results of the plugin update check.
      • fetchPluginUpdateStatus

        public static <R> StageChain<org.apache.commons.lang3.tuple.Pair<EPluginUpdateAvailability,​String>,​R> fetchPluginUpdateStatus​(IPublicPromaInvocationContext pc,
                                                                                                                                                  String pluginKey,
                                                                                                                                                  Locale locale,
                                                                                                                                                  PluginManifest manifest,
                                                                                                                                                  PluginRuntime runtime,
                                                                                                                                                  String licenseKey)
        This method retrieves the update status of the specified plugin.
        Parameters:
        pc - Context for accessing the PROMA API.
        pluginKey - the plugin key of the plugin
        locale - the locale for the informations
        manifest - Manifest of the plugin.
        runtime - the runtime of the plugin
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the update status enum
      • findPluginScopesToCheckForUpdates

        public static Set<WorkspaceScope> findPluginScopesToCheckForUpdates​(IEntityContext ec,
                                                                            IUser user,
                                                                            boolean forceUpdate)
        Finds all client or system scopes for which the user is allowed to check for plugin updates.
        Parameters:
        ec - Entity context to use for accessing the database.
        user - User for which to perform the check.
        forceUpdate - When true, always check for updates. When false, do not check for updates when a check was performed recently.
        Returns:
        A list of scopes for which to check for updates.
      • findPluginScopesToCheckForUpdates

        public static Set<WorkspaceScope> findPluginScopesToCheckForUpdates​(IPublicPromaInvocationContext pc,
                                                                            boolean forceUpdate)
        Finds all client or system scopes for which the user from the given context is allowed to check for plugin updates.
        Parameters:
        pc - Context for accessing the PROMA API.
        forceUpdate - When true, always check for updates. When false, do not check for updates when a check was performed recently.
        Returns:
        A list of scopes for which to check for updates.
      • getAvailabilityInProma

        public static EPluginUpdateAvailability getAvailabilityInProma​(PluginManifest manifest)
        This method returns whether the plugin should be present in the Proma plugin store or not based on the manifest of a plugin, which was not detected by the plugin update availability check.
        Parameters:
        manifest - of the plugin to check
        Returns:
        the EPluginUpdateAvailability for the plugin. Either it has "xfc-proma" in the manifest entry "plugin repository", with which the plugin should exist in the Proma plugin store but it did not (EPluginUpdateAvailability.UNKNOWN), or it has no entry in the manifest, with which it has the update availability EPluginUpdateAvailability.UNSYNCHED has.
      • getMostRecentCompatiblePluginFiles

        public static <R> StageChain<TempFile,​R> getMostRecentCompatiblePluginFiles​(IPublicPromaInvocationContext pc,
                                                                                          String pluginKey,
                                                                                          PluginManifest manifest,
                                                                                          String licenseKey,
                                                                                          Locale locale)
        This method returns a ZIP file containing all plugin files of the latest plugin version.
        Parameters:
        pc - Context for accessing the PROMA API.
        pluginKey - the key of the plugin
        manifest - the manifest of the plugin
        licenseKey - the license key of the current license. This could be either the system license or a client license.
        locale - the locale for the localized plugin informations
        Returns:
        A ZIP file with all plugin files of the latest plugin version. Returns null if the plugin key is null.
      • getMostRecentCompatiblePluginStoreItem

        public static <R> StageChain<de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult,​R> getMostRecentCompatiblePluginStoreItem​(IPublicPromaInvocationContext pc,
                                                                                                                                                             String pluginKey,
                                                                                                                                                             PluginManifest manifest,
                                                                                                                                                             Locale locale,
                                                                                                                                                             String licenseKey)
        This method returns the updated store item update check result of a given plugin.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        pluginKey - the key of the plugin
        manifest - the manifest of the plugin
        locale - the locale for localized plugin informations
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the update check result of the given plugin. Returns null when the plugin was not found in the remote repository.
      • getUpdateCheckResultMap

        public static <R> StageChain<de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResultMap,​R> getUpdateCheckResultMap​(IPublicPromaInvocationContext pc,
                                                                                                                                                 List<de.xima.proma.restclient.pub.gen.model.PublicStoreItemMetaResource> metaResourcesList,
                                                                                                                                                 Locale locale,
                                                                                                                                                 String licenseKey)
        This method returns data about the update availability of the given plugins in the list of PublicStoreItemMetaResource.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        metaResourcesList - list of store item meta data for the creation of meta list.
        locale - the locale for localized plugin informations
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the update check result of the given plugin. Returns null when the plugin was not found in the remote repository.
      • getPluginKey

        public static String getPluginKey​(String pluginKey,
                                          PluginManifest manifest)
        This method returns the available plugin key. If no plugin key is specified, the manifest is searched for a plugin key.
        Parameters:
        pluginKey - the plugin key of the plugin
        manifest - the manifest of the plugin
        Returns:
        The plugin key when it was given or from the manifest. Returns an empty string when no plugin key was found.
      • getPluginMetadata

        public static <R> StageChain<PluginUpdateMetadata,​R> getPluginMetadata​(IPublicPromaInvocationContext pc,
                                                                                     String pluginKey,
                                                                                     Locale locale,
                                                                                     PluginManifest manifest,
                                                                                     PluginRuntime runtime,
                                                                                     String licenseKey)
        This method returns a model class for caching the plugin meta data based on the plugin data passed.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        pluginKey - the plugin key of the plugin
        locale - the locale for localized plugin informations
        manifest - The plugin's manifest file.
        runtime - the runtime of the plugin
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the plugin update meta data for caching the plugin informations
      • getPluginMetadata

        public static <R> StageChain<PluginUpdateMetadata,​R> getPluginMetadata​(IPublicPromaInvocationContext pc,
                                                                                     String pluginKey,
                                                                                     Locale locale,
                                                                                     PluginManifest manifest,
                                                                                     PluginRuntime runtime,
                                                                                     de.xima.proma.restclient.pub.gen.model.PublicStoreItemResource storeItem,
                                                                                     String licenseKey)
        This method returns a model class for caching the plugin meta data based on the plugin data passed.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        pluginKey - the plugin key of the plugin
        locale - the locale for localized plugin informations
        manifest - The plugin's manifest file.
        runtime - the runtime of the plugin
        storeItem - given item out of the proma store
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the plugin update meta data for caching the plugin informations
      • getPluginName

        public static <R> StageChain<String,​R> getPluginName​(IPublicPromaInvocationContext pc,
                                                                   String pluginKey,
                                                                   PluginManifest manifest,
                                                                   Locale locale,
                                                                   String licenseKey)
        This method returns the localized plugin name from proma. When no plugin key is given, the manifest is searched for a plugin key.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        pluginKey - the key of the plugin
        manifest - the manifest of the plugin
        locale - the locale for localized plugin name
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the plugin name of proma plugin store item
      • isPromaRepo

        public static boolean isPromaRepo​(PluginManifest manifest)
      • getPluginPromaItem

        public static <R> StageChain<de.xima.proma.restclient.pub.gen.model.PublicStoreItemResource,​R> getPluginPromaItem​(IPublicPromaInvocationContext pc,
                                                                                                                                String pluginKey,
                                                                                                                                PluginManifest manifest,
                                                                                                                                Locale locale,
                                                                                                                                String licenseKey)
        This method gives the proma store item from the plugin store of the given plugin key. When no plugin key is given, the manifest is searched for the key.
        Parameters:
        pc - Context to use for accessing the PROMA API.
        pluginKey - the plugin key of the plugin
        manifest - the manifest of the plugin
        locale - the locale for localized plugin informations
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        PublicStoreItemResource which represents the API response of rest method
      • getUpdateAvailabilityFromUpdateCheckResult

        public static EPluginUpdateAvailability getUpdateAvailabilityFromUpdateCheckResult​(de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result)
        This method returns the EPluginUpdateAvailability by means of the given PublicStoreItemUpdateCheckResult.
        Parameters:
        result - with data about update check of a proma plugin.
        Returns:
        update availability
      • getPluginVersionItem

        public static <R> StageChain<de.xima.proma.restclient.pub.gen.model.PublicStoreItemVersionResource,​R> getPluginVersionItem​(IPublicPromaInvocationContext pc,
                                                                                                                                         String pluginKey,
                                                                                                                                         PluginManifest manifest,
                                                                                                                                         Locale locale,
                                                                                                                                         String licenseKey)
        This method gives plugin store item from proma of the plugin version of given plugin.
        Parameters:
        pluginKey - the key of the plugin
        manifest - the manifest of the plugin
        locale - the locale for localized plugin informations
        licenseKey - the license key of the current license. This could be either the system license or a client
        Returns:
        the plugin store item from proma. Return null when no plugin was found with the given informations.