Class CalendarObjectWriters

java.lang.Object
org.exoplatform.caldav.client.CalendarObjectWriters

@Component public class CalendarObjectWriters extends Object
Picks the door a server's copies go through: the one write-channel decision of the whole engine (EXO-90307).

Chosen per server, never per call site: the registration's CaldavServer.getWriteChannel() is read for the server the endpoint was minted from, and every write and removal on that endpoint — the organizer's copy, an invitee's copy, an answer carried onto a copy, a repair, a relocation — goes through the same door. That is what makes the administrator's flag a complete rollback: nothing else decides.

No fallback on a registry failure, and that is deliberate where CaldavPushService.mirrorTargetOf does fall back. There, writing the copies where they have always gone is at worst unchanged behaviour. Here, writing through CalDAV a copy meant for the import channel is the very defect the channel exists to prevent — BlueMind would schedule the meeting — so a registry that cannot be read fails the write, which the sweep retries, rather than quietly choosing the wrong door. The endpoint was minted from the same registry a moment earlier, so this read failing is a real incident, not a routine miss.

The doors are contributed. CalDAV is built in; every other channel's writer comes from a CalendarWriteChannelPlugin, collected by type from every web application, so this class names no server. A registration declaring a channel nobody contributes is refused with CaldavPushService.WRITE_CHANNEL_UNAVAILABLE — never written through CalDAV instead, for the reason stated above.

  • Constructor Details

    • CalendarObjectWriters

      @Autowired public CalendarObjectWriters(CaldavServerService caldavServerService, CalDavObjectWriter calDavObjectWriter, org.springframework.beans.factory.ObjectProvider<CalendarWriteChannelPlugin> plugins)
      The resolver over the registry, the CalDAV door and every contributed one.
      Parameters:
      caldavServerService - the registry the channel is read from
      calDavObjectWriter - the CalDAV door
      plugins - the contributed doors, from every web application, each read on its own so that one which cannot be created is left out (ContributedBeans); null reads as none
  • Method Details

    • of

      public static CalendarObjectWriters of(CaldavServerService caldavServerService, CalDavObjectWriter calDavObjectWriter, List<CalendarWriteChannelPlugin> plugins)
      The resolver over a fixed list of contributions, as a test states them.
      Parameters:
      caldavServerService - the registry the channel is read from
      calDavObjectWriter - the CalDAV door
      plugins - the contributed doors, may be null for none
      Returns:
      the resolver
    • writer

      public CalendarObjectWriter writer(CalDavEndpoint endpoint)
      The writer for every object of an endpoint's server.
      Parameters:
      endpoint - the endpoint minted from the registry
      Returns:
      the door the server's registration declares
      Throws:
      CaldavPushException - with CaldavPushService.WRITE_CHANNEL_UNAVAILABLE when the registration declares a channel no contribution serves
      RuntimeException - whatever the registry raises when it cannot be read — propagated, never turned into a door
    • serves

      public boolean serves(org.exoplatform.caldav.model.WriteChannel channel)
      Whether a channel has a door on this platform: CalDAV always, any other one when a contribution serves it.
      Parameters:
      channel - the channel, may be null for CalDAV
      Returns:
      true when a write on that channel can be carried out