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)  

rcExecMyRule.cpp
Go to the documentation of this file.
1 #include "execMyRule.h"
2 #include "oprComplete.h"
3 #include "dataObjPut.h"
4 #include "dataObjGet.h"
5 #include "rcMisc.h"
6 #include "apiNumber.h"
7 
35 int
36 rcExecMyRule( rcComm_t *conn, execMyRuleInp_t *execMyRuleInp,
37  msParamArray_t **outParamArray ) {
38 
39  int status = procApiRequest( conn, EXEC_MY_RULE_AN, execMyRuleInp, NULL,
40  ( void ** )outParamArray, NULL );
41 
42  while ( status == SYS_SVR_TO_CLI_MSI_REQUEST ) {
43  /* it is a server request */
44  msParam_t *myParam = NULL, *putParam = NULL;
45 
46  if ( ( myParam = putParam = getMsParamByLabel( *outParamArray, CL_PUT_ACTION ) ) ||
47  ( myParam = getMsParamByLabel( *outParamArray, CL_GET_ACTION ) ) ) {
48  //putParam is non-null if it's a put, null if it's a get
49  dataObjInp_t * dataObjInp = ( dataObjInp_t * ) myParam->inOutStruct;
50  char * locFilePath;
51  char myDir[MAX_NAME_LEN], myFile[MAX_NAME_LEN];
52  // locFilePath should be the return of getValByKey if it exists,
53  // otherwise use the filename from splitPathByKey
54  if ( ( locFilePath = getValByKey( &dataObjInp->condInput, LOCAL_PATH_KW ) ) ||
55  ( ( status = splitPathByKey( dataObjInp->objPath, myDir, MAX_NAME_LEN, myFile, MAX_NAME_LEN, '/' ) ) >= 0 &&
56  ( locFilePath = ( char * ) myFile ) ) ) {
57  status = putParam ?
58  rcDataObjPut( conn, dataObjInp, locFilePath ) :
59  rcDataObjGet( conn, dataObjInp, locFilePath );
60  rcOprComplete( conn, status );
61  }
62  else {
64  "rcExecMyRule: splitPathByKey for %s error",
65  dataObjInp->objPath );
67  }
68  clearKeyVal( &dataObjInp->condInput );
69  }
70  else {
72  }
73  /* free outParamArray */
74  clearMsParamArray( *outParamArray, 1 );
75  free( *outParamArray );
76  *outParamArray = NULL;
77 
78  /* read the reply from the earlier call */
79 
81  ( void ** )outParamArray, NULL );
82  if ( status < 0 ) {
84  "rcExecMyRule: readAndProcApiReply failed. status = %d",
85  status );
86  }
87  }
88 
89  return status;
90 }
getValByKey
char * getValByKey(const keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:675
DataObjInp::objPath
char objPath[(1024+64)]
Definition: dataObjInpOut.h:66
EXEC_MY_RULE_AN
#define EXEC_MY_RULE_AN
Definition: apiNumber.h:57
rcComm_t
Definition: rcConnect.h:95
NULL
#define NULL
Definition: rodsDef.h:70
rcExecMyRule
int rcExecMyRule(rcComm_t *conn, execMyRuleInp_t *execMyRuleInp, msParamArray_t **outParamArray)
Definition: rcExecMyRule.cpp:36
getMsParamByLabel
msParam_t * getMsParamByLabel(msParamArray_t *msParamArray, const char *label)
Definition: msParam.cpp:376
branchReadAndProcApiReply
int branchReadAndProcApiReply(rcComm_t *conn, int apiNumber, void **outStruct, bytesBuf_t *outBsBBuf)
Definition: procApiRequest.cpp:94
SYS_SVR_TO_CLI_MSI_NO_EXIST
@ SYS_SVR_TO_CLI_MSI_NO_EXIST
Definition: rodsErrorTable.h:112
rcMisc.h
SYS_SVR_TO_CLI_MSI_REQUEST
#define SYS_SVR_TO_CLI_MSI_REQUEST
Definition: rodsDef.h:109
USER_FILE_DOES_NOT_EXIST
@ USER_FILE_DOES_NOT_EXIST
Definition: rodsErrorTable.h:241
execMyRule.h
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
CL_PUT_ACTION
#define CL_PUT_ACTION
Definition: rodsDef.h:119
clearMsParamArray
int clearMsParamArray(msParamArray_t *msParamArray, int freeStruct)
Definition: msParam.cpp:447
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
rcDataObjGet
int rcDataObjGet(rcComm_t *conn, dataObjInp_t *dataObjInp, char *locFilePath)
Definition: rcDataObjGet.cpp:91
DataObjInp
Definition: dataObjInpOut.h:65
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
rcOprComplete
int rcOprComplete(rcComm_t *conn, int retval)
Definition: rcOprComplete.cpp:32
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
MsParam
Definition: msParam.h:76
splitPathByKey
int splitPathByKey(const char *srcPath, char *dir, size_t maxDirLen, char *file, size_t maxFileLen, char key)
Definition: stringOpr.cpp:222
LOCAL_PATH_KW
#define LOCAL_PATH_KW
Definition: rodsKeyWdDef.h:55
dataObjPut.h
apiNumber.h
CL_GET_ACTION
#define CL_GET_ACTION
Definition: rodsDef.h:120
ExecMyRuleInp
Definition: execMyRule.h:9
procApiRequest
int procApiRequest(rcComm_t *conn, int apiNumber, void *inputStruct, bytesBuf_t *inputBsBBuf, void **outStruct, bytesBuf_t *outBsBBuf)
Definition: procApiRequest.cpp:55
rodsLogError
void rodsLogError(int level, int errCode, char *formatStr,...)
Definition: rodsLog.cpp:422
oprComplete.h
rcDataObjPut
int rcDataObjPut(rcComm_t *conn, dataObjInp_t *dataObjInp, char *locFilePath)
Definition: rcDataObjPut.cpp:100
MsParam::inOutStruct
void * inOutStruct
Definition: msParam.h:80
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
MsParamArray
Definition: msParam.h:84
clearKeyVal
int clearKeyVal(keyValPair_t *condInput)
Definition: rcMisc.cpp:1047
dataObjGet.h