Ejemplo n.º 1
0
Archivo: rules.cpp Proyecto: bpow/irods
int parseAndComputeRuleNewEnv( char *rule, ruleExecInfo_t *rei, int reiSaveFlag, msParamArray_t *msParamArray, rError_t *errmsg, Region *r ) {
    Env *env = defaultEnv( r );
    addCmdExecOutToEnv( globalEnv( env ), r );

    int rescode = 0;
    msParamArray_t *orig = NULL;

    if ( msParamArray != NULL ) {
        rescode = convertMsParamArrayToEnv( msParamArray, env->previous, r );
        RE_ERROR( rescode < 0 );
    }

    orig = rei->msParamArray;
    rei->msParamArray = NULL;

    rescode = parseAndComputeRule( rule, env, rei, reiSaveFlag, errmsg, r );
    RE_ERROR( rescode < 0 );

    if ( orig == NULL ) {
        rei->msParamArray = newMsParamArray();
    }
    else {
        rei->msParamArray = orig;
    }
    rescode = convertEnvToMsParamArray( rei->msParamArray, env, errmsg, r );
    RE_ERROR( rescode < 0 );
    /* deleteEnv(env, 3); */
    return rescode;

error:

    /* deleteEnv(env, 3); */
    return rescode;
}
Ejemplo n.º 2
0
int parseAndComputeRuleAdapter( char *rule, msParamArray_t *msParamArray, ruleExecInfo_t *rei, int reiSaveFlag, Region *r ) {
    /* set clearDelayed to 0 so that nested calls to this function do not call clearDelay() */
    int recclearDelayed = ruleEngineConfig.clearDelayed;
    ruleEngineConfig.clearDelayed = 0;

    rError_t errmsgBuf;
    errmsgBuf.errMsg = NULL;
    errmsgBuf.len = 0;

    Env *env = defaultEnv( r );

    rei->status = 0;

    int rescode = 0;
    if ( msParamArray != NULL ) {
        if ( strncmp( rule, "@external\n", 10 ) == 0 ) {
            rescode = parseAndComputeMsParamArrayToEnv( msParamArray, globalEnv( env ), rei, reiSaveFlag, &errmsgBuf, r );
            RE_ERROR( rescode < 0 );
            rule = rule + 10;
        }
        else {
            rescode = convertMsParamArrayToEnv( msParamArray, globalEnv( env ), r );
            RE_ERROR( rescode < 0 );
        }
    }

    deleteFromHashTable(globalEnv(env)->current, "ruleExecOut");

    rei->msParamArray = msParamArray;

    rescode = parseAndComputeRule( rule, env, rei, reiSaveFlag, &errmsgBuf, r );
    RE_ERROR( rescode < 0 );

    if ( NULL == rei->msParamArray ) {
        rei->msParamArray = newMsParamArray();
    }
    rescode = convertEnvToMsParamArray( rei->msParamArray, env, &errmsgBuf, r );
    RE_ERROR( rescode < 0 );

    freeRErrorContent( &errmsgBuf );
    /* deleteEnv(env, 3); */

    return rescode;
error:
    logErrMsg( &errmsgBuf, &rei->rsComm->rError );
    rei->status = rescode;
    freeRErrorContent( &errmsgBuf );
    /* deleteEnv(env, 3); */
    if ( recclearDelayed ) {
        clearDelayed();
    }
    ruleEngineConfig.clearDelayed = recclearDelayed;

    return rescode;


}
Ejemplo n.º 3
0
int parseAndComputeRuleNewEnv( char *rule, ruleExecInfo_t *rei, int reiSaveFlag, msParamArray_t *msParamArray, rError_t *errmsg, Region *r ) {
    Env *env = defaultEnv( r );

    int rescode = 0;

    if ( msParamArray != NULL ) {
        rescode = convertMsParamArrayToEnv( msParamArray, env->previous, r );
        RE_ERROR( rescode < 0 );
        deleteFromHashTable(env->previous->current, "ruleExecOut");
    }

    rescode = parseAndComputeRule( rule, env, rei, reiSaveFlag, errmsg, r );
    RE_ERROR( rescode < 0 );

    rescode = convertEnvToMsParamArray( rei->msParamArray, env, errmsg, r );
    RE_ERROR( rescode < 0 );
    /* deleteEnv(env, 3); */
    return rescode;

error:

    /* deleteEnv(env, 3); */
    return rescode;
}
Ejemplo n.º 4
0
Archivo: rules.cpp Proyecto: bpow/irods
int parseAndComputeRuleAdapter( char *rule, msParamArray_t *msParamArray, ruleExecInfo_t *rei, int reiSaveFlag, Region *r ) {
    /* set clearDelayed to 0 so that nested calls to this function do not call clearDelay() */
    int recclearDelayed = ruleEngineConfig.clearDelayed;
    ruleEngineConfig.clearDelayed = 0;

    rError_t errmsgBuf;
    errmsgBuf.errMsg = NULL;
    errmsgBuf.len = 0;

    Env *env = defaultEnv( r );

    rei->status = 0;

    msParamArray_t *orig = NULL;

    Res *execOutRes;

    int rescode = 0;
    if ( msParamArray != NULL ) {
        if ( strncmp( rule, "@external\n", 10 ) == 0 ) {
            rescode = parseAndComputeMsParamArrayToEnv( msParamArray, globalEnv( env ), rei, reiSaveFlag, &errmsgBuf, r );
            RE_ERROR( rescode < 0 );
            rule = rule + 10;
        }
        else {
            rescode = convertMsParamArrayToEnv( msParamArray, globalEnv( env ), r );
            RE_ERROR( rescode < 0 );
        }
    }

    if ( ( execOutRes = ( Res * )lookupFromEnv( env, "ruleExecOut" ) ) == NULL || TYPE( execOutRes ) == T_UNSPECED ) {
        /* add cmdExecOut only if ruleExecOut is an output parameter */
        deleteFromHashTable( globalEnv( env )->current, "ruleExecOut" );
        addCmdExecOutToEnv( globalEnv( env ), r );
    }

    orig = rei->msParamArray;
    rei->msParamArray = NULL;

    rescode = parseAndComputeRule( rule, env, rei, reiSaveFlag, &errmsgBuf, r );

    if ( orig == NULL ) {
        rei->msParamArray = newMsParamArray();
    }
    else {
        rei->msParamArray = orig;
    }
    convertEnvToMsParamArray( rei->msParamArray, env, &errmsgBuf, r );

    RE_ERROR( rescode < 0 );
    freeRErrorContent( &errmsgBuf );
    /* deleteEnv(env, 3); */

    return rescode;
error:
    logErrMsg( &errmsgBuf, &rei->rsComm->rError );
    rei->status = rescode;
    freeRErrorContent( &errmsgBuf );
    /* deleteEnv(env, 3); */
    if ( recclearDelayed ) {
        clearDelayed();
    }
    ruleEngineConfig.clearDelayed = recclearDelayed;

    return rescode;


}