00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "reGlobalsExtern.h"
00010 #include "rsGlobalExtern.h"
00011 #include "dataObjCreate.h"
00012 #include "objMetaOpr.h"
00013 #include "regDataObj.h"
00014
00015 #include "miscServerFunct.h"
00016 #include "apiHeaderAll.h"
00017 #include "miscUtil.h"
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 int
00053 msiRegisterData(ruleExecInfo_t *rei)
00054 {
00055 int status;
00056 dataObjInfo_t *myDataObjInfo;
00057
00058
00059
00060 if (reTestFlag > 0 ) {
00061 if (reTestFlag == COMMAND_TEST_1 || reTestFlag == HTML_TEST_1) {
00062 print_doi(rei->doi);
00063 }
00064 else {
00065 rodsLog (LOG_NOTICE," Calling chlRegDataObj\n");
00066 print_doi(rei->doi);
00067 }
00068 if (reLoopBackFlag > 0)
00069 return(0);
00070 }
00071
00072
00073 myDataObjInfo = L1desc[rei->l1descInx].dataObjInfo;
00074 status = svrRegDataObj (rei->rsComm, myDataObjInfo);
00075 if (status < 0) {
00076 rodsLog (LOG_NOTICE,
00077 "msiRegisterData: rsRegDataObj for %s failed, status = %d",
00078 myDataObjInfo->objPath, status);
00079 return (status);
00080 } else {
00081 myDataObjInfo->replNum = status;
00082 return (0);
00083 }
00084 }
00085
00086 int
00087 recover_msiRegisterData(ruleExecInfo_t *rei)
00088 {
00089
00090
00091
00092 if (reTestFlag > 0 ) {
00093 if (reTestFlag == LOG_TEST_1)
00094 rodsLog (LOG_NOTICE," ROLLBACK:Calling recover_chlRegDataObj\n");
00095 if (reLoopBackFlag > 0)
00096 return(0);
00097 }
00098
00099
00100 msiRollback(rei);
00101 return(0);
00102
00103 }
00104 int
00105 print_bye(ruleExecInfo_t *rei)
00106 {
00107 RE_TEST_MACRO ("Bye\n");
00108 fprintf(stdout, "Bye\n");
00109 return(0);
00110 }
00111
00112 int
00113 print_eol(ruleExecInfo_t *rei)
00114 {
00115 RE_TEST_MACRO ("\n");
00116 fprintf(stdout, "\n");
00117 return(0);
00118 }
00119 int
00120 print_hello_arg(msParam_t* xs, ruleExecInfo_t *rei )
00121 {
00122 char *s;
00123
00124 s = (char *) xs->inOutStruct;
00125 RE_TEST_MACRO (s);
00126 fprintf(stdout,"%s\n",s);
00127 return(0);
00128 }
00129
00130 int
00131 recover_print_bye(ruleExecInfo_t *rei)
00132 {
00133 RE_TEST_MACRO ("\b\b\b \b\b\b");
00134 fprintf(stdout,"\b\b\b \b\b\b");
00135 return(0);
00136 }
00137
00138 int
00139 recover_print_eol(ruleExecInfo_t *rei)
00140 {
00141 RE_TEST_MACRO ("*\b");
00142 fprintf(stdout,"*\b");
00143 return(0);
00144 }
00145
00146 int
00147 recover_print_hello_arg(msParam_t* xs, ruleExecInfo_t *rei)
00148 {
00149 unsigned int i;
00150 char *s;
00151
00152 s = (char *) xs->inOutStruct;
00153 for (i = 0; i < strlen(s);i++)
00154 fprintf(stdout,"\b \b");
00155 return(0);
00156 }
00157
00158
00159
00160 int
00161 msitest1 (msParam_t *A, msParam_t *B, msParam_t* C, ruleExecInfo_t *rei)
00162 {
00163 msParam_t *mPA, *mPB, *mPC;
00164
00165 char tmpStr[200];
00166 mPA = (msParam_t *) A;
00167 mPB = (msParam_t *) B;
00168 mPC = (msParam_t *) C;
00169
00170 mPC->inOutStruct = (void *) strdup("msitest1 ValC");
00171 mPC->type = (char *) strdup("STR_PI");
00172 snprintf(tmpStr,199, "msitest1: In A=%s, In B=%s, Out C=%s",
00173 (char *) mPA->inOutStruct,(char *) mPB->inOutStruct,(char *) mPC->inOutStruct);
00174 printf("%s\n",tmpStr);
00175 RE_TEST_MACRO (tmpStr);
00176
00177 return(0);
00178 }
00179 int
00180 msitest2 (msParam_t *A, msParam_t *B, msParam_t* C, ruleExecInfo_t *rei)
00181 {
00182 msParam_t *mPA, *mPB, *mPC;
00183
00184 char tmpStr[200];
00185 mPA = (msParam_t *) A;
00186 mPB = (msParam_t *) B;
00187 mPC = (msParam_t *) C;
00188
00189 mPB->inOutStruct = (void *) strdup("msitest2 ValB");
00190 mPC->inOutStruct = (void *) strdup("msitest2 ValC");
00191 mPB->type = (char *) strdup("STR_PI");
00192 mPC->type = (char *) strdup("STR_PI");
00193 snprintf(tmpStr,199, "msitest2: In A=%s, Out B=%s, Out C=%s",
00194 (char *) mPA->inOutStruct,(char *) mPB->inOutStruct,(char *) mPC->inOutStruct);
00195 printf("%s\n",tmpStr);
00196 RE_TEST_MACRO (tmpStr);
00197
00198 return(0);
00199 }
00200
00201 int
00202 msitest3 (msParam_t *A, msParam_t *B, msParam_t* C, ruleExecInfo_t *rei)
00203 {
00204 msParam_t *mPA, *mPB, *mPC;
00205
00206 char tmpStr[200];
00207 mPA = (msParam_t *) A;
00208 mPB = (msParam_t *) B;
00209 mPC = (msParam_t *) C;
00210
00211 snprintf(tmpStr,199, "msitest3: In A=%s, In B=%s, In C=%s",
00212 (char *) mPA->inOutStruct,(char *) mPB->inOutStruct,(char *) mPC->inOutStruct);
00213 printf("%s\n",tmpStr);
00214 RE_TEST_MACRO (tmpStr);
00215
00216 return(0);
00217 }
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 int
00254 msiApplyDCMetadataTemplate(msParam_t* inpParam, msParam_t* outParam, ruleExecInfo_t *rei)
00255 {
00256 char *objPath;
00257 char objType[NAME_LEN];
00258 modAVUMetadataInp_t modAVUMetadataInp;
00259 int i, status;
00260
00261
00262 char *elements[]={"DC.Title", "DC.Creator", "DC.Subject", "DC.Description", "DC.Publisher", "DC.Contributor", "DC.Date", "DC.Type", "DC.Format", "DC.Identifier", "DC.Source", "DC.Language", "DC.Relation", "DC.Coverage", "DC.Rights" };
00263
00264
00265
00266 RE_TEST_MACRO (" Calling msiApplyDCMetadataTemplate")
00267
00268
00269
00270 if (rei == NULL || rei->rsComm == NULL) {
00271 rodsLog (LOG_ERROR, "msiApplyDCMetadataTemplate: input rei or rsComm is NULL");
00272 return (SYS_INTERNAL_NULL_INPUT_ERR);
00273 }
00274
00275
00276
00277 if ((objPath = parseMspForStr(inpParam)) == NULL) {
00278 rodsLog (LOG_ERROR, "msiApplyDCMetadataTemplate: input parameter is NULL");
00279 return (USER__NULL_INPUT_ERR);
00280 }
00281
00282
00283
00284 status = getObjType(rei->rsComm, objPath, objType);
00285
00286
00287
00288 for (i=0; i<15; i++) {
00289
00290 memset (&modAVUMetadataInp, 0, sizeof(modAVUMetadataInp_t));
00291 modAVUMetadataInp.arg0 = "add";
00292 modAVUMetadataInp.arg1 = objType;
00293 modAVUMetadataInp.arg2 = objPath;
00294 modAVUMetadataInp.arg3 = elements[i];
00295 modAVUMetadataInp.arg4 = " ";
00296 modAVUMetadataInp.arg5 = "";
00297
00298
00299 status = rsModAVUMetadata (rei->rsComm, &modAVUMetadataInp);
00300 }
00301
00302
00303
00304 fillIntInMsParam (outParam, status);
00305
00306
00307 return(status);
00308 }
00309