Class 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
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.
-
Field Summary
Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonEvent(org.exoplatform.services.listener.Event<org.exoplatform.agenda.model.AgendaEventModification, Object> event) Unwraps the broadcast and hands the modification to the subclass.protected abstract voidpropagate(CaldavEventPropagationService propagationService, org.exoplatform.agenda.model.AgendaEventModification modification) What this listener asks of the propagation service.protected voidsetCaldavEventPropagationService(CaldavEventPropagationService caldavEventPropagationService) 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, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 servicemodification- 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
-