00001
00002
00003
00004
00005
00006 #include "regDataObj.h"
00007 #include "icatHighLevelRoutines.h"
00008
00009
00010
00011
00012 int
00013 rsRegDataObj (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo,
00014 dataObjInfo_t **outDataObjInfo)
00015 {
00016 int status;
00017 rodsServerHost_t *rodsServerHost = NULL;
00018
00019 *outDataObjInfo = NULL;
00020
00021 status = getAndConnRcatHost (rsComm, MASTER_RCAT, dataObjInfo->objPath,
00022 &rodsServerHost);
00023 if (status < 0 || NULL == rodsServerHost ) {
00024 return(status);
00025 }
00026
00027 if (rodsServerHost->localFlag == LOCAL_HOST) {
00028 #ifdef RODS_CAT
00029 status = _rsRegDataObj (rsComm, dataObjInfo);
00030 if (status >= 0) {
00031 *outDataObjInfo = (dataObjInfo_t *) malloc (sizeof (dataObjInfo_t));
00032
00033 **outDataObjInfo = *dataObjInfo;
00034 }
00035 #else
00036 status = SYS_NO_RCAT_SERVER_ERR;
00037 #endif
00038 } else {
00039 status = rcRegDataObj (rodsServerHost->conn, dataObjInfo,
00040 outDataObjInfo);
00041 }
00042 return (status);
00043 }
00044
00045 int
00046 _rsRegDataObj (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
00047 {
00048 #ifdef RODS_CAT
00049 int status;
00050 status = chlRegDataObj (rsComm, dataObjInfo);
00051 return (status);
00052 #else
00053 return (SYS_NO_RCAT_SERVER_ERR);
00054 #endif
00055
00056 }
00057
00058 int
00059 svrRegDataObj (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
00060 {
00061 int status;
00062 rodsServerHost_t *rodsServerHost = NULL;
00063
00064 if (dataObjInfo->specColl != NULL) {
00065 rodsLog (LOG_NOTICE,
00066 "svrRegDataObj: Reg path %s is in spec coll",
00067 dataObjInfo->objPath);
00068 return (SYS_REG_OBJ_IN_SPEC_COLL);
00069 }
00070
00071 status = getAndConnRcatHost (rsComm, MASTER_RCAT, dataObjInfo->objPath,
00072 &rodsServerHost);
00073 if (status < 0 || NULL == rodsServerHost ) {
00074 return(status);
00075 }
00076
00077 if (rodsServerHost->localFlag == LOCAL_HOST) {
00078 #ifdef RODS_CAT
00079 status = _rsRegDataObj (rsComm, dataObjInfo);
00080 #else
00081 status = SYS_NO_RCAT_SERVER_ERR;
00082 #endif
00083 } else {
00084 dataObjInfo_t *outDataObjInfo = NULL;
00085 status = rcRegDataObj (rodsServerHost->conn, dataObjInfo,
00086 &outDataObjInfo);
00087 if (status >= 0 && NULL != outDataObjInfo ) {
00088 dataObjInfo->dataId = outDataObjInfo->dataId;
00089 free (outDataObjInfo);
00090 }
00091 }
00092
00093 return (status);
00094 }
00095