Class URLBasedDynamicInformationProvider
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.linkdirectory.dynamic.URLBasedDynamicInformationProvider
-
- All Implemented Interfaces:
DynamicInformationProvider
,LogEnabled
,PluginAware
,Component
,Configurable
,Serviceable
public class URLBasedDynamicInformationProvider extends AbstractLogEnabled implements DynamicInformationProvider, Configurable, PluginAware, Serviceable
Implementation ofDynamicInformationProvider
allowing to SAX information from a confiured URL.
-
-
Field Summary
Fields Modifier and Type Field Description private static Pattern
__CONFIG_PARAM_PATTERN
private static Pattern
__SITE_CONFIG_PARAM_PATTERN
private String
_id
private I18nizableText
_label
private String
_pluginName
private SiteManager
_siteManager
private SourceResolver
_sourceResolver
private String
_url
-
Constructor Summary
Constructors Constructor Description URLBasedDynamicInformationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
_handleVariable(String url, String siteName, String lang, int nbItems)
private void
_saxInformation(ContentHandler contentHandler, InputStream xml)
Sax xml feed returned by URL provider.private boolean
_xsdValidation(InputStream xml)
Verify if an XML document is an instance of a specified XML schema.void
configure(Configuration configuration)
String
getId()
Get id of this providerI18nizableText
getLabel()
Get label of this providerString
getUrl()
Get the url of the WebServicevoid
saxDynamicInformation(ContentHandler contentHandler, String linkId, String siteName, String lang, int nbItems)
SAX the dynamic information for a specific linkvoid
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
-
__CONFIG_PARAM_PATTERN
private static final Pattern __CONFIG_PARAM_PATTERN
-
__SITE_CONFIG_PARAM_PATTERN
private static final Pattern __SITE_CONFIG_PARAM_PATTERN
-
_siteManager
private SiteManager _siteManager
-
_pluginName
private String _pluginName
-
_label
private I18nizableText _label
-
_sourceResolver
private SourceResolver _sourceResolver
-
-
Constructor Detail
-
URLBasedDynamicInformationProvider
public URLBasedDynamicInformationProvider()
-
-
Method Detail
-
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
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
saxDynamicInformation
public void saxDynamicInformation(ContentHandler contentHandler, String linkId, String siteName, String lang, int nbItems) throws Exception
Description copied from interface:DynamicInformationProvider
SAX the dynamic information for a specific link- Specified by:
saxDynamicInformation
in interfaceDynamicInformationProvider
- Parameters:
contentHandler
- The contenthandler to sax intolinkId
- The id of link.siteName
- The current site namelang
- The language used.nbItems
- The number of item to get for tooltip.- Throws:
Exception
- if an exception error occurs.
-
_handleVariable
private String _handleVariable(String url, String siteName, String lang, int nbItems)
-
_xsdValidation
private boolean _xsdValidation(InputStream xml)
Verify if an XML document is an instance of a specified XML schema.- Parameters:
xml
- The XML feed.- Returns:
- True if XML verify the xml schema and false if not.
-
_saxInformation
private void _saxInformation(ContentHandler contentHandler, InputStream xml) throws Exception
Sax xml feed returned by URL provider.- Parameters:
contentHandler
- The content handler to sax intoxml
- The xml feed.- Throws:
Exception
- if exception error occurs.
-
getId
public String getId()
Description copied from interface:DynamicInformationProvider
Get id of this provider- Specified by:
getId
in interfaceDynamicInformationProvider
- Returns:
- The id of this provider
-
getLabel
public I18nizableText getLabel()
Description copied from interface:DynamicInformationProvider
Get label of this provider- Specified by:
getLabel
in interfaceDynamicInformationProvider
- Returns:
- The label of this provider
-
-