Class PageSavedIndexingListener

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.services.listener.Listener<Object,org.exoplatform.portal.config.model.Page>
io.meeds.social.cms.listener.PageSavedIndexingListener
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin, org.exoplatform.services.listener.ListenerBase<Object,org.exoplatform.portal.config.model.Page>

public class PageSavedIndexingListener extends org.exoplatform.services.listener.Listener<Object,org.exoplatform.portal.config.model.Page>
Reacts to the portal's own LayoutService.PAGE_CREATED / LayoutService.PAGE_UPDATED events — broadcast by every path that stores a page, the layout editor included — to index the bare page document (see PageContentIndexingConnector) of a page that PageContentBlockIndexingListener never hears about: a page imported from a site or space template, injected by an addon's configuration, or saved through the portal API rather than through the Layout addon's services, which are the only ones broadcasting layout.page.*.

Deliberately registered through Kernel configuration (indexing-configuration.xml) rather than as a Spring @Component: the Spring contexts finish booting in a post-init task of the portal container, after every Kernel Startable has run — including the one importing the product's sites on a fresh installation. A Spring listener would therefore miss the events of exactly the pages this one exists for. For the same reason it depends on Kernel services only.

It only ever queues the bare page document itself: whether it materializes is the connector's decision (a page carrying content blocks, or not reachable from any navigation node, yields none), and a page's content block documents are reconciled by the Layout events.

The portal events also fire for the saves the Layout addon performs itself — the layout editor's own save, a page creation, a layout restore — right before Layout broadcasts layout.page.updated for the same page, so on those paths both this listener and PageContentBlockIndexingListener run for one edit. This is accepted deliberately, and its cost is bounded: the indexing queue executes duplicates, but what this listener adds for an update is one bare page document refresh, which the connector builds without re-queuing the live blocks the other listener already refreshes (see PageContentIndexingConnector#update). Only a creation queues them. The two Layout saves that broadcast no layout.page.* event at all (a section clone, a page link update) are what keeps PAGE_UPDATED in this listener's scope.

  • Field Summary

    Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageSavedIndexingListener(org.exoplatform.commons.search.index.IndexingService indexingService, org.exoplatform.portal.mop.service.LayoutService layoutService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onEvent(org.exoplatform.services.listener.Event<Object,org.exoplatform.portal.config.model.Page> event)
     

    Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin

    getDescription, getName, setDescription, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.exoplatform.services.listener.ListenerBase

    getName
  • Constructor Details

    • PageSavedIndexingListener

      public PageSavedIndexingListener(org.exoplatform.commons.search.index.IndexingService indexingService, org.exoplatform.portal.mop.service.LayoutService layoutService)
  • Method Details

    • onEvent

      public void onEvent(org.exoplatform.services.listener.Event<Object,org.exoplatform.portal.config.model.Page> event) throws Exception
      Throws:
      Exception