Package de.xima.fc.proma.util
Class PromaPluginUpdateCheck
- java.lang.Object
-
- de.xima.fc.proma.util.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 Summary
Constructors Constructor Description PromaPluginUpdateCheck()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R> StageChain<List<PluginChangeLogVersion>,R>
createPluginChangelog(IPublicPromaInvocationContext pc, String pluginKey, PluginManifest manifest, Locale locale, String licenseKey)
This method creates a list of all changes of the given plugin.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.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.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.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.static Set<WorkspaceScope>
findPluginScopesToCheckForUpdates(IPublicPromaInvocationContext pc, boolean forceUpdate)
Finds all client or system scopes for which the userfrom the given context
is allowed to check for plugin updates.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.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.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.static String
getPluginKey(String pluginKey, PluginManifest manifest)
This method returns the available plugin key.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.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.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.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.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.static EPluginUpdateAvailability
getUpdateAvailabilityFromUpdateCheckResult(de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result)
This method returns theEPluginUpdateAvailability
by means of the givenPublicStoreItemUpdateCheckResult
.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 ofPublicStoreItemMetaResource
.static boolean
isPromaRepo(PluginManifest manifest)
-
-
-
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 userfrom the given invocation context
has access to the plugin menu.- Parameters:
pc
- Context to use for accessing the PROMA API.forceUpdate
- Whentrue
, always check for updates. Whenfalse
, 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 sendingrequests via the user's browser
, the update check is restricted to those scopes (system or client) for which the userfrom 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 pluginlocale
- the locale for the informationsmanifest
- Manifest of the plugin.runtime
- the runtime of the pluginlicenseKey
- 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
- Whentrue
, always check for updates. Whenfalse
, 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 userfrom the given context
is allowed to check for plugin updates.- Parameters:
pc
- Context for accessing the PROMA API.forceUpdate
- Whentrue
, always check for updates. Whenfalse
, 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 availabilityEPluginUpdateAvailability.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 pluginmanifest
- the manifest of the pluginlicenseKey
- 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 pluginmanifest
- the manifest of the pluginlocale
- the locale for localized plugin informationslicenseKey
- 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 ofPublicStoreItemMetaResource
.- 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 informationslicenseKey
- 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 pluginmanifest
- 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 pluginlocale
- the locale for localized plugin informationsmanifest
- The plugin's manifest file.runtime
- the runtime of the pluginlicenseKey
- 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 pluginlocale
- the locale for localized plugin informationsmanifest
- The plugin's manifest file.runtime
- the runtime of the pluginstoreItem
- given item out of the proma storelicenseKey
- 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 pluginmanifest
- the manifest of the pluginlocale
- the locale for localized plugin namelicenseKey
- 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 pluginmanifest
- the manifest of the pluginlocale
- the locale for localized plugin informationslicenseKey
- 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
-
createPluginChangelog
public static <R> StageChain<List<PluginChangeLogVersion>,R> createPluginChangelog(IPublicPromaInvocationContext pc, String pluginKey, PluginManifest manifest, Locale locale, String licenseKey)
This method creates a list of all changes of the given plugin.- Parameters:
pluginKey
- the plugin key of the pluginmanifest
- the manifest of the pluginlocale
- the given locale- Returns:
- A list of
PluginChangeLogVersion
which contains the meta informations about the changes
-
getUpdateAvailabilityFromUpdateCheckResult
public static EPluginUpdateAvailability getUpdateAvailabilityFromUpdateCheckResult(de.xima.proma.restclient.pub.gen.model.PublicStoreItemUpdateCheckResult result)
This method returns theEPluginUpdateAvailability
by means of the givenPublicStoreItemUpdateCheckResult
.- 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 pluginmanifest
- the manifest of the pluginlocale
- the locale for localized plugin informationslicenseKey
- 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.
-
-