Package org.ametys.plugins.core.ui.help
Class HelpManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.ui.help.HelpManager
- All Implemented Interfaces:
FileReloader
,LogEnabled
,Initializable
,Component
,Serviceable
public class HelpManager
extends AbstractLogEnabled
implements Component, Serviceable, FileReloader, Initializable
Provides the url associated to a family/id
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the default help urlGet the url for help for this family/id or null if not foundGet the url for help for this family/id or null if not foundgetHelpUrl
(String family, String id, String lang) Get the url for help for this family/id.Get an unique ID for this File ReloaderGet the search urlvoid
parseConfigFile
(Configuration configuration, String pluginName, String featureName) parse a configuration file for a plugin (plugin name and id)void
service
(ServiceManager manager) void
updateFile
(String sourceUrl, Source source, InputStream is) Update the file, the sourceUrl is only there if you manage multiple files, the Configuration object is already present to read itMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role -
_links
The map of rightId, Right of declared rights
-
-
Constructor Details
-
HelpManager
public HelpManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getHelpUrl
Get the url for help for this family/id. The result is a map containing "url", "error" and "error-cause"- Parameters:
family
- the family for this link (for example an extension point)id
- id in the family (must be unique in the family)lang
- requested language- Returns:
- an Map containg the URL for help. If this language is not found, a default language will be searched, then any language. If nothing is found, the url will be null.
- Throws:
Exception
- impossible to read the default help file
-
getDefaultHelpUrl
Get the default help url- Returns:
- The result (map with an url key, or possible error)
-
getSearchUrl
Get the search url- Returns:
- The result (map with an url key, or possible error)
-
getHelp
Get the url for help for this family/id or null if not found- Parameters:
family
- the family for this link (for example an extension point)id
- id in the family (must be unique in the family)lang
- requested language- Returns:
- an URL for help. If this language is not found, a default language will be searched, then any language, and null if really nothing is found
- Throws:
Exception
- impossible to read the default help file
-
getHelp
Get the url for help for this family/id or null if not found- Parameters:
family
- the family for this link (for example an extension point)id
- id in the family (must be unique in the family)languages
- Ordered list of requested languages- Returns:
- an URL for help. If no language is found, a default language will be searched, then any other language, and null if really nothing is found
- Throws:
Exception
- impossible to read the default help file
-
updateFile
Description copied from interface:FileReloader
Update the file, the sourceUrl is only there if you manage multiple files, the Configuration object is already present to read it- Specified by:
updateFile
in interfaceFileReloader
- Parameters:
sourceUrl
- the url of the file.source
- the source to read, can be null if no file was readis
- the input stream to read, can be null if no file was read- Throws:
Exception
- something went wrong while reading the inputstream
-
getId
Description copied from interface:FileReloader
Get an unique ID for this File Reloader- Specified by:
getId
in interfaceFileReloader
- Parameters:
sourceUrl
- this is passed as an argument if your class read multiple files. If it reads only one file, the full class name can be a good enough ID- Returns:
- an unique ID
-
parseConfigFile
public Map<String,HelpLink> parseConfigFile(Configuration configuration, String pluginName, String featureName) parse a configuration file for a plugin (plugin name and id)- Parameters:
configuration
- the configurationpluginName
- Unique identifier for the plugin hosting the extension (for logs)featureName
- Unique feature identifier (unique for a given pluginName) (for logs)- Returns:
- a map of HelpLink.uniqueId HelpLink representing the help URLs found in the configuration file
-