Class CalDavObjectWriter

java.lang.Object
org.exoplatform.caldav.client.CalDavObjectWriter
All Implemented Interfaces:
CalendarObjectWriter

@Component public class CalDavObjectWriter extends Object implements CalendarObjectWriter
The CalDAV door: every write is the CalDavClient method of the same name, with the same headers, the same body and the same answer. Zero behaviour change from the days the engine called the client directly — this class exists so that another door — a contributed one (CalendarWriteChannelPlugin), such as the BlueMind add-on's import writer — can be chosen per server without the engine knowing there are two.
  • Constructor Details

    • CalDavObjectWriter

      @Autowired public CalDavObjectWriter(CalDavClient calDavClient)
      The writer over the one CalDAV client.
      Parameters:
      calDavClient - the protocol client every request goes through
  • Method Details

    • putObject

      public PutResult putObject(CalDavEndpoint endpoint, String href, String icsData)
      Creates one object; an object already at the href is answered 412.
      Specified by:
      putObject in interface CalendarObjectWriter
      Parameters:
      endpoint - the declared server
      href - the object's server-absolute path to create at
      icsData - the iCalendar text to store
      Returns:
      the status and, when known, the stored version
    • overwriteObject

      public PutResult overwriteObject(CalDavEndpoint endpoint, String href, String icsData)
      Writes one object over whatever is there, with no precondition at all.
      Specified by:
      overwriteObject in interface CalendarObjectWriter
      Parameters:
      endpoint - the declared server
      href - the object's server-absolute path
      icsData - the iCalendar text to store
      Returns:
      the status and, when known, the stored version; never a 412
    • updateObject

      public PutResult updateObject(CalDavEndpoint endpoint, String href, String icsData, String ifMatch)
      Replaces one existing object, only when its version is still the one the caller last read.
      Specified by:
      updateObject in interface CalendarObjectWriter
      Parameters:
      endpoint - the declared server
      href - the object's server-absolute path
      icsData - the iCalendar text to store
      ifMatch - the version the caller's own read answered, verbatim
      Returns:
      the status and, when known, the stored version; 412 when the object moved on or is gone
    • deleteObject

      public int deleteObject(CalDavEndpoint endpoint, String href, String ifMatch)
      Deletes one object, conditionally when a version is given.
      Specified by:
      deleteObject in interface CalendarObjectWriter
      Parameters:
      endpoint - the declared server
      href - the object's server-absolute path
      ifMatch - the version to condition the removal on, or null to remove unconditionally
      Returns:
      200 or 204 removed, 404 or 410 already gone, 412 refused