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 ofDynamicInformationProviderallowing to SAX information from a confiured URL.
-
-
Field Summary
Fields Modifier and Type Field Description private static Pattern__CONFIG_PARAM_PATTERNprivate static Pattern__SITE_CONFIG_PARAM_PATTERNprivate String_idprivate I18nizableText_labelprivate String_pluginNameprivate SiteManager_siteManagerprivate SourceResolver_sourceResolverprivate 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.voidconfigure(Configuration configuration)StringgetId()Get id of this providerI18nizableTextgetLabel()Get label of this providerStringgetUrl()Get the url of the WebServicevoidsaxDynamicInformation(ContentHandler contentHandler, String linkId, String siteName, String lang, int nbItems)SAX the dynamic information for a specific linkvoidservice(ServiceManager manager)voidsetPluginInfo(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:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets 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:
setPluginInfoin 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:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
saxDynamicInformation
public void saxDynamicInformation(ContentHandler contentHandler, String linkId, String siteName, String lang, int nbItems) throws Exception
Description copied from interface:DynamicInformationProviderSAX the dynamic information for a specific link- Specified by:
saxDynamicInformationin 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:DynamicInformationProviderGet id of this provider- Specified by:
getIdin interfaceDynamicInformationProvider- Returns:
- The id of this provider
-
getLabel
public I18nizableText getLabel()
Description copied from interface:DynamicInformationProviderGet label of this provider- Specified by:
getLabelin interfaceDynamicInformationProvider- Returns:
- The label of this provider
-
-