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_contentTypeExtPtprivate ContentTypesHelper_contentTypeHelperprivate ContentTypesAssignmentHandler_cTypeAssignmentHandlerThe content type assignment handler.private DynamicContentTypeDescriptorExtentionPoint_dynamicCTDescriptorEPprivate PageResourceAccess_pageAccessThe monitored resource accessprivate RenderingContextHandler_renderingContextHandlerprivate ResourceAccessComponent_resourceAccessMonitorThe resource access monitoring componentprivate ServicesAssignmentHandler_serviceAssignmentHandlerThe service assignment handler.private ServiceExtensionPoint_serviceExtPtprivate SkinsManager_skinsManagerprivate TagProviderExtensionPoint_tagProviderEPprivate org.slf4j.Logger_timeLoggerprivate WorkspaceSelector_workspaceSelectorprivate PageElementCache_zoneItemCacheprivate int_zoneItemsInCacheprivate int_zoneItemsSaxedprivate 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.voidgenerate()voidservice(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:
servicein interfaceServiceable- Overrides:
servicein 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
-
-