Changeset 822
- Timestamp:
- May 3, 2017, 12:53:06 PM (8 years ago)
- Location:
- branches/prototype-v0/zoo-project/zoo-kernel
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/Makefile.in
r815 r822 38 38 gcc -fPIC ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} -c ulinet.c 39 39 40 sshapi.o: sshapi.c 41 g++ -fPIC ${CFLAGS} -c sshapi.c 42 40 43 request_parser.o: request_parser.c request_parser.h 41 44 g++ -fPIC ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} -c request_parser.c 42 45 43 46 sqlapi.o: sqlapi.c sqlapi.h 44 g++ -fPIC ${ GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} -c sqlapi.c47 g++ -fPIC ${METADB_ENABLED} ${GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} -c sqlapi.c 45 48 46 49 caching.o: caching.c … … 59 62 gcc ${YAML_CFLAGS} ${XML2CFLAGS} ${CFLAGS} -fPIC -c service_yaml.c 60 63 64 meta_sql.o: meta_sql.c meta_sql.h service.h 65 g++ ${METADB_ENABLED} ${GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} -c meta_sql.c 66 61 67 service_internal_ms.o: service_internal_ms.c 62 68 gcc ${JS_ENABLED} ${GDAL_CFLAGS} ${JSCFLAGS} ${XML2CFLAGS} ${CFLAGS} -fPIC -c service_internal_ms.c … … 68 74 service_internal_otb.o: service_internal_otb.c service_internal_otb.h service.h 69 75 g++ ${XML2CFLAGS} ${OTBCFLAGS} ${CFLAGS} -c service_internal_otb.c 76 77 service_internal_hpc.o: service_internal_hpc.c service_internal_hpc.h service.h 78 g++ ${XML2CFLAGS} ${HPCCFLAGS} ${CFLAGS} -c service_internal_hpc.c 70 79 71 80 service_internal_saga.o: service_internal_saga.c service_internal_saga.h service.h … … 99 108 g++ -c ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} service_loader.c 100 109 101 zoo_service_loader.o: zoo_service_loader.c service.h version.h ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} 102 g++ -g -O2 ${ XML2CFLAGS} ${CFLAGS} ${MONO_CFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${SAGA_ENABLED} ${OTB_ENABLED} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} ${MONO_ENABLED}-c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o110 zoo_service_loader.o: zoo_service_loader.c service.h version.h ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} ${HPC_FILES} ${METADB_FILE} 111 g++ -g -O2 ${GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} ${MONO_CFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${SAGA_ENABLED} ${OTB_ENABLED} ${HPC_ENABLED} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} ${MONO_ENABLED} ${METADB_ENABLED} -c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o 103 112 104 113 libzoo_service.${EXT}: version.h service_internal.o service.o sqlapi.o 105 114 gcc -shared ${GDAL_CFLAGS} ${DEFAULT_OPTS} -fpic -o libzoo_service.${EXT} ${CFLAGS} service_internal.o service.o sqlapi.o ${FCGI_LDFLAGS} ${GDAL_LIBS} 106 115 107 zoo_loader.cgi: version.h libzoo_service.${EXT} zoo_loader.c zoo_service_loader.o ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} 116 zoo_loader.cgi: version.h libzoo_service.${EXT} zoo_loader.c zoo_service_loader.o ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o request_parser.o response_print.o server_internal.o caching.o ${MS_FILE} ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} ${RUBY_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${HPC_FILES} ${METADB_FILE} 108 117 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${RUBYCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o 109 g++ ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS}118 g++ ${JSCFLAGS} ${SAGA_CFLAGS} ${OTBCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o ${MS_FILE} ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ${YAML_FILE} ${OTB_FILE} ${SAGA_FILE} ${MONO_FILE} ${HPC_FILES} ${METADB_FILE} response_print.o server_internal.o caching.o request_parser.o ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -L. ${LDFLAGS} 110 119 111 120 zcfg2yaml: zcfg2yaml.c service.h lex.sr.o service_conf.tab.o service_conf.y main_conf_read.tab.o lex.cr.o response_print.o server_internal.o service_internal.o ${MS_FILE} ${YAML_FILE} -
branches/prototype-v0/zoo-project/zoo-kernel/ZOOMakefile.opts.in
r811 r822 29 29 YAML_FILE=@YAML_FILE@ 30 30 YAML_FILE1=@YAML_FILE1@ 31 32 METADB_ENABLED=@METADB@ 33 METADB_FILE=@METADB_FILE@ 34 31 35 32 36 GDAL_CFLAGS=@GDAL_CFLAGS@ … … 67 71 MS_FILE=@MS_FILE@ 68 72 69 ZOO_CFLAGS= -I${ZRPATH}/../thirds/cgic206/ -I${ZRPATH}/zoo-kernel/70 ZOO_LDFLAGS=@ OPENSSL_LDFLAGS@ -luuid73 ZOO_CFLAGS=@GETTEXT_CFLAGS@ -I${ZRPATH}/../thirds/cgic206/ -I${ZRPATH}/zoo-kernel/ 74 ZOO_LDFLAGS=@GETTEXT_LDFLAGS@ @OPENSSL_LDFLAGS@ @UUID_LDFLAGS@ 71 75 72 76 JAVACFLAGS=@JAVA_CPPFLAGS@ … … 86 90 PERL_FILE=@PERL_FILE@ 87 91 92 HPCCFLAGS=@SSH2_CPPFLAGS@ @HPC_CPPFLAGS@ 93 HPCLDFLAGS=@SSH2_LDFLAGS@ @HPC_LDFLAGS@ 94 HPC_ENABLED=@HPC_ENABLED@ 95 HPC_FILES=@HPC_FILES@ 96 88 97 OTBCFLAGS=@OTB_CPPFLAGS@ 89 98 OTBLDFLAGS=@OTB_LDFLAGS@ … … 101 110 MONO_FILE=@MONO_FILE@ 102 111 103 CFLAGS=@ RELY_ON_DB@ @DEB_DEF@ -fpic @OPENSSL_CFLAGS@ ${FCGI_CFLAGS} ${YAML_CFLAGS} ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF104 LDFLAGS=-lzoo_service @ DEFAULT_LIBS@ -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} ${FCGI_LDFLAGS} @OPENSSL_LDFLAGS@ -luuid ${MS_LDFLAGS} ${MACOS_LD_FLAGS} ${MACOS_LD_NET_FLAGS} ${YAML_LDFLAGS} ${OTBLDFLAGS} ${SAGA_LDFLAGS} ${MONO_LDFLAGS}112 CFLAGS=@SSH2_CPPFLAGS@ @GETTEXT_CFLAGS@ @PROJ_CPPFLAGS@ @RELY_ON_DB@ @DEB_DEF@ -fpic @OPENSSL_CFLAGS@ @UUID_CFLAGS@ ${FCGI_CFLAGS} ${YAML_CFLAGS} ${MACOS_CFLAGS} ${MS_CFLAGS} -I../../thirds/cgic206 -I. -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 113 LDFLAGS=-lzoo_service @SSH2_LDFLAGS@ @PROJ_LDFLAGS@ @DEFAULT_LIBS@ -L../../thirds/cgic206 -lcgic ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} ${FCGI_LDFLAGS} @OPENSSL_LDFLAGS@ @UUID_LDFLAGS@ ${MS_LDFLAGS} ${MACOS_LD_FLAGS} ${MACOS_LD_NET_FLAGS} ${YAML_LDFLAGS} ${OTBLDFLAGS} ${SAGA_LDFLAGS} ${MONO_LDFLAGS} @GETTEXT_LDFLAGS@ 105 114 106 115 DATAROOTDIR=@datarootdir@/zoo-project -
branches/prototype-v0/zoo-project/zoo-kernel/caching.c
r817 r822 178 178 char icname[14]; 179 179 char xname[16]; 180 char bname[8]; 181 char hname[11]; 180 182 char oname[12]; 181 183 if(*index>0) … … 192 194 sprintf(icname,"isCached_%d",i); 193 195 sprintf(xname,"Reference_%d",i); 196 sprintf(bname,"body_%d",i); 197 sprintf(hname,"headers_%d",i); 194 198 sprintf(oname,"Order_%d",i); 195 199 }else{ … … 200 204 sprintf(icname,"isCached"); 201 205 sprintf(xname,"Reference"); 206 sprintf(bname,"body"); 207 sprintf(hname,"headers",i); 202 208 sprintf(oname,"Order"); 203 209 } … … 255 261 sprintf(ltmp1,"%d",fsize); 256 262 map* tmp=getMapFromMaps(*m,"main","cacheDir"); 263 char *request=NULL; 257 264 if(tmp!=NULL){ 258 char* md5str=getMd5(tmp1->value); 265 map* tmp2; 266 char* md5str=NULL; 267 if((tmp2=getMap(content->content,bname))!=NULL){ 268 dumpMap(tmp2); 269 char *tmpStr=(char*)malloc((strlen(tmp1->value)+strlen(tmp2->value)+1)*sizeof(char)); 270 sprintf(tmpStr,"%s%s",tmp1->value,tmp2->value); 271 if((tmp2=getMap(content->content,"headers"))!=NULL){ 272 char *tmpStr2=zStrdup(tmpStr); 273 tmpStr=(char*)malloc((strlen(tmpStr2)+strlen(tmp2->value)+1)*sizeof(char)); 274 sprintf(tmpStr,"%s%s",tmpStr2,tmp2->value); 275 free(tmpStr2); 276 } 277 md5str=getMd5(tmpStr); 278 request=zStrdup(tmpStr); 279 free(tmpStr); 280 }else{ 281 md5str=getMd5(tmp1->value); 282 request=zStrdup(tmp1->value); 283 } 259 284 char* fname=(char*)malloc(sizeof(char)*(strlen(tmp->value)+strlen(md5str)+6)); 260 285 sprintf(fname,"%s/%s.zca",tmp->value,md5str); … … 264 289 addToMap((*in)->content,sname,ltmp1); 265 290 addToMap((*in)->content,mname,mimeType); 266 addToCache(*m, tmp1->value,fcontent,mimeType,fsize, NULL, 0);291 addToCache(*m,request,fcontent,mimeType,fsize, NULL, 0); 267 292 free(fcontent); 268 293 free(mimeType); 294 free(request); 269 295 *index++; 270 296 -
branches/prototype-v0/zoo-project/zoo-kernel/configure.ac
r817 r822 1 1 AC_INIT([ZOO Kernel], [1.7.0], [bugs@zoo-project.org]) 2 3 AC_CONFIG_MACRO_DIR([macros]) 2 4 3 5 # Checks for programs. … … 12 14 AC_CHECK_LIB([dl], [dlopen,dlsym,dlerror,dlclose]) 13 15 AC_CHECK_LIB([crypto], [EVP_DigestInit,EVP_md5,EVP_DigestUpdate,BIO_f_base64,BIO_new]) 14 AC_CHECK_LIB([uuid], [uuid_generate_time])15 16 16 17 DEFAULT_LIBS="$LIBS" … … 20 21 # Checks for header files. 21 22 AC_FUNC_ALLOCA 22 AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.hmalloc.h stddef.h stdlib.h string.h unistd.h])23 AC_CHECK_HEADERS([fcntl.h inttypes.h malloc.h stddef.h stdlib.h string.h unistd.h]) 23 24 24 25 # Checks for typedefs, structures, and compiler characteristics. … … 38 39 AC_FUNC_REALLOC 39 40 AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr]) 41 42 #============================================================================ 43 # Detect if uuid is available 44 #============================================================================ 45 46 AC_ARG_WITH([uuid], 47 [AS_HELP_STRING([--with-uuid=PATH], [Specifies an alternative location for the ossp-uuid library])], 48 [UUID_DIR="$withval"], [UUID_DIR="/usr/"]) 49 UUID_CFLAGS="-I$UUID_DIR/include" 50 UUID_LDFLAGS="-L$UUID_DIR/lib -luuid" 51 CPPFLAGS_SAVE="$CPPFLAGS" 52 CPPFLAGS="$UUID_CFLAGS" 53 LIBS_SAVE="$LIBS" 54 LIBS="$UUID_LDFLAGS" 55 AC_CHECK_HEADERS([uuid/uuid.h], 56 [], [AC_MSG_ERROR([could not find header file uuid.h])]) 57 AC_CHECK_LIB([uuid], [uuid_generate_time], 58 [], [AC_MSG_ERROR([could not find function in uuid library])]) 59 CPPFLAGS="$CPPFLAGS_SAVE" 60 AC_SUBST([UUID_CFLAGS]) 61 AC_SUBST([UUID_LDFLAGS]) 40 62 41 63 #============================================================================ … … 56 78 AC_CHECK_LIB(crypto, BIO_f_base64, 57 79 [], [AC_MSG_ERROR([could not find $i function in openssl library])]) 80 CPPFLAGS="$CPPFLAGS_SAVE" 58 81 AC_SUBST([OPENSSL_CFLAGS]) 59 82 AC_SUBST([OPENSSL_LDFLAGS]) 83 84 #============================================================================ 85 # Detect if gettext is available 86 #============================================================================ 87 88 AC_ARG_WITH([gettext], 89 [AS_HELP_STRING([--with-gettext=PATH], [Specifies an alternative location for the openssl library])], 90 [GETTEXT_DIR="$withval"], [GETTEXT_DIR="/usr/"]) 91 GETTEXT_CFLAGS="-I$GETTEXT_DIR/include" 92 GETTEXT_LDFLAGS="-L$GETTEXT_DIR/lib -lintl" 93 CFLAGS_SAVE="$CFLAGS" 94 CFLAGS="$GETTEXT_CFLAGS" 95 LIBS_SAVE="$LIBS" 96 LIBS="$GETTEXT_LDFLAGS" 97 AM_GNU_GETTEXT([external], [], []) 98 AC_CHECK_LIB(intl, 99 [dgettext], [] , [AC_MSG_ERROR([could not find $i function in gettext library])]) 100 AC_SUBST([GETTEXT_CFLAGS]) 101 AC_SUBST([GETTEXT_LDFLAGS]) 60 102 61 103 #============================================================================ … … 145 187 AC_SUBST([FCGI_LDFLAGS]) 146 188 189 AC_ARG_WITH([metadb], 190 [AS_HELP_STRING([--with-metadb=yes], [Activates the metadata database support])], 191 [WITHMETADB="$withval"], [WITHMETADB=""]) 192 193 if test "x$WITHMETADB" = "xyes"; then 194 METADB="-DMETA_DB" 195 METADB_FILE="meta_sql.o sqlapi.o" 196 else 197 METADB="" 198 METADB_FILE="" 199 fi 200 201 AC_SUBST([METADB]) 202 AC_SUBST([METADB_FILE]) 203 204 AC_ARG_WITH([hpc], 205 [AS_HELP_STRING([--with-hpc=yes], [Specifies if you need to activate HPC support])], 206 [HPCWITH="$withval"], [HPCWITH="no"]) 207 208 if test "x$HPCWITH" = "xyes"; then 209 HPC_FILES="service_internal_hpc.o sshapi.o" 210 HPC_ENABLED="-DUSE_HPC" 211 HPC_CPPFLAGS="" 212 HPC_LDFLAGS="" 213 fi 214 215 AC_SUBST([HPC_CPPFLAGS]) 216 AC_SUBST([HPC_LDFLAGS]) 217 AC_SUBST([HPC_ENABLED]) 218 AC_SUBST([HPC_FILES]) 219 220 AC_ARG_WITH([ssh2], 221 [AS_HELP_STRING([--with-ssh2=PATH], [Specifies an alternative location for the ssh2 library])], 222 [SSH2PATH="$withval"], [SSH2PATH="/usr"]) 223 224 # Extract the linker and include flags 225 SSH2_LDFLAGS="-L$SSH2PATH/lib -lssh2" 226 SSH2_CPPFLAGS="-I$SSH2PATH/include" 227 # Check headers file 228 CPPFLAGS_SAVE="$CPPFLAGS" 229 CPPFLAGS="$SSH2_CPPFLAGS" 230 LIBS_SAVE="$LIBS" 231 LIBS="$SSH2_LDFLAGS" 232 echo $CPPFLAGS 233 echo $LIBS 234 235 AC_CHECK_HEADERS([libssh2.h], 236 [], [AC_MSG_ERROR([could not find headers related to libssh2])]) 237 AC_CHECK_LIB([ssh2], [libssh2_session_init]) 238 239 LIBS="$LIBS_SAVE" 240 AC_SUBST([SSH2_CPPFLAGS]) 241 AC_SUBST([SSH2_LDFLAGS]) 242 147 243 # =========================================================================== 148 244 # Detect if libxml2 is installed … … 400 496 AC_SUBST([MS_LIBS]) 401 497 AC_SUBST([MS_FILE]) 498 AC_SUBST([MS_VERSION]) 402 499 403 500 # =========================================================================== -
branches/prototype-v0/zoo-project/zoo-kernel/response_print.c
r821 r822 646 646 void printGetCapabilitiesForProcess(registry *reg, maps* m,xmlNodePtr nc,service* serv){ 647 647 xmlNsPtr ns,ns_ows,ns_xml,ns_xlink; 648 xmlNodePtr n=NULL,nc1,nc2 ;648 xmlNodePtr n=NULL,nc1,nc2,nc3; 649 649 map* version=getMapFromMaps(m,"main","rversion"); 650 650 int vid=getVersionId(version->value); … … 667 667 limit=7; 668 668 } 669 nc3=NULL; 669 670 for(;i<limit;i+=2){ 670 671 if(capabilities[vid][i]==NULL) … … 690 691 printDescription(nc1,ns_ows,serv->name,serv->content,vid); 691 692 tmp1=serv->metadata; 692 while(tmp1!=NULL){ 693 694 addMetadata(tmp1,nc1,ns_ows,ns_xlink); 695 696 /*while(tmp1!=NULL){ 693 697 nc2 = xmlNewNode(ns_ows, BAD_CAST "Metadata"); 694 xmlNewNsProp(nc2,ns_xlink,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 695 xmlAddChild(nc1,nc2); 698 if(strcmp(tmp1->name,"title")==0 || 699 strcmp(tmp1->name,"href")==0 || 700 strcmp(tmp1->name,"role")==0 || 701 strcmp(tmp1->name,"link_type")==0){ 702 xmlNewNsProp(nc2,ns_xlink,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 703 xmlAddChild(nc1,nc2); 704 }else{ 705 if(nc3==NULL) 706 nc3 = xmlNewNode(ns_ows, BAD_CAST "AdditionalParameter"); 707 xmlNodePtr nc4 = xmlNewNode(ns_ows, BAD_CAST "Name"); 708 xmlAddChild(nc4,xmlNewText(BAD_CAST tmp1->name)); 709 xmlNodePtr nc5 = xmlNewNode(ns_ows, BAD_CAST "Value"); 710 xmlAddChild(nc5,xmlNewText(BAD_CAST tmp1->value)); 711 xmlAddChild(nc3,nc4); 712 xmlAddChild(nc3,nc5); 713 } 696 714 tmp1=tmp1->next; 697 } 698 715 }*/ 716 if(nc3!=NULL) 717 xmlAddChild(nc1,nc3); 699 718 xmlAddChild(nc,nc1); 700 719 } 720 701 721 } 702 722 … … 734 754 } 735 755 } 756 } 757 758 int addMetadata(map* meta,xmlNodePtr nc,xmlNsPtr ns_ows,xmlNsPtr ns_xlink){ 759 int hasTitle=-1; 760 int hasValue=-1; 761 xmlNodePtr nc1; 762 map* oMeta=meta; 763 int isAdditionalParameters=-1; 764 //if(count(oMeta)>=2){ 765 int level=0; 766 map* test=getMap(meta,"title"); 767 if(test!=NULL) 768 level+=1; 769 test=getMap(meta,"href"); 770 if(test!=NULL) 771 level+=1; 772 test=getMap(meta,"role"); 773 if(test!=NULL) 774 level+=1; 775 if(count(oMeta)>level+1) 776 isAdditionalParameters=1; 777 //} 778 char *ctitle=NULL; 779 while(meta!=NULL){ 780 if(hasTitle<0) 781 if(isAdditionalParameters<0) 782 nc1 = xmlNewNode(ns_ows, BAD_CAST "Metadata"); 783 else 784 if(hasValue<0) 785 nc1 = xmlNewNode(ns_ows, BAD_CAST "AdditionalParameters"); 786 if(strncasecmp(meta->name,"title",5)==0 || 787 strcasecmp(meta->name,"href")==0 || 788 strcasecmp(meta->name,"role")==0 ){ 789 int index=5; 790 if(strncasecmp(meta->name,"title",5)==0){ 791 index=6; 792 hasTitle=1; 793 if(ctitle!=NULL && strcasecmp(meta->value,ctitle)!=0){ 794 xmlAddChild(nc,nc1); 795 nc1 = xmlNewNode(ns_ows, BAD_CAST "AdditionalParameters"); 796 free(ctitle); 797 ctitle=NULL; 798 } 799 if(ctitle==NULL){ 800 char *tmp=(char*)malloc((strlen(meta->name)+1)*sizeof(char)); 801 snprintf(tmp,index,"%s",meta->name); 802 xmlNewNsProp(nc1,ns_xlink,BAD_CAST tmp,BAD_CAST meta->value); 803 free(tmp); 804 } 805 if(ctitle!=NULL) 806 free(ctitle); 807 ctitle=zStrdup(meta->value); 808 } 809 }else{ 810 xmlNodePtr nc2 = xmlNewNode(ns_ows, BAD_CAST "AdditionalParameter"); 811 xmlNodePtr nc3 = xmlNewNode(ns_ows, BAD_CAST "Name"); 812 xmlAddChild(nc3,xmlNewText(BAD_CAST meta->name)); 813 xmlNodePtr nc4 = xmlNewNode(ns_ows, BAD_CAST "Value"); 814 xmlAddChild(nc4,xmlNewText(BAD_CAST meta->value)); 815 xmlAddChild(nc2,nc3); 816 xmlAddChild(nc2,nc4); 817 xmlAddChild(nc1,nc2); 818 hasTitle=-1; 819 } 820 meta=meta->next; 821 if(hasTitle<0){ 822 if(isAdditionalParameters) 823 xmlAddChild(nc,nc1); 824 hasValue=1; 825 } 826 } 827 if(oMeta!=NULL && hasValue<0 && nc1!=NULL){ 828 xmlAddChild(nc,nc1); 829 } 736 830 } 737 831 … … 843 937 tmp1=serv->metadata; 844 938 while(tmp1!=NULL){ 845 nc1 = xmlNewNode(ns_ows, BAD_CAST "Metadata"); 939 addMetadata(tmp1,nc,ns_ows,ns_xlink); 940 /*nc1 = xmlNewNode(ns_ows, BAD_CAST "Metadata"); 846 941 xmlNewNsProp(nc1,ns_xlink,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 847 xmlAddChild(nc,nc1); 942 xmlAddChild(nc,nc1);*/ 848 943 tmp1=tmp1->next; 849 944 } … … 855 950 } 856 951 }else{ 952 tmp1=serv->metadata; 953 addMetadata(tmp1,nc,ns_ows,ns_xlink); 857 954 addInheritedMetadata(nc,ns_ows,ns_xlink,reg,m,serv); 858 955 } … … 1340 1437 xmlNsPtr ns_xlink=usedNs[xlinkId]; 1341 1438 1342 while(metadata!=NULL){ 1343 nc6=xmlNewNode(ns_ows, BAD_CAST "Metadata"); 1344 xmlNewNsProp(nc6,ns_xlink,BAD_CAST metadata->name,BAD_CAST metadata->value); 1345 xmlAddChild(nc2,nc6); 1346 metadata=metadata->next; 1347 } 1439 dumpMap(metadata); 1440 addMetadata(metadata,nc2,ns_ows,ns_xlink); 1348 1441 1349 1442 } … … 1982 2075 elements* ecurs=getElements(e,(e!=NULL?e->name:m->name)); 1983 2076 ecurs=ecurs->child; 1984 while(curs!=NULL ){2077 while(curs!=NULL/* && ecurs!=NULL*/){ 1985 2078 ecurs=getElements(ecurs,(curs->name)); 1986 2079 map* inRequest=getMap(curs->content,"inRequest"); -
branches/prototype-v0/zoo-project/zoo-kernel/response_print.h
r785 r822 220 220 void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); 221 221 void printStatusInfo(maps*,map*,char*); 222 int addMetadata(map* meta,xmlNodePtr nc,xmlNsPtr ns_ows,xmlNsPtr ns_xlink); 222 223 223 224 void outputResponse(service*,maps*,maps*,map*,int,maps*,int); -
branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c
r821 r822 368 368 FILE * file=fopen(filename,"rb"); 369 369 if(file==NULL){ 370 fprintf(stderr,"Failed to open file %s for reading purpose.\n",filename);371 370 setMapInMaps(m,"lenv","message","Unable to read produced file. Please try again later"); 372 371 return ; … … 598 597 setMapArray(res,"value",nb,out1->name); 599 598 } 599 600 600 nb++; 601 601 result=out1->name; … … 701 701 } 702 702 } 703 else {703 else /*toto*/{ 704 704 iotype* tmpIoType=NULL; 705 705 if(tmpMaps->content!=NULL){ … … 834 834 addToMap(tmpMaps->content,"inRequest","true"); 835 835 elements* tmpElements=getElements(in,tmpMaps->name); 836 if( tmpElements!=NULL && tmpElements->child!=NULL){836 if(/*tmpMaps->child!=NULL && */tmpElements!=NULL && tmpElements->child!=NULL){ 837 837 char *res=addDefaultValues(&tmpMaps->child,tmpElements->child,m,type,err); 838 838 if(strlen(res)>0){ … … 841 841 } 842 842 } 843 tmpInputs=tmpInputs->next; 843 /*if(tmpInputs->child!=NULL){ 844 tmpInputss=tmpInputs->next; 845 tmpInputs=tmpInputs->child; 846 if(tmpMaps!=NULL){ 847 out1=tmpMaps->child; 848 out1s=tmpMaps; 849 } 850 }else*/ 851 tmpInputs=tmpInputs->next; 844 852 } 845 853 if(tmpInputss!=NULL){ -
branches/prototype-v0/zoo-project/zoo-kernel/service.c
r805 r822 98 98 fprintf(stderr," * CONTENT [%s] \n",tmp->name); 99 99 dumpMap(tmp->content); 100 fprintf(stderr," * CHILD [%s] \n",tmp->name); 101 dumpMaps(tmp->child); 100 if(tmp->child!=NULL){ 101 fprintf(stderr," * CHILD [%s] \n",tmp->name); 102 dumpMaps(tmp->child); 103 fprintf(stderr," * /CHILD [%s] \n",tmp->name); 104 } 102 105 tmp=tmp->next; 103 106 } … … 121 124 fflush(file); 122 125 tmp=tmp->next; 123 cnt++;124 126 if(limit>=0 && cnt==limit) 125 127 tmp=NULL; 128 cnt++; 126 129 } 127 130 fflush(file); … … 403 406 free(tmp->child); 404 407 } 405 freeIOType(&tmp->defaults);406 if(tmp->defaults!=NULL)408 if(tmp->defaults!=NULL){ 409 freeIOType(&tmp->defaults); 407 410 free(tmp->defaults); 408 freeIOType(&tmp->supported);411 } 409 412 if(tmp->supported!=NULL){ 413 freeIOType(&tmp->supported); 410 414 free(tmp->supported); 411 415 } 412 freeElements(&tmp->next);413 if(tmp->next!=NULL)416 if(tmp->next!=NULL){ 417 freeElements(&tmp->next); 414 418 free(tmp->next); 419 } 415 420 } 416 421 } … … 973 978 * @return a pointer to the allocated elements 974 979 */ 975 elements* createElements(c har* name){980 elements* createElements(const char* name){ 976 981 elements* res=(elements*)malloc(ELEMENTS_SIZE); 977 982 res->name=zStrdup(name); -
branches/prototype-v0/zoo-project/zoo-kernel/service.h
r790 r822 281 281 282 282 ZOO_DLL_EXPORT elements* createEmptyElements(); 283 ZOO_DLL_EXPORT elements* createElements(c har*);283 ZOO_DLL_EXPORT elements* createElements(const char*); 284 284 ZOO_DLL_EXPORT void setElementsName(elements**,char*); 285 285 ZOO_DLL_EXPORT bool hasElement(elements*,const char*); -
branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c
r781 r822 131 131 */ 132 132 void setReferenceUrl(maps* m,maps* tmpI){ 133 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 134 fflush(stderr); 135 dumpMaps(tmpI); 136 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 137 fflush(stderr); 133 138 outputMapfile(m,tmpI); 139 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 140 fflush(stderr); 141 dumpMaps(tmpI); 142 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 143 fflush(stderr); 134 144 map *msUrl=getMapFromMaps(m,"main","mapserverAddress"); 135 145 if(msUrl==NULL){ … … 150 160 {"WMS","1.3.0","GetMap","layers=%s","wms_extent"}, 151 161 {"WFS","1.1.0","GetFeature","typename=%s","wcs_extent"}, 152 {"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"} 162 //{"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"} 163 {"WCS","2.0.0","GetCoverage","coverageid=%s","wcs_extent"} 153 164 }; 154 165 int proto=0; … … 988 999 */ 989 1000 void outputMapfile(maps* conf,maps* outputs){ 990 1001 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1002 fflush(stderr); 1003 dumpMaps(outputs); 1004 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1005 fflush(stderr); 991 1006 /** 992 1007 * First store the value on disk … … 998 1013 ext="json"; 999 1014 1015 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1016 fflush(stderr); 1000 1017 map* tmpMap=getMapFromMaps(conf,"main","dataPath"); 1001 1018 map* sidMap=getMapFromMaps(conf,"lenv","usid"); … … 1009 1026 map* sizeMap=getMap(outputs->content,"size"); 1010 1027 map* vData=getMap(outputs->content,"value"); 1028 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1029 fflush(stderr); 1011 1030 if(sizeMap!=NULL){ 1012 1031 zWrite(f,vData->value,atoi(sizeMap->value)*sizeof(char)); … … 1015 1034 zWrite(f,vData->value,(strlen(vData->value)+1)*sizeof(char)); 1016 1035 } 1036 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1037 fflush(stderr); 1017 1038 close(f); 1039 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1040 fflush(stderr); 1018 1041 addToMap(outputs->content,"storage",pszDataSource); 1019 1042 free(pszDataSource); 1043 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1044 fflush(stderr); 1020 1045 1021 1046 /* … … 1024 1049 mapObj *myMap=msNewMapObj(); 1025 1050 free(myMap->name); 1051 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1052 fflush(stderr); 1026 1053 myMap->name=zStrdup("ZOO-Project_WXS_Server"); 1054 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1055 fflush(stderr); 1027 1056 msMapSetSize(myMap,2048,2048); 1057 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1058 fflush(stderr); 1028 1059 msMapSetExtent(myMap,-1,-1,1,1); 1060 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1061 fflush(stderr); 1029 1062 1030 1063 /* … … 1035 1068 tmp1=getMapFromMaps(conf,"main","tmpUrl"); 1036 1069 myMap->web.imageurl=zStrdup(tmp1->value); 1070 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1071 fflush(stderr); 1037 1072 1038 1073 /* … … 1045 1080 msAppendOutputFormat(myMap,msCloneOutputFormat(o1)); 1046 1081 msFreeOutputFormat(o1); 1082 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1083 fflush(stderr); 1047 1084 1048 1085 #ifdef USE_KML 1049 1086 outputFormatObj *o2=msCreateDefaultOutputFormat(NULL,"KML","kml"); 1050 o2->inmapfile=MS_TRUE; 1051 msAppendOutputFormat(myMap,msCloneOutputFormat(o2)); 1052 msFreeOutputFormat(o2); 1053 #endif 1087 if(!o2){ 1088 perror("Unable to initialize KML driver"); 1089 fprintf(stderr,"Unable to initialize KML driver !\n"); 1090 }else{ 1091 o2->inmapfile=MS_TRUE; 1092 msAppendOutputFormat(myMap,msCloneOutputFormat(o2)); 1093 msFreeOutputFormat(o2); 1094 } 1095 #endif 1096 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1097 fflush(stderr); 1054 1098 1055 1099 outputFormatObj *o3=msCreateDefaultOutputFormat(NULL,"GDAL/GTiff","tiff"); … … 1062 1106 msFreeOutputFormat(o3); 1063 1107 } 1108 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1109 fflush(stderr); 1064 1110 1065 1111 outputFormatObj *o4=msCreateDefaultOutputFormat(NULL,"GDAL/AAIGRID","grd"); … … 1072 1118 msFreeOutputFormat(o4); 1073 1119 } 1120 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1121 fflush(stderr); 1074 1122 1075 1123 #ifdef USE_CAIRO … … 1085 1133 } 1086 1134 #endif 1135 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1136 fflush(stderr); 1087 1137 1088 1138 /* … … 1091 1141 msLoadProjectionStringEPSG(&myMap->projection,"EPSG:4326"); 1092 1142 myMap->transparent=1; 1143 fprintf(stderr,"%s %D \n",__FILE__,__LINE__); 1144 fflush(stderr); 1093 1145 1094 1146 /** -
branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c
r786 r822 1 1 /* 2 * Author : David Saggiorato3 * Gérald Fenoy2 * Authors : David Saggiorato 3 * Gérald Fenoy 4 4 * Copyright 2015 GeoLabs SARL. All rights reserved. 5 5 * … … 23 23 */ 24 24 25 #ifdef RELY_ON_DB26 25 #include "ogr_api.h" 27 26 #include "ogrsf_frmts.h" … … 52 51 53 52 /** 54 * Create a GDAL / OGR string for connecting to the db backend 55 * (do not support active_schema) 56 * 57 * @param conf the maps containing the setting of the main.cfg file 58 */ 59 char* createInitString(maps* conf){ 53 * Create a GDAL / OGR string for connecting to a db backend defined in the 54 * key section. 55 * 56 * @param conf the maps containing the setting of the main.cfg file 57 * @param key the name of the section containing the connection setting 58 * @return the OGR connection string 59 */ 60 char* _createInitString(maps* conf,const char* key){ 60 61 char* res=NULL; 61 char keywords[ 5][9]={62 char keywords[6][14]={ 62 63 "dbname", 63 64 "host", 64 65 "port", 65 66 "user", 66 "password" 67 "password", 68 "active_schema" 67 69 }; 68 70 int i=0; 69 maps* cconf=getMaps(conf, "database");71 maps* cconf=getMaps(conf,key); 70 72 int len=0; 71 for(i=0;i< 5;i++){73 for(i=0;i<6;i++){ 72 74 map* tmp=getMap(cconf->content,keywords[i]); 75 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 76 fflush(stderr); 73 77 if(tmp!=NULL){ 78 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 79 fflush(stderr); 74 80 if(res==NULL){ 75 81 res=(char*)malloc((strlen(keywords[i])+strlen(tmp->value)+4)*sizeof(char)); … … 83 89 len+=strlen(res1); 84 90 res[len]=0; 91 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 92 fflush(stderr); 85 93 free(res1); 86 94 } 87 95 } 88 } 96 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 97 fflush(stderr); 98 } 99 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 100 fflush(stderr); 89 101 map* tmp=getMap(cconf->content,"type"); 90 102 if(tmp!=NULL){ … … 98 110 99 111 /** 100 * Connect to the db backend. 112 * Create a GDAL / OGR string for connecting to the db backend 113 * 114 * @param conf the maps containing the setting of the main.cfg file 115 * @return the OGR connection string 116 */ 117 char* createInitString(maps* conf){ 118 return _createInitString(conf,"database"); 119 } 120 121 /** 122 * Connect to a db backend. 101 123 * 102 124 * @param conf the maps containing the setting of the main.cfg file 103 125 * @see createInitString 104 126 */ 105 void init_sql(maps* conf){106 char* sqlInitString= createInitString(conf);127 void _init_sql(maps* conf,const char* key){ 128 char* sqlInitString=_createInitString(conf,key); 107 129 OGRSFDriver *poDriver = NULL; 108 130 OGRRegisterAll(); … … 129 151 #endif 130 152 free(sqlInitString); 153 } 154 155 /** 156 * Connect to the db backend. 157 * 158 * @param conf the maps containing the setting of the main.cfg file 159 * @see createInitString 160 */ 161 void init_sql(maps* conf){ 162 return _init_sql(conf,"database"); 131 163 } 132 164 … … 158 190 159 191 /** 192 * Fetch a tuple set by executing a SQL query to the Database Backend. 193 * 194 * @param conf the maps containing the setting of the main.cfg file 195 * @param sqlQuery the SQL query to run 196 * @return NULL in case of failure or an OGRLayer pointer if the query succeed. 197 */ 198 OGRLayer *fetchSql(maps* conf,const char* sqlQuery){ 199 OGRLayer *res=NULL; 200 res = zoo_DS->ExecuteSQL( sqlQuery, NULL, NULL); 201 return res; 202 } 203 204 void cleanFetchSql(maps* conf,OGRLayer *objects){ 205 if( objects != NULL ){ 206 zoo_DS->ReleaseResultSet( objects ); 207 objects=NULL; 208 } 209 } 210 211 /** 160 212 * Execute a SQL query to the SQL Database Backend. 161 213 * … … 165 217 */ 166 218 int execSql(maps* conf,const char* sqlQuery){ 219 int res=-1; 167 220 zoo_ResultSet = zoo_DS->ExecuteSQL( sqlQuery, NULL, NULL); 168 221 if( zoo_ResultSet != NULL ){ 169 return 1; 170 } 171 return -1; 222 res=1; 223 } 224 zoo_DS->ReleaseResultSet( zoo_ResultSet ); 225 return res; 172 226 } 173 227 … … 260 314 } 261 315 316 #ifdef RELY_ON_DB 262 317 /** 263 318 * Update the current status of the running service. -
branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.h
r784 r822 25 25 #ifndef ZOO_SQLAPI_H 26 26 #define ZOO_SQLAPI_H 1 27 #ifdef RELY_ON_DB 27 28 #ifdef META_DB 29 #include "ogrsf_frmts.h" 30 #if GDAL_VERSION_MAJOR >= 2 31 #include <gdal_priv.h> 32 #endif 33 #endif 34 28 35 #include "service.h" 29 36 #include "service_internal.h" … … 32 39 extern "C" { 33 40 #endif 41 42 #ifdef META_DB 43 ZOO_DLL_EXPORT char* _createInitString(maps*,const char*); 44 ZOO_DLL_EXPORT void _init_sql(maps*,const char*); 45 ZOO_DLL_EXPORT OGRLayer *fetchSql(maps*,const char*); 46 #endif 47 #ifdef RELY_ON_DB 34 48 ZOO_DLL_EXPORT void init_sql(maps*); 35 49 ZOO_DLL_EXPORT void close_sql(maps*); … … 42 56 ZOO_DLL_EXPORT char* getStatusId(maps*,char*); 43 57 ZOO_DLL_EXPORT void removeService(maps*,char*); 58 #endif 44 59 45 60 #ifdef __cplusplus … … 48 63 49 64 #endif 50 #endif -
branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c
r817 r822 26 26 extern "C" int crlex (); 27 27 28 #ifdef META_DB 29 #include "ogrsf_frmts.h" 30 #if GDAL_VERSION_MAJOR >= 2 31 #include <gdal_priv.h> 32 #endif 33 #endif 34 28 35 #ifdef USE_OTB 29 36 #include "service_internal_otb.h" 37 #endif 38 39 #ifdef USE_HPC 40 #include "service_internal_hpc.h" 30 41 #endif 31 42 … … 53 64 #ifdef WIN32 54 65 #include "caching.h" 66 #endif 67 68 #ifdef META_DB 69 #include "meta_sql.h" 55 70 #endif 56 71 … … 305 320 return -1; 306 321 } 307 #if def DEBUG322 #ifndef DEBUG 308 323 fprintf (stderr, "#################\n%s\n#################\n", 309 324 tmps1); … … 330 345 fflush (stderr); 331 346 #endif 332 347 inheritance(r,&s1); 333 348 func (r, m, n, s1); 334 349 freeService (&s1); … … 631 646 else 632 647 648 #ifdef USE_HPC 649 if (strncasecmp (r_inputs->value, "HPC", 3) == 0) 650 { 651 *eres = 652 zoo_hpc_support (&m, request_inputs, s1, 653 &request_input_real_format, 654 &request_output_real_format); 655 } 656 else 657 #endif 658 633 659 #ifdef USE_SAGA 634 if (strncasecmp (r_inputs->value, "SAGA", 6) == 0)660 if (strncasecmp (r_inputs->value, "SAGA", 4) == 0) 635 661 { 636 662 *eres = … … 643 669 644 670 #ifdef USE_OTB 645 if (strncasecmp (r_inputs->value, "OTB", 6) == 0)671 if (strncasecmp (r_inputs->value, "OTB", 3) == 0) 646 672 { 647 673 *eres = … … 1304 1330 fflush (stdout); 1305 1331 dup2 (saved_stdout, fileno (stdout)); 1332 #ifdef META_DB 1333 fetchServicesFromDb(zooRegistry,m,n,printGetCapabilitiesForProcess); 1334 #endif 1306 1335 printDocument (m, doc, getpid ()); 1307 1336 freeMaps (&m); … … 1412 1441 printDescribeProcessForProcess) < 0) 1413 1442 return res; 1443 #ifdef META_DB 1444 fetchServicesFromDb(zooRegistry,m,n,printDescribeProcessForProcess); 1445 #endif 1446 1414 1447 } 1415 1448 else … … 1427 1460 if (import != NULL && import->value != NULL) 1428 1461 { 1429 s1 = (service *) malloc (SERVICE_SIZE); 1430 t = readServiceFile (m, import->value, &s1, import->name); 1462 #ifdef META_DB 1463 service* s2=extractServiceFromDb(m,import->name); 1464 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 1465 fflush(stderr); 1466 if(s2==NULL){ 1467 #endif 1468 s1 = (service *) malloc (SERVICE_SIZE); 1469 t = readServiceFile (m, import->value, &s1, import->name); 1431 1470 1432 if (t < 0) // failure reading zcfg 1433 { 1434 map *tmp00 = getMapFromMaps (m, "lenv", "message"); 1435 char tmp01[1024]; 1436 if (tmp00 != NULL) 1437 sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"), import->value, tmp00->value); 1438 else 1439 sprintf (tmp01, _("Unable to parse the ZCFG file: %s."), import->value); 1440 1441 dup2 (saved_stdout, fileno (stdout)); 1442 errorException (m, tmp01, "InternalError", NULL); 1443 1444 freeMaps (&m); 1445 free (m); 1446 1447 if(zooRegistry!=NULL){ 1448 freeRegistry(&zooRegistry); 1449 free(zooRegistry); 1471 if (t < 0) // failure reading zcfg 1472 { 1473 map *tmp00 = getMapFromMaps (m, "lenv", "message"); 1474 char tmp01[1024]; 1475 if (tmp00 != NULL) 1476 sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"), import->value, tmp00->value); 1477 else 1478 sprintf (tmp01, _("Unable to parse the ZCFG file: %s."), import->value); 1479 1480 dup2 (saved_stdout, fileno (stdout)); 1481 errorException (m, tmp01, "InternalError", NULL); 1482 1483 freeMaps (&m); 1484 free (m); 1485 1486 if(zooRegistry!=NULL){ 1487 freeRegistry(&zooRegistry); 1488 free(zooRegistry); 1489 } 1490 free (orig); 1491 free (REQUEST); 1492 closedir (dirp); 1493 xmlFreeDoc (doc); 1494 xmlCleanupParser (); 1495 zooXmlCleanupNs (); 1496 1497 return 1; 1450 1498 } 1451 free (orig); 1452 free (REQUEST); 1453 closedir (dirp); 1454 xmlFreeDoc (doc); 1455 xmlCleanupParser (); 1456 zooXmlCleanupNs (); 1457 1458 return 1; 1459 } 1460 #ifdef DEBUG 1461 dumpService (s1); 1462 #endif 1463 1464 inheritance(zooRegistry,&s1); 1465 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1466 freeService (&s1); 1467 free (s1); 1468 s1 = NULL; 1469 scount++; 1470 hasVal = 1; 1471 } 1499 #ifdef DEBUG 1500 dumpService (s1); 1501 #endif 1502 1503 inheritance(zooRegistry,&s1); 1504 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1505 freeService (&s1); 1506 free (s1); 1507 s1 = NULL; 1508 scount++; 1509 hasVal = 1; 1510 #ifdef META_DB 1511 } 1512 #endif 1513 } 1472 1514 else if (strstr (corig, ".") != NULL) 1473 1515 { … … 1479 1521 map *tmpMapI = getMapFromMaps (m, "lenv", "Identifier"); 1480 1522 1481 s1 = (service *) malloc (SERVICE_SIZE); 1482 t = readServiceFile (m, buff1, &s1, tmpMapI->value); 1483 if (t < 0) 1484 { 1485 map *tmp00 = getMapFromMaps (m, "lenv", "message"); 1486 char tmp01[1024]; 1487 if (tmp00 != NULL) 1488 sprintf (tmp01, 1489 _ 1490 ("Unable to parse the ZCFG file for the following ZOO-Service: %s. Message: %s"), 1491 tmps, tmp00->value); 1492 else 1493 sprintf (tmp01, 1494 _ 1495 ("Unable to parse the ZCFG file for the following ZOO-Service: %s."), 1496 tmps); 1497 dup2 (saved_stdout, fileno (stdout)); 1498 errorException (m, tmp01, "InvalidParameterValue", 1499 "identifier"); 1500 freeMaps (&m); 1501 free (m); 1502 if(zooRegistry!=NULL){ 1503 freeRegistry(&zooRegistry); 1504 free(zooRegistry); 1523 #ifdef META_DB 1524 service* s2=extractServiceFromDb(m,tmpMapI->name); 1525 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 1526 fflush(stderr); 1527 if(s2==NULL){ 1528 #endif 1529 s1 = (service *) malloc (SERVICE_SIZE); 1530 t = readServiceFile (m, buff1, &s1, tmpMapI->value); 1531 if (t < 0) 1532 { 1533 map *tmp00 = getMapFromMaps (m, "lenv", "message"); 1534 char tmp01[1024]; 1535 if (tmp00 != NULL) 1536 sprintf (tmp01, 1537 _ 1538 ("Unable to parse the ZCFG file for the following ZOO-Service: %s. Message: %s"), 1539 tmps, tmp00->value); 1540 else 1541 sprintf (tmp01, 1542 _ 1543 ("Unable to parse the ZCFG file for the following ZOO-Service: %s."), 1544 tmps); 1545 dup2 (saved_stdout, fileno (stdout)); 1546 errorException (m, tmp01, "InvalidParameterValue", 1547 "identifier"); 1548 freeMaps (&m); 1549 free (m); 1550 if(zooRegistry!=NULL){ 1551 freeRegistry(&zooRegistry); 1552 free(zooRegistry); 1553 } 1554 free (REQUEST); 1555 free (corig); 1556 free (orig); 1557 free (SERVICE_URL); 1558 free (s1); 1559 closedir (dirp); 1560 xmlFreeDoc (doc); 1561 xmlCleanupParser (); 1562 zooXmlCleanupNs (); 1563 return 1; 1505 1564 } 1506 free (REQUEST); 1507 free (corig); 1508 free (orig); 1509 free (SERVICE_URL); 1510 free (s1); 1511 closedir (dirp); 1512 xmlFreeDoc (doc); 1513 xmlCleanupParser (); 1514 zooXmlCleanupNs (); 1515 return 1; 1516 } 1517 #ifdef DEBUG 1518 dumpService (s1); 1519 #endif 1520 inheritance(zooRegistry,&s1); 1521 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1522 freeService (&s1); 1523 free (s1); 1524 s1 = NULL; 1525 scount++; 1526 hasVal = 1; 1527 setMapInMaps (m, "lenv", "level", "0"); 1565 #ifdef DEBUG 1566 dumpService (s1); 1567 #endif 1568 inheritance(zooRegistry,&s1); 1569 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1570 freeService (&s1); 1571 free (s1); 1572 s1 = NULL; 1573 scount++; 1574 hasVal = 1; 1575 setMapInMaps (m, "lenv", "level", "0"); 1576 #ifdef META_DB 1577 } 1578 #endif 1528 1579 } 1529 1580 else 1530 1581 { 1582 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 1583 fflush(stderr); 1584 #ifdef META_DB 1585 _init_sql(m,"metadb"); 1586 service* s2=extractServiceFromDb(m,corig); 1587 if(s2!=NULL){ 1588 fprintf(stderr,"%s %d \n",__FILE__,__LINE__); 1589 fflush(stderr); 1590 inheritance(zooRegistry,&s2); 1591 printDescribeProcessForProcess (zooRegistry,m, n, s2); 1592 freeService (&s2); 1593 free (s2); 1594 s2 = NULL; 1595 hasVal = 1; 1596 }else /*TOTO*/{ 1597 #endif 1531 1598 memset (buff, 0, 256); 1532 1599 snprintf (buff, 256, "%s.zcfg", corig); 1533 1600 memset (buff1, 0, 1024); 1534 1601 #ifdef DEBUG 1535 printf ("\n#######%s\n########\n", buff);1536 #endif 1537 while ((dp = readdir (dirp)) != NULL)1538 {1539 if (strcasecmp (dp->d_name, buff) == 0)1540 1541 memset (buff1, 0, 1024);1542 snprintf (buff1, 1024, "%s/%s", conf_dir,1543 dp->d_name);1544 s1 = (service *) malloc (SERVICE_SIZE);1545 if (s1 == NULL)1546 {1547 dup2 (saved_stdout, fileno (stdout));1548 return errorException (m,1549 _1550 ("Unable to allocate memory"),1551 "InternalError",1552 NULL);1553 }1602 printf ("\n#######%s\n########\n", buff); 1603 #endif 1604 while ((dp = readdir (dirp)) != NULL) 1605 { 1606 if (strcasecmp (dp->d_name, buff) == 0) 1607 { 1608 memset (buff1, 0, 1024); 1609 snprintf (buff1, 1024, "%s/%s", conf_dir, 1610 dp->d_name); 1611 s1 = (service *) malloc (SERVICE_SIZE); 1612 if (s1 == NULL) 1613 { 1614 dup2 (saved_stdout, fileno (stdout)); 1615 return errorException (m, 1616 _ 1617 ("Unable to allocate memory"), 1618 "InternalError", 1619 NULL); 1620 } 1554 1621 #ifdef DEBUG_SERVICE_CONF 1555 fprintf 1556 (stderr,"#################\n(%s) %s\n#################\n", 1557 r_inputs->value, buff1); 1558 #endif 1559 char *tmp0 = zStrdup (dp->d_name); 1560 tmp0[strlen (tmp0) - 5] = 0; 1561 t = readServiceFile (m, buff1, &s1, tmp0); 1562 free (tmp0); 1563 if (t < 0) 1564 { 1565 map *tmp00 = 1566 getMapFromMaps (m, "lenv", "message"); 1567 char tmp01[1024]; 1568 if (tmp00 != NULL) 1569 sprintf (tmp01, 1570 _ 1571 ("Unable to parse the ZCFG file: %s (%s)"), 1572 dp->d_name, tmp00->value); 1573 else 1574 sprintf (tmp01, 1575 _ 1576 ("Unable to parse the ZCFG file: %s."), 1577 dp->d_name); 1578 dup2 (saved_stdout, fileno (stdout)); 1579 errorException (m, tmp01, "InternalError", 1580 NULL); 1581 freeMaps (&m); 1582 free (m); 1583 if(zooRegistry!=NULL){ 1584 freeRegistry(&zooRegistry); 1585 free(zooRegistry); 1622 fprintf 1623 (stderr,"#################\n(%s) %s\n#################\n", 1624 r_inputs->value, buff1); 1625 #endif 1626 char *tmp0 = zStrdup (dp->d_name); 1627 tmp0[strlen (tmp0) - 5] = 0; 1628 t = readServiceFile (m, buff1, &s1, tmp0); 1629 free (tmp0); 1630 if (t < 0) 1631 { 1632 map *tmp00 = 1633 getMapFromMaps (m, "lenv", "message"); 1634 char tmp01[1024]; 1635 if (tmp00 != NULL) 1636 sprintf (tmp01, 1637 _ 1638 ("Unable to parse the ZCFG file: %s (%s)"), 1639 dp->d_name, tmp00->value); 1640 else 1641 sprintf (tmp01, 1642 _ 1643 ("Unable to parse the ZCFG file: %s."), 1644 dp->d_name); 1645 dup2 (saved_stdout, fileno (stdout)); 1646 errorException (m, tmp01, "InternalError", 1647 NULL); 1648 freeMaps (&m); 1649 free (m); 1650 if(zooRegistry!=NULL){ 1651 freeRegistry(&zooRegistry); 1652 free(zooRegistry); 1653 } 1654 free (orig); 1655 free (REQUEST); 1656 closedir (dirp); 1657 xmlFreeDoc (doc); 1658 xmlCleanupParser (); 1659 zooXmlCleanupNs (); 1660 return 1; 1586 1661 } 1587 free (orig); 1588 free (REQUEST); 1589 closedir (dirp); 1590 xmlFreeDoc (doc); 1591 xmlCleanupParser (); 1592 zooXmlCleanupNs (); 1593 return 1; 1594 } 1595 #ifdef DEBUG 1596 dumpService (s1); 1597 #endif 1598 inheritance(zooRegistry,&s1); 1599 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1600 freeService (&s1); 1601 free (s1); 1602 s1 = NULL; 1603 scount++; 1604 hasVal = 1; 1605 } 1606 } 1607 } 1662 #ifdef DEBUG 1663 dumpService (s1); 1664 #endif 1665 inheritance(zooRegistry,&s1); 1666 printDescribeProcessForProcess (zooRegistry,m, n, s1); 1667 freeService (&s1); 1668 free (s1); 1669 s1 = NULL; 1670 scount++; 1671 hasVal = 1; 1672 } 1673 } 1674 #ifdef META_DB 1675 } 1676 #endif 1677 } 1608 1678 if (hasVal < 0) 1609 1679 { … … 2365 2435 } 2366 2436 2367 #ifdef DEBUG2437 //#ifdef DEBUG 2368 2438 dumpMaps (request_output_real_format); 2369 #endif2370 2439 //#endif 2440 //sleep(120); 2371 2441 if (eres != -1) 2372 2442 outputResponse (s1, request_input_real_format,
Note: See TracChangeset
for help on using the changeset viewer.