Class AgendaEventPropagationListener

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.services.listener.Listener<org.exoplatform.agenda.model.AgendaEventModification,Object>
org.exoplatform.caldav.listener.AgendaEventPropagationListener
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin, org.exoplatform.services.listener.ListenerBase<org.exoplatform.agenda.model.AgendaEventModification,Object>
Direct Known Subclasses:
EventCreatedListener, EventDeletedListener, EventUpdatedListener

public abstract class AgendaEventPropagationListener extends org.exoplatform.services.listener.Listener<org.exoplatform.agenda.model.AgendaEventModification,Object>
What the two agenda-modification listeners share: unwrapping the broadcast, resolving the propagation service, and refusing to run outside a container.

Glue only, per the extensibility norm. Nothing here decides anything about a calendar copy — which modifications matter, who holds a copy, what is written and what is removed all live in CaldavEventPropagationService. Two subclasses exist rather than one class switching on the event name, because "the meeting changed" and "the meeting is gone" are two different instructions to a calendar and reading them apart is worth two files.

Why asynchronous

Same reason as CalendarCreatedListener and EventResponseSavedListener: agenda raises these inside the transaction that saves the edit. Talking to one calendar server there would hold a database transaction open across a network round trip; talking to fifty would let the slowest of fifty unrelated accounts decide whether somebody can move a meeting.

The container the asynchronous thread runs in

It has one, and that is not incidental. The kernel wraps an @Asynchronous listener in its own RunListener, which does ExoContainerContext.setCurrentContainer(container) and RequestLifeCycle.begin(container) before calling onEvent (kernel, ListenerService.java:241-242). That is what makes the transactional write recording what was pushed actually commit — outside a container it fails as a warning nobody reads.

It is checked rather than assumed — with getCurrentContainerIfPresent(), which answers null rather than building a root container out of a check — because the failure it guards against is silent by construction, and because the guarantee holds only for as long as the work stays on this thread. Nothing below here may start a thread of its own: a fan-out onto an executor would leave the container behind and reintroduce exactly the silent failure. The fan-out is therefore sequential, on this thread, by design and not by omission. The one exception is the walk over the members of an invited space, handed to the add-on's outward thread, which sets up a container of its own (CaldavEventPropagationService#seedSpaceMembersInContainer).

  • Field Summary

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

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onEvent(org.exoplatform.services.listener.Event<org.exoplatform.agenda.model.AgendaEventModification,Object> event)
    Unwraps the broadcast and hands the modification to the subclass.
    protected abstract void
    propagate(CaldavEventPropagationService propagationService, org.exoplatform.agenda.model.AgendaEventModification modification)
    What this listener asks of the propagation service.
    protected void
    Hands the service to tests, which have no container to resolve it from.

    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

    • AgendaEventPropagationListener

      public AgendaEventPropagationListener()
  • Method Details

    • onEvent

      public void onEvent(org.exoplatform.services.listener.Event<org.exoplatform.agenda.model.AgendaEventModification,Object> event)
      Unwraps the broadcast and hands the modification to the subclass.
      Parameters:
      event - carries the modification as its source
    • propagate

      protected abstract void propagate(CaldavEventPropagationService propagationService, org.exoplatform.agenda.model.AgendaEventModification modification)
      What this listener asks of the propagation service.
      Parameters:
      propagationService - the resolved service
      modification - the modification agenda broadcast
    • setCaldavEventPropagationService

      protected void setCaldavEventPropagationService(CaldavEventPropagationService caldavEventPropagationService)
      Hands the service to tests, which have no container to resolve it from.
      Parameters:
      caldavEventPropagationService - the service to use