Package org.ametys.web.repository.page
Class DefaultServicesAssignmentHandler
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.repository.page.DefaultServicesAssignmentHandler
-
- All Implemented Interfaces:
ServicesAssignmentHandler
,LogEnabled
,Serviceable
public class DefaultServicesAssignmentHandler extends AbstractLogEnabled implements ServicesAssignmentHandler, Serviceable
This implementation of the services handler is based on services declared in the whole application
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultServicesAssignmentHandler.Cache
The cache is a HashSet of String + a date
-
Field Summary
Fields Modifier and Type Field Description private Map<String,DefaultServicesAssignmentHandler.Cache>
_cache
protected ServiceExtensionPoint
_serviceEP
The services managerprotected SiteTypesExtensionPoint
_siteTypeExtensionPoint
The site type managerprotected SourceResolver
_srcResolver
The source resolver-
Fields inherited from interface org.ametys.web.repository.page.ServicesAssignmentHandler
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultServicesAssignmentHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultServicesAssignmentHandler.Cache
_getPublicServices()
Get the public services.private Set<String>
_getServicesForSiteType(String siteType)
private Set<String>
_getServicesForSkin(String siteType, String skinName)
private Set<String>
_getServicesForTemplate(String siteType, String skinName, String templateName)
private Set<String>
_getServicesForZone(String siteType, String skinName, String templateName, String zoneName)
protected DefaultServicesAssignmentHandler.Cache
_parseServices(Configuration configuration, long lastModificationDade)
Parses the valid services in a configuration.protected DefaultServicesAssignmentHandler.Cache
_parseServices(Source configFile)
Parses the valid services for the site typeprotected DefaultServicesAssignmentHandler.Cache
_parseTemplateServices(Source configFile)
Parse a template configuration file.protected DefaultServicesAssignmentHandler.Cache
_parseZoneServices(Source configFile, String zoneName)
Parse a template configuration file and get the set of available services for a given zone.Set<String>
getAvailableServices(Page page, String zoneName)
Returns the list of available services for a givenZone
.void
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_serviceEP
protected ServiceExtensionPoint _serviceEP
The services manager
-
_siteTypeExtensionPoint
protected SiteTypesExtensionPoint _siteTypeExtensionPoint
The site type manager
-
_srcResolver
protected SourceResolver _srcResolver
The source resolver
-
_cache
private Map<String,DefaultServicesAssignmentHandler.Cache> _cache
-
-
Constructor Detail
-
DefaultServicesAssignmentHandler
public DefaultServicesAssignmentHandler()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getAvailableServices
public Set<String> getAvailableServices(Page page, String zoneName)
Description copied from interface:ServicesAssignmentHandler
Returns the list of available services for a givenZone
.- Specified by:
getAvailableServices
in interfaceServicesAssignmentHandler
- Parameters:
page
- the Page to considerzoneName
- the zone name to consider- Returns:
- the list of available services ' id for a given Page and Zone
-
_getServicesForZone
private Set<String> _getServicesForZone(String siteType, String skinName, String templateName, String zoneName)
-
_getServicesForTemplate
private Set<String> _getServicesForTemplate(String siteType, String skinName, String templateName)
-
_getServicesForSkin
private Set<String> _getServicesForSkin(String siteType, String skinName)
-
_getServicesForSiteType
private Set<String> _getServicesForSiteType(String siteType)
-
_getPublicServices
protected DefaultServicesAssignmentHandler.Cache _getPublicServices()
Get the public services.- Returns:
- the public services.
-
_parseTemplateServices
protected DefaultServicesAssignmentHandler.Cache _parseTemplateServices(Source configFile)
Parse a template configuration file.- Parameters:
configFile
- the template configuration file.- Returns:
- the set of available services for the template.
-
_parseZoneServices
protected DefaultServicesAssignmentHandler.Cache _parseZoneServices(Source configFile, String zoneName)
Parse a template configuration file and get the set of available services for a given zone.- Parameters:
configFile
- the template configuration file.zoneName
- the zone name.- Returns:
- the set of available services for the given zone.
-
_parseServices
protected DefaultServicesAssignmentHandler.Cache _parseServices(Source configFile)
Parses the valid services for the site type- Parameters:
configFile
- the configuration file.- Returns:
- the services id in a Set
-
_parseServices
protected DefaultServicesAssignmentHandler.Cache _parseServices(Configuration configuration, long lastModificationDade) throws ConfigurationException
Parses the valid services in a configuration.- Parameters:
configuration
- the configuration.lastModificationDade
- date de dernière modification- Returns:
- the services id in a Set
- Throws:
ConfigurationException
- if configuration is invalid
-
-