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)  

rsExecRuleExpression.cpp
Go to the documentation of this file.
1 #include "irods_re_plugin.hpp"
2 #include "miscServerFunct.hpp"
3 #include "rcMisc.h"
4 #include "packStruct.h"
6 
7 #include <string>
8 
9 extern const packInstruct_t RodsPackTable[];
10 
12  rsComm_t* _comm,
13  exec_rule_expression_t* _exec_rule ) {
14  if( !_comm || !_exec_rule ) {
16  }
17 
18  std::string my_rule_text = (char*)_exec_rule->rule_text_.buf;
19 
20  ruleExecInfoAndArg_t* rei_and_arg = NULL;
21  int status = unpackStruct(
22  _exec_rule->packed_rei_.buf,
23  ( void ** ) &rei_and_arg,
24  "ReiAndArg_PI",
26  NATIVE_PROT );
27  if ( status < 0 ) {
28  rodsLog(
29  LOG_ERROR,
30  "%s :: unpackStruct error. status = %d",
31  __FUNCTION__,
32  status );
33  return status;
34  }
35 
36  ruleExecInfo_t* rei = rei_and_arg->rei;
37  rei->rsComm = _comm;
38  rei->rsComm->clientUser = *rei->uoic;
39 
40  // do doi things?
41  if ( rei->doi != NULL ) {
42  if ( rei->doi->next != NULL ) {
43  free( rei->doi->next );
44  rei->doi->next = NULL;
45  }
46  }
47 
48  std::string instance_name;
49  if(strlen(rei->pluginInstanceName) > 0) {
50  instance_name = rei->pluginInstanceName;
51  }
52 
56  irods::AUDIT_RULE> re_ctx_mgr(
57  irods::re_plugin_globals->global_re_mgr,
58  rei);
59 
60  std::string instance_name_string{instance_name};
61  irods::error err = re_ctx_mgr.exec_rule_expression(
62  instance_name_string,
63  my_rule_text,
64  _exec_rule->params_);
65  if(!err.ok()) {
66  rodsLog(
67  LOG_ERROR,
68  "%s : %d, %s",
69  __FUNCTION__,
70  err.code(),
71  err.result().c_str()
72  );
73  }
74 
75  return err.code();
76 
77 } // rsExecRuleExpression
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
irods::unit
std::tuple<> unit
Definition: irods_re_plugin.hpp:736
rsComm_t
Definition: rcConnect.h:145
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
exec_rule_expression_t::rule_text_
bytesBuf_t rule_text_
Definition: exec_rule_expression.h:10
packInstruct_t
Definition: packStruct.h:31
rsExecRuleExpression
int rsExecRuleExpression(rsComm_t *_comm, exec_rule_expression_t *_exec_rule)
Definition: rsExecRuleExpression.cpp:11
irods::rule_engine_context_manager
Definition: irods_re_plugin.hpp:522
rcMisc.h
RuleExecInfo::doi
dataObjInfo_t * doi
Definition: irods_re_structs.hpp:28
unpackStruct
int unpackStruct(const void *inPackStr, void **outStruct, const char *packInstName, const packInstruct_t *myPackTable, irodsProt_t irodsProt)
Definition: packStruct.cpp:63
rsExecRuleExpression.hpp
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
DataObjInfo::next
struct DataObjInfo * next
Definition: objInfo.h:163
irods_re_plugin.hpp
RuleExecInfo::rsComm
rsComm_t * rsComm
Definition: irods_re_structs.hpp:22
irods::error::code
long long code() const
Definition: irods_error.cpp:194
exec_rule_expression_t
Definition: exec_rule_expression.h:9
irods::AUDIT_RULE
@ AUDIT_RULE
Definition: irods_re_plugin.hpp:124
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
RuleExecInfoAndArg
Definition: irods_re_structs.hpp:46
packStruct.h
rsComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:153
RodsPackTable
const packInstruct_t RodsPackTable[]
Definition: rodsPackTable.h:61
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
RuleExecInfo::pluginInstanceName
char pluginInstanceName[(1024+64)]
Definition: irods_re_structs.hpp:23
RuleExecInfo::uoic
userInfo_t * uoic
Definition: irods_re_structs.hpp:30
RuleExecInfo
Definition: irods_re_structs.hpp:18
NATIVE_PROT
@ NATIVE_PROT
Definition: rodsDef.h:148
exec_rule_expression_t::packed_rei_
bytesBuf_t packed_rei_
Definition: exec_rule_expression.h:11
exec_rule_expression_t::params_
msParamArray_t * params_
Definition: exec_rule_expression.h:12
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::error::result
std::string result() const
Definition: irods_error.cpp:201
irods::re_plugin_globals
std::unique_ptr< struct irods::global_re_plugin_mgr > re_plugin_globals
Definition: irods_re_plugin.cpp:16