Changeset 34
- Timestamp:
- Oct 1, 2010, 1:41:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 15 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/main_conf_read.l
r12 r34 65 65 <PAIRSTART,INITIAL,HORSBALISE,DANSBALISE>{newline}+{whitesp}* {if (affichetrace==1) printf ("\n\nNEWLINE 2\n") ; BEGIN(INITIAL); return NEWLINE;} 66 66 67 <INITIAL>"<?"[Xx][Mm][Ll] { if (attentionImpossibleDeTrouverXMLDeclapres == 1 || attentionImpossibleDeTrouverPIapres == 1) { printf("\nerror : a la ligne %d : il y a eut un commentaire ou un PI avant la declaration xml\n",yylineno); exit (10) ; } ; if (affichetrace==1) printf ("\n\nSTARTXMLDECL:%s\n",yytext) ;return STARTXMLDECL;}67 <INITIAL>"<?"[Xx][Mm][Ll] { if (attentionImpossibleDeTrouverXMLDeclapres == 1 || attentionImpossibleDeTrouverPIapres == 1) { printf("\nerror : LINE %d : comment ot PI before xml declaration\n",yylineno); exit (10) ; } ; if (affichetrace==1) printf ("\n\nSTARTXMLDECL:%s\n",yytext) ;return STARTXMLDECL;} 68 68 69 69 <INITIAL>"version"{egalevolue}\"1.0\"|"version"{egalevolue}\'1.0\' {if (affichetrace==1) printf ("\n\nVERSIONDECL:%s\n",yytext) ;return VERSIONDECL;} 70 <INITIAL>"version"{egalevolue}\"[^"]*\"|"version"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : a la ligne %d : la version xml n est pas reconnue: %s\n",yylineno,yytext); exit (9) ; }70 <INITIAL>"version"{egalevolue}\"[^"]*\"|"version"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : XML Version not supported : %s\n",yylineno,yytext); exit (9) ; } 71 71 72 72 73 73 <INITIAL>"encoding"{egalevolue}\"[Ii][Ss][Oo]"-8859-1"\"|"encoding"{egalevolue}\'[Ii][Ss][Oo]"-8859-1"\' {if (affichetrace==1) printf ("\n\nENCODINGDECL:%s\n",yytext) ; return ENCODINGDECL;} 74 <INITIAL>"encoding"{egalevolue}\"[^"]*\"|"encoding"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : a la ligne %d : la version d encodage n est pas reconnue: %s\n",yylineno,yytext); exit (8) ; }74 <INITIAL>"encoding"{egalevolue}\"[^"]*\"|"encoding"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : encoding version not supported : %s\n",yylineno,yytext); exit (8) ; } 75 75 76 76 77 77 <INITIAL>"standalone"{egalevolue}\"yes\"|"standalone"{egalevolue}\'yes\'|"standalone"{egalevolue}\"no\"|"standalone"{egalevolue}\'no\' {if (affichetrace==1) printf ("\n\nSDDECL:%s\n",yytext) ; return SDDECL;} 78 78 79 <INITIAL>"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\'|"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : a la ligne %d : la version standalone n est pas reconnue: %s\n",yylineno,yytext); exit (7) ; }79 <INITIAL>"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\'|"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : standalone version not supported : %s\n",yylineno,yytext); exit (7) ; } 80 80 81 81 … … 111 111 112 112 113 <INITIAL,DANSBALISE,HORSBALISE>.|\n {if (affichetrace==1)printf("error : ligne %d : caractere non reconnu'%s'\n",yylineno,yytext); }113 <INITIAL,DANSBALISE,HORSBALISE>.|\n {if (affichetrace==1)printf("error : LINE %d : character not supported '%s'\n",yylineno,yytext); } 114 114 115 115 %% -
trunk/zoo-kernel/service_internal.c
r33 r34 25 25 #include "service_internal.h" 26 26 27 void *addLangAttr(xmlNodePtr n,maps *m){ 28 map *tmpLmap=getMapFromMaps(m,"main","language"); 29 if(tmpLmap!=NULL) 30 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST tmpLmap->value); 31 else 32 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en-US"); 33 } 34 27 35 /* Converts a hex character to its integer value */ 28 36 char from_hex(char ch) { … … 281 289 xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd"); 282 290 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 291 addLangAttr(n,m); 283 292 284 293 if(toto1!=NULL){ … … 512 521 xmlAddChild(nc2,nc4); 513 522 xmlAddChild(nc1,nc2); 514 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST buff);515 523 dcount++; 516 524 } … … 590 598 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 591 599 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.0.0"); 592 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");600 addLangAttr(n,m); 593 601 594 602 xmlDocSetRootElement(doc, n); … … 954 962 xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS"); 955 963 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.0.0"); 956 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en"); 964 addLangAttr(n,m); 965 957 966 char tmp[256]; 958 967 char url[1024]; … … 1046 1055 case SERVICE_SUCCEEDED: 1047 1056 nc1 = xmlNewNode(ns, BAD_CAST "ProcessSucceeded"); 1048 sprintf(sMsg, "Service \"%s\" run successfully.",serv->name);1057 sprintf(sMsg,_("Service \"%s\" run successfully."),serv->name); 1049 1058 nc3=xmlNewText(BAD_CAST sMsg); 1050 1059 xmlAddChild(nc1,nc3); … … 1054 1063 tmpStatus=getMapFromMaps(m,"lenv","status"); 1055 1064 xmlNewProp(nc1,BAD_CAST "percentCompleted",BAD_CAST tmpStatus->value); 1056 sprintf(sMsg, "ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service.",serv->name);1065 sprintf(sMsg,_("ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service."),serv->name); 1057 1066 nc3=xmlNewText(BAD_CAST sMsg); 1058 1067 xmlAddChild(nc1,nc3); … … 1060 1069 case SERVICE_ACCEPTED: 1061 1070 nc1 = xmlNewNode(ns, BAD_CAST "ProcessAccepted"); 1062 sprintf(sMsg, "Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document.",serv->name);1071 sprintf(sMsg,_("Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document."),serv->name); 1063 1072 nc3=xmlNewText(BAD_CAST sMsg); 1064 1073 xmlAddChild(nc1,nc3); … … 1077 1086 addToMap(errorMap,"text",te->value); 1078 1087 else 1079 addToMap(errorMap,"text", "No more information available");1088 addToMap(errorMap,"text",_("No more information available")); 1080 1089 nc3=createExceptionReportNode(m,errorMap,0); 1081 1090 xmlAddChild(nc1,nc3); 1082 1091 break; 1083 1092 default : 1084 printf( "error code not know : %i\n",status);1093 printf(_("error code not know : %i\n"),status); 1085 1094 //exit(1); 1086 1095 break; … … 1250 1259 // Extract Title required to be first element in the ZCFG file ! 1251 1260 nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name); 1252 nc3=xmlNewText(BAD_CAST tmp->value);1261 nc3=xmlNewText(BAD_CAST _ss(tmp->value)); 1253 1262 xmlAddChild(nc2,nc3); 1254 1263 xmlAddChild(nc1,nc2); … … 1256 1265 tmp=tmp->next; 1257 1266 nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name); 1258 nc3=xmlNewText(BAD_CAST tmp->value);1267 nc3=xmlNewText(BAD_CAST _ss(tmp->value)); 1259 1268 xmlAddChild(nc2,nc3); 1260 1269 xmlAddChild(nc1,nc2); … … 1352 1361 if(tmp1!=NULL){ 1353 1362 nc2 = xmlNewNode(ns_ows, BAD_CAST tmp2[j]); 1354 xmlAddChild(nc2,xmlNewText(BAD_CAST tmp1->value)); 1363 fprintf(stderr,"[%s] \n[%s]\n",tmp1->value,_ss(tmp1->value)); 1364 xmlAddChild(nc2,xmlNewText(BAD_CAST _ss(tmp1->value))); 1355 1365 xmlAddChild(root,nc2); 1356 1366 } … … 1389 1399 xmlDocPtr doc; 1390 1400 xmlChar *xmlbuff; 1391 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 1392 xmlNodePtr n,nc,nc1,nc2; 1401 xmlNodePtr n; 1393 1402 1394 1403 doc = xmlNewDoc(BAD_CAST "1.0"); … … 1405 1414 }else 1406 1415 printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding); 1407 1408 ns=xmlNewNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1409 n = xmlNewNode(ns, BAD_CAST "ExceptionReport"); 1410 ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows"); 1411 ns_xlink=xmlNewNs(n,BAD_CAST "http://www.w3.org/1999/xlink",BAD_CAST "xlink"); 1412 ns_xsi=xmlNewNs(n,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi"); 1413 xmlNewProp(n,BAD_CAST "xsi:schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"); 1414 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en"); 1415 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0"); 1416 1417 nc = xmlNewNode(ns, BAD_CAST "Exception"); 1418 1419 map* tmp=getMap(s,"code"); 1420 if(tmp!=NULL) 1421 xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST tmp->value); 1422 else 1423 xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST "NoApplicableCode"); 1424 1425 tmp=getMap(s,"text"); 1426 nc1 = xmlNewNode(ns, BAD_CAST "ExceptionText"); 1427 nc2=NULL; 1428 if(tmp!=NULL){ 1429 xmlNodeSetContent(nc1, BAD_CAST tmp->value); 1430 } 1431 else{ 1432 xmlNodeSetContent(nc1, BAD_CAST "No debug message available"); 1433 } 1434 xmlAddChild(nc,nc1); 1435 xmlAddChild(n,nc); 1416 n=createExceptionReportNode(m,s,1); 1436 1417 xmlDocSetRootElement(doc, n); 1437 1438 1418 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 1439 1419 printf("%s",xmlbuff); … … 1441 1421 xmlFreeDoc(doc); 1442 1422 xmlFree(xmlbuff); 1443 xmlFreeNs(ns);1444 1423 xmlCleanupParser(); 1445 1424 } … … 1465 1444 xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"); 1466 1445 } 1467 xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");1446 addLangAttr(n,m); 1468 1447 xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0"); 1469 1448 … … 1483 1462 } 1484 1463 else{ 1485 xmlNodeSetContent(nc1, BAD_CAST "No debug message available");1464 xmlNodeSetContent(nc1, BAD_CAST _("No debug message available")); 1486 1465 } 1487 1466 xmlAddChild(nc,nc1); … … 1544 1523 toto=getMap(request_outputs->content,"value"); 1545 1524 if(toto==NULL){ 1546 map * errormap = createMap("text", "Unable to fetch any result");1525 map * errormap = createMap("text",_("Unable to fetch any result")); 1547 1526 addToMap(errormap,"code", "InternalError"); 1548 1527 printExceptionReportResponse(m,errormap); … … 1585 1564 lenv=getMapFromMaps(m,"lenv","message"); 1586 1565 if(lenv!=NULL) 1587 sprintf(tmp, "Unable to run the Service. The message returned back by the Service was the following : %s",lenv->value);1566 sprintf(tmp,_("Unable to run the Service. The message returned back by the Service was the following : %s"),lenv->value); 1588 1567 else 1589 sprintf(tmp, "Unable to run the Service. No more information was returned back by the Service.");1568 sprintf(tmp,_("Unable to run the Service. No more information was returned back by the Service.")); 1590 1569 errormap = createMap("text",tmp); 1591 1570 addToMap(errormap,"code", "InternalError"); -
trunk/zoo-kernel/service_internal.h
r26 r34 28 28 #pragma once 29 29 30 #define DEFAULT_SERVICE_URL "http:// dev.geolabs.fr/zoo-wps/"30 #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/" 31 31 #define TIME_SIZE 40 32 33 #include <libintl.h> 34 #include <locale.h> 35 #define _(String) dgettext ("zoo-kernel",String) 36 #define _ss(String) dgettext ("zoo-services",String) 32 37 33 38 #include <sys/stat.h> -
trunk/zoo-kernel/service_internal_js.c
r26 r34 208 208 /* Cleanup. */ 209 209 JS_DestroyScript(cx, script); 210 JS_MaybeGC(cx);210 //JS_MaybeGC(cx); 211 211 // If we use the DestroyContext as requested to release memory then we get 212 212 // issue getting back the main configuration maps after coming back to the -
trunk/zoo-kernel/zoo_service_loader.c
r33 r34 40 40 #include "ulinet.h" 41 41 42 #include <libintl.h> 43 #include <locale.h> 42 44 #include <string.h> 43 45 44 46 #include "service.h" 47 45 48 #include "service_internal.h" 46 49 … … 80 83 #include <time.h> 81 84 #include <stdarg.h> 85 86 #define _(String) dgettext ("zoo-kernel",String) 87 88 89 void *translateChar(char* str,char toReplace,char toReplaceBy){ 90 int i=0,len=strlen(str); 91 for(i=0;i<len;i++){ 92 if(str[i]==toReplace) 93 str[i]=toReplaceBy; 94 } 95 } 82 96 83 97 xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,char* search){ … … 116 130 break; 117 131 } 118 sprintf(tmp, "ZOO Kernel failed to process your request receiving signal %d = %s",sig,ssig);132 sprintf(tmp,_("ZOO Kernel failed to process your request receiving signal %d = %s"),sig,ssig); 119 133 errorException(NULL, tmp, "InternalError"); 120 134 #ifdef DEBUG … … 122 136 #endif 123 137 exit(0); 138 } 139 140 void *loadServiceAndRun(maps **myMap,service* s1,map* request_inputs,maps **inputs,maps** ioutputs,int* eres){ 141 char tmps1[1024]; 142 char ntmp[1024]; 143 maps *m=*myMap; 144 maps *request_output_real_format=*ioutputs; 145 maps *request_input_real_format=*inputs; 146 /** 147 * Extract serviceType to know what kind of service should be loaded 148 */ 149 map* r_inputs=NULL; 150 #ifndef WIN32 151 getcwd(ntmp,1024); 152 #else 153 _getcwd(ntmp,1024); 154 #endif 155 r_inputs=getMap(s1->content,"serviceType"); 156 #ifdef DEBUG 157 fprintf(stderr,"LOAD A %s SERVICE PROVIDER \n",r_inputs->value); 158 fflush(stderr); 159 #endif 160 if(strncasecmp(r_inputs->value,"C",1)==0){ 161 r_inputs=getMap(request_inputs,"metapath"); 162 if(r_inputs!=NULL) 163 sprintf(tmps1,"%s/%s",ntmp,r_inputs->value); 164 else 165 sprintf(tmps1,"%s/",ntmp); 166 char *altPath=strdup(tmps1); 167 r_inputs=getMap(s1->content,"ServiceProvider"); 168 sprintf(tmps1,"%s/%s",altPath,r_inputs->value); 169 free(altPath); 170 #ifdef DEBUG 171 fprintf(stderr,"Trying to load %s\n",tmps1); 172 #endif 173 #ifdef WIN32 174 HINSTANCE so = LoadLibraryEx(tmps1,NULL,LOAD_WITH_ALTERED_SEARCH_PATH); 175 #else 176 void* so = dlopen(tmps1, RTLD_LAZY); 177 #endif 178 #ifdef DEBUG 179 #ifdef WIN32< 180 DWORD errstr; 181 errstr = GetLastError(); 182 fprintf(stderr,"%s loaded (%d) \n",tmps1,errstr); 183 #else 184 char *errstr; 185 errstr = dlerror(); 186 #endif 187 #endif 188 189 if( so != NULL ) { 190 #ifdef DEBUG 191 fprintf(stderr,"Library loaded %s \n",errstr); 192 fprintf(stderr,"Service Shared Object = %s\n",r_inputs->value); 193 #endif 194 r_inputs=getMap(s1->content,"serviceType"); 195 #ifdef DEBUG 196 dumpMap(r_inputs); 197 fprintf(stderr,"%s\n",r_inputs->value); 198 fflush(stderr); 199 #endif 200 if(strncasecmp(r_inputs->value,"C-FORTRAN",9)==0){ 201 #ifdef WIN32 202 //Strange return value needed here ! 203 return 1; 204 #endif 205 r_inputs=getMap(request_inputs,"Identifier"); 206 char fname[1024]; 207 sprintf(fname,"%s_",r_inputs->value); 208 #ifdef DEBUG 209 fprintf(stderr,"Try to load function %s\n",fname); 210 #endif 211 #ifdef WIN32 212 typedef int (CALLBACK* execute_t)(char***,char***,char***); 213 execute_t execute=(execute_t)GetProcAddress(so,fname); 214 #else 215 typedef int (*execute_t)(char***,char***,char***); 216 execute_t execute=(execute_t)dlsym(so,fname); 217 #endif 218 #ifdef DEBUG 219 #ifdef WIN32 220 errstr = GetLastError(); 221 #else 222 errstr = dlerror(); 223 #endif 224 fprintf(stderr,"Function loaded %s\n",errstr); 225 #endif 226 227 char main_conf[10][30][1024]; 228 char inputs[10][30][1024]; 229 char outputs[10][30][1024]; 230 for(int i=0;i<10;i++){ 231 for(int j=0;j<30;j++){ 232 memset(main_conf[i][j],0,1024); 233 memset(inputs[i][j],0,1024); 234 memset(outputs[i][j],0,1024); 235 } 236 } 237 mapsToCharXXX(m,(char***)main_conf); 238 mapsToCharXXX(request_input_real_format,(char***)inputs); 239 mapsToCharXXX(request_output_real_format,(char***)outputs); 240 *eres=execute((char***)&main_conf[0],(char***)&inputs[0],(char***)&outputs[0]); 241 #ifdef DEBUG 242 fprintf(stderr,"Function run successfully \n"); 243 #endif 244 charxxxToMaps((char***)&outputs[0],&request_output_real_format); 245 }else{ 246 #ifdef DEBUG 247 #ifdef WIN32 248 errstr = GetLastError(); 249 fprintf(stderr,"Function %s failed to load because of %d\n",r_inputs->value,errstr); 250 #endif 251 #endif 252 r_inputs=getMap(request_inputs,"Identifier"); 253 #ifdef DEBUG 254 fprintf(stderr,"Try to load function %s\n",r_inputs->value); 255 #endif 256 typedef int (*execute_t)(maps**,maps**,maps**); 257 #ifdef WIN32 258 execute_t execute=(execute_t)GetProcAddress(so,r_inputs->value); 259 #else 260 execute_t execute=(execute_t)dlsym(so,r_inputs->value); 261 #endif 262 263 #ifdef DEBUG 264 #ifdef WIN32 265 errstr = GetLastError(); 266 #else 267 errstr = dlerror(); 268 #endif 269 fprintf(stderr,"Function loaded %s\n",errstr); 270 #endif 271 272 #ifdef DEBUG 273 fprintf(stderr,"Now run the function \n"); 274 fflush(stderr); 275 #endif 276 *eres=execute(&m,&request_input_real_format,&request_output_real_format); 277 #ifdef DEBUG 278 fprintf(stderr,"Function loaded and returned %d\n",eres); 279 fflush(stderr); 280 #endif 281 } 282 dlclose(so); 283 } else { 284 /** 285 * Unable to load the specified shared library 286 */ 287 char tmps[1024]; 288 #ifdef WIN32 289 DWORD errstr = GetLastError(); 290 #else 291 char* errstr = dlerror(); 292 #endif 293 sprintf(tmps,_("C Library can't be loaded %s \n"),errstr); 294 map* tmps1=createMap("text",tmps); 295 printExceptionReportResponse(m,tmps1); 296 *eres=-1; 297 } 298 } 299 else 300 #ifdef USE_PYTHON 301 if(strncasecmp(r_inputs->value,"PYTHON",6)==0){ 302 *eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 303 } 304 else 305 #endif 306 307 #ifdef USE_JAVA 308 if(strncasecmp(r_inputs->value,"JAVA",4)==0){ 309 *eres=zoo_java_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 310 } 311 else 312 #endif 313 314 #ifdef USE_PHP 315 if(strncasecmp(r_inputs->value,"PHP",3)==0){ 316 *eres=zoo_php_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 317 } 318 else 319 #endif 320 321 322 #ifdef USE_PERL 323 if(strncasecmp(r_inputs->value,"PERL",4)==0){ 324 *eres=zoo_perl_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 325 } 326 else 327 #endif 328 329 #ifdef USE_JS 330 if(strncasecmp(r_inputs->value,"JS",2)==0){ 331 *eres=zoo_js_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 332 } 333 else 334 #endif 335 { 336 char tmpv[1024]; 337 sprintf(tmpv,_("Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n"),r_inputs->value); 338 map* tmps=createMap("text",tmpv); 339 printExceptionReportResponse(m,tmps); 340 *eres=-1; 341 } 342 *ioutputs=request_output_real_format; 124 343 } 125 344 … … 144 363 m=(maps*)calloc(1,MAPS_SIZE); 145 364 if(m == NULL){ 146 return errorException(m, "Unable to allocate memory.", "InternalError");365 return errorException(m, _("Unable to allocate memory."), "InternalError"); 147 366 } 148 367 char ntmp[1024]; … … 173 392 #endif 174 393 394 bindtextdomain ("zoo-kernel","/usr/share/locale/"); 395 bindtextdomain ("zoo-services","/usr/share/locale/"); 396 397 if((r_inputs=getMap(request_inputs,"language"))!=NULL){ 398 char *tmp=strdup(r_inputs->value); 399 translateChar(tmp,'-','_'); 400 setlocale (LC_ALL, tmp); 401 free(tmp); 402 setMapInMaps(m,"main","language",r_inputs->value); 403 } 404 else{ 405 setlocale (LC_ALL, "en_US"); 406 setMapInMaps(m,"main","language","en-US"); 407 } 408 setlocale (LC_NUMERIC, "en_US"); 409 bind_textdomain_codeset("zoo-kernel","UTF-8"); 410 textdomain("zoo-kernel"); 411 bind_textdomain_codeset("zoo-services","UTF-8"); 412 textdomain("zoo-services"); 413 414 175 415 /** 176 416 * Check for minimum inputs … … 178 418 r_inputs=getMap(request_inputs,"Request"); 179 419 if(request_inputs==NULL || r_inputs==NULL){ 180 errorException(m, "Parameter <request> was not specified","MissingParameterValue");420 errorException(m, _("Parameter <request> was not specified"),"MissingParameterValue"); 181 421 freeMaps(&m); 182 422 free(m); … … 188 428 && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0 189 429 && strncasecmp(r_inputs->value,"Execute",7)!=0){ 190 errorException(m, "Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute.", "InvalidParameterValue");430 errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue"); 191 431 freeMaps(&m); 192 432 free(m); … … 198 438 r_inputs=getMap(request_inputs,"Service"); 199 439 if(r_inputs==NULLMAP){ 200 errorException(m, "Parameter <service> was not specified","MissingParameterValue");440 errorException(m, _("Parameter <service> was not specified"),"MissingParameterValue"); 201 441 freeMaps(&m); 202 442 free(m); … … 207 447 r_inputs=getMap(request_inputs,"Version"); 208 448 if(r_inputs==NULL){ 209 errorException(m, "Parameter <version> was not specified","MissingParameterValue");449 errorException(m, _("Parameter <version> was not specified"),"MissingParameterValue"); 210 450 freeMaps(&m); 211 451 free(m); … … 254 494 DIR *dirp = opendir(conf_dir); 255 495 if(dirp==NULL){ 256 return errorException(m, "The specified path doesn't exist.","InvalidParameterValue");496 return errorException(m, _("The specified path doesn't exist."),"InvalidParameterValue"); 257 497 } 258 498 xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); … … 277 517 s1=(service*)calloc(1,SERVICE_SIZE); 278 518 if(s1 == NULL){ 279 return errorException(m, "Unable to allocate memory.","InternalError");519 return errorException(m, _("Unable to allocate memory."),"InternalError"); 280 520 } 281 521 #ifdef DEBUG … … 308 548 if(r_inputs==NULL 309 549 || strlen(r_inputs->name)==0 || strlen(r_inputs->value)==0){ 310 errorException(m, "Mandatory <identifier> was not specified","MissingParameterValue");550 errorException(m, _("Mandatory <identifier> was not specified"),"MissingParameterValue"); 311 551 freeMaps(&m); 312 552 free(m); … … 319 559 DIR *dirp = opendir(conf_dir); 320 560 if(dirp==NULL){ 321 errorException(m, "The specified path path doesn't exist.","InvalidParameterValue");561 errorException(m, _("The specified path path doesn't exist."),"InvalidParameterValue"); 322 562 freeMaps(&m); 323 563 free(m); … … 364 604 s1=(service*)calloc(1,SERVICE_SIZE); 365 605 if(s1 == NULL){ 366 return errorException(m, "Unable to allocate memory.","InternalError");606 return errorException(m, _("Unable to allocate memory."),"InternalError"); 367 607 } 368 608 #ifdef DEBUG … … 399 639 else 400 640 if(strncasecmp(REQUEST,"Execute",strlen(REQUEST))!=0){ 401 errorException(m, "Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute.", "InvalidParameterValue");641 errorException(m, _("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), "InvalidParameterValue"); 402 642 #ifdef DEBUG 403 643 fprintf(stderr,"No request found %s",REQUEST); … … 417 657 free(REQUEST); 418 658 free(SERVICE_URL); 419 return errorException(m, "Unable to allocate memory.","InternalError");659 return errorException(m, _("Unable to allocate memory."),"InternalError"); 420 660 } 421 661 r_inputs=getMap(request_inputs,"MetaPath"); … … 438 678 if(t<0){ 439 679 char tmpMsg[2048+strlen(r_inputs->value)]; 440 sprintf(tmpMsg, "The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request.",r_inputs->value);680 sprintf(tmpMsg,_("The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),r_inputs->value); 441 681 errorException(m, tmpMsg, "InvalidParameterValue"); 442 682 freeService(&s1); … … 516 756 char** outputs_as_text=(char**)calloc(128,sizeof(char*)); 517 757 if(outputs_as_text == NULL) { 518 return errorException(m, "Unable to allocate memory", "InternalError");758 return errorException(m, _("Unable to allocate memory"), "InternalError"); 519 759 } 520 760 i=0; … … 527 767 outputs_as_text[i]=(char*)calloc(strlen(pToken)+1,sizeof(char)); 528 768 if(outputs_as_text[i] == NULL) { 529 return errorException(m, "Unable to allocate memory", "InternalError");769 return errorException(m, _("Unable to allocate memory"), "InternalError"); 530 770 } 531 771 snprintf(outputs_as_text[i],strlen(pToken)+1,"%s",pToken); … … 544 784 tmp_output=(maps*)calloc(1,MAPS_SIZE); 545 785 if(tmp_output == NULL){ 546 return errorException(m, "Unable to allocate memory.", "InternalError");786 return errorException(m, _("Unable to allocate memory."), "InternalError"); 547 787 } 548 788 tmp_output->name=strdup(tmpc); … … 603 843 snprintf(cursor_input,40960,"%s",r_inputs->value); 604 844 else{ 605 errorException(m, "Parameter <DataInputs> was not specified","MissingParameterValue");845 errorException(m, _("Parameter <DataInputs> was not specified"),"MissingParameterValue"); 606 846 freeMaps(&m); 607 847 free(m); … … 620 860 char** inputs_as_text=(char**)calloc(100,sizeof(char*)); 621 861 if(inputs_as_text == NULL){ 622 return errorException(m, "Unable to allocate memory.", "InternalError");862 return errorException(m, _("Unable to allocate memory."), "InternalError"); 623 863 } 624 864 i=0; … … 634 874 snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken); 635 875 if(inputs_as_text[i] == NULL){ 636 return errorException(m, "Unable to allocate memory.", "InternalError");876 return errorException(m, _("Unable to allocate memory."), "InternalError"); 637 877 } 638 878 pToken = strtok(NULL,";"); … … 661 901 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 662 902 if(tmpmaps == NULL){ 663 return errorException(m, "Unable to allocate memory.", "InternalError");903 return errorException(m, _("Unable to allocate memory."), "InternalError"); 664 904 } 665 905 tmpmaps->name=strdup(tmpn); … … 702 942 char* tmpContent=(char*)calloc((res.nDataLen+1),sizeof(char)); 703 943 if(tmpContent == NULL){ 704 return errorException(m, "Unable to allocate memory.", "InternalError");944 return errorException(m, _("Unable to allocate memory."), "InternalError"); 705 945 } 706 946 size_t dwRead; … … 785 1025 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 786 1026 if(tmpmaps == NULL){ 787 return errorException(m, "Unable to allocate memory.", "InternalError");1027 return errorException(m, _("Unable to allocate memory."), "InternalError"); 788 1028 } 789 1029 tmpmaps->name=strdup((char*)val); … … 803 1043 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 804 1044 if(tmpmaps == NULL){ 805 return errorException(m, "Unable to allocate memory.", "InternalError");1045 return errorException(m, _("Unable to allocate memory."), "InternalError"); 806 1046 } 807 1047 tmpmaps->name="missingIndetifier"; … … 861 1101 (char*)calloc((res.nDataLen+1),sizeof(char)); 862 1102 if(tmpContent == NULL){ 863 return errorException(m, "Unable to allocate memory.", "InternalError");1103 return errorException(m, _("Unable to allocate memory."), "InternalError"); 864 1104 } 865 1105 size_t dwRead; … … 902 1142 has=(char*)calloc((3+strlen((char*)val)+strlen(key)),sizeof(char)); 903 1143 if(has == NULL){ 904 return errorException(m, "Unable to allocate memory.", "InternalError");1144 return errorException(m, _("Unable to allocate memory."), "InternalError"); 905 1145 } 906 1146 snprintf(has,(3+strlen((char*)val)+strlen(key)),"%s: %s",key,(char*)val); … … 949 1189 char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char)); 950 1190 if(tmpContent == NULL){ 951 return errorException(m, "Unable to allocate memory.", "InternalError");1191 return errorException(m, _("Unable to allocate memory."), "InternalError"); 952 1192 } 953 1193 size_t dwRead; … … 984 1224 (char*)calloc((res1.nDataLen+1),sizeof(char)); 985 1225 if(tmp == NULL){ 986 return errorException(m, "Unable to allocate memory.", "InternalError");1226 return errorException(m, _("Unable to allocate memory."), "InternalError"); 987 1227 } 988 1228 size_t bRead; … … 1002 1242 char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char)); 1003 1243 if(tmpContent == NULL){ 1004 return errorException(m, "Unable to allocate memory.", "InternalError");1244 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1005 1245 } 1006 1246 size_t dwRead; … … 1143 1383 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1144 1384 if(tmpmaps == NULL){ 1145 return errorException(m, "Unable to allocate memory.", "InternalError");1385 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1146 1386 } 1147 1387 tmpmaps->name="unknownIdentifier"; … … 1215 1455 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1216 1456 if(tmpmaps == NULL){ 1217 return errorException(m, "Unable to allocate memory.", "InternalError");1457 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1218 1458 } 1219 1459 tmpmaps->name=strdup((char*)val); … … 1235 1475 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1236 1476 if(tmpmaps == NULL){ 1237 return errorException(m, "Unable to allocate memory.", "InternalError");1477 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1238 1478 } 1239 1479 tmpmaps->name="missingIndetifier"; … … 1295 1535 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1296 1536 if(tmpmaps == NULL){ 1297 return errorException(m, "Unable to allocate memory.", "InternalError");1537 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1298 1538 } 1299 1539 tmpmaps->name="unknownIdentifier"; … … 1321 1561 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1322 1562 if(tmpmaps == NULL){ 1323 return errorException(m, "Unable to allocate memory.", "InternalError");1563 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1324 1564 } 1325 1565 tmpmaps->name=strdup((char*)val); … … 1363 1603 if(strcmp(dfv,"")!=0){ 1364 1604 char tmps[1024]; 1365 snprintf(tmps,1024, "The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file.",dfv);1605 snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv); 1366 1606 map* tmpe=createMap("text",tmps); 1367 1607 addToMap(tmpe,"code","MissingParameterValue"); … … 1458 1698 r_inputs=NULL; 1459 1699 if(r_inputs==NULLMAP){ 1460 /** 1461 * Extract serviceType to know what kind of service shoudl be loaded 1462 */ 1463 r_inputs=NULL; 1464 r_inputs=getMap(s1->content,"serviceType"); 1465 #ifdef DEBUG 1466 fprintf(stderr,"LOAD A %s SERVICE PROVIDER IN NORMAL MODE \n",r_inputs->value); 1467 fflush(stderr); 1468 #endif 1469 if(strncasecmp(r_inputs->value,"C",1)==0){ 1470 r_inputs=getMap(request_inputs,"metapath"); 1471 if(r_inputs!=NULL) 1472 sprintf(tmps1,"%s/%s",ntmp,r_inputs->value); 1473 else 1474 sprintf(tmps1,"%s/",ntmp); 1475 char *altPath=strdup(tmps1); 1476 r_inputs=getMap(s1->content,"ServiceProvider"); 1477 sprintf(tmps1,"%s/%s",altPath,r_inputs->value); 1478 free(altPath); 1479 #ifdef DEBUG 1480 fprintf(stderr,"Trying to load %s\n",tmps1); 1481 #endif 1482 #ifdef WIN32 1483 HINSTANCE so = LoadLibraryEx(tmps1,NULL,LOAD_WITH_ALTERED_SEARCH_PATH); 1484 #else 1485 void* so = dlopen(tmps1, RTLD_LAZY); 1486 #endif 1487 #ifdef DEBUG 1488 #ifdef WIN32 1489 DWORD errstr; 1490 errstr = GetLastError(); 1491 fprintf(stderr,"%s loaded (%d) \n",tmps1,errstr); 1492 #else 1493 char *errstr; 1494 errstr = dlerror(); 1495 #endif 1496 #endif 1497 1498 if( so != NULL ) { 1499 #ifdef DEBUG 1500 fprintf(stderr,"Library loaded %s \n",errstr); 1501 fprintf(stderr,"Service Shared Object = %s\n",r_inputs->value); 1502 #endif 1503 r_inputs=getMap(s1->content,"serviceType"); 1504 #ifdef DEBUG 1505 dumpMap(r_inputs); 1506 fprintf(stderr,"%s\n",r_inputs->value); 1507 fflush(stderr); 1508 #endif 1509 if(strncasecmp(r_inputs->value,"C-FORTRAN",9)==0){ 1510 #ifdef WIN32 1511 //Strange return value needed here ! 1512 return 1; 1513 #endif 1514 r_inputs=getMap(request_inputs,"Identifier"); 1515 char fname[1024]; 1516 sprintf(fname,"%s_",r_inputs->value); 1517 #ifdef DEBUG 1518 fprintf(stderr,"Try to load function %s\n",fname); 1519 #endif 1520 #ifdef WIN32 1521 typedef int (CALLBACK* execute_t)(char***,char***,char***); 1522 execute_t execute=(execute_t)GetProcAddress(so,fname); 1523 #else 1524 typedef int (*execute_t)(char***,char***,char***); 1525 execute_t execute=(execute_t)dlsym(so,fname); 1526 #endif 1527 #ifdef DEBUG 1528 #ifdef WIN32 1529 errstr = GetLastError(); 1530 #else 1531 errstr = dlerror(); 1532 #endif 1533 fprintf(stderr,"Function loaded %s\n",errstr); 1534 #endif 1535 1536 char main_conf[10][30][1024]; 1537 char inputs[10][30][1024]; 1538 char outputs[10][30][1024]; 1539 for(int i=0;i<10;i++){ 1540 for(int j=0;j<30;j++){ 1541 memset(main_conf[i][j],0,1024); 1542 memset(inputs[i][j],0,1024); 1543 memset(outputs[i][j],0,1024); 1544 } 1545 } 1546 mapsToCharXXX(m,(char***)main_conf); 1547 mapsToCharXXX(request_input_real_format,(char***)inputs); 1548 mapsToCharXXX(request_output_real_format,(char***)outputs); 1549 eres=execute((char***)&main_conf[0],(char***)&inputs[0],(char***)&outputs[0]); 1550 #ifdef DEBUG 1551 fprintf(stderr,"Function run successfully \n"); 1552 #endif 1553 charxxxToMaps((char***)&outputs[0],&request_output_real_format); 1554 }else{ 1555 #ifdef DEBUG 1556 #ifdef WIN32 1557 errstr = GetLastError(); 1558 fprintf(stderr,"Function %s failed to load because of %d\n",r_inputs->value,errstr); 1559 #endif 1560 #endif 1561 r_inputs=getMap(request_inputs,"Identifier"); 1562 #ifdef DEBUG 1563 fprintf(stderr,"Try to load function %s\n",r_inputs->value); 1564 #endif 1565 typedef int (*execute_t)(maps**,maps**,maps**); 1566 #ifdef WIN32 1567 execute_t execute=(execute_t)GetProcAddress(so,r_inputs->value); 1568 #ifdef DEBUG 1569 errstr = GetLastError(); 1570 fprintf(stderr,"Function %s failed to load because of %d\n",r_inputs->value,errstr); 1571 #endif 1572 #else 1573 execute_t execute=(execute_t)dlsym(so,r_inputs->value); 1574 #endif 1575 1576 #ifdef DEBUG 1577 #ifdef WIN32 1578 errstr = GetLastError(); 1579 #else 1580 errstr = dlerror(); 1581 #endif 1582 fprintf(stderr,"Function loaded %s\n",errstr); 1583 #endif 1584 1585 #ifdef DEBUG 1586 fprintf(stderr,"Now run the function \n"); 1587 fflush(stderr); 1588 #endif 1589 eres=execute(&m,&request_input_real_format,&request_output_real_format); 1590 #ifdef DEBUG 1591 fprintf(stderr,"Function loaded and returned %d\n",eres); 1592 fflush(stderr); 1593 #endif 1594 } 1595 dlclose(so); 1596 } else { 1597 /** 1598 * Unable to load the specified shared library 1599 */ 1600 char tmps[1024]; 1601 #ifdef WIN32 1602 DWORD errstr = GetLastError(); 1603 #else 1604 char* errstr = dlerror(); 1605 #endif 1606 sprintf(tmps,"C Library can't be loaded %s \n",errstr); 1607 map* tmps1=createMap("text",tmps); 1608 printExceptionReportResponse(m,tmps1); 1609 exit(1); 1610 } 1611 } 1612 else 1613 #ifdef USE_PYTHON 1614 if(strncasecmp(r_inputs->value,"PYTHON",6)==0){ 1615 eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1616 } 1617 else 1618 #endif 1619 1620 #ifdef USE_JAVA 1621 if(strncasecmp(r_inputs->value,"JAVA",4)==0){ 1622 eres=zoo_java_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1623 } 1624 else 1625 #endif 1626 1627 #ifdef USE_PHP 1628 if(strncasecmp(r_inputs->value,"PHP",3)==0){ 1629 eres=zoo_php_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1630 } 1631 else 1632 #endif 1633 1634 1635 #ifdef USE_PERL 1636 if(strncasecmp(r_inputs->value,"PERL",4)==0){ 1637 eres=zoo_perl_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1638 } 1639 else 1640 #endif 1641 1642 #ifdef USE_JS 1643 if(strncasecmp(r_inputs->value,"JS",2)==0){ 1644 eres=zoo_js_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1645 } 1646 else 1647 #endif 1648 { 1649 char tmpv[1024]; 1650 sprintf(tmpv,"Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n",r_inputs->value); 1651 map* tmps=createMap("text",tmpv); 1652 printExceptionReportResponse(m,tmps); 1653 return(-1); 1654 } 1655 } 1700 loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres); 1701 } 1656 1702 else{ 1657 1658 1703 pid_t pid; 1659 1704 #ifdef DEBUG … … 1696 1741 free(fbkp); 1697 1742 free(flog); 1698 if(setsid()<0)1699 return errorException(m, "Unable to run the child process properly", "InternalError");1700 1743 /** 1701 1744 * set status to SERVICE_STARTED and flush stdout to ensure full … … 1711 1754 fflush(stdout); 1712 1755 rewind(stdout); 1713 /** 1714 * Extract serviceType to know what kind of service shoudl be loaded 1715 */ 1716 r_inputs=NULL; 1717 r_inputs=getMap(s1->content,"serviceType"); 1718 #ifdef DEBUG 1719 fprintf(stderr,"LOAD A %s SERVICE PROVIDER IN BACKGROUND MODE \n",r_inputs->value); 1720 #endif 1721 1722 if(strncasecmp(r_inputs->value,"C",1)==0){ 1723 1724 r_inputs=getMap(request_inputs,"metapath"); 1725 if(r_inputs!=NULL){ 1726 sprintf(tmps1,"%s/%s",ntmp,r_inputs->value); 1727 r_inputs=getMap(s1->content,"ServiceProvider"); 1728 if(r_inputs!=NULL) 1729 sprintf(tmps1,"%s/%s",strdup(tmps1),r_inputs->value); 1730 }else{ 1731 sprintf(tmps1,"%s/",ntmp); 1732 } 1733 1734 1735 #ifdef DEBUG 1736 fprintf(stderr,"Trying to load %s\n",tmps1); 1737 #endif 1738 #ifdef WIN32 1739 HINSTANCE so = LoadLibraryEx(tmps1,NULL,LOAD_WITH_ALTERED_SEARCH_PATH); 1740 #else 1741 void* so = dlopen(tmps1, RTLD_LAZY); 1742 #endif 1743 #ifdef WIN32 1744 DWORD errstr; 1745 errstr = GetLastError(); 1746 #else 1747 char *errstr; 1748 errstr = dlerror(); 1749 #endif 1750 if( so != NULL ) { 1751 r_inputs=getMap(s1->content,"serviceType"); 1752 #ifdef DEBUG 1753 fprintf(stderr,"r_inputs->value = %s\n",r_inputs->value); 1754 #endif 1755 if(strncasecmp(r_inputs->value,"C-FORTRAN",9)==0){ 1756 r_inputs=getMap(request_inputs,"Identifier"); 1757 #ifdef DEBUG 1758 fprintf(stderr,"Try to load function %s\n",r_inputs->value); 1759 #endif 1760 typedef int (*execute_t)(char***,char***,char***); 1761 char fname[1024]; 1762 sprintf(fname,"%s_",r_inputs->value); 1763 #ifdef DEBUG 1764 fprintf(stderr,"Try to load function %s\n",fname); 1765 #endif 1766 #ifdef WIN32 1767 execute_t execute=(execute_t)GetProcAddress(so,fname); 1768 #else 1769 execute_t execute=(execute_t)dlsym(so,fname); 1770 #endif 1771 #ifdef DEBUG 1772 #ifdef WIN32 1773 errstr = GetLastError(); 1774 #else 1775 errstr = dlerror(); 1776 #endif 1777 #endif 1778 char main_conf[10][10][1024]; 1779 char inputs[10][10][1024]; 1780 char outputs[10][10][1024]; 1781 for(int i=0;i<10;i++){ 1782 for(int j=0;j<10;j++){ 1783 memset(main_conf[i][j],0,1024); 1784 memset(inputs[i][j],0,1024); 1785 memset(outputs[i][j],0,1024); 1786 } 1787 } 1788 mapsToCharXXX(m,(char***)main_conf); 1789 mapsToCharXXX(request_input_real_format,(char***)inputs); 1790 //mapsToCharXXX(request_output_real_format,(char***)outputs); 1791 eres=execute((char***)&main_conf[0],(char***)&inputs[0],(char***)&outputs[0]); 1792 charxxxToMaps((char***)&outputs[0],&request_output_real_format); 1793 1794 }else{ 1795 1796 typedef int (*execute_t)(maps**,maps**,maps**); 1797 #ifdef DEBUG 1798 fprintf(stderr,"Library loaded %s \n",errstr); 1799 #endif 1800 r_inputs=getMap(request_inputs,"Identifier"); 1801 #ifdef DEBUG 1802 fprintf(stderr,"Try to load function %s\n",r_inputs->value); 1803 #endif 1804 #ifdef WIN32 1805 execute_t execute=(execute_t)GetProcAddress(so,r_inputs->value); 1806 #else 1807 execute_t execute=(execute_t)dlsym(so,r_inputs->value); 1808 #endif 1809 #ifdef DEBUG 1810 #ifdef WIN32 1811 errstr = GetLastError(); 1812 #else 1813 errstr = dlerror(); 1814 #endif 1815 fprintf(stderr,"Function loaded %s\n",errstr); 1816 #endif 1817 /** 1818 * set the status code value returned by the service function itself 1819 */ 1820 eres=execute(&m,&request_input_real_format,&request_output_real_format); 1821 } 1822 dlclose(so); 1823 } else { 1824 /** 1825 * Unable to load the requested C Library 1826 */ 1827 char tmps2[1024]; 1828 sprintf(tmps1,"C Library can't be loaded %s \n",errstr); 1829 map* tmps=createMap("text",tmps1); 1830 printExceptionReportResponse(m,tmps); 1831 freeMap(&tmps); 1832 free(tmps); 1833 exit(1); 1834 } 1835 } 1836 else 1837 #ifdef USE_PYTHON 1838 if(strncasecmp(r_inputs->value,"PYTHON",6)==0) 1839 eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1840 else 1841 #endif 1842 #ifdef USE_JAVA 1843 if(strncasecmp(r_inputs->value,"JAVA",4)==0){ 1844 eres=zoo_java_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1845 } 1846 else 1847 #endif 1848 1849 #ifdef USE_PHP 1850 if(strncasecmp(r_inputs->value,"PHP",3)==0){ 1851 eres=zoo_php_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1852 } 1853 else 1854 #endif 1855 1856 #ifdef USE_PERL 1857 if(strncasecmp(r_inputs->value,"PERL",4)==0){ 1858 eres=zoo_perl_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1859 } 1860 else 1861 #endif 1862 #ifdef USE_JS 1863 if(strncasecmp(r_inputs->value,"JS",2)==0){ 1864 eres=zoo_js_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 1865 } 1866 else 1867 #endif 1868 { 1869 char tmpv[1024]; 1870 sprintf(tmpv,"Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n",r_inputs->value); 1871 map* tmps=createMap("text",tmpv); 1872 printExceptionReportResponse(m,tmps); 1873 return -1; 1874 } 1875 1876 1756 1757 loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres); 1758 1877 1759 } else { 1878 1760 /** … … 1880 1762 * error response here !!! 1881 1763 */ 1764 eres=-1; 1765 errorException(m, _("Unable to run the child process properly"), "InternalError"); 1882 1766 } 1883 1767 -
trunk/zoo-services/ogr/base-vect-ops/service.c
r32 r34 23 23 */ 24 24 25 #include <libintl.h> 26 #include <locale.h> 27 #define _(String) dgettext ("zoo-services",String) 28 25 29 #include "cpl_conv.h" 26 30 #include "ogr_api.h" … … 28 32 #include "geos_c.h" 29 33 #include "service.h" 34 30 35 31 36 extern "C" { … … 479 484 } 480 485 if(geometry2==NULL){ 481 setMapInMaps(conf,"lenv","message", "Unable to parse input geometry for InputEntity2.");486 setMapInMaps(conf,"lenv","message",_("Unable to parse input geometry for InputEntity2.")); 482 487 fprintf(stderr,"SERVICE FAILED !\n"); 483 488 return SERVICE_FAILED; -
trunk/zoo-services/utils/status/service.c
r32 r34 22 22 * THE SOFTWARE. 23 23 */ 24 24 25 #include "service.h" 25 26 … … 75 76 }else{ 76 77 char tmp[1024]; 77 snprintf(tmp,1024, "GetStatus was unable to use the tmpPath value set in main.cfg file as directory %s.",tmpTmap->value);78 snprintf(tmp,1024,_ss("GetStatus was unable to use the tmpPath value set in main.cfg file as directory %s."),tmpTmap->value); 78 79 setMapInMaps(conf,"lenv","message",tmp); 79 80 return SERVICE_FAILED; … … 81 82 if(hasFile<0){ 82 83 char tmp[1024]; 83 snprintf(tmp,1024, "GetStatus was unable to find any cache file for Service ID %s.",tmpMap->value);84 snprintf(tmp,1024,_ss("GetStatus was unable to find any cache file for Service ID %s."),tmpMap->value); 84 85 setMapInMaps(conf,"lenv","message",tmp); 85 86 return SERVICE_FAILED; … … 107 108 else{ 108 109 char tmp[1024]; 109 sprintf(tmp, "ZOO GetStatus Service was unable to parse the cache xml file available for the Service ID %s.",tmpMap->value);110 sprintf(tmp,_ss("ZOO GetStatus Service was unable to parse the cache xml file available for the Service ID %s."),tmpMap->value); 110 111 setMapInMaps(conf,"lenv","message",tmp); 111 112 return SERVICE_FAILED;
Note: See TracChangeset
for help on using the changeset viewer.