irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_network_manager.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
3 #include "irods_load_plugin.hpp"
4 
5 namespace irods {
6 // =-=-=-=-=-=-=-
7 // network manager singleton
9 
10 // =-=-=-=-=-=-=-
11 // public - Constructor
13 
14  } // ctor
15 
16 // =-=-=-=-=-=-=-
17 // public - Copy Constructor
19  plugins_ = _rhs.plugins_;
20 
21  } // cctor
22 
23 // =-=-=-=-=-=-=-
24 // public - Destructor
26 
27  } // dtor
28 
29 // =-=-=-=-=-=-=-
30 // public - retrieve a network plugin given its key
32  std::string _key,
33  network_ptr& _value ) {
34 
35  if ( _key.empty() ) {
36  return ERROR( SYS_INVALID_INPUT_PARAM, "empty key" );
37  }
38 
39  if ( plugins_.has_entry( _key ) ) {
40  _value = plugins_[ _key ];
41  return SUCCESS();
42 
43  }
44  else {
45  std::stringstream msg;
46  msg << "no network plugin found for name ["
47  << _key
48  << "]";
49  return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );
50 
51  }
52 
53  } // resolve
54 
56  network_ptr& _plugin,
57  const std::string& _plugin_name,
58  const std::string& _inst_name,
59  const std::string& _context ) {
60  // =-=-=-=-=-=-=-
61  // call generic plugin loader
62  network* net = 0;
63  error ret = load_plugin< network >(
64  net,
65  _plugin_name,
67  _inst_name,
68  _context );
69  if ( ret.ok() && net ) {
70  _plugin.reset( net );
71  return SUCCESS();
72 
73  }
74  else {
75  return PASS( ret );
76 
77  }
78 
79  } // load_network_plugin
80 
81 // =-=-=-=-=-=-=-
82 // public - given a type, load up a network plugin
84  const int& _proc_type,
85  const std::string& _type,
86  const std::string& _key,
87  const std::string& _inst,
88  const std::string& _ctx,
89  network_ptr& _net ) {
90 
91  std::string type = _type;
92  if( CLIENT_PT == _proc_type ) {
93  type += "_client";
94  }
95  else {
96  type += "_server";
97  }
98 
99  // =-=-=-=-=-=-=-
100  // create the network plugin and add it to the table
101  network_ptr ptr;
102  error ret = load_network_plugin( ptr, type, _inst, _ctx );
103  if ( !ret.ok() ) {
104  return PASSMSG( "Failed to load network plugin", ret );
105  }
106 
107  plugins_[ _key ] = ptr;
108 
109  _net = plugins_[ _key ];
110 
111  return SUCCESS();
112 
113  } // init_from_type
114 
115 }; // namespace irods
116 
117 
118 
irods::PLUGIN_TYPE_NETWORK
const std::string PLUGIN_TYPE_NETWORK("network")
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
irods::network
Definition: irods_network_plugin.hpp:18
irods::netwk_mgr
network_manager netwk_mgr
Definition: irods_network_manager.cpp:8
irods::network_manager
Definition: irods_network_manager.hpp:15
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
irods_network_manager.hpp
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
irods::network_manager::init_from_type
error init_from_type(const int &, const std::string &, const std::string &, const std::string &, const std::string &, network_ptr &)
Definition: irods_network_manager.cpp:83
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods::load_network_plugin
static error load_network_plugin(network_ptr &_plugin, const std::string &_plugin_name, const std::string &_inst_name, const std::string &_context)
Definition: irods_network_manager.cpp:55
irods
Definition: apiHandler.hpp:35
irods::network_ptr
boost::shared_ptr< network > network_ptr
Definition: irods_network_types.hpp:19
irods_load_plugin.hpp
irods::network_manager::network_manager
network_manager()
Definition: irods_network_manager.cpp:12
irods::lookup_table::has_entry
bool has_entry(KeyType _k) const
Definition: irods_lookup_table.hpp:41
CLIENT_PT
#define CLIENT_PT
Definition: rodsDef.h:77
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
irods::error
Definition: irods_error.hpp:23
irods::network_manager::~network_manager
virtual ~network_manager()
Definition: irods_network_manager.cpp:25
irods::network_manager::resolve
error resolve(std::string, network_ptr &)
Definition: irods_network_manager.cpp:31
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
type
int type
Definition: filesystem.cpp:103
irods::network_manager::plugins_
lookup_table< network_ptr > plugins_
Definition: irods_network_manager.hpp:47