int _rsDataObjCreate( rsComm_t *rsComm, dataObjInp_t *dataObjInp ) { int status; int l1descInx; std::string resc_name; /* query rcat for resource info and sort it */ status = getRescForCreate( rsComm, dataObjInp, resc_name ); if ( status < 0 || resc_name.empty() ) { rodsLog( LOG_ERROR, "_rsDataObjCreate : failed in call to getRescForCreate. status = %d", status ); return status; } status = l1descInx = _rsDataObjCreateWithResc( rsComm, dataObjInp, resc_name ); // JMC - legacy resource - if (status < 0) { if ( status >= 0 ) { return status; } else { rodsLog( LOG_NOTICE, "rsDataObjCreate: Internal error" ); return SYS_INTERNAL_NULL_INPUT_ERR; } }
int createPhyBundleDataObj( rsComm_t *rsComm, char *collection, const std::string& _resc_name, const char* rescHier, dataObjInp_t *dataObjInp, // should be able to only use rescHier char* dataType ) { // JMC - backport 4658 int l1descInx; int status; /* XXXXXX We do bundle only with UNIX_FILE_TYPE for now */ if ( _resc_name.empty() ) { return SYS_INTERNAL_NULL_INPUT_ERR; } std::string type; irods::error err = irods::get_resource_property< std::string >( _resc_name, irods::RESOURCE_TYPE, type ); if ( !err.ok() ) { irods::log( PASS( err ) ); } do { int loopCnt = 0; bzero( dataObjInp, sizeof( dataObjInp_t ) ); while ( 1 ) { status = rsMkBundlePath( rsComm, collection, dataObjInp->objPath, getRandomInt() ); if ( status < 0 ) { rodsLog( LOG_ERROR, "createPhyBundleFile: getPhyBundlePath err for %s.stat = %d", collection, status ); return status; } /* check if BundlePath already existed */ if ( isData( rsComm, dataObjInp->objPath, NULL ) >= 0 ) { if ( loopCnt >= 100 ) { break; } else { loopCnt++; continue; } } else { break; } } if ( dataType != NULL && strstr( dataType, BUNDLE_STR ) != NULL ) { // JMC - backport 4658 addKeyVal( &dataObjInp->condInput, DATA_TYPE_KW, dataType ); } else { /* assume it is TAR_BUNDLE_DT_STR */ addKeyVal( &dataObjInp->condInput, DATA_TYPE_KW, TAR_BUNDLE_DT_STR ); } if ( rescHier != NULL ) { addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, rescHier ); } if ( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) { // JMC - backport 4664 /* zipFile type. must end with .zip */ int len = strlen( dataObjInp->objPath ); if ( strcmp( &dataObjInp->objPath[len - 4], ".zip" ) != 0 ) { strcat( dataObjInp->objPath, ".zip" ); } } l1descInx = _rsDataObjCreateWithResc( rsComm, dataObjInp, _resc_name ); clearKeyVal( &dataObjInp->condInput ); } while ( l1descInx == OVERWRITE_WITHOUT_FORCE_FLAG ); if ( l1descInx >= 0 ) { l3Close( rsComm, l1descInx ); L1desc[l1descInx].l3descInx = 0; if ( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) { // JMC - backport 4664 l3Unlink( rsComm, L1desc[l1descInx].dataObjInfo ); } } return l1descInx; }