Package org.ametys.web.inputdata
Class SitemapInputData
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.inputdata.SitemapInputData
-
- All Implemented Interfaces:
FileReloader,LogEnabled,InputData,Initializable,Contextualizable,Serviceable
public class SitemapInputData extends AbstractLogEnabled implements InputData, Contextualizable, Serviceable, FileReloader, Initializable
InputDatafor SAXing events about the current sitemap.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSitemapInputData.SitemapKey
-
Field Summary
Fields Modifier and Type Field Description private static int__DEFAULT_DESCENDANT_DEPTHprivate static int__DEFAULT_INITIAL_DEPTHprivate static String__DESCENDANT_DEPTHprivate static String__INITIAL_DEPTHprivate static String_CACHE_IDprivate AbstractCacheManager_cacheManagerprivate Context_contextprivate FileReloaderUtils_fileReloaderUtilsprivate SiteManager_siteManagerprivate SitemapSaxer_sitemapSaxer
-
Constructor Summary
Constructors Constructor Description SitemapInputData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Cache<SitemapInputData.SitemapKey,Integer>_getCache()private String_getSkinId()private void_loadSitemapConfiguration(boolean forceRead)private int_parseInt(Configuration cfg, String tagName, int defaultValue)voidcontextualize(Context context)StringgetId(String sourceUrl)Get an unique ID for this File Reloadervoidinitialize()booleanisCacheable(Site site, Page page)Returns true if thisInputDatais cacheable for the current site and if possible page.voidservice(ServiceManager manager)booleanshouldBeCached(Site site, Page page)Returns true if the resulting SAX events should be actually stored in the centralPageElementCache.
It may be useful to return false for some InputData managing their own cache and don't wanting to waste space in the central cache.
This method is only called ifInputData.isCacheable(Site, Page)returns true.voidtoSAX(ContentHandler handler)Generates SAX events for providing data.voidupdateFile(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 it-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__INITIAL_DEPTH
private static final String __INITIAL_DEPTH
- See Also:
- Constant Field Values
-
__DESCENDANT_DEPTH
private static final String __DESCENDANT_DEPTH
- See Also:
- Constant Field Values
-
__DEFAULT_INITIAL_DEPTH
private static final int __DEFAULT_INITIAL_DEPTH
- See Also:
- Constant Field Values
-
__DEFAULT_DESCENDANT_DEPTH
private static final int __DEFAULT_DESCENDANT_DEPTH
- See Also:
- Constant Field Values
-
_sitemapSaxer
private SitemapSaxer _sitemapSaxer
-
_fileReloaderUtils
private FileReloaderUtils _fileReloaderUtils
-
_siteManager
private SiteManager _siteManager
-
_cacheManager
private AbstractCacheManager _cacheManager
-
-
Constructor Detail
-
SitemapInputData
public SitemapInputData()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
isCacheable
public boolean isCacheable(Site site, Page page)
Description copied from interface:InputDataReturns true if thisInputDatais cacheable for the current site and if possible page.- Specified by:
isCacheablein interfaceInputData- Parameters:
site- the currentSite.page- the currentPage. Can be null.- Returns:
- true if this
InputDatais cacheable for the current site or page.
-
shouldBeCached
public boolean shouldBeCached(Site site, Page page)
Description copied from interface:InputDataReturns true if the resulting SAX events should be actually stored in the centralPageElementCache.
It may be useful to return false for some InputData managing their own cache and don't wanting to waste space in the central cache.
This method is only called ifInputData.isCacheable(Site, Page)returns true.- Specified by:
shouldBeCachedin interfaceInputData- Parameters:
site- the currentSite.page- the currentPage. Can be null.- Returns:
- true if the content is cacheable and should be stored in the
PageElementCache.
-
toSAX
public void toSAX(ContentHandler handler) throws SAXException, ProcessingException
Description copied from interface:InputDataGenerates SAX events for providing data.- Specified by:
toSAXin interfaceInputData- Parameters:
handler- the content handler to SAX into.- Throws:
SAXException- if an error occurs while SAXing.ProcessingException- if an error occurs during processing.
-
_loadSitemapConfiguration
private void _loadSitemapConfiguration(boolean forceRead)
-
getId
public String getId(String sourceUrl)
Description copied from interface:FileReloaderGet an unique ID for this File Reloader- Specified by:
getIdin 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
-
_getSkinId
private String _getSkinId()
-
updateFile
public void updateFile(String sourceUrl, Source source, InputStream is) throws Exception
Description copied from interface:FileReloaderUpdate the file, the sourceUrl is only there if you manage multiple files, the Configuration object is already present to read it- Specified by:
updateFilein 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
-
_parseInt
private int _parseInt(Configuration cfg, String tagName, int defaultValue)
-
_getCache
private Cache<SitemapInputData.SitemapKey,Integer> _getCache()
-
-