Package org.ametys.web.service
Class ServiceXSLTEnumerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.service.ServiceXSLTEnumerator
-
- All Implemented Interfaces:
Enumerator<String>
,Enumerator
,PluginAware
,Component
,Configurable
,Contextualizable
,LogEnabled
,Serviceable
public class ServiceXSLTEnumerator extends AbstractLogEnabled implements Enumerator<String>, Enumerator, Component, Configurable, PluginAware, Serviceable, Contextualizable
This enuerator return the list of available files for services. The files are searched in the skin and in the plugin Configuration is <path> to specify the path where file are stored <file> an optionnal regexp to list files in the path (default is ^.*\.xsl$ to list all xsl files)
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The avalon contextprotected String
_defaultValue
The default value of the xsl to use.protected String
_featureName
The feature declaring the enumeratorprotected Pattern
_fileFilter
The file patternprotected String
_path
The relative path to searchprotected String
_pluginName
The plugin declaring the enumeratorprotected SourceResolver
_resolver
The excalibur source resolverprotected Set<String>
_values
The plugin xsl to use.
-
Constructor Summary
Constructors Constructor Description ServiceXSLTEnumerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
_filterNames(Collection<TraversableSource> files)
Filter a list of sources to return thoses matching the _filtervoid
configure(Configuration configuration)
void
contextualize(Context context)
Map<String,Object>
getConfiguration()
Get the configuration of this enumeratorMap<Object,I18nizableText>
getEntries()
Provides the enumerated values with their optional label.I18nizableText
getEntry(String value)
Retrieves a single label from a value.Map<String,I18nizableText>
getTypedEntries()
Provides the enumerated values with their optional label.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.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_fileFilter
protected Pattern _fileFilter
The file pattern
-
_pluginName
protected String _pluginName
The plugin declaring the enumerator
-
_featureName
protected String _featureName
The feature declaring the enumerator
-
_resolver
protected SourceResolver _resolver
The excalibur source resolver
-
_defaultValue
protected String _defaultValue
The default value of the xsl to use. Can be null.
-
-
Constructor Detail
-
ServiceXSLTEnumerator
public ServiceXSLTEnumerator()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
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
-
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
-
getConfiguration
public Map<String,Object> getConfiguration()
Description copied from interface:Enumerator
Get the configuration of this enumerator- Specified by:
getConfiguration
in interfaceEnumerator<String>
- Specified by:
getConfiguration
in interfaceEnumerator
- Returns:
- the configuration
-
_filterNames
protected List<String> _filterNames(Collection<TraversableSource> files)
Filter a list of sources to return thoses matching the _filter- Parameters:
files
- A non null list of files to filter- Returns:
- The non null filtered list of names
-
getTypedEntries
public Map<String,I18nizableText> getTypedEntries() throws Exception
Description copied from interface:Enumerator
Provides the enumerated values with their optional label.- Specified by:
getTypedEntries
in interfaceEnumerator<String>
- Returns:
- the enumerated values and their label.
- Throws:
Exception
- if an error occurs. TODO NEWATTRIBUTEAPI: rename this method whenEnumerator
will be removed
-
getEntries
public Map<Object,I18nizableText> getEntries() throws Exception
Description copied from interface:Enumerator
Provides the enumerated values with their optional label.- Specified by:
getEntries
in interfaceEnumerator
- Returns:
- the enumerated values and their label.
- Throws:
Exception
- if an error occurs.
-
getEntry
public I18nizableText getEntry(String value) throws Exception
Description copied from interface:Enumerator
Retrieves a single label from a value.- Specified by:
getEntry
in interfaceEnumerator<String>
- Specified by:
getEntry
in interfaceEnumerator
- Parameters:
value
- the value.- Returns:
- the label or
null
if not found. - Throws:
Exception
- if an error occurs.
-
-