2016-04-18 19:17:08 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Bjoern Schiessle <bjoern@schiessle.org>
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2016-04-18 19:17:08 +03:00
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* 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, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace OCA\FederatedFileSharing\AppInfo;
|
|
|
|
|
|
|
|
|
2016-08-19 13:01:13 +03:00
|
|
|
use OC\AppFramework\Utility\SimpleContainer;
|
|
|
|
use OCA\FederatedFileSharing\AddressHandler;
|
|
|
|
use OCA\FederatedFileSharing\Controller\RequestHandlerController;
|
2016-04-18 19:17:08 +03:00
|
|
|
use OCA\FederatedFileSharing\FederatedShareProvider;
|
2016-08-19 13:01:13 +03:00
|
|
|
use OCA\FederatedFileSharing\Notifications;
|
2016-04-18 19:17:08 +03:00
|
|
|
use OCP\AppFramework\App;
|
2017-05-24 10:07:58 +03:00
|
|
|
use OCP\GlobalScale\IConfig;
|
2016-04-18 19:17:08 +03:00
|
|
|
|
|
|
|
class Application extends App {
|
|
|
|
|
|
|
|
/** @var FederatedShareProvider */
|
|
|
|
protected $federatedShareProvider;
|
|
|
|
|
2016-05-23 12:48:14 +03:00
|
|
|
public function __construct() {
|
|
|
|
parent::__construct('federatedfilesharing');
|
2016-08-19 13:01:13 +03:00
|
|
|
|
|
|
|
$container = $this->getContainer();
|
|
|
|
$server = $container->getServer();
|
|
|
|
|
|
|
|
$container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) {
|
|
|
|
$addressHandler = new AddressHandler(
|
|
|
|
$server->getURLGenerator(),
|
2017-01-27 14:52:17 +03:00
|
|
|
$server->getL10N('federatedfilesharing'),
|
|
|
|
$server->getCloudIdManager()
|
2016-08-19 13:01:13 +03:00
|
|
|
);
|
|
|
|
$notification = new Notifications(
|
|
|
|
$addressHandler,
|
|
|
|
$server->getHTTPClientService(),
|
2017-04-05 23:35:59 +03:00
|
|
|
$server->query(\OCP\OCS\IDiscoveryService::class),
|
2016-08-19 13:01:13 +03:00
|
|
|
\OC::$server->getJobList()
|
|
|
|
);
|
|
|
|
return new RequestHandlerController(
|
|
|
|
$c->query('AppName'),
|
|
|
|
$server->getRequest(),
|
|
|
|
$this->getFederatedShareProvider(),
|
|
|
|
$server->getDatabaseConnection(),
|
|
|
|
$server->getShareManager(),
|
|
|
|
$notification,
|
|
|
|
$addressHandler,
|
2017-01-27 14:52:17 +03:00
|
|
|
$server->getUserManager(),
|
|
|
|
$server->getCloudIdManager()
|
2016-08-19 13:01:13 +03:00
|
|
|
);
|
|
|
|
});
|
2016-05-23 12:48:14 +03:00
|
|
|
}
|
|
|
|
|
2016-04-18 19:17:08 +03:00
|
|
|
/**
|
|
|
|
* get instance of federated share provider
|
|
|
|
*
|
|
|
|
* @return FederatedShareProvider
|
|
|
|
*/
|
|
|
|
public function getFederatedShareProvider() {
|
|
|
|
if ($this->federatedShareProvider === null) {
|
|
|
|
$this->initFederatedShareProvider();
|
|
|
|
}
|
|
|
|
return $this->federatedShareProvider;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* initialize federated share provider
|
|
|
|
*/
|
|
|
|
protected function initFederatedShareProvider() {
|
2017-05-24 10:07:58 +03:00
|
|
|
$c = $this->getContainer();
|
2016-04-18 19:17:08 +03:00
|
|
|
$addressHandler = new \OCA\FederatedFileSharing\AddressHandler(
|
|
|
|
\OC::$server->getURLGenerator(),
|
2017-01-27 14:52:17 +03:00
|
|
|
\OC::$server->getL10N('federatedfilesharing'),
|
|
|
|
\OC::$server->getCloudIdManager()
|
2016-04-18 19:17:08 +03:00
|
|
|
);
|
|
|
|
$notifications = new \OCA\FederatedFileSharing\Notifications(
|
|
|
|
$addressHandler,
|
|
|
|
\OC::$server->getHTTPClientService(),
|
2017-04-05 23:35:59 +03:00
|
|
|
\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
|
2016-04-18 19:17:08 +03:00
|
|
|
\OC::$server->getJobList()
|
|
|
|
);
|
|
|
|
$tokenHandler = new \OCA\FederatedFileSharing\TokenHandler(
|
|
|
|
\OC::$server->getSecureRandom()
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->federatedShareProvider = new \OCA\FederatedFileSharing\FederatedShareProvider(
|
|
|
|
\OC::$server->getDatabaseConnection(),
|
|
|
|
$addressHandler,
|
|
|
|
$notifications,
|
|
|
|
$tokenHandler,
|
|
|
|
\OC::$server->getL10N('federatedfilesharing'),
|
|
|
|
\OC::$server->getLogger(),
|
|
|
|
\OC::$server->getLazyRootFolder(),
|
2016-05-11 21:48:27 +03:00
|
|
|
\OC::$server->getConfig(),
|
2017-01-27 14:52:17 +03:00
|
|
|
\OC::$server->getUserManager(),
|
2017-05-24 10:07:58 +03:00
|
|
|
\OC::$server->getCloudIdManager(),
|
|
|
|
$c->query(IConfig::class)
|
2016-04-18 19:17:08 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|