public class HelpManager extends AbstractLogEnabled implements Component, Serviceable, FileReloader, Initializable
Modifier and Type | Field and Description |
---|---|
private FileReloaderUtils |
_fileReloader |
private HelpExtensionPoint |
_helpEP |
protected Map<String,HelpLink> |
_links
The map of rightId, Right of declared rights
|
private static String |
DEFAULT_HELP_URL |
private static String |
DEFAULT_SEARCH_URL |
static String |
ROLE
The avalon role
|
Constructor and Description |
---|
HelpManager() |
Modifier and Type | Method and Description |
---|---|
private HelpLink |
_addLink(Configuration linkConfiguration,
String pluginName,
String featureName)
adds a link in the global plugin map
|
private String |
_getAnyLanguageHelp(HelpLink helpLink) |
private String |
_getAnyLanguageHelp(String family,
String id) |
private String |
_getHelp(String family,
String id,
String lang) |
Map<String,Object> |
getDefaultHelpUrl()
Get the default help url
|
String |
getHelp(String family,
String id,
List<String> languages)
Get the url for help for this family/id or null if not found
|
String |
getHelp(String family,
String id,
String lang)
Get the url for help for this family/id or null if not found
|
Map<String,Object> |
getHelpUrl(String family,
String id,
String lang)
Get the url for help for this family/id.
|
String |
getId(String sourceUrl)
Get an unique ID for this File Reloader
|
Map<String,Object> |
getSearchUrl()
Get the search url
|
void |
initialize() |
Map<String,HelpLink> |
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,
InputStream is)
Update the file, the sourceUrl is only there if you manage multiple files, the Configuration object is already present to read it
|
getLogger, setLogger
private static final String DEFAULT_HELP_URL
private static final String DEFAULT_SEARCH_URL
private FileReloaderUtils _fileReloader
private HelpExtensionPoint _helpEP
public HelpManager()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public Map<String,Object> getHelpUrl(String family, String id, String lang) throws Exception
family
- the family for this link (for example an extension point)id
- id in the family (must be unique in the family)lang
- requested languageException
- impossible to read the default help filepublic Map<String,Object> getDefaultHelpUrl()
public Map<String,Object> getSearchUrl()
public String getHelp(String family, String id, String lang) throws Exception
family
- the family for this link (for example an extension point)id
- id in the family (must be unique in the family)lang
- requested languageException
- impossible to read the default help filepublic String getHelp(String family, String id, List<String> languages) throws Exception
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 languagesException
- impossible to read the default help fileprivate String _getAnyLanguageHelp(String family, String id)
private String _getAnyLanguageHelp(HelpLink helpLink)
public void updateFile(String sourceUrl, InputStream is) throws Exception
FileReloader
updateFile
in interface FileReloader
sourceUrl
- the url of the file.is
- the input stram to read, can be null if no file was readException
- something went wrong while reading the inputstreampublic String getId(String sourceUrl)
FileReloader
getId
in interface FileReloader
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 IDpublic Map<String,HelpLink> parseConfigFile(Configuration configuration, String pluginName, String featureName)
configuration
- the configurationpluginName
- Unique identifier for the plugin hosting the extension (for logs)featureName
- Unique feature identifier (unique for a given pluginName) (for logs)private HelpLink _addLink(Configuration linkConfiguration, String pluginName, String featureName)
linkConfiguration
- link node in the configurationpluginName
- Unique identifier for the plugin hosting the extension (for logs)featureName
- Unique feature identifier (unique for a given pluginName) (for logs)