doing "real" work in tests and test of configuration in general.
-/* $Id: ex_filter_frontend_net.cpp,v 1.31 2008-02-20 10:51:11 adam Exp $
+/* $Id: ex_filter_frontend_net.cpp,v 1.32 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
// put frontend filter in router
mp::filter::FrontendNet filter_front;
- filter_front.ports() = ports;
+ filter_front.set_ports(ports);
// 0=no time, >0 timeout in seconds
if (duration != -1)
- filter_front.listen_duration() = duration;
+ filter_front.set_listen_duration(duration);
router.append(filter_front);
-/* $Id: ex_router_flexml.cpp,v 1.12 2008-02-20 10:51:11 adam Exp $
+/* $Id: ex_router_flexml.cpp,v 1.13 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
if (doc)
{
mp::FactoryStatic factory;
- mp::RouterFleXML router(doc, factory);
+ mp::RouterFleXML router(doc, factory, false);
mp::Package pack;
-/* $Id: filter.cpp,v 1.10 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter.cpp,v 1.11 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
namespace mp = metaproxy_1;
-void mp::filter::Base::configure(const xmlNode * ptr)
+void mp::filter::Base::configure(const xmlNode * ptr, bool test_only)
{
mp::xml::check_empty(ptr);
}
-/* $Id: filter.hpp,v 1.20 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter.hpp,v 1.21 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
virtual void process(Package & package) const = 0;
/// configuration during filter load
- virtual void configure(const xmlNode * ptr);
+ virtual void configure(const xmlNode * ptr, bool test_only);
};
class FilterException : public std::runtime_error {
-/* $Id: filter_auth_simple.cpp,v 1.24 2007-05-23 14:24:10 adam Exp $
+/* $Id: filter_auth_simple.cpp,v 1.25 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
// Read XML config.. Put config info in m_p.
-void mp::filter::AuthSimple::configure(const xmlNode * ptr)
+void mp::filter::AuthSimple::configure(const xmlNode * ptr, bool test_only)
{
std::string userRegisterName;
std::string targetRegisterName;
-/* $Id: filter_auth_simple.hpp,v 1.9 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_auth_simple.hpp,v 1.10 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
public:
AuthSimple();
~AuthSimple();
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
void process(metaproxy_1::Package & package) const;
private:
void config_userRegister(std::string filename);
-/* $Id: filter_cql_to_rpn.cpp,v 1.7 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_cql_to_rpn.cpp,v 1.8 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-/* $Id: filter_cql_to_rpn.cpp,v 1.7 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_cql_to_rpn.cpp,v 1.8 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::CQLtoRPN::configure(const xmlNode *xmlnode)
+void yf::CQLtoRPN::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_cql_to_rpn.hpp,v 1.4 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_cql_to_rpn.hpp,v 1.5 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
CQLtoRPN();
~CQLtoRPN();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
private:
};
}
-/* $Id: filter_frontend_net.cpp,v 1.25 2008-01-21 16:15:00 adam Exp $
- Copyright (c) 2005-2007, Index Data.
+/* $Id: filter_frontend_net.cpp,v 1.26 2008-02-20 15:07:51 adam Exp $
+ Copyright (c) 2005-2008, Index Data.
This file is part of Metaproxy.
namespace mp = metaproxy_1;
namespace metaproxy_1 {
+ class My_Timer_Thread;
+ class ZAssocServer;
namespace filter {
class FrontendNet::Rep {
friend class FrontendNet;
std::vector<std::string> m_ports;
int m_listen_duration;
int m_session_timeout;
+ yazpp_1::SocketManager mySocketManager;
+
+ ZAssocServer **az;
};
}
class My_Timer_Thread : public yazpp_1::ISocketObserver {
class ZAssocServer : public yazpp_1::Z_Assoc {
public:
~ZAssocServer();
- ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
- mp::ThreadPoolSocketObserver *m_thread_pool_observer,
- const mp::Package *package,
- int timeout);
+ ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable, int timeout);
+ void set_package(const mp::Package *package);
+ void set_thread_pool(ThreadPoolSocketObserver *m_thread_pool_observer);
private:
yazpp_1::IPDU_Observer* sessionNotify(
yazpp_1::IPDU_Observable *the_PDU_Observable,
}
mp::ZAssocServer::ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
- mp::ThreadPoolSocketObserver *thread_pool_observer,
- const mp::Package *package,
int timeout)
: Z_Assoc(PDU_Observable), m_session_timeout(timeout)
{
- m_thread_pool_observer = thread_pool_observer;
+ m_package = 0;
+}
+
+
+void mp::ZAssocServer::set_package(const mp::Package *package)
+{
m_package = package;
+}
+void mp::ZAssocServer::set_thread_pool(ThreadPoolSocketObserver *observer)
+{
+ m_thread_pool_observer = observer;
}
yazpp_1::IPDU_Observer *mp::ZAssocServer::sessionNotify(yazpp_1::IPDU_Observable
m_p->m_no_threads = 5;
m_p->m_listen_duration = 0;
m_p->m_session_timeout = 300; // 5 minutes
+ m_p->az = 0;
}
mp::filter::FrontendNet::~FrontendNet()
{
+ if (m_p->az)
+ {
+ size_t i;
+ for (i = 0; i<m_p->m_ports.size(); i++)
+ delete m_p->az[i];
+ delete [] m_p->az;
+ }
}
bool mp::My_Timer_Thread::timeout()
void mp::filter::FrontendNet::process(Package &package) const
{
- if (m_p->m_ports.size() == 0)
+ if (m_p->az == 0)
return;
-
- yazpp_1::SocketManager mySocketManager;
-
+ size_t i;
My_Timer_Thread *tt = 0;
- if (m_p->m_listen_duration)
- tt = new My_Timer_Thread(&mySocketManager, m_p->m_listen_duration);
-
- ThreadPoolSocketObserver threadPool(&mySocketManager, m_p->m_no_threads);
- mp::ZAssocServer **az = new mp::ZAssocServer *[m_p->m_ports.size()];
+ if (m_p->m_listen_duration)
+ tt = new My_Timer_Thread(&m_p->mySocketManager,
+ m_p->m_listen_duration);
+
+ ThreadPoolSocketObserver tp(&m_p->mySocketManager, m_p->m_no_threads);
- // Create mp::ZAssocServer for each port
- size_t i;
for (i = 0; i<m_p->m_ports.size(); i++)
{
- // create a PDU assoc object (one per mp::ZAssocServer)
- yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&mySocketManager);
-
- // create ZAssoc with PDU Assoc
- az[i] = new mp::ZAssocServer(as, &threadPool, &package,
- m_p->m_session_timeout);
- az[i]->server(m_p->m_ports[i].c_str());
+ m_p->az[i]->set_package(&package);
+ m_p->az[i]->set_thread_pool(&tp);
}
- while (mySocketManager.processEvent() > 0)
+ while (m_p->mySocketManager.processEvent() > 0)
{
if (tt && tt->timeout())
break;
}
- for (i = 0; i<m_p->m_ports.size(); i++)
- delete az[i];
-
- delete [] az;
delete tt;
}
-void mp::filter::FrontendNet::configure(const xmlNode * ptr)
+void mp::filter::FrontendNet::configure(const xmlNode * ptr, bool test_only)
{
if (!ptr || !ptr->children)
{
ptr->name));
}
}
- m_p->m_ports = ports;
+ if (test_only)
+ return;
+ set_ports(ports);
}
-std::vector<std::string> &mp::filter::FrontendNet::ports()
+void mp::filter::FrontendNet::set_ports(std::vector<std::string> &ports)
{
- return m_p->m_ports;
+ m_p->m_ports = ports;
+
+ m_p->az = new mp::ZAssocServer *[m_p->m_ports.size()];
+
+ // Create mp::ZAssocServer for each port
+ size_t i;
+ for (i = 0; i<m_p->m_ports.size(); i++)
+ {
+ // create a PDU assoc object (one per mp::ZAssocServer)
+ yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&m_p->mySocketManager);
+
+ // create ZAssoc with PDU Assoc
+ m_p->az[i] = new mp::ZAssocServer(as,
+ m_p->m_session_timeout);
+ if (m_p->az[i]->server(m_p->m_ports[i].c_str()))
+ {
+ throw mp::filter::FilterException("Unable to bind to address "
+ + std::string(m_p->m_ports[i]));
+ }
+ }
}
-int &mp::filter::FrontendNet::listen_duration()
+void mp::filter::FrontendNet::set_listen_duration(int d)
{
- return m_p->m_listen_duration;
+ m_p->m_listen_duration = d;
}
static mp::filter::Base* filter_creator()
-/* $Id: filter_frontend_net.hpp,v 1.16 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_frontend_net.hpp,v 1.17 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
FrontendNet();
~FrontendNet();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
public:
/// set ports
- std::vector<std::string> &ports();
+ void set_ports(std::vector<std::string> &ports);
// set liten duraction (number of seconcds to listen)
- int &listen_duration();
+ void set_listen_duration(int d);
};
}
}
-/* $Id: filter_http_file.cpp,v 1.9 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_http_file.cpp,v 1.10 2008-02-20 15:07:51 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
package.move();
}
-void mp::filter::HttpFile::configure(const xmlNode * ptr)
+void mp::filter::HttpFile::configure(const xmlNode * ptr, bool test_only)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
-/* $Id: filter_http_file.hpp,v 1.7 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_http_file.hpp,v 1.8 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
HttpFile();
~HttpFile();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
};
}
}
-/* $Id: filter_load_balance.cpp,v 1.9 2008-01-29 16:51:12 adam Exp $
+/* $Id: filter_load_balance.cpp,v 1.10 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::LoadBalance::configure(const xmlNode *xmlnode)
+void yf::LoadBalance::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_load_balance.hpp,v 1.3 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_load_balance.hpp,v 1.4 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
LoadBalance();
~LoadBalance();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
};
}
}
-/* $Id: filter_log.cpp,v 1.32 2007-05-24 14:07:12 adam Exp $
+/* $Id: filter_log.cpp,v 1.33 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::Log::configure(const xmlNode *xmlnode)
+void yf::Log::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_log.hpp,v 1.19 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_log.hpp,v 1.20 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Log(const std::string &x);
~Log();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
//class LFile;
private:
class Impl;
-/* $Id: filter_multi.cpp,v 1.30 2008-01-19 09:02:11 adam Exp $
+/* $Id: filter_multi.cpp,v 1.31 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
m_p->release_frontend(package);
}
-void mp::filter::Multi::configure(const xmlNode * ptr)
+void mp::filter::Multi::configure(const xmlNode * ptr, bool test_only)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
-/* $Id: filter_multi.hpp,v 1.8 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_multi.hpp,v 1.9 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
~Multi();
Multi();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
void add_map_host2hosts(std::string host,
std::list<std::string> hosts,
std::string route);
-/* $Id: filter_query_rewrite.cpp,v 1.11 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_query_rewrite.cpp,v 1.12 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
m_p->process(package);
}
-void mp::filter::QueryRewrite::configure(const xmlNode *ptr)
+void mp::filter::QueryRewrite::configure(const xmlNode *ptr, bool test_only)
{
m_p->configure(ptr);
}
-/* $Id: filter_query_rewrite.hpp,v 1.7 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_query_rewrite.hpp,v 1.8 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
QueryRewrite();
~QueryRewrite();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
};
}
}
-/* $Id: filter_record_transform.cpp,v 1.13 2007-12-16 22:22:49 adam Exp $
+/* $Id: filter_record_transform.cpp,v 1.14 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::RecordTransform::configure(const xmlNode *xmlnode)
+void yf::RecordTransform::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_record_transform.hpp,v 1.3 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_record_transform.hpp,v 1.4 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
RecordTransform();
~RecordTransform();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
};
}
}
-/* $Id: filter_session_shared.cpp,v 1.19 2008-01-21 15:23:11 adam Exp $
+/* $Id: filter_session_shared.cpp,v 1.20 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
m_p->release_frontend(package);
}
-void yf::SessionShared::configure(const xmlNode *ptr)
+void yf::SessionShared::configure(const xmlNode *ptr, bool test_only)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
-/* $Id: filter_session_shared.hpp,v 1.10 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_session_shared.hpp,v 1.11 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
~SessionShared();
SessionShared();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
private:
boost::scoped_ptr<Rep> m_p;
};
-/* $Id: filter_sru_to_z3950.cpp,v 1.37 2008-01-29 21:25:46 adam Exp $
+/* $Id: filter_sru_to_z3950.cpp,v 1.38 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::SRUtoZ3950::configure(const xmlNode *xmlnode)
+void yf::SRUtoZ3950::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_sru_to_z3950.hpp,v 1.5 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_sru_to_z3950.hpp,v 1.6 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
public:
SRUtoZ3950();
~SRUtoZ3950();
- void configure(const xmlNode *xmlnode);
+ void configure(const xmlNode *xmlnode, bool test_only);
void process(metaproxy_1::Package & package) const;
};
}
-/* $Id: filter_template.cpp,v 1.11 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_template.cpp,v 1.12 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-/* $Id: filter_template.cpp,v 1.11 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_template.cpp,v 1.12 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::Template::configure(const xmlNode *xmlnode)
+void yf::Template::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_template.hpp,v 1.9 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_template.hpp,v 1.10 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Template();
~Template();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
};
}
}
-/* $Id: filter_virt_db.cpp,v 1.53 2007-11-26 21:45:08 adam Exp $
+/* $Id: filter_virt_db.cpp,v 1.54 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-/* $Id: filter_virt_db.cpp,v 1.53 2007-11-26 21:45:08 adam Exp $
+/* $Id: filter_virt_db.cpp,v 1.54 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
}
-void mp::filter::VirtualDB::configure(const xmlNode * ptr)
+void mp::filter::VirtualDB::configure(const xmlNode * ptr, bool test_only)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
-/* $Id: filter_virt_db.hpp,v 1.19 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_virt_db.hpp,v 1.20 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
~VirtualDB();
VirtualDB();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
void add_map_db2targets(std::string db,
std::list<std::string> targets,
std::string route);
-/* $Id: filter_z3950_client.cpp,v 1.31 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_z3950_client.cpp,v 1.32 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-/* $Id: filter_z3950_client.cpp,v 1.31 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_z3950_client.cpp,v 1.32 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
m_p->release_assoc(package);
}
-void yf::Z3950Client::configure(const xmlNode *ptr)
+void yf::Z3950Client::configure(const xmlNode *ptr, bool test_only)
{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
-/* $Id: filter_z3950_client.hpp,v 1.12 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_z3950_client.hpp,v 1.13 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
~Z3950Client();
Z3950Client();
void process(metaproxy_1::Package & package) const;
- void configure(const xmlNode * ptr);
+ void configure(const xmlNode * ptr, bool test_only);
private:
boost::scoped_ptr<Rep> m_p;
};
-/* $Id: filter_zeerex_explain.cpp,v 1.6 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_zeerex_explain.cpp,v 1.7 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
{ // must have a destructor because of boost::scoped_ptr
}
-void yf::ZeeRexExplain::configure(const xmlNode *xmlnode)
+void yf::ZeeRexExplain::configure(const xmlNode *xmlnode, bool test_only)
{
m_p->configure(xmlnode);
}
-/* $Id: filter_zeerex_explain.hpp,v 1.3 2007-05-09 21:23:09 adam Exp $
+/* $Id: filter_zeerex_explain.hpp,v 1.4 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
public:
ZeeRexExplain();
~ZeeRexExplain();
- void configure(const xmlNode *xmlnode);
+ void configure(const xmlNode *xmlnode, bool test_only);
void process(metaproxy_1::Package & package) const;
};
}
-/* $Id: metaproxy_prog.cpp,v 1.13 2008-02-20 12:39:35 adam Exp $
+/* $Id: metaproxy_prog.cpp,v 1.14 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2008, Index Data.
This file is part of Metaproxy.
break;
case 'l':
yaz_log_init_file(arg);
+ yaz_log(YLOG_LOG, "Metaproxy " VERSION " started");
break;
case 'p':
pidfile = arg;
std::cerr << "processing XInclude directive\n";
}
mp::FactoryStatic factory;
- mp::RouterFleXML router(doc, factory);
+ mp::RouterFleXML router(doc, factory, false);
yaz_daemon("metaproxy", mode, handler, &router, pidfile, uid);
}
-/* $Id: router_flexml.cpp,v 1.22 2007-05-09 21:23:09 adam Exp $
+/* $Id: router_flexml.cpp,v 1.23 2008-02-20 15:07:52 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
friend class RouterFleXML::Pos;
Rep();
- void base(xmlDocPtr doc, mp::FactoryFilter &factory);
+ void base(xmlDocPtr doc, mp::FactoryFilter &factory, bool test_only);
typedef std::map<std::string,
boost::shared_ptr<const mp::filter::Base > >
std::string m_dl_path;
- void parse_xml_config_dom(xmlDocPtr doc);
+ void parse_xml_config_dom(xmlDocPtr doc, bool test_only);
- void parse_xml_filters(xmlDocPtr doc, const xmlNode *node);
- void parse_xml_routes(xmlDocPtr doc, const xmlNode *node);
+ void parse_xml_filters(xmlDocPtr doc, const xmlNode *node,
+ bool test_only);
+ void parse_xml_routes(xmlDocPtr doc, const xmlNode *node,
+ bool test_only);
bool m_xinclude;
private:
}
void mp::RouterFleXML::Rep::parse_xml_filters(xmlDocPtr doc,
- const xmlNode *node)
+ const xmlNode *node,
+ bool test_only)
{
unsigned int filter_nr = 0;
while(node && mp::xml::check_element_mp(node, "filter"))
}
mp::filter::Base* filter_base = m_factory->create(type_value);
- filter_base->configure(node);
+ filter_base->configure(node, test_only);
if (m_id_filter_map.find(id_value) != m_id_filter_map.end())
throw mp::XMLError("Filter " + id_value + " already defined");
}
void mp::RouterFleXML::Rep::parse_xml_routes(xmlDocPtr doc,
- const xmlNode *node)
+ const xmlNode *node,
+ bool test_only)
{
mp::xml::check_element_mp(node, "route");
}
mp::filter::Base* filter_base = m_factory->create(type_value);
- filter_base->configure(node3);
+ filter_base->configure(node3, test_only);
route.m_list.push_back(
boost::shared_ptr<mp::filter::Base>(filter_base));
}
}
-void mp::RouterFleXML::Rep::parse_xml_config_dom(xmlDocPtr doc)
+void mp::RouterFleXML::Rep::parse_xml_config_dom(xmlDocPtr doc,
+ bool test_only)
{
if (!doc)
throw mp::XMLError("Empty XML Document");
if (mp::xml::is_element_mp(node, "filters"))
{
parse_xml_filters(doc, mp::xml::jump_to_children(node,
- XML_ELEMENT_NODE));
+ XML_ELEMENT_NODE),
+ test_only);
node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
}
// process <routes> node which is expected third element node
mp::xml::check_element_mp(node, "routes");
- parse_xml_routes(doc, mp::xml::jump_to_children(node, XML_ELEMENT_NODE));
+ parse_xml_routes(doc, mp::xml::jump_to_children(node, XML_ELEMENT_NODE),
+ test_only);
node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
if (node)
{
}
-void mp::RouterFleXML::Rep::base(xmlDocPtr doc, mp::FactoryFilter &factory)
+void mp::RouterFleXML::Rep::base(xmlDocPtr doc, mp::FactoryFilter &factory,
+ bool test_only)
{
m_factory = &factory;
- parse_xml_config_dom(doc);
+ parse_xml_config_dom(doc, test_only);
m_start_route = "start";
}
-mp::RouterFleXML::RouterFleXML(xmlDocPtr doc, mp::FactoryFilter &factory)
+mp::RouterFleXML::RouterFleXML(xmlDocPtr doc, mp::FactoryFilter &factory,
+ bool test_only)
: m_p(new Rep)
{
- m_p->base(doc, factory);
+ m_p->base(doc, factory, test_only);
}
-mp::RouterFleXML::RouterFleXML(std::string xmlconf, mp::FactoryFilter &factory)
+mp::RouterFleXML::RouterFleXML(std::string xmlconf, mp::FactoryFilter &factory,
+ bool test_only)
: m_p(new Rep)
{
LIBXML_TEST_VERSION;
throw mp::XMLError("xmlParseMemory failed");
else
{
- m_p->base(doc, factory);
+ m_p->base(doc, factory, test_only);
xmlFreeDoc(doc);
}
}
-/* $Id: router_flexml.hpp,v 1.17 2007-05-09 21:23:09 adam Exp $
+/* $Id: router_flexml.hpp,v 1.18 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
class Route;
class Pos;
public:
- RouterFleXML(std::string xmlconf, metaproxy_1::FactoryFilter &factory);
- RouterFleXML(xmlDocPtr doc, metaproxy_1::FactoryFilter &factory);
+ RouterFleXML(std::string xmlconf, metaproxy_1::FactoryFilter &factory,
+ bool test_only);
+ RouterFleXML(xmlDocPtr doc, metaproxy_1::FactoryFilter &factory,
+ bool test_only);
~RouterFleXML();
-/* $Id: test_filter2.cpp,v 1.24 2007-11-02 17:30:04 adam Exp $
+/* $Id: test_filter2.cpp,v 1.25 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
void process(mp::Package & package) const {
package.move();
};
- void configure(const xmlNode* ptr = 0);
+ void configure(const xmlNode* ptr, bool test_only);
int get_constant() const { return m_constant; };
private:
const xmlNode *m_ptr;
};
-void FilterConstant::configure(const xmlNode* ptr)
+void FilterConstant::configure(const xmlNode* ptr, bool test_only)
{
m_ptr = ptr;
-
+
BOOST_CHECK_EQUAL (ptr->type, XML_ELEMENT_NODE);
BOOST_CHECK_EQUAL(std::string((const char *) ptr->name), "filter");
{
xmlNodePtr root_element = xmlDocGetRootElement(doc);
- base->configure(root_element);
+ base->configure(root_element, true);
xmlFreeDoc(doc);
}
-/* $Id: test_filter_frontend_net.cpp,v 1.19 2007-11-02 17:47:41 adam Exp $
+/* $Id: test_filter_frontend_net.cpp,v 1.20 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-/* $Id: test_filter_frontend_net.cpp,v 1.19 2007-11-02 17:47:41 adam Exp $
+/* $Id: test_filter_frontend_net.cpp,v 1.20 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
See the LICENSE file for details
std::vector <std::string> ports;
ports.insert(ports.begin(), "unix:socket");
- filter_front.ports() = ports;
- filter_front.listen_duration() = 1; // listen a short time only
+ filter_front.set_ports(ports);
+ filter_front.set_listen_duration(1); // listen a short time only
router.append(filter_front);
// put in a backend
-/* $Id: test_filter_query_rewrite.cpp,v 1.14 2007-11-02 17:47:41 adam Exp $
+/* $Id: test_filter_query_rewrite.cpp,v 1.15 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
// creating and configuring filter
mp::filter::QueryRewrite f_query_rewrite;
- f_query_rewrite.configure(root_element);
+ f_query_rewrite.configure(root_element, true);
// remeber to free XML DOM
xmlFreeDoc(doc);
-/* $Id: test_filter_record_transform.cpp,v 1.7 2007-11-02 17:47:41 adam Exp $
+/* $Id: test_filter_record_transform.cpp,v 1.8 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
// creating and configuring filter
mp::filter::RecordTransform f_rec_trans;
- f_rec_trans.configure(root_element);
+ f_rec_trans.configure(root_element, true);
// remeber to free XML DOM
xmlFreeDoc(doc);
-/* $Id: test_router_flexml.cpp,v 1.21 2007-11-02 17:47:41 adam Exp $
+/* $Id: test_router_flexml.cpp,v 1.22 2008-02-20 15:07:53 adam Exp $
Copyright (c) 2005-2007, Index Data.
This file is part of Metaproxy.
mp::FactoryStatic factory;
factory.add_creator("tfilter", filter_creator);
- mp::RouterFleXML rflexml(xmlconf, factory);
+ mp::RouterFleXML rflexml(xmlconf, factory, true);
BOOST_CHECK_EQUAL(tfilter_ref, 2);
}
catch ( std::runtime_error &e) {
" <port>@:210</port>\n";
mp::FactoryFilter factory;
- mp::RouterFleXML rflexml(xmlconf_invalid, factory);
+ mp::RouterFleXML rflexml(xmlconf_invalid, factory, true);
}
catch ( mp::XMLError &e) {
std::cout << "XMLError: " << e.what() << "\n";
"</mp:metaproxy>\n";
mp::FactoryStatic factory;
- mp::RouterFleXML rflexml(xmlconf, factory);
+ mp::RouterFleXML rflexml(xmlconf, factory, true);
}
catch ( std::runtime_error &e) {
std::cout << "std::runtime error: " << e.what() << "\n";
mp::FactoryStatic factory;
factory.add_creator("tfilter", filter_creator);
- mp::RouterFleXML rflexml(xmlconf, factory);
+ mp::RouterFleXML rflexml(xmlconf, factory, true);
}
catch ( mp::FactoryFilter::NotFound &e) {
std::cout << "mp::FactoryFilter::NotFound: " << e.what() << "\n";