1 /* $Id: metaproxy_prog.cpp,v 1.11 2008-02-20 10:28:23 adam Exp $
2 Copyright (c) 2005-2008, Index Data.
4 This file is part of Metaproxy.
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #include <yaz/options.h>
28 #include <libxml/xinclude.h>
31 #include "package.hpp"
32 #include "router_flexml.hpp"
33 #include "factory_static.hpp"
35 namespace mp = metaproxy_1;
37 int main(int argc, char **argv)
41 const char *fname = 0;
44 while ((ret = options("h{help}V{version}c{config}:", argv, argc, &arg))
50 std::cout << "metaproxy\n"
52 " -V|--version version\n"
53 " -c|--config config filename\n"
57 std::cout << "Metaproxy " VERSION "\n";
63 std::cerr << "bad option: " << arg << std::endl;
69 std::cerr << "No configuration given\n";
72 xmlDocPtr doc = xmlReadFile(fname,
74 XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS
75 + XML_PARSE_NSCLEAN + XML_PARSE_NONET );
79 std::cerr << "XML parsing failed\n";
82 // and perform Xinclude then
83 if (xmlXIncludeProcess(doc) > 0) {
84 std::cerr << "processing XInclude directive\n";
86 mp::FactoryStatic factory;
87 mp::RouterFleXML router(doc, factory);
89 pack.router(router).move();
92 catch (std::logic_error &e) {
93 std::cerr << "std::logic error: " << e.what() << "\n";
96 catch (std::runtime_error &e) {
97 std::cerr << "std::runtime error: " << e.what() << "\n";
101 std::cerr << "Unknown Exception" << std::endl;
111 * indent-tabs-mode: nil
112 * c-file-style: "stroustrup"
114 * vim: shiftwidth=4 tabstop=8 expandtab