Provides marketplace browsing, install and enable operations for apps, libs, themes and recipes. Wraps a MarketPlaceService (which may be backed by a local or remote catalog) with the current cluster version and tenant context, and installs and enables apps into the current organisation, website or branch. It is registered with the ApplicationManager as the "marketPlaceManager" service, so it is reachable from server-side JS as well as from Java code via RequestContext.C(MarketPlaceManager.class).
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| remoteMarketplaceUrl | String | URL of the remote marketplace server this instance syncs its catalog from, if remote marketplace access is configured. |
Methods
findAllMarketPlaceItems() · findAllMarketPlaceItems(String clusterVersion, boolean isDefaultCluster) · findMarketPlaceItem(String name, String version) · findMarketPlaceItem(String clusterVersion, boolean isDefaultCluster, String name, String version) · findMarketPlaceItems(String type) · findMarketPlaceItems(String clusterVersion, boolean isDefaultCluster, String type) · findMarketPlaceItems(String clusterVersion, boolean isDefaultCluster, String type, boolean checkAvailMode) · installApps(List<String> appIds) · install(String appId) · install(String appId, String version) · enable(AppRepository repo, Website website, Branch branch) · getPublishedVersion(String appId) · isInstalled(String appName) · isEnabledInWebsite(String appName, String websiteName, String branchName) · enableApp(String appId, String websiteName, String branchName) · disableApp(String appId, String websiteName, String branchName) · listInstalledApps(String websiteName, String branchName) · isEnabledInAccount(String appName) · getRemoteMarketplaceUrl()
findAllMarketPlaceItems()
Returns: List<IMarketPlaceItem>
Finds every marketplace item available to the current cluster, using the current cluster version and default cluster flag. This is an expensive lookup as it may query a remote marketplace server.
findAllMarketPlaceItems(String clusterVersion, boolean isDefaultCluster)
Returns: List<IMarketPlaceItem>
Finds every marketplace item available to the given cluster. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
clusterVersion | the cluster version to find items for |
isDefaultCluster | true if the given cluster is the default cluster |
findMarketPlaceItem(String name, String version)
Returns: IMarketPlaceItem
Finds a single marketplace item by id and version, using the current cluster version and default cluster flag. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
name | the unique id of the marketplace item to find |
version | the version of the item to find, or null to find the published version |
findMarketPlaceItem(String clusterVersion, boolean isDefaultCluster, String name, String version)
Returns: IMarketPlaceItem
Finds a single marketplace item by id and version, for the given cluster. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
clusterVersion | the cluster version to find the item for |
isDefaultCluster | true if the given cluster is the default cluster |
name | the unique id of the marketplace item to find |
version | the version of the item to find, or null to find the published version |
findMarketPlaceItems(String type)
Returns: List<IMarketPlaceItem>
Finds every marketplace item of the given type available to the current cluster, checking each item's availability mode against the current tenant. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
type | the type of item to find, such as "app", "lib", "theme" or "recipe" |
findMarketPlaceItems(String clusterVersion, boolean isDefaultCluster, String type)
Returns: List<IMarketPlaceItem>
Finds every marketplace item of the given type available to the given cluster, checking each item's availability mode against the current tenant. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
clusterVersion | the cluster version to find items for |
isDefaultCluster | true if the given cluster is the default cluster |
type | the type of item to find, such as "app", "lib", "theme" or "recipe" |
findMarketPlaceItems(String clusterVersion, boolean isDefaultCluster, String type, boolean checkAvailMode)
Returns: List<IMarketPlaceItem>
Finds every marketplace item of the given type available to the given cluster, optionally checking each item's availability mode against the current tenant. This is an expensive lookup as it may query a remote marketplace server.
| Parameter | Description |
|---|---|
clusterVersion | the cluster version to find items for |
isDefaultCluster | true if the given cluster is the default cluster |
type | the type of item to find, such as "app", "lib", "theme" or "recipe" |
checkAvailMode | true to exclude items whose availability mode excludes the current tenant, false to return all matching items regardless of availability |
installApps(List<String> appIds)
Returns: List<AppRepository>
Installs each of the given apps, in order, into the current tenant organisation. An app that fails to install is skipped rather than aborting the whole batch; check the returned list length against the input to detect partial failures.
| Parameter | Description |
|---|---|
appIds | the unique ids of the apps to install |
install(String appId)
Returns: AppRepository
Installs the published version of the given app into the current tenant organisation.
| Parameter | Description |
|---|---|
appId | the unique id of the app to install |
install(String appId, String version)
Returns: AppRepository
Installs the given version of the given app into the current tenant organisation. Invalidates the repository app cache and notifies other cluster nodes so the newly installed app is picked up immediately.
| Parameter | Description |
|---|---|
appId | the unique id of the app to install |
version | the version of the app to install, or null to install the published version |
enable(AppRepository repo, Website website, Branch branch)
Returns: void
Enables an already-installed app in the current tenant organisation, and optionally in the given website and branch as well. If the app is a theme provider, it is also selected as the theme for that website and branch. Invalidates the repository app cache and notifies other cluster nodes so the change takes effect immediately.
| Parameter | Description |
|---|---|
repo | the repository of the app to enable |
website | the website to also enable the app in, or null to enable only at the organisation level |
branch | the branch within the given website to enable the app in, required if website is not null |
getPublishedVersion(String appId)
Returns: String
Looks up the published version of the given marketplace item, for the current cluster.
| Parameter | Description |
|---|---|
appId | the unique id of the marketplace item to look up |
isInstalled(String appName)
Returns: boolean
Checks whether the given app is installed in the current tenant organisation, regardless of whether it is enabled anywhere.
| Parameter | Description |
|---|---|
appName | the unique id of the app to check |
isEnabledInWebsite(String appName, String websiteName, String branchName)
Returns: boolean
Checks whether the given app is installed and enabled in the given branch of the given website.
| Parameter | Description |
|---|---|
appName | the unique id of the app to check |
websiteName | the name of the website to check |
branchName | the name of the branch, within the given website, to check |
enableApp(String appId, String websiteName, String branchName)
Returns: Map<String,Object>
Switches an installed app on, for the account and optionally for one website, addressed by name. <p>The same work as {@link #enable(AppRepository, Website, Branch)}, reached with the three strings a caller actually has rather than the three entities it would otherwise have to resolve first. That sequence - find the repository, find the website, find the branch, then enable - is the kind of thing that works when an expert performs it and fails quietly otherwise, and it is the reason enabling an app has been treated as too fiddly to offer. It is one call. <p>Enabling is not installing. This refuses an app the account has not got, rather than quietly buying it: the two are different decisions, one of them costs money, and an agent asking permission for the cheap one must not be able to perform the expensive one by accident.
| Parameter | Description |
|---|---|
appId | the app to switch on, which must already be installed |
websiteName | the website to switch it on for, or null or blank for the account only |
branchName | the branch of that website, or blank for its live one |
disableApp(String appId, String websiteName, String branchName)
Returns: Map<String,Object>
Switches an app off, for one website or for the whole account. <p>The other half of {@link #enableApp}, and the half that makes enabling safe to offer at all. Enabling is defensible for an agent to do because it can be undone; without this it could only be undone by a person finding the right admin page, which is a weaker claim than it sounds. <p>Two different sizes of action share this method, and the difference is the website argument. Naming a website switches the app off for that site alone and leaves every other site running it. Omitting one switches it off for the account, everywhere. Callers should not treat those as the same request. <p>Routed through {@code ApplicationManager.setStatus} rather than its {@code disable}, because only the former checks what else depends on the app first. Disabling something three other apps are built on is not a change anybody means to make, and the check is the difference between a refusal and a broken site.
| Parameter | Description |
|---|---|
appId | the app to switch off |
websiteName | the website to switch it off for, or null or blank for the whole account |
branchName | the branch of that website, or blank for its live one |
listInstalledApps(String websiteName, String branchName)
Returns: List<Map<String,Object>>
Every app installed in the current account, and where each one is switched on. <p>The three facts an agent needs to tell a missing capability from an impossible one are separate on this class - {@link #isInstalled}, {@link #isEnabledInAccount} and {@link #isEnabledInWebsite} - and each answers about one named app. Answering "what can this site do" through them means knowing the names to ask about, which is the thing being asked. This enumerates instead. <p>The distinction between installed and enabled is the one worth keeping. An app installed in the account but not enabled on this website is a capability the account already owns and has already paid for; switching it on is free, immediate and reversible. An app that is not installed at all is a purchase. Collapsing the two would turn every "you do not have that" into a licensing conversation that is often not needed.
| Parameter | Description |
|---|---|
websiteName | the website to report enablement for, or null or blank to report account level only |
branchName | the branch of that website, or blank for its live one |
isEnabledInAccount(String appName)
Returns: boolean
Checks whether the given app is installed and enabled in the current tenant organisation.
| Parameter | Description |
|---|---|
appName | the unique id of the app to check |
getRemoteMarketplaceUrl()
Returns: String
URL of the remote marketplace server this instance syncs its catalog from, if remote marketplace access is configured.