Class CaldavManagedDisconnectionService

java.lang.Object
org.exoplatform.caldav.service.CaldavManagedDisconnectionService

@Service public class CaldavManagedDisconnectionService extends Object
Disconnects the users an administrator's change leaves on a CalDAV server that is no longer theirs, and counts them beforehand for the warning the administration screen shows.

Two changes, two populations:

  • a change of the managed mode - another designated server, managed mode off, a group excluded - disconnects the users managed mode attached and no longer governs; the users who chose a server themselves are never touched;
  • a server moved to another credentials provider disconnects every user of that server, whoever made the connection. Nobody is reconnected automatically.
Every disconnection is CaldavRelayService.disconnectForUser(long, String): agenda's record of the connection is removed, then CaldavConnectorService.deleteCaldavSetting(long, String), the path a user's own disconnection takes - the calendars are tidied, the shares and the BlueMind session forgotten, as they are then. They run in the background, one user at a time: the administrator's request does not wait for them, and the failure of one is logged without abandoning the rest - a user left connected is caught at their next login, or at the next change.
  • Constructor Details

    • CaldavManagedDisconnectionService

      public CaldavManagedDisconnectionService()
  • Method Details

    • countUsersNoLongerManaged

      public int countUsersNoLongerManaged(Long designation, List<String> excludedGroups, String username) throws IllegalAccessException
      How many accounts a managed-mode change would disconnect, before it is applied: the users managed mode attached that the proposed state no longer governs.
      Parameters:
      designation - the server the change designates, null when it switches managed mode off
      excludedGroups - the groups the change excludes, null for none
      username - the eXo login of the caller
      Returns:
      the number of accounts the change would disconnect
      Throws:
      IllegalAccessException - when the caller may not administer CalDAV servers
    • countUsersOf

      public int countUsersOf(long serverId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      How many accounts moving a server to another provider would disconnect: every user connected to it.
      Parameters:
      serverId - the server
      username - the eXo login of the caller
      Returns:
      the number of users connected to the server
      Throws:
      IllegalAccessException - when the caller may not administer CalDAV servers
      org.exoplatform.commons.exception.ObjectNotFoundException - when no server has this id
    • disconnectUsersNoLongerManaged

      public void disconnectUsersNoLongerManaged()
      Disconnects, in the background, the users managed mode attached and no longer governs in the state now stored. The selection itself runs in the background too: the administrator's request returns as soon as the change is stored.
    • disconnectAllUsersOf

      public void disconnectAllUsersOf(long serverId)
      Disconnects, in the background, every user of a server.
      Parameters:
      serverId - the server whose provider changed
    • reconcile

      public void reconcile()
      Selects and disconnects the users managed mode no longer governs, on the executor's thread.

      @ContainerTransactional because this runs on a bare executor thread; the work itself is in reconcileNow(), the un-advised method.

      One request lifecycle for the whole run, disconnectAll(long) likewise: every setting read stays in its persistence context until the run ends. Accepted: a run reads each user it walks once, and a lifecycle per user would set the container up again for every one of them.

    • disconnectAll

      public void disconnectAll(long serverId)
      Disconnects every user of a server, on the executor's thread.
      Parameters:
      serverId - the server whose provider changed
    • stop

      @PreDestroy public void stop()