Package org.ametys.web.repository
Class PageGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
public class PageGenerator extends ServiceableGenerator
Generator for SAXing <code>Content</code> associated with a Page.<br> SAX events are like :<br> <pageContents><br> <zone id="..."><br> <i><!-- XHTML content --></i><br> </zone><br> ...<br> </pageContents/><br>
-
-
Field Summary
Fields Modifier and Type Field Description private ContentTypeExtensionPoint
_contentTypeExtPt
private ContentTypesHelper
_contentTypeHelper
private ContentTypesAssignmentHandler
_cTypeAssignmentHandler
The content type assignment handler.private DynamicContentTypeDescriptorExtentionPoint
_dynamicCTDescriptorEP
private PageResourceAccess
_pageAccess
The monitored resource accessprivate RenderingContextHandler
_renderingContextHandler
private ResourceAccessComponent
_resourceAccessMonitor
The resource access monitoring componentprivate ServicesAssignmentHandler
_serviceAssignmentHandler
The service assignment handler.private ServiceExtensionPoint
_serviceExtPt
private SkinsManager
_skinsManager
private TagProviderExtensionPoint
_tagProviderEP
private org.slf4j.Logger
_timeLogger
private WorkspaceSelector
_workspaceSelector
private PageElementCache
_zoneItemCache
private int
_zoneItemsInCache
private int
_zoneItemsSaxed
private int
_zonesSaxed
-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description PageGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private SkinTemplate
_getTemplateDefinition(Page page)
Get the template definition for a pageprivate String
_getType(ZoneItem zoneItem)
private void
_handleZoneAccess(PageElementResourceAccess zoneAccess, boolean cacheable, boolean hit)
private Zone
_inherit(Page childPage, Page page, String zoneName)
Try to inherit the zone (as it is empty)private void
_saxAvailableContentTypes(Page page, String zoneName)
Generate the list of available content types for the given zone.private void
_saxAvailableServices(Page page, String zoneName)
Generate the list of available services for the given zone.private Object
_saxContentZoneItem(ZoneItem zoneItem, ContentHandler handler, Request request)
private void
_saxCSSFile(ContentHandler handler, ClientSideElement.ScriptFile cssFile)
private void
_saxError(ContentHandler handler, Throwable e)
private Object
_saxServiceZoneItem(ZoneItem zoneItem, ContentHandler handler, Exception ex)
private void
_saxSource(ContentHandler handler, Source src, Exception ex)
private void
_saxZone(Page page, String zoneName, AmetysObjectIterable<? extends ZoneItem> zoneItems, String workspace, String site, RenderingContext renderingContext)
Sax a zoneprivate void
_saxZoneItem(Page page, String workspace, String site, RenderingContext renderingContext, Request request, ZoneItem zoneItem)
private void
_saxZoneItems(Page page, AmetysObjectIterable<? extends ZoneItem> zoneItems, String workspace, String site, RenderingContext renderingContext)
Sax zone itemsprivate boolean
_throwException(Exception ex)
Test if the error has to be thrown instead of SAXing it as an error zone item.void
generate()
void
service(ServiceManager serviceManager)
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_serviceExtPt
private ServiceExtensionPoint _serviceExtPt
-
_contentTypeExtPt
private ContentTypeExtensionPoint _contentTypeExtPt
-
_skinsManager
private SkinsManager _skinsManager
-
_tagProviderEP
private TagProviderExtensionPoint _tagProviderEP
-
_zoneItemCache
private PageElementCache _zoneItemCache
-
_workspaceSelector
private WorkspaceSelector _workspaceSelector
-
_renderingContextHandler
private RenderingContextHandler _renderingContextHandler
-
_contentTypeHelper
private ContentTypesHelper _contentTypeHelper
-
_dynamicCTDescriptorEP
private DynamicContentTypeDescriptorExtentionPoint _dynamicCTDescriptorEP
-
_cTypeAssignmentHandler
private ContentTypesAssignmentHandler _cTypeAssignmentHandler
The content type assignment handler.
-
_serviceAssignmentHandler
private ServicesAssignmentHandler _serviceAssignmentHandler
The service assignment handler.
-
_resourceAccessMonitor
private ResourceAccessComponent _resourceAccessMonitor
The resource access monitoring component
-
_pageAccess
private PageResourceAccess _pageAccess
The monitored resource access
-
_zoneItemsInCache
private int _zoneItemsInCache
-
_zoneItemsSaxed
private int _zoneItemsSaxed
-
_zonesSaxed
private int _zonesSaxed
-
_timeLogger
private org.slf4j.Logger _timeLogger
-
-
Constructor Detail
-
PageGenerator
public PageGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_saxZone
private void _saxZone(Page page, String zoneName, AmetysObjectIterable<? extends ZoneItem> zoneItems, String workspace, String site, RenderingContext renderingContext) throws SAXException, IOException, ProcessingException
Sax a zone- Parameters:
page
- The pagezoneName
- The zone in the page to saxzoneItems
- The items of the zone or nullworkspace
- the workspacesite
- the site's namerenderingContext
- the rendering context- Throws:
SAXException
- if an error occurs while saxingIOException
- if an I/O exception occursProcessingException
- if an error occurs
-
_saxAvailableServices
private void _saxAvailableServices(Page page, String zoneName) throws SAXException
Generate the list of available services for the given zone.- Parameters:
page
- the page.zoneName
- the zone name in the page.- Throws:
SAXException
- if something goes wrong when saxing the available services
-
_saxAvailableContentTypes
private void _saxAvailableContentTypes(Page page, String zoneName) throws SAXException
Generate the list of available content types for the given zone.- Parameters:
page
- the page.zoneName
- the zone name in the page.- Throws:
SAXException
- if something goes wrong when saxing the available content types
-
_saxZoneItems
private void _saxZoneItems(Page page, AmetysObjectIterable<? extends ZoneItem> zoneItems, String workspace, String site, RenderingContext renderingContext) throws SAXException, IOException, ProcessingException
Sax zone items- Parameters:
page
- the pagezoneItems
- The zone items to saxworkspace
- the workspacesite
- the site's namerenderingContext
- the rendering context- Throws:
SAXException
- if an error occurs while saxingIOException
- if an I/O exception occursProcessingException
- if an error occurs
-
_handleZoneAccess
private void _handleZoneAccess(PageElementResourceAccess zoneAccess, boolean cacheable, boolean hit)
-
_saxZoneItem
private void _saxZoneItem(Page page, String workspace, String site, RenderingContext renderingContext, Request request, ZoneItem zoneItem) throws SAXException, ProcessingException, IOException
-
_saxContentZoneItem
private Object _saxContentZoneItem(ZoneItem zoneItem, ContentHandler handler, Request request) throws SAXException, MalformedURLException, IOException
-
_saxServiceZoneItem
private Object _saxServiceZoneItem(ZoneItem zoneItem, ContentHandler handler, Exception ex) throws SAXException, MalformedURLException, IOException
-
_saxCSSFile
private void _saxCSSFile(ContentHandler handler, ClientSideElement.ScriptFile cssFile) throws SAXException
- Throws:
SAXException
-
_saxSource
private void _saxSource(ContentHandler handler, Source src, Exception ex) throws SAXException, IOException, ProcessingException
-
_getTemplateDefinition
private SkinTemplate _getTemplateDefinition(Page page)
Get the template definition for a page- Parameters:
page
- The page. Cannot be null.- Returns:
- The template definition. Null if the page is not a container or if the template is not declared.
-
_inherit
private Zone _inherit(Page childPage, Page page, String zoneName)
Try to inherit the zone (as it is empty)- Parameters:
childPage
- The child page that do inherit. Cannot be nullpage
- The page to inherit. Cannot be nullzoneName
- The zone name in the page to inherit. Cannot be null or empty- Returns:
- The zone inherited or null.
-
_throwException
private boolean _throwException(Exception ex)
Test if the error has to be thrown instead of SAXing it as an error zone item.- Parameters:
ex
- the exception.- Returns:
- true to throw the exception, false to catch it and SAX it as an error zone item.
-
_saxError
private void _saxError(ContentHandler handler, Throwable e) throws SAXException
- Throws:
SAXException
-
-