zoom: Handle authentication element
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 14 Jun 2011 10:59:42 +0000 (12:59 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 14 Jun 2011 10:59:42 +0000 (12:59 +0200)
etc/config-zoom.xml
src/filter_zoom.cpp

index 05002a2..12275f9 100644 (file)
              <id>z-local</id>
              <zurl>localhost:9999/db01</zurl>
              <queryEncoding>iso-8859-1</queryEncoding>
-            <useTurboMarc>1</useTurboMarc>
             <elementSet>F</elementSet>
             <requestSyntax>MARC21</requestSyntax>
             <recordEncoding>MARC-8</recordEncoding>
             <transform>tmarc.xsl</transform>
+            <authentication>a/b</authentication>
              <cclmap_term>u=1016 2=3 3=3 s=al s=pw t=l,r 6=1</cclmap_term>
              <cclmap_au>u=1003 2=3 s=al s=pw t=l,r 6=1</cclmap_au>
              <cclmap_ti>u=4 2=3 3=3 s=al s=pw t=l,r 6=1</cclmap_ti>
index a42d9f5..68252b2 100644 (file)
@@ -42,6 +42,7 @@ namespace yf = mp::filter;
 namespace metaproxy_1 {
     namespace filter {
         struct Zoom::Searchable : boost::noncopyable {
+            std::string authentication;
             std::string database;
             std::string target;
             std::string query_encoding;
@@ -297,7 +298,12 @@ void yf::Zoom::Impl::parse_torus(const xmlNode *ptr1)
                     {
                         if (ptr3->type != XML_ELEMENT_NODE)
                             continue;
-                        if (!strcmp((const char *) ptr3->name, "id"))
+                        if (!strcmp((const char *) ptr3->name,
+                                    "authentication"))
+                        {
+                            s->authentication = mp::xml::get_text(ptr3);
+                        }
+                        else if (!strcmp((const char *) ptr3->name, "id"))
                         {
                             s->database = mp::xml::get_text(ptr3);
                         }
@@ -466,6 +472,9 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases(
     if (sptr->query_encoding.length())
         b->set_option("rpnCharset", sptr->query_encoding.c_str());
 
+    if (sptr->authentication.length())
+        b->set_option("user", sptr->authentication.c_str());
+
     std::string url;
     if (sptr->sru.length())
     {