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
InputData
for SAXing events about the current sitemap.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SitemapInputData.SitemapKey
-
Field Summary
Fields Modifier and Type Field Description private static int
__DEFAULT_DESCENDANT_DEPTH
private static int
__DEFAULT_INITIAL_DEPTH
private static String
__DESCENDANT_DEPTH
private static String
__INITIAL_DEPTH
private static String
_CACHE_ID
private AbstractCacheManager
_cacheManager
private Context
_context
private FileReloaderUtils
_fileReloaderUtils
private SiteManager
_siteManager
private 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)
void
contextualize(Context context)
String
getId(String sourceUrl)
Get an unique ID for this File Reloadervoid
initialize()
boolean
isCacheable(Site site, Page page)
Returns true if thisInputData
is cacheable for the current site and if possible page.void
service(ServiceManager manager)
boolean
shouldBeCached(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.void
toSAX(ContentHandler handler)
Generates SAX events for providing data.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 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
isCacheable
public boolean isCacheable(Site site, Page page)
Description copied from interface:InputData
Returns true if thisInputData
is cacheable for the current site and if possible page.- Specified by:
isCacheable
in interfaceInputData
- Parameters:
site
- the currentSite
.page
- the currentPage
. Can be null.- Returns:
- true if this
InputData
is cacheable for the current site or page.
-
shouldBeCached
public boolean shouldBeCached(Site site, Page page)
Description copied from interface:InputData
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.- Specified by:
shouldBeCached
in 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:InputData
Generates SAX events for providing data.- Specified by:
toSAX
in 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: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
-
_getSkinId
private String _getSkinId()
-
updateFile
public void updateFile(String sourceUrl, Source source, InputStream is) throws Exception
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
-
_parseInt
private int _parseInt(Configuration cfg, String tagName, int defaultValue)
-
_getCache
private Cache<SitemapInputData.SitemapKey,Integer> _getCache()
-
-