Drupal modules for browsing and managing Fedora-based digital repositories.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

<?php
//do this until we expost these in a module or library
require_once 'sites/all/libraries/tuque/Datastream.php';
require_once 'sites/all/libraries/tuque/FedoraApi.php';
require_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
require_once 'sites/all/libraries/tuque/Object.php';
require_once 'sites/all/libraries/tuque/RepositoryConnection.php';
require_once 'sites/all/libraries/tuque/Cache.php';
require_once 'sites/all/libraries/tuque/RepositoryException.php';
require_once 'sites/all/libraries/tuque/Repository.php';
require_once 'sites/all/libraries/tuque/FedoraRelationships.php';
class IslandoraTuque {
13 years ago
/**
* Connection to the repository
*
* @var RepositoryConnection
*/
public $connection = NULL;
13 years ago
/**
* The Fedora API we are using
*
* @var FedoraAPI
*/
public $api = NULL;
13 years ago
/**
* The cache we use to connect.
*
* @var SimpleCache
*/
public $cache = NULL;
13 years ago
/**
* The repository object.
*
* @var FedoraRepository
*/
public $repository = NULL;
13 years ago
function __construct($user = NULL, $url = NULL) {
if(!isset($user)) {
global $user;
}
if(!isset($user) || $user->uid == 0){
$user_string = 'anonymous';
$pass_string = 'anonymous';
} else {
$user_string = $user->name;
$pass_string = $user->pass;
}
13 years ago
if (!isset($url)) {
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
}
$this->connection = new RepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection);
$this->cache = new SimpleCache();
$this->repository = new FedoraRepository($this->api, $this->cache);
}
static function exists() {
return class_exists('RepositoryConnection');
}
}