metaproxy  1.13.0
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
metaproxy_1::filter::VirtualDB Class Reference

#include <filter_virt_db.hpp>

Inheritance diagram for metaproxy_1::filter::VirtualDB:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::VirtualDB:
Collaboration graph

Classes

struct  Backend
 
struct  Frontend
 
struct  Map
 
class  Rep
 
struct  Set
 

Public Member Functions

 ~VirtualDB ()
 
 VirtualDB ()
 
void process (metaproxy_1::Package &package) const
 
void configure (const xmlNode *ptr, bool test_only, const char *path)
 
void add_map_db2targets (std::string db, std::list< std::string > targets, std::string route)
 
void add_map_db2target (std::string db, std::string target, std::string route)
 

Private Types

typedef boost::shared_ptr< BackendBackendPtr
 
typedef boost::shared_ptr< FrontendFrontendPtr
 

Private Attributes

boost::scoped_ptr< Repm_p
 

Detailed Description

Definition at line 31 of file filter_virt_db.hpp.

Member Typedef Documentation

typedef boost::shared_ptr<Backend> metaproxy_1::filter::VirtualDB::BackendPtr
private

Definition at line 36 of file filter_virt_db.hpp.

typedef boost::shared_ptr<Frontend> metaproxy_1::filter::VirtualDB::FrontendPtr
private

Definition at line 38 of file filter_virt_db.hpp.

Constructor & Destructor Documentation

metaproxy_1::filter::VirtualDB::~VirtualDB ( )
metaproxy_1::filter::VirtualDB::VirtualDB ( )

Member Function Documentation

void metaproxy_1::filter::VirtualDB::add_map_db2target ( std::string  db,
std::string  target,
std::string  route 
)
void metaproxy_1::filter::VirtualDB::add_map_db2targets ( std::string  db,
std::list< std::string >  targets,
std::string  route 
)
void metaproxy_1::filter::VirtualDB::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 861 of file filter_virt_db.cpp.

References m_p.

863 {
864  for (ptr = ptr->children; ptr; ptr = ptr->next)
865  {
866  if (ptr->type != XML_ELEMENT_NODE)
867  continue;
868  if (!strcmp((const char *) ptr->name, "pass-vhosts"))
869  {
870  m_p->pass_vhosts = mp::xml::get_bool(ptr, false);
871  }
872  else if (!strcmp((const char *) ptr->name, "virtual"))
873  {
874  std::string database;
875  std::list<std::string> targets;
876  xmlNode *v_node = ptr->children;
877  for (; v_node; v_node = v_node->next)
878  {
879  if (v_node->type != XML_ELEMENT_NODE)
880  continue;
881 
882  if (mp::xml::is_element_mp(v_node, "database"))
883  database = mp::xml::get_text(v_node);
884  else if (mp::xml::is_element_mp(v_node, "target"))
885  targets.push_back(mp::xml::get_text(v_node));
886  else
887  throw mp::filter::FilterException
888  ("Bad element "
889  + std::string((const char *) v_node->name)
890  + " in virtual section"
891  );
892  }
893  std::string route = mp::xml::get_route(ptr);
894 
895  VirtualDB::Map vmap(mp::util::database_name_normalize(database),
896  targets, route);
897  m_p->m_maps.push_back(vmap);
898  }
899  else
900  {
901  throw mp::filter::FilterException
902  ("Bad element "
903  + std::string((const char *) ptr->name)
904  + " in virt_db filter");
905  }
906  }
907 }
boost::scoped_ptr< Rep > m_p
void metaproxy_1::filter::VirtualDB::process ( metaproxy_1::Package &  package) const

Member Data Documentation

boost::scoped_ptr<Rep> metaproxy_1::filter::VirtualDB::m_p
private

Definition at line 52 of file filter_virt_db.hpp.

Referenced by configure().


The documentation for this class was generated from the following files: