Class MarketplaceServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v2.service.marketplace.MarketplaceServiceImpl
-
- All Implemented Interfaces:
MarketplaceService
public class MarketplaceServiceImpl extends Object implements MarketplaceService
Default implementation ofMarketplaceService
that proxies all request to the configured Marketplace- Since:
- 3.1.2
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected MarketplaceServiceInternal
marketplaceServiceInternal
-
Constructor Summary
Constructors Constructor Description MarketplaceServiceImpl(MarketplaceServiceInternal marketplaceServiceInternal)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyPlugin(String siteId, String path, Map<String,String> parameters)
Copy a plugin in a sitevoid
createSite(CreateSiteRequest request)
Creates a site using the given blueprintList<PluginRecord>
getInstalledPlugins(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 objectString
getPluginConfigurationAsString(String siteId, String pluginId)
Load the configuration for a given plugin as a stringList<String>
getPluginUsage(String siteId, String pluginId)
List dependant items for a pluginvoid
installPlugin(String siteId, String pluginId, org.craftercms.commons.plugin.model.Version pluginVersion, Map<String,String> parameters)
Install a plugin in a sitevoid
removePlugin(String siteId, String pluginId, boolean force)
Removes a plugin from a site@Valid Map<String,Object>
searchPlugins(String type, String keywords, boolean showIncompatible, long offset, long limit)
Performs a search for all available plugins that match the given filtersvoid
writePluginConfiguration(String siteId, String pluginId, String content)
Writes the configuration for a given plugin
-
-
-
Field Detail
-
marketplaceServiceInternal
protected final MarketplaceServiceInternal marketplaceServiceInternal
-
-
Constructor Detail
-
MarketplaceServiceImpl
@ConstructorProperties("marketplaceServiceInternal") public MarketplaceServiceImpl(MarketplaceServiceInternal marketplaceServiceInternal)
-
-
Method Detail
-
searchPlugins
@Valid public @Valid Map<String,Object> searchPlugins(String type, String keywords, boolean showIncompatible, long offset, long limit) throws MarketplaceException
Description copied from interface:MarketplaceService
Performs a search for all available plugins that match the given filters- Specified by:
searchPlugins
in 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:MarketplaceService
Creates a site using the given blueprint- Specified by:
createSite
in 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
public List<PluginRecord> getInstalledPlugins(String siteId) throws MarketplaceException
Description copied from interface:MarketplaceService
Returns a list of the plugins currently installed in the given site- Specified by:
getInstalledPlugins
in 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 MarketplaceException
Description copied from interface:MarketplaceService
Install a plugin in a site- Specified by:
installPlugin
in 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 MarketplaceException
Description copied from interface:MarketplaceService
Copy a plugin in a site- Specified by:
copyPlugin
in 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:MarketplaceService
Removes a plugin from a site- Specified by:
removePlugin
in 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:
MarketplaceException
- if there is any error removing the pluginServiceLayerException
-
getPluginUsage
public List<String> getPluginUsage(String siteId, String pluginId) throws ServiceLayerException
Description copied from interface:MarketplaceService
List dependant items for a plugin- Specified by:
getPluginUsage
in 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:MarketplaceService
Load the configuration for a given plugin as an object- Specified by:
getPluginConfiguration
in 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:MarketplaceService
Load the configuration for a given plugin as a string- Specified by:
getPluginConfigurationAsString
in 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:MarketplaceService
Writes the configuration for a given plugin- Specified by:
writePluginConfiguration
in 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
-
-