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
73 lines
1.8 KiB
13 years ago
|
<?php
|
||
|
|
||
13 years ago
|
//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';
|
||
13 years ago
|
require_once 'sites/all/libraries/tuque/Repository.php';
|
||
13 years ago
|
require_once 'sites/all/libraries/tuque/FedoraRelationships.php';
|
||
13 years ago
|
|
||
13 years ago
|
class IslandoraTuque {
|
||
13 years ago
|
|
||
13 years ago
|
/**
|
||
|
* Connection to the repository
|
||
|
*
|
||
|
* @var RepositoryConnection
|
||
|
*/
|
||
13 years ago
|
public $connection = NULL;
|
||
13 years ago
|
|
||
|
/**
|
||
|
* The Fedora API we are using
|
||
|
*
|
||
|
* @var FedoraAPI
|
||
|
*/
|
||
13 years ago
|
public $api = NULL;
|
||
13 years ago
|
|
||
|
/**
|
||
|
* The cache we use to connect.
|
||
|
*
|
||
|
* @var SimpleCache
|
||
|
*/
|
||
13 years ago
|
public $cache = NULL;
|
||
13 years ago
|
|
||
|
/**
|
||
|
* The repository object.
|
||
|
*
|
||
|
* @var FedoraRepository
|
||
|
*/
|
||
13 years ago
|
public $repository = NULL;
|
||
|
|
||
13 years ago
|
function __construct($user = NULL, $url = NULL) {
|
||
13 years ago
|
if(!isset($user)) {
|
||
|
global $user;
|
||
|
}
|
||
|
|
||
13 years ago
|
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');
|
||
|
}
|
||
|
|
||
13 years ago
|
$this->connection = new RepositoryConnection($url, $user_string, $pass_string);
|
||
13 years ago
|
$this->connection->reuseConnection = TRUE;
|
||
|
$this->api = new FedoraApi($this->connection);
|
||
|
$this->cache = new SimpleCache();
|
||
|
$this->repository = new FedoraRepository($this->api, $this->cache);
|
||
13 years ago
|
}
|
||
13 years ago
|
|
||
13 years ago
|
static function exists() {
|
||
|
return class_exists('RepositoryConnection');
|
||
|
}
|
||
13 years ago
|
}
|
||
13 years ago
|
|