Interface CalendarObjectWriter
- All Known Implementing Classes:
CalDavObjectWriter
Why an interface between the engine and CalDavClient (EXO-90307).
On BlueMind a CalDAV PUT makes the server schedule the meeting
itself, and the only door that does not is BlueMind's own REST import API;
the engine, though, must not know which server it is talking to — a service
that branched on "is this BlueMind" at every write would carry that
knowledge into a dozen call sites. So each write goes through the writer
CalendarObjectWriters resolves for the server, and the engine's own
rules — conditional in both directions, a 412 is an answer and not a fault,
a 404 on delete is a fact — are stated once here and honoured by every
implementation.
The contracts are those of the CalDavClient methods of the same
names, restated so an implementation that has no If-Match header to
send knows what it must emulate:
putObject(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.lang.String)creates and only creates: an object already at the href is answered 412, never overwritten.updateObject(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.lang.String, java.lang.String)replaces only what the caller last read: a version other thanifMatch— or no object at all — is answered 412, and a blank precondition is refused rather than sent unconditional.overwriteObject(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.lang.String)writes whatever is there, and is only ever reached after somebody compared both copies; seeCalDavClient.overwriteObject(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.lang.String).deleteObject(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.lang.String)removes conditionally when a version is given, and answers 200/204 removed, 404/410 already gone, 412 refused.
etag is the version the server now holds for the
object, in the shape the server's own listings answer for it, or null when
the implementation could not learn it.-
Method Summary
Modifier and TypeMethodDescriptionintdeleteObject(CalDavEndpoint endpoint, String href, String ifMatch) Deletes one object, conditionally when a version is given.overwriteObject(CalDavEndpoint endpoint, String href, String icsData) Writes one object over whatever is there, with no precondition at all.putObject(CalDavEndpoint endpoint, String href, String icsData) Creates one object; an object already at the href is answered 412.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.
-
Method Details
-
putObject
Creates one object; an object already at the href is answered 412.- Parameters:
endpoint- the declared serverhref- the object's server-absolute path to create aticsData- the iCalendar text to store- Returns:
- the status and, when known, the stored version
- Throws:
CalDavAuthenticationException- when the credentials are refusedCalDavException- when the write could not be carried out
-
overwriteObject
Writes one object over whatever is there, with no precondition at all.- Parameters:
endpoint- the declared serverhref- the object's server-absolute pathicsData- the iCalendar text to store- Returns:
- the status and, when known, the stored version; never a 412
- Throws:
CalDavAuthenticationException- when the credentials are refusedCalDavException- when the write could not be carried out
-
updateObject
Replaces one existing object, only when its version is still the one the caller last read.- Parameters:
endpoint- the declared serverhref- the object's server-absolute pathicsData- the iCalendar text to storeifMatch- 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
- Throws:
IllegalArgumentException- when the precondition is blankCalDavAuthenticationException- when the credentials are refusedCalDavException- when the write could not be carried out
-
deleteObject
Deletes one object, conditionally when a version is given.- Parameters:
endpoint- the declared serverhref- the object's server-absolute pathifMatch- the version to condition the removal on, or null to remove unconditionally- Returns:
- 200 or 204 removed, 404 or 410 already gone, 412 refused
- Throws:
CalDavAuthenticationException- when the credentials are refusedCalDavException- when the removal could not be carried out
-