From 8c9c3b0f7bf85453c42e418f4a740d570f2189c1 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 8 Dec 2011 11:01:21 +0100 Subject: [PATCH] zoom: separate Torus URL for content things A new attribute, content_url, is allowed in the torus element of the zoom module configuration. --- doc/zoom.xml | 12 +++++++++++- src/filter_zoom.cpp | 21 +++++++++++++++------ xml/schema/filter_zoom.rnc | 1 + 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/zoom.xml b/doc/zoom.xml index 50a4682..a0bd2d3 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -72,7 +72,7 @@ URL of Web service to be used to fetch target profile - for a given database (udb). The special sequence + for a given database (udb) of type searchable. The special sequence %db of the URL is replaced by the actual database specified as part of Search. @@ -83,6 +83,16 @@ + attribute content_url + + + URL of Web service to be used to fetch target profile + for a given database (udb) of type content. Semantics otherwise like + url attribute above. + + + + attribute realm diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 10a02c4..60a8bab 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -170,7 +170,8 @@ namespace metaproxy_1 { std::map m_clients; boost::mutex m_mutex; boost::condition m_cond_session_ready; - std::string torus_url; + std::string torus_searchable_url; + std::string torus_content_url; std::string default_realm; std::map fieldmap; std::string xsldir; @@ -572,7 +573,9 @@ void yf::Zoom::Impl::configure(const xmlNode *ptr, bool test_only, for (attr = ptr->properties; attr; attr = attr->next) { if (!strcmp((const char *) attr->name, "url")) - torus_url = mp::xml::get_text(attr->children); + torus_searchable_url = mp::xml::get_text(attr->children); + else if (!strcmp((const char *) attr->name, "content_url")) + torus_content_url = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "realm")) default_realm = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "xsldir")) @@ -588,6 +591,10 @@ void yf::Zoom::Impl::configure(const xmlNode *ptr, bool test_only, "Bad attribute " + std::string((const char *) attr->name)); } + // If content_url is not given, use value of searchable, to + // ensure backwards compatibility + if (!torus_content_url.length()) + torus_content_url = torus_searchable_url; configure_local_records(ptr->children, test_only); } else if (!strcmp((const char *) ptr->name, "cclmap")) @@ -743,6 +750,8 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( const char **out_values = (const char **) odr_malloc(odr, (10 + no_parms) * sizeof(*out_values)); + // may be changed if it's a content connection + std::string torus_url = m_p->torus_searchable_url; int i; for (i = 0; i < no_parms; i++) { @@ -766,6 +775,7 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( { out_names[no_out_args] = name; out_values[no_out_args++] = value; + torus_url = m_p->torus_content_url; } else if (!strcmp(name, "realm")) realm = value; @@ -802,11 +812,10 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( it = m_p->s_map.find(torus_db); if (it != m_p->s_map.end()) sptr = it->second; - else if (m_p->torus_url.length() > 0) + else if (torus_url.length() > 0) { - xmlDoc *doc = mp::get_searchable(package, - m_p->torus_url, torus_db, realm, - m_p->proxy); + xmlDoc *doc = mp::get_searchable(package,torus_url, torus_db, + realm, m_p->proxy); if (!doc) { *error = YAZ_BIB1_DATABASE_DOES_NOT_EXIST; diff --git a/xml/schema/filter_zoom.rnc b/xml/schema/filter_zoom.rnc index 9140539..ece0c09 100644 --- a/xml/schema/filter_zoom.rnc +++ b/xml/schema/filter_zoom.rnc @@ -8,6 +8,7 @@ filter_zoom = attribute name { xsd:NCName }?, element mp:torus { attribute url { xsd:string }, + attribute content_url { xsd:string }, attribute realm { xsd:string }, attribute xsldir { xsd:string }?, attribute element_transform { xsd:string }?, -- 1.7.10.4