public class SiteConfigurationExtensionPoint extends AbstractThreadSafeComponentExtensionPoint<SiteParameter>
SiteParameter
definitions.Modifier and Type | Class and Description |
---|---|
(package private) class |
SiteConfigurationExtensionPoint.I18nizableTextComparator |
(package private) class |
SiteConfigurationExtensionPoint.I18nizableTextTranslationComparator |
(package private) class |
SiteConfigurationExtensionPoint.SiteParameterParser
Parser for SiteParameter.
|
Modifier and Type | Field and Description |
---|---|
private static String |
__GENERAL_INFORMATIONS_I18N_KEY |
private static Pattern |
__PARAM_NAME_PATTERN |
private ThreadSafeComponentManager<Enumerator> |
_enumeratorManager
ComponentManager for
Enumerator s. |
protected I18nUtils |
_i18nUtils
Component gathering utility methods for internationalizable text translation
I18nUtils |
private Map<String,Boolean> |
_isComplete
Determines if all parameters are valued, by site.
|
private SiteConfigurationExtensionPoint.SiteParameterParser |
_parameterParser
Site parameter parser.
|
private Map<String,SiteParameter> |
_parameters
Parameters map, indexed by parameter ID.
|
protected SiteManager |
_siteManager
The site manager.
|
protected SiteTypesExtensionPoint |
_siteTypeEP
The site type extension point.
|
private ThreadSafeComponentManager<Validator> |
_validatorManager
ComponentManager for
Validator s. |
static String |
ROLE
Avalon Role
|
_cocoonManager, _context, _manager
Constructor and Description |
---|
SiteConfigurationExtensionPoint() |
Modifier and Type | Method and Description |
---|---|
protected void |
_addParameter(String pluginName,
String featureName,
Configuration configuration)
Declare a site parameter.
|
protected Map<I18nizableText,Map<I18nizableText,List<SiteParameter>>> |
_categorize(Collection<SiteParameter> parameters)
Organize a collection of site parameters by categories and groups.
|
protected boolean |
_validateParameter(SiteParameter parameter,
String siteName)
Validate a parameter value for a given site.
|
protected boolean |
_validateSiteConfig(String siteName)
Validate the configuration of a site.
|
void |
addExtension(String id,
String pluginName,
String featureName,
Configuration configuration)
Add an extension to this point.
|
void |
dispose()
Dispose the manager before restarting it
|
Map<I18nizableText,Map<I18nizableText,List<SiteParameter>>> |
getCategorizedParameters(String siteName)
Get all the parameters of a given site, classified by category and group.
|
SiteParameter |
getExtension(String id)
Returns the named extension
|
Set<String> |
getExtensionsIds()
Returns a Set containing the ids of all known extensions
|
Map<String,SiteParameter> |
getParameters(String siteName)
Get all the parameters for a given site.
|
String |
getUntypedValue(String siteName,
String id)
Return the untyped value of a site parameter as String.
|
Object |
getValue(String siteName,
String id)
Return the value of a site parameter.
|
Boolean |
getValueAsBoolean(String siteName,
String id)
Return the typed value as boolean.
|
Date |
getValueAsDate(String siteName,
String id)
Return the typed value as Date.
|
Double |
getValueAsDouble(String siteName,
String id)
Return the typed value casted as double.
|
Long |
getValueAsLong(String siteName,
String id)
Return the typed value as long.
|
String |
getValueAsString(String siteName,
String id)
Return the typed value as String.
|
boolean |
hasExtension(String id)
Returns true if the named extension exists
|
void |
initialize() |
void |
initializeExtensions()
Finalize the initialization of the extensions.
This method is called after all addExtension() calls.This is the last step before the actual startup of the application. |
boolean |
isValid(String siteName)
Test if a site configuration is valid.
|
void |
reloadConfiguration(String siteName)
Reload a site's configuration.
|
void |
removeConfiguration(String siteName)
Remove a site's configuration.
|
void |
service(ServiceManager manager) |
addComponent, contextualize
getLogger, setLogger
private static final Pattern __PARAM_NAME_PATTERN
private static final String __GENERAL_INFORMATIONS_I18N_KEY
protected SiteManager _siteManager
protected SiteTypesExtensionPoint _siteTypeEP
protected I18nUtils _i18nUtils
I18nUtils
private Map<String,SiteParameter> _parameters
private Map<String,Boolean> _isComplete
private ThreadSafeComponentManager<Validator> _validatorManager
Validator
s.private ThreadSafeComponentManager<Enumerator> _enumeratorManager
Enumerator
s.private SiteConfigurationExtensionPoint.SiteParameterParser _parameterParser
public SiteConfigurationExtensionPoint()
public void initialize() throws Exception
initialize
in interface Initializable
initialize
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
Exception
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
ServiceException
public void dispose()
dispose
in interface Disposable
dispose
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
public boolean hasExtension(String id)
ExtensionPoint
hasExtension
in interface ExtensionPoint<SiteParameter>
hasExtension
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
id
- the unique id of the extensionpublic void addExtension(String id, String pluginName, String featureName, Configuration configuration) throws ConfigurationException
ExtensionPoint
addExtension
in interface ExtensionPoint<SiteParameter>
addExtension
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
id
- the unique identifier of the extension.pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)configuration
- the information about the extension to be addedConfigurationException
- when a configuration problem occurspublic SiteParameter getExtension(String id)
ExtensionPoint
getExtension
in interface ExtensionPoint<SiteParameter>
getExtension
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
id
- the unique id of the extensionpublic Set<String> getExtensionsIds()
ExtensionPoint
getExtensionsIds
in interface ExtensionPoint<SiteParameter>
getExtensionsIds
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
public void initializeExtensions() throws Exception
ExtensionPoint
addExtension()
calls.initializeExtensions
in interface ExtensionPoint<SiteParameter>
initializeExtensions
in class AbstractThreadSafeComponentExtensionPoint<SiteParameter>
Exception
- if something wrong occurspublic boolean isValid(String siteName) throws UnknownAmetysObjectException
siteName
- the site name.UnknownAmetysObjectException
- if the site doesn't exist.public void reloadConfiguration(String siteName) throws UnknownAmetysObjectException
siteName
- the site name.UnknownAmetysObjectException
- if the site doesn't exist.public void removeConfiguration(String siteName)
siteName
- the site name.public Map<String,SiteParameter> getParameters(String siteName)
siteName
- the site name.public Map<I18nizableText,Map<I18nizableText,List<SiteParameter>>> getCategorizedParameters(String siteName)
siteName
- the site name.public String getUntypedValue(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public Object getValue(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public String getValueAsString(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public Date getValueAsDate(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public Long getValueAsLong(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public Boolean getValueAsBoolean(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to getUnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.public Double getValueAsDouble(String siteName, String id) throws UnknownAmetysObjectException, AmetysRepositoryException
siteName
- the site name.id
- Id of the parameter to get.UnknownAmetysObjectException
- if the site does not exist.AmetysRepositoryException
- if another repository error occurs.protected void _addParameter(String pluginName, String featureName, Configuration configuration) throws ConfigurationException
pluginName
- The name of the plugin declaring the extension.featureName
- the name of the featureconfiguration
- The parameter configuration.ConfigurationException
- if configuration if not complete.protected boolean _validateSiteConfig(String siteName)
siteName
- the name of the site to check.protected boolean _validateParameter(SiteParameter parameter, String siteName)
parameter
- the site parameter to validate.siteName
- the site name on which to check.protected Map<I18nizableText,Map<I18nizableText,List<SiteParameter>>> _categorize(Collection<SiteParameter> parameters)
parameters
- a collection of site parameters.