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_ms_plugin.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 // My Includes
3 #include "irods_ms_plugin.hpp"
4 #include "irods_load_plugin.hpp"
5 #include "irods_log.hpp"
6 
7 // =-=-=-=-=-=-=-
8 // STL Includes
9 #include <iostream>
10 #include <sstream>
11 
12 namespace irods {
13 // =-=-=-=-=-=-=-
14 // ms_table_entry definition
17  "",
18  "" ),
19  num_args_( 0 ) {
20  } // def ctor
21 
23  int _n ) :
25  "msvc",
26  "ctx" ),
27  num_args_( _n ) {
28  } // ctor
29 
31  const std::string& _name,
32  unsigned int _num_args,
33  boost::any _fcn_ptr ) :
35  "msvc",
36  "ctx" ),
37  operation_name_( _name ),
38  num_args_( _num_args ) {
39  operations_[operation_name_] = _fcn_ptr;
40  } // ctor
41 
43  const ms_table_entry& _rhs ) :
44  plugin_base( _rhs ),
45  operation_name_( _rhs.operation_name_ ),
46  num_args_( _rhs.num_args_ ) {
47  } // cctor
48 
50  const ms_table_entry& _rhs ) {
51  plugin_base::operator=( _rhs );
52  num_args_ = _rhs.num_args_;
54  return *this;
55  } // operator=
56 
58  } // dtor
59 
61  ruleExecInfo_t* _rei,
62  std::vector<msParam_t*>& _params ) {
63  if( _params.size() != num_args_ ) {
65  }
66 
67  int status = 0;
68  if ( _params.size() == 0 ) {
69  status = call_handler<ruleExecInfo_t*>( _rei );
70  }
71  else if ( _params.size() == 1 ) {
73  msParam_t*,
75  _params[0],
76  _rei );
77  }
78  else if ( _params.size() == 2 ) {
80  msParam_t*,
81  msParam_t*,
83  _params[0],
84  _params[1],
85  _rei );
86  }
87  else if ( _params.size() == 3 ) {
89  msParam_t*,
90  msParam_t*,
91  msParam_t*,
93  _params[0],
94  _params[1],
95  _params[2],
96  _rei );
97  }
98  else if ( _params.size() == 4 ) {
100  msParam_t*,
101  msParam_t*,
102  msParam_t*,
103  msParam_t*,
104  ruleExecInfo_t*>(
105  _params[0],
106  _params[1],
107  _params[2],
108  _params[3],
109  _rei );
110 
111  }
112  else if ( _params.size() == 5 ) {
114  msParam_t*,
115  msParam_t*,
116  msParam_t*,
117  msParam_t*,
118  msParam_t*,
119  ruleExecInfo_t*>(
120  _params[0],
121  _params[1],
122  _params[2],
123  _params[3],
124  _params[4],
125  _rei );
126  }
127  else if ( _params.size() == 6 ) {
129  msParam_t*,
130  msParam_t*,
131  msParam_t*,
132  msParam_t*,
133  msParam_t*,
134  msParam_t*,
135  ruleExecInfo_t*>(
136  _params[0],
137  _params[1],
138  _params[2],
139  _params[3],
140  _params[4],
141  _params[5],
142  _rei );
143  }
144  else if ( _params.size() == 7 ) {
146  msParam_t*,
147  msParam_t*,
148  msParam_t*,
149  msParam_t*,
150  msParam_t*,
151  msParam_t*,
152  msParam_t*,
153  ruleExecInfo_t*>(
154  _params[0],
155  _params[1],
156  _params[2],
157  _params[3],
158  _params[4],
159  _params[5],
160  _params[6],
161  _rei );
162 
163  }
164  else if ( _params.size() == 8 ) {
166  msParam_t*,
167  msParam_t*,
168  msParam_t*,
169  msParam_t*,
170  msParam_t*,
171  msParam_t*,
172  msParam_t*,
173  msParam_t*,
174  ruleExecInfo_t*>(
175  _params[0],
176  _params[1],
177  _params[2],
178  _params[3],
179  _params[4],
180  _params[5],
181  _params[6],
182  _params[7],
183  _rei );
184  }
185  else if ( _params.size() == 9 ) {
187  msParam_t*,
188  msParam_t*,
189  msParam_t*,
190  msParam_t*,
191  msParam_t*,
192  msParam_t*,
193  msParam_t*,
194  msParam_t*,
195  msParam_t*,
196  ruleExecInfo_t*>(
197  _params[0],
198  _params[1],
199  _params[2],
200  _params[3],
201  _params[4],
202  _params[5],
203  _params[6],
204  _params[7],
205  _params[8],
206  _rei );
207  }
208  else if ( _params.size() == 10 ) {
210  msParam_t*,
211  msParam_t*,
212  msParam_t*,
213  msParam_t*,
214  msParam_t*,
215  msParam_t*,
216  msParam_t*,
217  msParam_t*,
218  msParam_t*,
219  msParam_t*,
220  ruleExecInfo_t*>(
221  _params[0],
222  _params[1],
223  _params[2],
224  _params[3],
225  _params[4],
226  _params[5],
227  _params[6],
228  _params[7],
229  _params[8],
230  _params[9],
231  _rei );
232  }
233 
234  return status;
235 
236  } // call
237 
238 
239 // =-=-=-=-=-=-=-
240 // given the name of a microservice, try to load the shared object
241 // and then register that ms with the table
242  error load_microservice_plugin( ms_table& _table, const std::string _ms ) {
243  ms_table_entry* entry = 0;
244  error load_err = load_plugin< ms_table_entry >(
245  entry,
246  _ms,
248  "msvc", "ctx" );
249  if ( load_err.ok() && entry ) {
250  _table[ _ms ] = entry;
251  return SUCCESS();
252  }
253  else {
254  error ret = PASSMSG( "Failed to create ms plugin entry.", load_err );
255  // JMC :: spams the log - log( ret );
256  return ret;
257  }
258  } // load_microservice_plugin
259 
260 }; // namespace irods
irods::lookup_table
Definition: irods_lookup_table.hpp:24
irods_ms_plugin.hpp
irods::ms_table_entry::ms_table_entry
ms_table_entry()
Definition: irods_ms_plugin.cpp:15
irods::ms_table_entry::~ms_table_entry
virtual ~ms_table_entry()
Definition: irods_ms_plugin.cpp:57
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods::plugin_base::operator=
plugin_base & operator=(const plugin_base &_rhs)
Definition: irods_plugin_base.hpp:75
irods::PLUGIN_TYPE_MICROSERVICE
const std::string PLUGIN_TYPE_MICROSERVICE("microservices")
irods::ms_table_entry::call_handler
int call_handler(types_t... _t)
Definition: irods_ms_plugin.hpp:90
irods
Definition: apiHandler.hpp:35
irods_load_plugin.hpp
irods::plugin_base
Definition: irods_plugin_base.hpp:48
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
MsParam
Definition: msParam.h:76
irods::error
Definition: irods_error.hpp:23
irods::ms_table_entry
Definition: irods_ms_plugin.hpp:28
irods::ms_table_entry::operation_name_
std::string operation_name_
Definition: irods_ms_plugin.hpp:121
entry
Definition: ruleAdmin.cpp:22
irods::ms_table_entry::call
int call(ruleExecInfo_t *, std::vector< msParam_t * > &)
Definition: irods_ms_plugin.cpp:60
RuleExecInfo
Definition: irods_re_structs.hpp:18
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::ms_table_entry::operator=
ms_table_entry & operator=(const ms_table_entry &_rhs)
Definition: irods_ms_plugin.cpp:49
irods::ms_table_entry::num_args_
unsigned int num_args_
Definition: irods_ms_plugin.hpp:122
irods_log.hpp
irods::plugin_base::operations_
lookup_table< boost::any > operations_
Definition: irods_plugin_base.hpp:340
irods::load_microservice_plugin
error load_microservice_plugin(ms_table &_table, const std::string _ms)
Definition: irods_ms_plugin.cpp:242