-->
<!NOTATION PDF SYSTEM "PDF">
]>
-<!-- $Id: book.xml,v 1.43 2006-10-12 12:04:23 marc Exp $ -->
+<!-- $Id: book.xml,v 1.44 2006-11-29 13:00:53 marc Exp $ -->
<book id="metaproxy">
<bookinfo>
<title>Metaproxy - User's Guide and Reference</title>
<title>Overview of the config file XML structure</title>
<para>
All elements and attributes are in the namespace
- <ulink url="http://indexdata.dk/yp2/config/1"/>.
+ <ulink url="http://indexdata.com/metaproxy"/>.
This is most easily achieved by setting the default namespace on
the top-level element, as here:
</para>
<screen>
- <yp2 xmlns="http://indexdata.dk/yp2/config/1">
+ <metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
</screen>
<para>
- The top-level element is <yp2>. This contains a
+ The top-level element is <metaproxy>. This contains a
<start> element, a <filters> element and a
<routes> element, in that order. <filters> is
optional; the other two are mandatory. All three are
client-server dialogues.
</para>
<screen><![CDATA[<?xml version="1.0"?>
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
]]></screen>
<para>
It works by defining a single route, called
</virtual>
<virtual>
<database>marc</database>
- <target>indexdata.dk/marc</target>
+ <target>indexdata.com/marc</target>
</virtual>
</filter>]]></screen>
<para>
Index Data's tiny testing database of MARC records:
</para>
<screen><![CDATA[<?xml version="1.0"?>
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
</virtual>
<virtual>
<database>marc</database>
- <target>indexdata.dk/marc</target>
+ <target>indexdata.com/marc</target>
</virtual>
<virtual>
<database>all</database>
<target>z3950.loc.gov:7090/voyager</target>
- <target>indexdata.dk/marc</target>
+ <target>indexdata.com/marc</target>
</virtual>
</filter>
<filter type="multi"/>
<filter type="bounce"/>
</route>
</routes>
-</yp2>]]></screen>
+</metaproxy>]]></screen>
<para>
(Using a
<literal>virt_db</literal>
"http://www.oasis-open.org/docbook/xml/4.1/docbookx.dtd" [
<!ENTITY copyright SYSTEM "copyright.xml">
]>
-<!-- $Id: virt_db.xml,v 1.4 2006-04-25 12:48:52 marc Exp $ -->
+<!-- $Id: virt_db.xml,v 1.5 2006-11-29 13:00:53 marc Exp $ -->
<refentry>
<refmeta>
<refentrytitle>virt_db</refentrytitle>
</virtual>
<virtual>
<database>db2</database>
- <target>indexdata.dk/gils</target>
+ <target>indexdata.com/gils</target>
</virtual>
<virtual>
<database>combined</database>
- <target>indexdata.dk/gils</target>
+ <target>indexdata.com/gils</target>
<target>localhost:9999/Default</target>
</virtual>
</filter>
<?xml version="1.0"?>
-<!-- $Id: config-bytarget.xml,v 1.3 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-bytarget.xml,v 1.4 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config-local.xml,v 1.2 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-local.xml,v 1.3 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config-record-transform.xml,v 1.1 2006-10-04 11:21:47 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-record-transform.xml,v 1.2 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config-shared1.xml,v 1.4 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-shared1.xml,v 1.5 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config-sru-to-z3950.xml,v 1.4 2006-10-10 15:10:16 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-sru-to-z3950.xml,v 1.5 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config-zurg.xml,v 1.10 2006-10-10 15:10:16 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config-zurg.xml,v 1.11 2006-11-29 13:00:53 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config0.xml,v 1.3 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config0.xml,v 1.4 2006-11-29 13:00:54 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config1.xml,v 1.11 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config1.xml,v 1.12 2006-11-29 13:00:54 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config2.xml,v 1.8 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config2.xml,v 1.9 2006-11-29 13:00:54 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config3.xml,v 1.9 2006-11-17 14:03:46 adam Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config3.xml,v 1.10 2006-11-29 13:00:54 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<routes>
<route id="start">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config4.xml,v 1.2 2006-08-31 13:01:09 marc Exp $ -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<!-- $Id: config4.xml,v 1.3 2006-11-29 13:00:54 marc Exp $ -->
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<!-- sample config which illustrates the use of http_file filter.. -->
<routes>
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
<?xml version="1.0"?>
-<!-- $Id: config5.xml,v 1.5 2006-08-31 13:01:09 marc Exp $ -->
+<!-- $Id: config5.xml,v 1.6 2006-11-29 13:00:54 marc Exp $ -->
<!-- Uses dummy backend + query rewrite filter.. -->
-<yp2 xmlns="http://indexdata.dk/yp2/config/1">
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
<start route="start"/>
<filters>
<filter id="frontend" type="frontend_net">
<filter type="bounce"/>
</route>
</routes>
-</yp2>
+</metaproxy>
-/* $Id: filter_http_file.cpp,v 1.6 2006-08-29 10:34:32 marc Exp $
+/* $Id: filter_http_file.cpp,v 1.7 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
if (a_node->type != XML_ELEMENT_NODE)
continue;
- if (mp::xml::is_element_yp2(a_node, "documentroot"))
+ if (mp::xml::is_element_mp(a_node, "documentroot"))
a.m_file_root = mp::xml::get_text(a_node);
- else if (mp::xml::is_element_yp2(a_node, "prefix"))
+ else if (mp::xml::is_element_mp(a_node, "prefix"))
a.m_url_path_prefix = mp::xml::get_text(a_node);
else
throw mp::filter::FilterException
-/* $Id: filter_virt_db.cpp,v 1.46 2006-09-29 08:42:47 marc Exp $
+/* $Id: filter_virt_db.cpp,v 1.47 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
if (v_node->type != XML_ELEMENT_NODE)
continue;
- if (mp::xml::is_element_yp2(v_node, "database"))
+ if (mp::xml::is_element_mp(v_node, "database"))
database = mp::xml::get_text(v_node);
- else if (mp::xml::is_element_yp2(v_node, "target"))
+ else if (mp::xml::is_element_mp(v_node, "target"))
targets.push_back(mp::xml::get_text(v_node));
else
throw mp::filter::FilterException
-/* $Id: router_flexml.cpp,v 1.18 2006-06-10 14:29:12 adam Exp $
+/* $Id: router_flexml.cpp,v 1.19 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
const xmlNode *node)
{
unsigned int filter_nr = 0;
- while(node && mp::xml::check_element_yp2(node, "filter"))
+ while(node && mp::xml::check_element_mp(node, "filter"))
{
filter_nr++;
void mp::RouterFleXML::Rep::parse_xml_routes(xmlDocPtr doc,
const xmlNode *node)
{
- mp::xml::check_element_yp2(node, "route");
+ mp::xml::check_element_mp(node, "route");
unsigned int route_nr = 0;
- while(mp::xml::is_element_yp2(node, "route"))
+ while(mp::xml::is_element_mp(node, "route"))
{
route_nr++;
const xmlNode* node3 = mp::xml::jump_to_children(node, XML_ELEMENT_NODE);
unsigned int filter3_nr = 0;
- while(node3 && mp::xml::check_element_yp2(node3, "filter"))
+ while(node3 && mp::xml::check_element_mp(node3, "filter"))
{
filter3_nr++;
const xmlNode* root = xmlDocGetRootElement(doc);
- mp::xml::check_element_yp2(root, "yp2");
+ mp::xml::check_element_mp(root, "metaproxy");
const xmlNode* node = mp::xml::jump_to_children(root, XML_ELEMENT_NODE);
- if (mp::xml::is_element_yp2(node, "dlpath"))
+ if (mp::xml::is_element_mp(node, "dlpath"))
{
m_dl_path = mp::xml::get_text(node);
node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
}
// process <start> node which is expected first element node
- if (mp::xml::check_element_yp2(node, "start"))
+ if (mp::xml::check_element_mp(node, "start"))
{
const struct _xmlAttr *attr;
std::string id_value;
node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
}
// process <filters> node if given
- if (mp::xml::is_element_yp2(node, "filters"))
+ if (mp::xml::is_element_mp(node, "filters"))
{
parse_xml_filters(doc, mp::xml::jump_to_children(node,
XML_ELEMENT_NODE));
node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
}
// process <routes> node which is expected third element node
- mp::xml::check_element_yp2(node, "routes");
+ mp::xml::check_element_mp(node, "routes");
parse_xml_routes(doc, mp::xml::jump_to_children(node, XML_ELEMENT_NODE));
-/* $Id: test_filter_query_rewrite.cpp,v 1.10 2006-06-10 14:29:12 adam Exp $
+/* $Id: test_filter_query_rewrite.cpp,v 1.11 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
std::string xmlconf =
"<?xml version='1.0'?>\n"
- "<filter xmlns='http://indexdata.dk/yp2/config/1'\n"
+ "<filter xmlns='http://indexdata.com/metaproxy'\n"
" id='qrw1' type='query_rewrite'>\n"
"</filter>\n"
;
-/* $Id: test_filter_record_transform.cpp,v 1.2 2006-10-04 11:21:47 marc Exp $
+/* $Id: test_filter_record_transform.cpp,v 1.3 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
std::string xmlconf =
"<?xml version='1.0'?>\n"
- "<filter xmlns='http://indexdata.dk/yp2/config/1'\n"
+ "<filter xmlns='http://indexdata.com/metaproxy'\n"
" id='rec_trans_1' type='record_transform'>\n"
"<retrievalinfo>"
"<retrieval"
-/* $Id: test_filter_sru_to_z3950.cpp,v 1.2 2006-09-28 11:56:54 marc Exp $
+/* $Id: test_filter_sru_to_z3950.cpp,v 1.3 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
// std::string xmlconf =
// "<?xml version='1.0'?>\n"
-// "<filter xmlns='http://indexdata.dk/yp2/config/1'\n"
+// "<filter xmlns='http://indexdata.com/metaproxy'\n"
// " id='qrw1' type='sru_to_z3950'>\n"
// "</filter>\n"
// ;
-/* $Id: test_router_flexml.cpp,v 1.17 2006-06-10 14:29:13 adam Exp $
+/* $Id: test_router_flexml.cpp,v 1.18 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
try
{
std::string xmlconf = "<?xml version=\"1.0\"?>\n"
- "<yp2 xmlns=\"http://indexdata.dk/yp2/config/1\">\n"
+ "<metaproxy xmlns=\"http://indexdata.com/metaproxy\""
+ " version=\"1.0\">\n"
" <start route=\"start\"/>\n"
" <filters>\n"
" <filter id=\"front_default\" type=\"frontend_net\">\n"
" </filter>\n"
" </route>\n"
" </routes>\n"
- "</yp2>\n";
+ "</metaproxy>\n";
mp::FactoryStatic factory;
factory.add_creator("tfilter", filter_creator);
try
{
std::string xmlconf_invalid = "<?xml version=\"1.0\"?>\n"
- "<y:yp2 xmlns:y=\"http://indexdata.dk/yp2/config/1\">\n"
+ "<mp:metaproxy xmlns:mp=\"http://indexdata.com/metaproxy\" version=\"1.0\">\n"
" <start route=\"start\"/>\n"
" <filters>\n"
" <filter id=\"front_default\" type=\"frontend_net\">\n"
try
{
std::string xmlconf = "<?xml version=\"1.0\"?>\n"
- "<y:yp2 xmlns:y=\"http://indexdata.dk/yp2/config/1\">\n"
- " <y:start route=\"start\"/>\n"
- " <y:filters>\n"
- " <y:filter id=\"front_default\" type=\"frontend_net\">\n"
+ "<mp:metaproxy xmlns:mp=\"http://indexdata.com/metaproxy\""
+ " version=\"1.0\">\n"
+ " <mp:start route=\"start\"/>\n"
+ " <mp:filters>\n"
+ " <mp:filter id=\"front_default\" type=\"frontend_net\">\n"
" <port>@:210</port>\n"
- " </y:filter>\n"
- " <y:filter id=\"log_cout\" type=\"log\">\n"
+ " </mp:filter>\n"
+ " <mp:filter id=\"log_cout\" type=\"log\">\n"
" <message>my msg</message>\n"
- " </y:filter>\n"
- " </y:filters>\n"
- " <y:routes>\n"
- " <y:route id=\"start\">\n"
- " <y:filter refid=\"front_default\"/>\n"
- " <y:filter refid=\"log_cout\"/>\n"
- " </y:route>\n"
- " </y:routes>\n"
- "</y:yp2>\n";
+ " </mp:filter>\n"
+ " </mp:filters>\n"
+ " <mp:routes>\n"
+ " <mp:route id=\"start\">\n"
+ " <mp:filter refid=\"front_default\"/>\n"
+ " <mp:filter refid=\"log_cout\"/>\n"
+ " </mp:route>\n"
+ " </mp:routes>\n"
+ "</mp:metaproxy>\n";
mp::FactoryStatic factory;
mp::RouterFleXML rflexml(xmlconf, factory);
try
{
std::string xmlconf = "<?xml version=\"1.0\"?>\n"
- "<yp2 xmlns=\"http://indexdata.dk/yp2/config/1\">\n"
- " <start route=\"start\"/>\n"
+ "<metaproxy xmlns=\"http://indexdata.com/metaproxy\""
+ " version=\"1.0\">\n"
+ " <start route=\"start\"/>\n"
" <filters>\n"
" <filter id=\"front_default\" type=\"notknown\">\n"
" <port>@:210</port>\n"
" <filter refid=\"front_default\"/>\n"
" </route>\n"
" </routes>\n"
- "</yp2>\n";
+ "</metaproxy>\n";
mp::FactoryStatic factory;
factory.add_creator("tfilter", filter_creator);
-/* $Id: xmlutil.cpp,v 1.9 2006-06-21 09:16:54 adam Exp $
+/* $Id: xmlutil.cpp,v 1.10 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
// Doxygen doesn't like mp::xml, so we use this instead
namespace mp_xml = metaproxy_1::xml;
+static const std::string metaproxy_ns = "http://indexdata.com/metaproxy";
+
std::string mp_xml::get_text(const xmlNode *ptr)
{
std::string c;
return false;
}
-bool mp_xml::is_element_yp2(const xmlNode *ptr,
- const std::string &name)
+bool mp_xml::is_element_mp(const xmlNode *ptr,
+ const std::string &name)
{
- return mp::xml::is_element(ptr, "http://indexdata.dk/yp2/config/1", name);
+ return mp::xml::is_element(ptr, metaproxy_ns, name);
}
-bool mp_xml::check_element_yp2(const xmlNode *ptr,
- const std::string &name)
+bool mp_xml::check_element_mp(const xmlNode *ptr,
+ const std::string &name)
{
- if (!mp::xml::is_element_yp2(ptr, name))
- throw mp::XMLError("Expected element name " + name);
+ if (!mp::xml::is_element_mp(ptr, name))
+ {
+ std::string got_element = "<";
+ if (ptr && ptr->name)
+ got_element += std::string((const char *)ptr->name);
+ if (ptr && ptr->ns && ptr->ns->href){
+ got_element += " xmlns=\"";
+ got_element += std::string((const char *)ptr->ns->href);
+ got_element += "\"";
+ }
+ got_element += ">";
+
+ throw mp::XMLError("Expected XML element <" + name
+ + " xmlns=\"" + metaproxy_ns + "\">"
+ + ", not " + got_element);
+ }
return true;
}
-/* $Id: xmlutil.hpp,v 1.8 2006-06-21 09:16:54 adam Exp $
+/* $Id: xmlutil.hpp,v 1.9 2006-11-29 13:00:54 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
bool is_element(const xmlNode *ptr,
const std::string &ns,
const std::string &name);
- bool is_element_yp2(const xmlNode *ptr, const std::string &name);
- bool check_element_yp2(const xmlNode *ptr,
+ bool is_element_mp(const xmlNode *ptr, const std::string &name);
+ bool check_element_mp(const xmlNode *ptr,
const std::string &name);
std::string get_route(const xmlNode *node);
# Metaproxy XML config file schemas
-# $Id: metaproxy.rnc,v 1.6 2006-11-17 14:03:47 adam Exp $
+# $Id: metaproxy.rnc,v 1.7 2006-11-29 13:00:54 marc Exp $
#
# Copyright (c) 2005-2006, Index Data.
#
# For information on RelaxNG see http://relaxng.org
# see also http://books.xmlschemata.org/relaxng/
-default namespace = "http://indexdata.dk/yp2/config/1"
+default namespace = "http://indexdata.com/metaproxy"
start = metaproxy
metaproxy =
- element yp2 {
+ element metaproxy {
+ attribute version { xsd:float },
element start {
- attribute route { xsd:NCName }
+ attribute route { xsd:NCName }
},
element filters { filter+ }?,
element routes { route+ }