Class MarketplaceServiceImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.marketplace.MarketplaceServiceImpl
- All Implemented Interfaces:
MarketplaceService
Default implementation of
MarketplaceService that proxies all request to the configured Marketplace- Since:
- 3.1.2
- Author:
- joseross
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMarketplaceServiceImpl(MarketplaceServiceInternal marketplaceServiceInternal) -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy a plugin in a sitevoidcreateSite(CreateSiteRequest request) Creates a site using the given blueprintgetInstalledPlugins(String siteId) Returns a list of the plugins currently installed in the given siteorg.apache.commons.configuration2.HierarchicalConfiguration<?> getPluginConfiguration(String siteId, String pluginId) Load the configuration for a given plugin as an objectgetPluginConfigurationAsString(String siteId, String pluginId) Load the configuration for a given plugin as a stringgetPluginUsage(String siteId, String pluginId) List dependant items for a pluginvoidinstallPlugin(String siteId, String pluginId, org.craftercms.commons.plugin.model.Version pluginVersion, Map<String, String> parameters) Install a plugin in a sitevoidremovePlugin(String siteId, String pluginId, boolean force) Removes a plugin from a sitesearchPlugins(String type, String keywords, boolean showIncompatible, long offset, long limit) Performs a search for all available plugins that match the given filtersvoidwritePluginConfiguration(String siteId, String pluginId, String content) Writes the configuration for a given plugin
-
Field Details
-
marketplaceServiceInternal
-
-
Constructor Details
-
MarketplaceServiceImpl
@ConstructorProperties("marketplaceServiceInternal") public MarketplaceServiceImpl(MarketplaceServiceInternal marketplaceServiceInternal)
-
-
Method Details
-
searchPlugins
@Valid public @Valid Map<String,Object> searchPlugins(String type, String keywords, boolean showIncompatible, long offset, long limit) throws MarketplaceException Description copied from interface:MarketplaceServicePerforms a search for all available plugins that match the given filters- Specified by:
searchPluginsin interfaceMarketplaceService- Parameters:
type- the type of plugins to searchkeywords- the keywords to filter pluginsshowIncompatible- indicates if incompatible plugins should be returnedoffset- the offset for paginationlimit- the limit for pagination- Returns:
- the result from the Marketplace
- Throws:
MarketplaceException- if there is any error performing the search
-
createSite
public void createSite(CreateSiteRequest request) throws RemoteRepositoryNotFoundException, InvalidRemoteRepositoryException, InvalidRemoteUrlException, ServiceLayerException, InvalidRemoteRepositoryCredentialsException Description copied from interface:MarketplaceServiceCreates a site using the given blueprint- Specified by:
createSitein interfaceMarketplaceService- Parameters:
request- the site information- Throws:
RemoteRepositoryNotFoundException- if there is an error with the remote repositoryInvalidRemoteRepositoryException- if there is an error with the remote repositoryInvalidRemoteUrlException- if there is an error with the remote repositoryServiceLayerException- if there is any unexpected errorInvalidRemoteRepositoryCredentialsException- if there is any error with the credentials
-
getInstalledPlugins
Description copied from interface:MarketplaceServiceReturns a list of the plugins currently installed in the given site- Specified by:
getInstalledPluginsin interfaceMarketplaceService- Parameters:
siteId- the id of the site- Returns:
- the list of plugins
- Throws:
MarketplaceException- if there is any error reading the plugin registry
-
installPlugin
public void installPlugin(String siteId, String pluginId, org.craftercms.commons.plugin.model.Version pluginVersion, Map<String, String> parameters) throws MarketplaceExceptionDescription copied from interface:MarketplaceServiceInstall a plugin in a site- Specified by:
installPluginin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the pluginpluginVersion- the version of the pluginparameters- the parameters for the plugin- Throws:
MarketplaceException- if there is any error installing the plugin
-
copyPlugin
@Valid public void copyPlugin(String siteId, String path, Map<String, String> parameters) throws MarketplaceExceptionDescription copied from interface:MarketplaceServiceCopy a plugin in a site- Specified by:
copyPluginin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepath- the path of the plugin folderparameters- the parameters for the plugin- Throws:
MarketplaceException- if there is any error copying the plugin
-
removePlugin
public void removePlugin(String siteId, String pluginId, boolean force) throws ServiceLayerException Description copied from interface:MarketplaceServiceRemoves a plugin from a site- Specified by:
removePluginin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the pluginforce- indicates if the plugin should be removed even if there are dependant items- Throws:
ServiceLayerException
-
getPluginUsage
Description copied from interface:MarketplaceServiceList dependant items for a plugin- Specified by:
getPluginUsagein interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the plugin- Throws:
ServiceLayerException- if there is any error getting the dependant items
-
getPluginConfiguration
public org.apache.commons.configuration2.HierarchicalConfiguration<?> getPluginConfiguration(String siteId, String pluginId) throws ConfigurationException Description copied from interface:MarketplaceServiceLoad the configuration for a given plugin as an object- Specified by:
getPluginConfigurationin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the plugin- Returns:
- the configuration object
- Throws:
ConfigurationException- if there is any error loading the configuration
-
getPluginConfigurationAsString
public String getPluginConfigurationAsString(String siteId, String pluginId) throws ContentNotFoundException Description copied from interface:MarketplaceServiceLoad the configuration for a given plugin as a string- Specified by:
getPluginConfigurationAsStringin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the plugin- Returns:
- the configuration string
- Throws:
ContentNotFoundException- if there is any issue reading the file from the repository
-
writePluginConfiguration
public void writePluginConfiguration(String siteId, String pluginId, String content) throws UserNotFoundException, ServiceLayerException Description copied from interface:MarketplaceServiceWrites the configuration for a given plugin- Specified by:
writePluginConfigurationin interfaceMarketplaceService- Parameters:
siteId- the id of the sitepluginId- the id of the plugincontent- the new configuration- Throws:
UserNotFoundException- if there is any error authenticating the userServiceLayerException- if there is any error writing the configuration
-