Package org.ametys.web.site
Class SiteConfigurationManager
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.site.SiteConfigurationManager
-
- All Implemented Interfaces:
LogEnabled
,Disposable
,Initializable
,Component
,Serviceable
public class SiteConfigurationManager extends AbstractLogEnabled implements Component, Serviceable, Initializable, Disposable
Helper component for managing sites configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Boolean>
_areSiteComplete
Determines if all parameters are valued, by site.protected SiteManager
_siteManager
The site manager.protected SiteTypesExtensionPoint
_siteTypesExtensionPoint
The site type extension point.static String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description SiteConfigurationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_isSiteConfigurationValid(Site site)
Validate the configuration of the given site.protected boolean
_isValidSiteParameter(ElementDefinition parameter, Site site)
Validate the the given site parametervoid
dispose()
ElementDefinition
getSiteParameter(String siteName, String parameterName)
Retrieves the parameter of the given site with the given nameElementDefinition
getSiteParameter(Site site, String parameterName)
Retrieves the parameter of the given site with the given nameCollection<ElementDefinition>
getSiteParameters(String siteName)
Retrieves the parameters of the given siteCollection<ElementDefinition>
getSiteParameters(Site site)
Retrieves the parameters of the given siteView
getSiteView(String siteName)
Retrieves the view of the site with the given nameView
getSiteView(Site site)
Retrieves the view of the site with the given namevoid
initialize()
boolean
isSiteConfigurationValid(String siteName)
Validate the configuration of the given site.boolean
isSiteConfigurationValid(Site site)
Validate the configuration of the given site.void
reloadSiteConfiguration(String siteName)
Reload a site's configuration.void
reloadSiteConfiguration(Site site)
Reload a site's configuration.void
removeSiteConfiguration(String siteName)
Remove a site's configuration.void
removeSiteConfiguration(Site site)
Remove a site's configuration.void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_siteManager
protected SiteManager _siteManager
The site manager.
-
_siteTypesExtensionPoint
protected SiteTypesExtensionPoint _siteTypesExtensionPoint
The site type extension point.
-
_areSiteComplete
protected Map<String,Boolean> _areSiteComplete
Determines if all parameters are valued, by site.
-
-
Constructor Detail
-
SiteConfigurationManager
public SiteConfigurationManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
reloadSiteConfiguration
public void reloadSiteConfiguration(String siteName) throws UnknownAmetysObjectException
Reload a site's configuration.- Parameters:
siteName
- the site name.- Throws:
UnknownAmetysObjectException
- if the site doesn't exist.
-
reloadSiteConfiguration
public void reloadSiteConfiguration(Site site) throws UnknownAmetysObjectException
Reload a site's configuration.- Parameters:
site
- the site.- Throws:
UnknownAmetysObjectException
- if the site doesn't exist.
-
removeSiteConfiguration
public void removeSiteConfiguration(Site site)
Remove a site's configuration.- Parameters:
site
- the site.
-
removeSiteConfiguration
public void removeSiteConfiguration(String siteName)
Remove a site's configuration.- Parameters:
siteName
- the site name.
-
isSiteConfigurationValid
public boolean isSiteConfigurationValid(String siteName) throws UnknownAmetysObjectException
Validate the configuration of the given site.- Parameters:
siteName
- the name of the site to check.- Returns:
true
if the site is correctly configured,false
otherwise.- Throws:
UnknownAmetysObjectException
- if the site doesn't exist.
-
isSiteConfigurationValid
public boolean isSiteConfigurationValid(Site site) throws UnknownAmetysObjectException
Validate the configuration of the given site.- Parameters:
site
- the site to check.- Returns:
true
if the site is correctly configured,false
otherwise.- Throws:
UnknownAmetysObjectException
- if the site doesn't exist.
-
_isSiteConfigurationValid
protected boolean _isSiteConfigurationValid(Site site)
Validate the configuration of the given site.- Parameters:
site
- the site to check.- Returns:
true
if the site is correctly configured,false
otherwise.
-
_isValidSiteParameter
protected boolean _isValidSiteParameter(ElementDefinition parameter, Site site)
Validate the the given site parameter- Parameters:
parameter
- the site parameter to validate.site
- the site- Returns:
- true if the parameter's value is valid, false otherwise.
-
getSiteParameters
public Collection<ElementDefinition> getSiteParameters(String siteName)
Retrieves the parameters of the given site- Parameters:
siteName
- the name of the site- Returns:
- the site's parameters
-
getSiteParameters
public Collection<ElementDefinition> getSiteParameters(Site site)
Retrieves the parameters of the given site- Parameters:
site
- the site- Returns:
- the site's parameters
-
getSiteParameter
public ElementDefinition getSiteParameter(String siteName, String parameterName) throws UndefinedItemPathException
Retrieves the parameter of the given site with the given name- Parameters:
siteName
- the name of the siteparameterName
- the name of the parameter to retrieve- Returns:
- the site's parameter
- Throws:
UndefinedItemPathException
- if there is no site parameter defined with the given name
-
getSiteParameter
public ElementDefinition getSiteParameter(Site site, String parameterName) throws UndefinedItemPathException
Retrieves the parameter of the given site with the given name- Parameters:
site
- the siteparameterName
- the name of the parameter to retrieve- Returns:
- the site's parameter
- Throws:
UndefinedItemPathException
- if there is no site parameter defined with the given name
-
getSiteView
public View getSiteView(String siteName)
Retrieves the view of the site with the given name- Parameters:
siteName
- the name of the site- Returns:
- the site's view
-
getSiteView
public View getSiteView(Site site)
Retrieves the view of the site with the given name- Parameters:
site
- the site- Returns:
- the site's view
-
-