setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorHost\''); $host = $db -> loadResult(); $db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorPort\''); $port = $db -> loadResult(); // Create a thrift connection (Boiler plate) $socket = new TSocket($host, $port); $db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorTimeout\''); $timeout = $db -> loadResult(); $socket->setRecvTimeout($timeout); $this->transport = new TBufferedTransport($socket); $protocol = new TBinaryProtocol($this->transport); $this->client = new OpenAireConnectorClient($protocol); $db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'serviceUrl.stats.exist.repos\''); $this -> statsExistUrl = $db -> loadResult(); $db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'serviceUrl.stats.chart.repos\''); $this -> statsChartUrl = $db -> loadResult(); } function getStatsExistUrl() { return $this -> statsExistUrl; } function getStatsChartUrl() { return $this -> statsChartUrl; } function searchOrganizations($term, $limit) { // Open up the connection $this->transport->open(); $list = $this->client->searchOrganizations($term, $limit); $this->transport->close(); return $list; } function getOrganizationRepositories($orgId) { // Open up the connection $this->transport->open(); $list = $this->client->getOrganizationRepositories($orgId); $this->transport->close(); return $list; } function quickSearchProjects($term, $limit) { // Open up the connection $this->transport->open(); $list = $this->client->quickSearchProjects($term, $limit); $this->transport->close(); return $list; } function getShortProjectInfoByGrant($grant) { // Open up the connection $this->transport->open(); $info = $this->client->getProjectInfoByGrant($grant); $this->transport->close(); return $info; } function getShortProjectInfo($projectId) { // Open up the connection $this->transport->open(); $info = $this->client->getProjectInfo($projectId); $this->transport->close(); return $info; } function getCompliantRepositories() { // Open up the connection $this->transport->open(); $list = $this->client->getOpenaireRepositories(); $this->transport->close(); return $list; } } ?>