diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-06-18 18:15:50 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-06-25 04:59:01 +0200 |
commit | 8f061f5407a3c1c0286b08851ab6740b52a20964 (patch) | |
tree | d3ad852025f4a86fa212959bb565b81996e292aa /lib | |
parent | 9aca92c441229619cfef5ee4dc68f71d819bc6e9 (diff) | |
download | nextcloud-server-8f061f5407a3c1c0286b08851ab6740b52a20964.tar.gz nextcloud-server-8f061f5407a3c1c0286b08851ab6740b52a20964.zip |
periodically query calendar resource / room backends for updated resource / room information
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Calendar/Resource/Manager.php | 12 | ||||
-rw-r--r-- | lib/private/Calendar/Room/Manager.php | 12 | ||||
-rw-r--r-- | lib/public/Calendar/BackendTemporarilyUnavailableException.php | 26 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IBackend.php | 4 | ||||
-rw-r--r-- | lib/public/Calendar/Resource/IManager.php | 6 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IBackend.php | 4 | ||||
-rw-r--r-- | lib/public/Calendar/Room/IManager.php | 6 |
7 files changed, 70 insertions, 0 deletions
diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php index 0cb4a739b7e..2d1746cb989 100644 --- a/lib/private/Calendar/Resource/Manager.php +++ b/lib/private/Calendar/Resource/Manager.php @@ -61,6 +61,18 @@ class Manager implements \OCP\Calendar\Resource\IManager { } /** + * @param string $backendId + * @return IBackend|null + */ + public function getBackend($backendId):IBackend { + if (!isset($this->backends[$backendId])) { + return null; + } + + return $this->backends[$backendId]; + } + + /** * removes all registered backend instances * @return void * @since 14.0.0 diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php index ac446aca944..9ddf1f1d7b7 100644 --- a/lib/private/Calendar/Room/Manager.php +++ b/lib/private/Calendar/Room/Manager.php @@ -61,6 +61,18 @@ class Manager implements \OCP\Calendar\Room\IManager { } /** + * @param string $backendId + * @return IBackend|null + */ + public function getBackend($backendId):IBackend { + if (!isset($this->backends[$backendId])) { + return null; + } + + return $this->backends[$backendId]; + } + + /** * removes all registered backend instances * @return void * @since 14.0.0 diff --git a/lib/public/Calendar/BackendTemporarilyUnavailableException.php b/lib/public/Calendar/BackendTemporarilyUnavailableException.php new file mode 100644 index 00000000000..61c1934c342 --- /dev/null +++ b/lib/public/Calendar/BackendTemporarilyUnavailableException.php @@ -0,0 +1,26 @@ +<?php +/** + * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Calendar; + +class BackendTemporarilyUnavailableException extends \Exception {} diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php index 8b0ea677401..564c9e008b5 100644 --- a/lib/public/Calendar/Resource/IBackend.php +++ b/lib/public/Calendar/Resource/IBackend.php @@ -22,6 +22,7 @@ */ namespace OCP\Calendar\Resource; +use OCP\Calendar\BackendTemporarilyUnavailableException; /** * Interface IBackend @@ -34,6 +35,7 @@ interface IBackend { /** * get a list of all resources in this backend * + * @throws BackendTemporarilyUnavailableException * @return IResource[] */ public function getAllResources():array; @@ -41,6 +43,7 @@ interface IBackend { /** * get a list of all resource identifiers in this backend * + * @throws BackendTemporarilyUnavailableException * @return string[] */ public function listAllResources():array; @@ -49,6 +52,7 @@ interface IBackend { * get a resource by it's id * * @param string $id + * @throws BackendTemporarilyUnavailableException * @return IResource|null */ public function getResource($id); diff --git a/lib/public/Calendar/Resource/IManager.php b/lib/public/Calendar/Resource/IManager.php index dc52b269ad4..d2ec7350dad 100644 --- a/lib/public/Calendar/Resource/IManager.php +++ b/lib/public/Calendar/Resource/IManager.php @@ -50,6 +50,12 @@ interface IManager { public function getBackends():array; /** + * @param string $backendId + * @return IBackend + */ + public function getBackend($backendId):IBackend; + + /** * removes all registered backend instances * @return void * @since 14.0.0 diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php index 84e01f6e320..0d4c3ef678f 100644 --- a/lib/public/Calendar/Room/IBackend.php +++ b/lib/public/Calendar/Room/IBackend.php @@ -22,6 +22,7 @@ */ namespace OCP\Calendar\Room; +use OCP\Calendar\BackendTemporarilyUnavailableException; /** * Interface IBackend @@ -34,6 +35,7 @@ interface IBackend { /** * get a list of all rooms in this backend * + * @throws BackendTemporarilyUnavailableException * @return IRoom[] */ public function getAllRooms():array; @@ -41,6 +43,7 @@ interface IBackend { /** * get a list of all room identifiers in this backend * + * @throws BackendTemporarilyUnavailableException * @return string[] */ public function listAllRooms():array; @@ -49,6 +52,7 @@ interface IBackend { * get a room by it's id * * @param string $id + * @throws BackendTemporarilyUnavailableException * @return IRoom|null */ public function getRoom($id); diff --git a/lib/public/Calendar/Room/IManager.php b/lib/public/Calendar/Room/IManager.php index a04e75c41b4..6f55f0f76c0 100644 --- a/lib/public/Calendar/Room/IManager.php +++ b/lib/public/Calendar/Room/IManager.php @@ -50,6 +50,12 @@ interface IManager { public function getBackends():array; /** + * @param string $backendId + * @return IBackend + */ + public function getBackend($backendId):IBackend; + + /** * removes all registered backend instances * @return void * @since 14.0.0 |