X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fex_router_flexml.cpp;h=b8ec894a17f2fd99f5c8069e31cdf856be7e7c8d;hb=85189f2d04df4cfc8b16ee78187fb89d00dfe3ff;hp=6fdb856c97d21bd3cc2ea0e10777c1a27c52c173;hpb=14d0e634d5061208301502d813d488d1e82f190b;p=metaproxy-moved-to-github.git diff --git a/src/ex_router_flexml.cpp b/src/ex_router_flexml.cpp index 6fdb856..b8ec894 100644 --- a/src/ex_router_flexml.cpp +++ b/src/ex_router_flexml.cpp @@ -1,46 +1,91 @@ -/* $Id: ex_router_flexml.cpp,v 1.5 2006-01-04 14:30:51 adam Exp $ - Copyright (c) 2005, Index Data. +/* $Id: ex_router_flexml.cpp,v 1.13 2008-02-20 15:07:51 adam Exp $ + Copyright (c) 2005-2007, Index Data. -%LICENSE% +This file is part of Metaproxy. + +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Metaproxy; see the file LICENSE. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ +#include "config.hpp" + +#include + #include #include -#include "config.hpp" #include "filter.hpp" +#include "package.hpp" #include "router_flexml.hpp" +#include "factory_static.hpp" + +namespace mp = metaproxy_1; int main(int argc, char **argv) { try { - - std::string xmlconf = "\n" - "\n" - "\n" - "\n" - "\n" - "210\n" - "\n" - "\n" - "mylog.log\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n"; - - yp2::FactoryFilter factory; - yp2::RouterFleXML rflexml(xmlconf, factory); - - - - } + int ret; + char *arg; + char *fname = 0; + + while ((ret = options("h{help}c{config}:", + argv, argc, &arg)) != -2) + { + switch(ret) + { + case -1: + std::cerr << "bad option " << arg << std::endl; + case 'h': + std::cerr << "ex_router_flexml\n" + " -h|--help help\n" + " -c|--config fname configuation\n" + << std::endl; + std::exit(1); + case 'c': + fname = arg; + } + } + + xmlDocPtr doc = 0; + if (fname) + { + doc = xmlParseFile(fname); + if (!doc) + { + std::cerr << "xmlParseFile failed\n"; + std::exit(1); + } + } + else + { + std::cerr << "No configuration given\n"; + std::exit(1); + } + if (doc) + { + mp::FactoryStatic factory; + mp::RouterFleXML router(doc, factory, false); + + mp::Package pack; + + pack.router(router).move(); + + xmlFreeDoc(doc); + } + } catch ( ... ) { std::cerr << "Unknown Exception" << std::endl; throw; @@ -50,8 +95,6 @@ int main(int argc, char **argv) } - - /* * Local variables: * c-basic-offset: 4