uid == 0) { $user_string = 'anonymous'; $pass_string = 'anonymous'; } else { $user_string = $user->name; $pass_string = $user->pass; } if (!isset($url)) { $url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); } if (!isset($sparql_endpoint)) { if (variable_get('islandora_sparql_endpoint_externalized', FALSE)) { $sparql_endpoint = variable_get('islandora_sparql_endpoint', $url); } else { $sparql_endpoint = $url; } } if (self::exists()) { module_load_include('inc', 'islandora', 'includes/tuque_wrapper'); $this->connection = new IslandoraRepositoryConnection($url, $user_string, $pass_string, $sparql_endpoint); $this->connection->reuseConnection = TRUE; $this->api = new IslandoraFedoraApi($this->connection); $this->cache = new IslandoraSimpleCache(); $this->repository = new IslandoraFedoraRepository($this->api, $this->cache); } } /** * Checks if the Connection class exists. * * @returns bool * TRUE if the Connection class exists FALSE otherwise. */ public static function exists() { return class_exists('RepositoryConnection'); } /** * Displays and error for use when Tuque is not installed. */ public static function getError() { $islandora_doc_link = l(t('Islandora documentation'), 'https://wiki.duraspace.org/display/ISLANDORA/Islandora'); $tuque_link = l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque'); $message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array('!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link)); drupal_set_message(filter_xss($message), 'error', FALSE); } }