Пример #1
0
int
rsModAVUMetadata (rsComm_t *rsComm, modAVUMetadataInp_t *modAVUMetadataInp )
{
    rodsServerHost_t *rodsServerHost;
    int status;
    char *myHint;

    if (strcmp(modAVUMetadataInp->arg0,"add")==0) {
	myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"adda")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"addw")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"rmw")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"rmi")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"rm")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"cp")==0) {
        myHint = modAVUMetadataInp->arg3;
    } else if (strcmp(modAVUMetadataInp->arg0,"mod")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else if (strcmp(modAVUMetadataInp->arg0,"set")==0) {
        myHint = modAVUMetadataInp->arg2;
    } else {
	/* assume local */
	myHint = NULL;
    }
 
    status = getAndConnRcatHost(rsComm, MASTER_RCAT, myHint, &rodsServerHost);
    if (status < 0) {
       return(status);
    }

    if (rodsServerHost->localFlag == LOCAL_HOST) {
#ifdef RODS_CAT
       status = _rsModAVUMetadata (rsComm, modAVUMetadataInp);
#else
       status = SYS_NO_RCAT_SERVER_ERR;
#endif
    }
    else {
       status = rcModAVUMetadata(rodsServerHost->conn,
			       modAVUMetadataInp);
    }

    if (status < 0) { 
       rodsLog (LOG_NOTICE,
		"rsModAVUMetadata: rcModAVUMetadata failed");
    }
    return (status);
}
Пример #2
0
int
rsModAVUMetadata( rsComm_t *rsComm, modAVUMetadataInp_t *modAVUMetadataInp ) {
    rodsServerHost_t *rodsServerHost;
    int status;
    char *myHint;

    if ( strcmp( modAVUMetadataInp->arg0, "add" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "adda" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "addw" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "rmw" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "rmi" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "rm" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "cp" ) == 0 ) {
        myHint = modAVUMetadataInp->arg3;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "mod" ) == 0 ) {
        myHint = modAVUMetadataInp->arg2;
    }
    else if ( strcmp( modAVUMetadataInp->arg0, "set" ) == 0 ) { // JMC - backport 4836
        myHint = modAVUMetadataInp->arg2;
    }
    else {
        /* assume local */
        myHint = NULL;
    }

    status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )myHint, &rodsServerHost );
    if ( status < 0 ) {
        return status;
    }

    if ( rodsServerHost->localFlag == LOCAL_HOST ) {
        std::string svc_role;
        irods::error ret = get_catalog_service_role(svc_role);
        if(!ret.ok()) {
            irods::log(PASS(ret));
            return ret.code();
        }

        if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
            status = _rsModAVUMetadata( rsComm, modAVUMetadataInp );
        } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
            status = SYS_NO_RCAT_SERVER_ERR;
        } else {
            rodsLog(
                LOG_ERROR,
                "role not supported [%s]",
                svc_role.c_str() );
            status = SYS_SERVICE_ROLE_NOT_SUPPORTED;
        }

    }
    else {
        status = rcModAVUMetadata( rodsServerHost->conn,
                                   modAVUMetadataInp );
    }

    if ( status < 0 ) {
        rodsLog( LOG_NOTICE,
                 "rsModAVUMetadata: rcModAVUMetadata failed" );
    }
    return status;
}