Browse Source

Make modifications to turn tuque back into a library.

Tuque is a library again. And all of the functions are overriden in 
islandora for the sake of object loading.
pull/203/head
jonathangreen 12 years ago
parent
commit
baa8d6ed58
  1. 5
      admin/islandora.admin.inc
  2. 91
      includes/IslandoraTuque.inc
  3. 1
      islandora.info

5
admin/islandora.admin.inc

@ -16,6 +16,11 @@ function islandora_repository_admin($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
drupal_add_css(drupal_get_path('module', 'islandora') . '/css/islandora.admin.css'); drupal_add_css(drupal_get_path('module', 'islandora') . '/css/islandora.admin.css');
if (!IslandoraTuque::exists()) {
IslandoraTuque::getError();
return;
}
$form = array(); $form = array();
if (isset($form_state['values']['islandora_base_url'])) { if (isset($form_state['values']['islandora_base_url'])) {
$url = $form_state['values']['islandora_base_url']; $url = $form_state['values']['islandora_base_url'];

91
includes/IslandoraTuque.inc

@ -6,6 +6,29 @@
* This file contains a class to include the Tuque php library. * This file contains a class to include the Tuque php library.
*/ */
$islandora_module_path = drupal_get_path('module', 'islandora');
//do this until we expost these in a module or library
@include_once 'sites/all/libraries/tuque/Datastream.php';
@include_once 'sites/all/libraries/tuque/FedoraApi.php';
@include_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
@include_once 'sites/all/libraries/tuque/Object.php';
@include_once 'sites/all/libraries/tuque/RepositoryConnection.php';
@include_once 'sites/all/libraries/tuque/Cache.php';
@include_once 'sites/all/libraries/tuque/RepositoryException.php';
@include_once 'sites/all/libraries/tuque/Repository.php';
@include_once 'sites/all/libraries/tuque/FedoraRelationships.php';
@include_once "$islandora_module_path/libraries/tuque/Datastream.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraApi.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraApiSerializer.php";
@include_once "$islandora_module_path/libraries/tuque/Object.php";
@include_once "$islandora_module_path/libraries/tuque/RepositoryConnection.php";
@include_once "$islandora_module_path/libraries/tuque/Cache.php";
@include_once "$islandora_module_path/libraries/tuque/RepositoryException.php";
@include_once "$islandora_module_path/libraries/tuque/Repository.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraRelationships.php";
class IslandoraTuque { class IslandoraTuque {
/** /**
@ -55,11 +78,11 @@ class IslandoraTuque {
} }
if (self::exists()) { if (self::exists()) {
$this->connection = new RepositoryConnection($url, $user_string, $pass_string); $this->connection = new IslandoraRepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE; $this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection); $this->api = new IslandoraFedoraApi($this->connection);
$this->cache = new SimpleCache(); $this->cache = new IslandoraSimpleCache();
$this->repository = new FedoraRepository($this->api, $this->cache); $this->repository = new IslandoraFedoraRepository($this->api, $this->cache);
} }
} }
@ -85,11 +108,61 @@ class IslandoraTuque {
function islandora_get_tuque_connection() { function islandora_get_tuque_connection() {
$tuque = &drupal_static(__FUNCTION__); $tuque = &drupal_static(__FUNCTION__);
if (!$tuque) { if (!$tuque) {
try { if(IslandoraTuque::exists()) {
$tuque = new IslandoraTuque(); try {
} catch (Exception $e) { $tuque = new IslandoraTuque();
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error'); } catch (Exception $e) {
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error');
}
}
else {
return NULL;
} }
} }
return $tuque; return $tuque;
} }
class IslandoraFedoraRepository extends FedoraRepository {
protected $queryClass = 'IslandoraRepositoryQuery';
protected $newObjectClass = 'IslandoraNewFedoraObject';
protected $objectClass = 'IslandoraFedoraObject';
}
class IslandoraRepositoryQuery extends RepositoryQuery {}
class IslandoraNewFedoraObject extends NewFedoraObject {
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
}
class IslandoraFedoraObject extends FedoraObject {
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
}
class IslandoraRepositoryConnection extends RepositoryConnection {}
class IslandoraFedoraApi extends FedoraApi {}
class IslandoraSimpleCache extends SimpleCache {}
class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
}
class IslandoraFedoraDatastream extends FedoraDatastream {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
}
class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion {
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
}
class IslandoraFedoraRelsExt extends FedoraRelsExt {}
class IslandoraFedoraRelsInt extends FedoraRelsInt {}

1
islandora.info

@ -1,7 +1,6 @@
name = Islandora name = Islandora
description = "View and manage Fedora objects" description = "View and manage Fedora objects"
package = Islandora package = Islandora
dependencies[] = tuque
version = 7.x-dev version = 7.x-dev
core = 7.x core = 7.x
configure = admin/islandora/configure configure = admin/islandora/configure

Loading…
Cancel
Save