1 /* $Id: ex_router_flexml.cpp,v 1.11 2007-05-09 21:23:09 adam Exp $
2 Copyright (c) 2005-2007, 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 <boost/program_options.hpp>
25 namespace po = boost::program_options;
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 po::options_description desc("Allowed options");
43 ("help", "produce help message")
44 ("config", po::value< std::vector<std::string> >(), "xml config")
47 po::positional_options_description p;
51 po::store(po::command_line_parser(argc, argv).
52 options(desc).positional(p).run(), vm);
55 if (vm.count("help")) {
56 std::cout << desc << "\n";
61 if (vm.count("config"))
63 std::vector<std::string> config_fnames =
64 vm["config"].as< std::vector<std::string> >();
66 if (config_fnames.size() != 1)
68 std::cerr << "Only one configuration must be given\n";
72 doc = xmlParseFile(config_fnames[0].c_str());
75 std::cerr << "xmlParseFile failed\n";
81 std::cerr << "No configuration given\n";
86 mp::FactoryStatic factory;
87 mp::RouterFleXML router(doc, factory);
91 pack.router(router).move();
97 std::cerr << "Unknown Exception" << std::endl;
108 * indent-tabs-mode: nil
109 * c-file-style: "stroustrup"
111 * vim: shiftwidth=4 tabstop=8 expandtab