List more dependencies
[yazproxy-moved-to-github.git] / doc / using.xml
index d6ed178..5c58560 100644 (file)
@@ -5,16 +5,10 @@
    This chapter includes a few examples.
   </para>
   <para>
-   -- All config directives --
-   -- SRW/SRU ..
-   -- Example config
-   -- Mention XSLT conversion
-  </para>
-  <para>
    The YAZ Proxy is useful for debugging SRW/SRU/Z39.50 software, logging
    APDUs, redirecting Z39.50 packages through firewalls, etc.
    Furthermore, it offers facilities that often
-   boost performance for connectionless Z39.50 clients such
+   boost performance for connection-less Z39.50 clients such
    as web gateways.
   </para>
   <para>
    </screen>
   </example>
 
-  <example id="example-firewall">
-   <title>Exposing a Z39.50 server behind a firewall</title>
+  <example id="first-config">
+   <title>Using a configuration file</title>
+   <para>
+    In <xref linkend="example-apdu-logging"/> the default backend server
+    was specified by a command line option. The same proxy behavior can
+    be achieved by creating a configuration with the following contents:
+    <screen><![CDATA[
+     <?xml version="1.0"?>
+     <proxy xmlns="http://indexdata.dk/yazproxy/schema/0.9/">
+       <target name="foo" default="1">
+         <url>foo.bar.com:18398</url>
+         <log>client-apdu</log>
+       </target>
+       <target name="*">
+       </target>
+     </proxy>
+]]>
+    </screen>
+   </para>
    <para>
-    ..
+    The proxy is started with
+    <screen><![CDATA[
+     yazproxy -c config.xml @:9000
+]]>
+    </screen>
+   </para>
+   <para>
+    The last target section is used for all servers except foo.
+    Had the the last section been omitted, then
+    <emphasis>only</emphasis> foo could be reached via the proxy.
    </para>
   </example>
   
   <example id="example-srw-service">
    <title>Offering SRW/SRU/Z39.50 service</title>
    <para>
-    ..
+    In order to offer SRW/SRU service we must be specify sufficient
+    information to allow the proxy to convert from SRW/SRU to Z39.50.
+    This involves translating CQL queries
+    to Type-1 (also called RPN/PQF), since most
+    Z39.50 servers do not support CQL. The conversion
+    is specified by the <literal>cql2rpn</literal> element.
+   </para>
+   <para>
+    We must also ensure that the
+    server can return at least one kind of XML record (Dublin-Core
+    recommended). 
+   </para>
+   <para>
+    An explain record for the SRW/SRU service must also be created.
+   </para>
+   <para>
+    The following is a relatively simple configuration file for 
+    such a service. This service lives on <literal>indexdata.dk</literal>,
+    port 9000. The database is <literal>gils</literal>. The
+    backend server is also <literal>indexdata.dk</literal> (port 210) as
+    given by <literal>url</literal>.
+   </para>
+   <para>
+    The server may return USMARC/MARC21 (Z39.50/SRW/SRU) and
+    MARCXML (SRW/SRU only) as specified by the
+    <link linkend="proxy-config-syntax">syntax</link> elements.
+   </para>
+    <screen><![CDATA[
+<?xml version="1.0"?>
+<!-- $Id: using.xml,v 1.6 2005-03-14 13:16:03 adam Exp $ -->
+<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.9/">
+  <target name="bagel">
+    <url>indexdata.dk</url>
+    <target-timeout>240</target-timeout>
+    <client-timeout>180</client-timeout>
+    <attribute type="1" value="1-11,13-1016"/>
+    <attribute type="1" value="*" error="114"/>
+    <syntax type="usmarc"/>
+    <syntax type="none"/>
+    <syntax type="xml" marcxml="1"
+      identifier="info:srw/schema/1/marcxml-v1.1" >
+      <name>marcxml</name>
+    </syntax>
+    <syntax type="*" error="238"/>
+    <preinit>0</preinit>
+    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
+       <serverInfo>
+       <host>indexdata.dk</host>
+       <port>9000</port>
+       <database>gils</database>
+       </serverInfo>
+    </explain>
+    <cql2rpn>pqf.properties</cql2rpn>
+  </target>
+</proxy>
+]]>
+    </screen>
+   <para>
+    The conversion from CQL to RPN is specified by a file whose name,
+    relative to the working directory, is given in the
+    <link linkend="proxy-config-cql2rpn">cql2rpn</link> element.
+    A complete Bath/DC conversion file,
+    <filename>pqf.properties</filename> is provided as part of the
+    yazproxy distribution in the <filename>etc</filename>
+    subdirectory.
+   </para>
+   <para>
+    Explain information is embedded in the configuration file. 
+    Note that in this example,only a few mandatory
+    explain elements are specified. A well-behaving server should describe
+    index sets, indexes, record schemas as well.
    </para>
   </example>
-
  </chapter>
 
  <!-- Keep this comment at the end of the file