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 class
SitemapSaxer.BufferedPage
(package private) static class
SitemapSaxer.PageElementKey
(package private) static interface
SitemapSaxer.PageWrapper
(package private) class
SitemapSaxer.RepositoryPage
-
Field Summary
Fields Modifier and Type Field Description private AbstractCacheManager
_cacheManager
private CurrentUserProvider
_currentUserProvider
private Context
_environmentContext
private static ExecutorService
_executor
private RenderingContextHandler
_renderingContextHandler
(package private) RightManager
_rightManager
private ServiceManager
_serviceManager
private SiteManager
_siteManager
private WorkspaceSelector
_workspaceSelector
static String
NAMESPACE_PREFIX
Prefix for sitemap namespace.static String
NAMESPACE_URI
URI for sitemap namespace.private static int
PATH_CURRENT
private static int
PATH_DESCENDANT
private static int
PATH_IN_PATH
private static int
PATH_NOT_IN_PATH
static String
ROLE
Avalon 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)
void
clearCache(String siteName, String workspace)
Clear the page cache.void
contextualize(Context context)
void
initialize()
void
service(ServiceManager manager)
void
toSAX(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:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in 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()
-
-