db =& JFactory :: getDBO(); $this -> log =& JLog :: getInstance(); } public function getThriftHost() { $this -> db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorHost\';'); $thriftHost = $this -> db -> loadResult(); if ($thriftHost === NULL) $this -> log -> addEntry(array('level' => 'error', 'comment' => ('Error retrieving Thrift host: ' . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Thrift host is $thriftHost")); return $thriftHost; } public function setThriftHost($host) { $this -> db -> setQuery('UPDATE `#__openaire` SET `value` = ' . $this -> db -> quote($host) . ' WHERE `key` = \'thriftConnectorHost\';'); if ($this -> db -> query() === FALSE) $this -> log -> addEntry(array('level' => 'error', 'comment' => ("Error setting Thrift host to $host: " . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Set Thrift host to $host")); } public function getThriftPort() { $this -> db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorPort\';'); $thriftPort = $this -> db -> loadResult(); if ($thriftPort === NULL) $this -> log -> addEntry(array('level' => 'error', 'comment' => ('Error retrieving Thrift port: ' . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Thrift port is $thriftPort")); return $thriftPort; } public function setThriftPort($port) { $this -> db -> setQuery('UPDATE `#__openaire` SET `value` = ' . $this -> db -> quote($port) . ' WHERE `key` = \'thriftConnectorPort\';'); if ($this -> db -> query() === FALSE) $this -> log -> addEntry(array('level' => 'error', 'comment' => ("Error setting Thrift port to $port: " . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Set Thrift port to $port")); } public function getThriftTimeout() { $this -> db -> setQuery('SELECT `value` FROM `#__openaire` WHERE `key` = \'thriftConnectorTimeout\';'); $thriftTimeout = $this -> db -> loadResult(); if ($thriftTimeout === NULL) $this -> log -> addEntry(array('level' => 'error', 'comment' => ('Error retrieving Thrift timeout: ' . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Thrift timeout is $thriftTimeout")); return $thriftTimeout; } public function setThriftTimeout($timeout) { $this -> db -> setQuery('UPDATE `#__openaire` SET `value` = ' . $this -> db -> quote($timeout) . ' WHERE `key` = \'thriftConnectorTimeout\';'); if ($this -> db -> query() === FALSE) $this -> log -> addEntry(array('level' => 'error', 'comment' => ("Error setting Thrift timeout to $timeout: " . $this -> db -> getErrorMsg() . ' (' . $this -> db -> getErrorNum() . ')'))); else $this -> log -> addEntry(array('level' => 'info', 'comment' => "Set Thrift timeout to $timeout")); } } ?>