<?xml version="1.0"?>
<!--
1.   LCDB_UTF8_Port1        (e.g., z3950.loc.gov:7097/voyager)
2.   LCDB_UTF8_Port2        (e.g., z3950.loc.gov:7098/voyager)
3.   LCDB_MARC8_Port1       (e.g., z3950.loc.gov:7095/voyager)
4.   LCDB_MARC8_Port2       (e.g., z3950.loc.gov:7096/voyager)
5.   HLAS_UTF8              (e.g., z3950.loc.gov:7999/voyager)
6.   HLAS_MARC8             (e.g., z3950.loc.gov:7990/voyager)
7.   NLSBPH_UTF8            (e.g., z3950.loc.gov:7499/voyager)
8.   NLSBPH_MARC8           (e.g., z3950.loc.gov:7490/voyager)
9.   Name_Authority_File    (e.g., sun4.loc.gov:9018/NAF)
10.  Subject_Authority_File (e.g., sun4.loc.gov:9019/SAF)
11.  Server_in_the_UK       (e.g., blah.blah.uk:210/Aleph)
12.  Server_in_California   (e.g., blah.blah.edu:210/Unicorn)
13.  Performing_Arts_Encyclopedia (e.g., sun4.loc.gov:9013/PAE)
14.  Veterans_History_Project (e.g., sun4.loc.gov:9013/VETS)


MetaProxy could be configured to support accessing
the following databaseNames (virtual databases):

   LCDB_UTF8               (1 and 2 above with load balancing)
   LCDB_MARC8              (3 and 4 above with load balancing)
   AllVoyager              (1, 2, 5, 7 above with merged results)
   Name_Authority_File     (Just 9 above)
   Subject_Authority_File  (Just 10 above)
   Authority_Files         (9 and 10 above)
   LC_and_Friends          (1, 2, 5, 7, 11, 12, 13, and 14 above)
-->
<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
  <start route="start"/>
  <filters>
    <!-- record transform for servers that return MARC8-encoded MARC -->
    <filter id="marc8-records" type="record_transform">
      <retrievalinfo xmlns="http://indexdata.com/yaz" version="1.0">
        <retrieval identifier="info:srw/schema/1/dc-v1.1" name="dc" syntax="xml">
          <backend name="F" syntax="usmarc">
            <marc inputcharset="marc-8" inputformat="marc" outputformat="marcxml"/>
            <xslt stylesheet="../xml/xslt/MARC21slim2DC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="opac"/>
        <retrieval name="opac" syntax="xml">
          <backend name="F" syntax="opac">
            <marc inputcharset="marc-8" inputformat="marc" outputformat="marcxml"/>
          </backend>
        </retrieval>
        <retrieval syntax="usmarc">
          <backend name="F" syntax="usmarc">
        </backend>
        </retrieval>
      </retrievalinfo>
    </filter>
    <!-- record transform for servers that return UTF8-encoded MARC -->
    <filter id="utf8-records" type="record_transform">
      <retrievalinfo xmlns="http://indexdata.com/yaz" version="1.0">
        <retrieval identifier="info:srw/schema/1/dc-v1.1" name="dc" syntax="xml">
          <backend name="F" syntax="usmarc">
            <marc inputcharset="utf8" inputformat="marc" outputformat="marcxml"/>
            <xslt stylesheet="../xml/xslt/MARC21slim2DC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="opac"/>
        <retrieval name="opac" syntax="xml">
          <backend name="F" syntax="opac">
            <marc inputcharset="utf8" inputformat="marc" outputformat="marcxml"/>
          </backend>
        </retrieval>
        <retrieval syntax="usmarc">
          <backend name="F" syntax="usmarc">
        </backend>
        </retrieval>
      </retrievalinfo>
    </filter>
  </filters>
  <routes>
    <route id="start">
      <filter type="frontend_net">
        <threads>100</threads>
        <port>@:7090</port>
      </filter>
      <!-- converts SRU to Z39.50 and back -->
      <filter type="sru_z3950"/>
      <filter type="log">
        <message>F</message>
        <category apdu="false" init-options="true"/>
      </filter>
      <!-- converts CQL to RPN -->
      <filter type="cql_rpn">
        <conversion file="cql2pqf.txt"/>
      </filter>
      <!-- RPN Query rewrite .. Does query check as well -->
      <filter type="query_rewrite">
        <xslt stylesheet="pqf2pqf-loc.xsl"/>
      </filter>
      <filter type="limit">
        <limit bandwidth="50000" pdu="100" retrieve="50" search="5"/>
      </filter>
      <filter type="session_shared">
        <resultset max="3" ttl="5"/>
        <session ttl="15" max="30"/>
        <init ignore-auth="true"/>
      </filter>
      <filter type="virt_db">
        <virtual>
          <database>idtest</database>
          <target>localhost:9999/Default</target>
        </virtual>
        <virtual>
          <database>LCDB_UTF8</database>
          <target>z3950.loc.gov:7097/LCDB_UTF8</target>
        </virtual>
        <virtual>
          <database>LCDB_MARC8</database>
          <target>z3950.loc.gov:7095/LCDB_MARC8</target>
        </virtual>
        <virtual>
          <database>HLAS_UTF8</database>
          <target>z3950.loc.gov:7999/HLAS_UTF8</target>
        </virtual>
        <virtual>
          <database>HLAS_MARC8</database>
          <target>z3950.loc.gov:7990/HLAS_MARC8</target>
        </virtual>
        <virtual>
          <database>NLSBPH_UTF8</database>
          <target>z3950.loc.gov:7499/NLSBPH_UTF8</target>
        </virtual>
        <virtual>
          <database>NLSBPH_MARC8</database>
          <target>z3950.loc.gov:7490/NLSBPH_MARC8</target>
        </virtual>
        <virtual>
          <database>Name_Authority_File</database>
          <target>sun4.loc.gov:9018/NAF</target>
        </virtual>
        <virtual>
          <database>Subject_Authority_File</database>
          <target>sun4.loc.gov:9019/SAF</target>
        </virtual>
        <virtual>
          <database>Server_in_the_UK</database>
          <target>blah.blah.uk:210/Aleph</target>
        </virtual>
        <virtual>
          <database>Server_in_Califorina</database>
          <target>blah.blah.edu:210/Unicorn</target>
        </virtual>
        <virtual>
          <database>Performing_Arts_Encylopedia</database>
          <target>sun4.loc.gov:9013/PAE</target>
        </virtual>
        <virtual>
          <database>Veterans_History_Project</database>
          <target>sun4.loc.gov:9013/VETS</target>
        </virtual>
        <!-- merged results -->
        <virtual>
          <database>AllVoyager</database>
          <target>z3950.loc.gov:7097/LCDB_UTF8</target>
          <target>z3950.loc.gov:7999/HLAS_UTF8</target>
          <target>z3950.loc.gov:7999/NLSBPH_UTF8</target>
        </virtual>
      </filter>
      <!-- merge and route -->
      <filter type="multi">
        <target route="idtest">localhost*</target>
        <target route="lcdb_utf8">z3950.loc.gov:7097/LCDB_UTF8</target>
        <target route="lcdb_marc8">z3950.loc.gov:7095/LCDB_MARC8</target>
        <target route="utf8">*UTF8</target>
      </filter>
      <!-- other targets.. MARC-8 and foreign .. -->
      <filter refid="marc8-records"/>
      <filter type="z3950_client"/>
      <filter type="bounce"/>
    </route>
    <!-- idtest -->
    <route id="idtest">
      <filter type="log">
        <message>V</message>
        <category init-options="true" session="true"/>
      </filter>
      <filter type="virt_db">
        <virtual>
          <database>Default</database>
          <target>localhost:9001/Default</target>
          <target>localhost:9002/Default</target>
        </virtual>
      </filter>
      <filter type="log">
        <message>L</message>
        <category init-options="true" session="true"/>
      </filter>
      <filter type="load_balance"/>
      <filter refid="marc8-records"/>
      <filter type="log">
        <message>O</message>
        <category init-options="true" session="true"/>
      </filter>
      <filter type="z3950_client"/>
      <filter type="bounce"/>
    </route>
    <!-- lcdb utf8 -->
    <route id="lcdb_utf8">
      <filter type="virt_db">
        <virtual>
          <database>LCDB_UTF8</database>
          <target>z3950.loc.gov:7097/voyager</target>
          <target>z3950.loc.gov:7098/voyager</target>
        </virtual>
      </filter>
      <filter type="load_balance"/>
      <filter refid="utf8-records"/>
      <filter type="z3950_client"/>
      <filter type="bounce"/>
    </route>
    <!-- lcdb marc8 -->
    <route id="lcdb_marc8">
      <filter type="virt_db">
        <virtual>
          <database>LCDB_MARC8</database>
          <target>z3950.loc.gov:7095/voyager</target>
          <target>z3950.loc.gov:7096/voyager</target>
        </virtual>
      </filter>
      <filter type="load_balance"/>
      <filter refid="marc8-records"/>
      <filter type="z3950_client"/>
      <filter type="bounce"/>
    </route>
    <!-- other utf8 targets -->
    <route id="utf8">
      <filter refid="utf8-records"/>
      <filter type="z3950_client"/>
      <filter type="bounce"/>
    </route>
  </routes>
</metaproxy>
