Interface CalendarSubscriptionChannel

All Known Implementing Classes:
BlueMindSubscriptionChannel, NoSubscriptionChannel

public interface CalendarSubscriptionChannel
How a calendar server product lays out, and lets eXo edit, the calendars an account subscribes to — the calendars of somebody else that its DAV listing shows under the account's own home, and that a share only reaches once the colleague is subscribed.

How it is found. CalendarSubscriptionChannelRegistry collects every bean implementing this interface, across web applications: a contributor is a Spring @Service, never final. The channel of an account is the first one that names its principal's uid (userUidOf(java.lang.String)); a listed collection is a subscription when the first channel that reads one in it says so (subscriptionOf(java.lang.String, java.lang.String)).

What happens without one. A listed collection is what the DAV listing says it is (no subscription is recognised by its name), no owner listing is read, and a subscription change eXo owes an account is abandoned with a reason at the next drain rather than retried (NoSubscriptionChannel).

  • Method Details

    • id

      String id()
      The channel's stable identifier, for the log.
      Returns:
      the identifier, never blank
    • userUidOf

      String userUidOf(String principal)
      The uid this product addresses a user by, read from their DAV principal.
      Parameters:
      principal - a principal path, any spelling, may be null
      Returns:
      the uid, or null when the principal is not one of this product's user principals — acting on a guessed uid is worse than not acting
    • subscriptionOf

      CalendarSubscription subscriptionOf(String href, String principal)
      The subscription a collection listed in an account's home is, when its name says it belongs to somebody else.
      Parameters:
      href - the collection's path, raw or canonical
      principal - the account's own principal path, may be null or blank when the server named none
      Returns:
      the subscription, or null when the collection is not one, names the account itself, or no principal is known
    • asSubscriber

      <T> T asSubscriber(CalDavEndpoint endpoint, String userUid, Function<SubscriptionEdits,T> job)
      Runs subscription edits in one session opened as a user, after checking the session really is theirs.
      Type Parameters:
      T - what the job produces
      Parameters:
      endpoint - the user's DAV endpoint, minted for their eXo login
      userUid - the uid eXo recorded for them
      job - the edits to make
      Returns:
      what the job produced
      Throws:
      UnsupportedOperationException - when the user's configured credentials cannot open such a session
      CalDavSubjectMismatchException - when the server authenticated somebody other than the recorded uid; nothing was sent
      CalDavException - when the session cannot be opened or an edit is answered with a failure
    • ownersOf

      CalendarOwners ownersOf(CalDavEndpoint endpoint)
      The owner of every calendar an account's session sees, as the server itself answers it.
      Parameters:
      endpoint - the account's endpoint
      Returns:
      the listing, never null
      Throws:
      UnsupportedOperationException - when the account's configured credentials cannot open such a session
      RuntimeException - whatever stops the listing from being read