Package org.ametys.web.inputdata
Class SitemapSaxer
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.inputdata.SitemapSaxer
-
- All Implemented Interfaces:
LogEnabled,Initializable,Component,Contextualizable,Serviceable
public class SitemapSaxer extends AbstractLogEnabled implements Serviceable, Component, Initializable, Contextualizable
Send a sitemap as SAX events. Handles both cacheable and non-cacheable cases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSitemapSaxer.BufferedPage(package private) static classSitemapSaxer.PageElementKey(package private) static interfaceSitemapSaxer.PageWrapper(package private) classSitemapSaxer.RepositoryPage
-
Field Summary
Fields Modifier and Type Field Description private AbstractCacheManager_cacheManagerprivate CurrentUserProvider_currentUserProviderprivate Context_environmentContextprivate static ExecutorService_executorprivate RenderingContextHandler_renderingContextHandler(package private) RightManager_rightManagerprivate ServiceManager_serviceManagerprivate SiteManager_siteManagerprivate WorkspaceSelector_workspaceSelectorstatic StringNAMESPACE_PREFIXPrefix for sitemap namespace.static StringNAMESPACE_URIURI for sitemap namespace.private static intPATH_CURRENTprivate static intPATH_DESCENDANTprivate static intPATH_IN_PATHprivate static intPATH_NOT_IN_PATHstatic StringROLEAvalon role.
-
Constructor Summary
Constructors Constructor Description SitemapSaxer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_asyncFill(SitemapSaxer.PageElementKey key, String siteName, String sitemapName, String workspace)private List<SitemapSaxer.BufferedPage>_fill(String siteName, String sitemapName)private List<SitemapSaxer.BufferedPage>_fill(AmetysObjectIterable<? extends Page> pages)(package private) Map<String,String>_getAttributes(Page page)private Cache<SitemapSaxer.PageElementKey,List<SitemapSaxer.BufferedPage>>_getCache()(package private) Map<String,String>_getInternalAttributes(Page page)protected int_saxCurrentStatus(String currentPagePath, String pagePath, AttributesImpl attrs)SAX current status.private void_saxPage(ContentHandler handler, SitemapSaxer.PageWrapper page, Page currentPage, String currentPagePath, UserIdentity userIdentity, RenderingContext renderingContext, RestrictedPagePolicy policy, int initialDepth, int descendantDepth, int currentDepth, int currentDescendantDepth)private void_saxPages(ContentHandler handler, List<? extends SitemapSaxer.PageWrapper> pages, Page currentPage, String currentPagePath, UserIdentity userIdentity, RenderingContext renderingContext, RestrictedPagePolicy policy, int initialDepth, int descendantDepth, int currentDepth, int currentDescendantDepth)voidclearCache(String siteName, String workspace)Clear the page cache.voidcontextualize(Context context)voidinitialize()voidservice(ServiceManager manager)voidtoSAX(ContentHandler contentHandler, String siteName, String sitemapName, Page currentPage, int initialDepth, int descendantDepth)Send SAX events representing pages from a sitemap.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
NAMESPACE_PREFIX
public static final String NAMESPACE_PREFIX
Prefix for sitemap namespace.- See Also:
- Constant Field Values
-
NAMESPACE_URI
public static final String NAMESPACE_URI
URI for sitemap namespace.- See Also:
- Constant Field Values
-
_executor
private static ExecutorService _executor
-
PATH_DESCENDANT
private static final int PATH_DESCENDANT
- See Also:
- Constant Field Values
-
PATH_NOT_IN_PATH
private static final int PATH_NOT_IN_PATH
- See Also:
- Constant Field Values
-
PATH_IN_PATH
private static final int PATH_IN_PATH
- See Also:
- Constant Field Values
-
PATH_CURRENT
private static final int PATH_CURRENT
- See Also:
- Constant Field Values
-
_rightManager
RightManager _rightManager
-
_renderingContextHandler
private RenderingContextHandler _renderingContextHandler
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_workspaceSelector
private WorkspaceSelector _workspaceSelector
-
_siteManager
private SiteManager _siteManager
-
_cacheManager
private AbstractCacheManager _cacheManager
-
_serviceManager
private ServiceManager _serviceManager
-
_environmentContext
private Context _environmentContext
-
-
Constructor Detail
-
SitemapSaxer
public SitemapSaxer()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
clearCache
public void clearCache(String siteName, String workspace)
Clear the page cache.- Parameters:
siteName- the site.workspace- the JCR workspace.
-
toSAX
public void toSAX(ContentHandler contentHandler, String siteName, String sitemapName, Page currentPage, int initialDepth, int descendantDepth) throws SAXException, ProcessingException
Send SAX events representing pages from a sitemap.- Parameters:
contentHandler- the SAX handler.siteName- the site name.sitemapName- the sitemap name.currentPage- the currentPage.initialDepth- max depth from the root.descendantDepth- max depth under the current page.- Throws:
SAXException- if an error occurs with the content handler.ProcessingException- if an error occurs while processing data.
-
_asyncFill
private void _asyncFill(SitemapSaxer.PageElementKey key, String siteName, String sitemapName, String workspace)
-
_fill
private List<SitemapSaxer.BufferedPage> _fill(String siteName, String sitemapName)
-
_fill
private List<SitemapSaxer.BufferedPage> _fill(AmetysObjectIterable<? extends Page> pages)
-
_getInternalAttributes
Map<String,String> _getInternalAttributes(Page page)
-
_getAttributes
Map<String,String> _getAttributes(Page page)
-
_saxPages
private void _saxPages(ContentHandler handler, List<? extends SitemapSaxer.PageWrapper> pages, Page currentPage, String currentPagePath, UserIdentity userIdentity, RenderingContext renderingContext, RestrictedPagePolicy policy, int initialDepth, int descendantDepth, int currentDepth, int currentDescendantDepth) throws SAXException
- Throws:
SAXException
-
_saxPage
private void _saxPage(ContentHandler handler, SitemapSaxer.PageWrapper page, Page currentPage, String currentPagePath, UserIdentity userIdentity, RenderingContext renderingContext, RestrictedPagePolicy policy, int initialDepth, int descendantDepth, int currentDepth, int currentDescendantDepth) throws SAXException
- Throws:
SAXException
-
_saxCurrentStatus
protected int _saxCurrentStatus(String currentPagePath, String pagePath, AttributesImpl attrs)
SAX current status.- Parameters:
currentPagePath- the path to the current page.pagePath- the path to the page to process.attrs- the attributes to populate.- Returns:
- the current status.
-
_getCache
private Cache<SitemapSaxer.PageElementKey,List<SitemapSaxer.BufferedPage>> _getCache()
-
-