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