Class StaticUserPreferenceProvider
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.userpref.StaticUserPreferenceProvider
-
- All Implemented Interfaces:
UserPreferenceProvider
,LogEnabled
,PluginAware
,Disposable
,Configurable
,Contextualizable
,Serviceable
public class StaticUserPreferenceProvider extends AbstractLogEnabled implements UserPreferenceProvider, Contextualizable, Serviceable, Configurable, PluginAware, Disposable
Provides user preferences based on static configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
StaticUserPreferenceProvider.StaticUserPreference
A user pref with additionnal static information such as workspace(package private) class
StaticUserPreferenceProvider.UserPreferenceParser
Parser for UserPreference.
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
Avalon contextprotected ThreadSafeComponentManager<Enumerator>
_enumeratorManager
ComponentManager forEnumerator
s.protected String
_pluginName
The plugin name.protected Map<String,UserPreference>
_preferences
The user preferences, indexed by Idprotected ServiceManager
_serviceManager
Avalon service managerprotected ThreadSafeComponentManager<Validator>
_validatorManager
ComponentManager forValidator
s.-
Fields inherited from interface org.ametys.core.userpref.UserPreferenceProvider
CONTEXT_VAR_WORKSPACE
-
-
Constructor Summary
Constructors Constructor Description StaticUserPreferenceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Configuration configuration)
protected void
configurePreference(StaticUserPreferenceProvider.UserPreferenceParser prefParser, Configuration configuration)
Configure a user preference.void
contextualize(Context context)
void
dispose()
Collection<UserPreference>
getPreferences(Map<String,String> context)
Get this provider's preferences.void
service(ServiceManager manager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_preferences
protected Map<String,UserPreference> _preferences
The user preferences, indexed by Id
-
_validatorManager
protected ThreadSafeComponentManager<Validator> _validatorManager
ComponentManager forValidator
s.
-
_enumeratorManager
protected ThreadSafeComponentManager<Enumerator> _enumeratorManager
ComponentManager forEnumerator
s.
-
_serviceManager
protected ServiceManager _serviceManager
Avalon service manager
-
_pluginName
protected String _pluginName
The plugin name.
-
-
Constructor Detail
-
StaticUserPreferenceProvider
public StaticUserPreferenceProvider()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
configurePreference
protected void configurePreference(StaticUserPreferenceProvider.UserPreferenceParser prefParser, Configuration configuration) throws ConfigurationException
Configure a user preference.- Parameters:
prefParser
- the preference parser.configuration
- The preference configuration.- Throws:
ConfigurationException
- if configuration is incomplete or invalid.
-
getPreferences
public Collection<UserPreference> getPreferences(Map<String,String> context)
Description copied from interface:UserPreferenceProvider
Get this provider's preferences.- Specified by:
getPreferences
in interfaceUserPreferenceProvider
- Parameters:
context
- a Map of context variables.- Returns:
- a Collection of preferences for the context.
-
-