Changeset 465 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Apr 23, 2014, 3:05:01 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r464 r465 34 34 #define FALSE -1 35 35 #endif 36 37 int readServiceFile(maps* conf, char* file,service** service,char *name){ 38 int t=getServiceFromFile(conf,file,service); 39 #ifdef YAML 40 if(t<0){ 41 t=getServiceFromYAML(conf,file,service,name); 42 } 43 #endif 44 return t; 45 } 36 46 37 47 void printHeaders(maps* m){ … … 883 893 884 894 void printFullDescription(elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){ 885 char *orderedFields[1 2];895 char *orderedFields[13]; 886 896 orderedFields[0]="mimeType"; 887 897 orderedFields[1]="encoding"; … … 892 902 orderedFields[6]="value"; 893 903 orderedFields[7]="AllowedValues"; 894 orderedFields[8]="rangeMin"; 895 orderedFields[9]="rangeMax"; 896 orderedFields[10]="rangeClosure"; 897 orderedFields[11]="rangeSpace"; 904 orderedFields[8]="range"; 905 orderedFields[9]="rangeMin"; 906 orderedFields[10]="rangeMax"; 907 orderedFields[11]="rangeClosure"; 908 orderedFields[12]="rangeSpace"; 898 909 899 910 xmlNodePtr nc2,nc3,nc4,nc5,nc6,nc7,nc8; … … 935 946 nc3 = xmlNewNode(NULL, BAD_CAST e->format); 936 947 } 948 iotype* _tmp0=NULL; 937 949 iotype* _tmp=e->defaults; 938 950 int datatype=0; … … 961 973 int dcnt=0; 962 974 int oI=0; 963 for(oI=0;oI<1 2;oI++)975 for(oI=0;oI<13;oI++) 964 976 if((tmp1=getMap(_tmp->content,orderedFields[oI]))!=NULL){ 965 977 //while(tmp1!=NULL){ … … 1018 1030 token=strtok_r(NULL,",",&saveptr1); 1019 1031 } 1020 if(getMap(_tmp->content,"rangeMin")!=NULL || 1032 if(getMap(_tmp->content,"range")!=NULL || 1033 getMap(_tmp->content,"rangeMin")!=NULL || 1021 1034 getMap(_tmp->content,"rangeMax")!=NULL || 1022 1035 getMap(_tmp->content,"rangeClosure")!=NULL ) … … 1029 1042 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1030 1043 doRange: 1044 1045 /** 1046 * Range: Table 46 OGC Web Services Common Standard 1047 */ 1031 1048 nc8 = xmlNewNode(ns_ows, BAD_CAST "Range"); 1032 map *tmp0=getMap(tmp1,"rangeMin"); 1049 1050 map* tmp0=getMap(tmp1,"range"); 1051 if(tmp0!=NULL){ 1052 char* pToken; 1053 char* orig=zStrdup(tmp0->value); 1054 /** 1055 * RangeClosure: Table 47 OGC Web Services Common Standard 1056 */ 1057 char *tmp="closed"; 1058 if(orig[0]=='[' && orig[strlen(orig)-1]=='[') 1059 tmp="closed-open"; 1060 else 1061 if(orig[0]==']' && orig[strlen(orig)-1]==']') 1062 tmp="open-closed"; 1063 else 1064 if(orig[0]==']' && orig[strlen(orig)-1]=='[') 1065 tmp="open"; 1066 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp); 1067 pToken=strtok(orig,","); 1068 int nci0=0; 1069 while(pToken!=NULL){ 1070 char *tmpStr=(char*) malloc((strlen(pToken))*sizeof(char)); 1071 if(nci0==0){ 1072 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1073 int nci=1; 1074 for(nci=1;nci<strlen(pToken);nci++){ 1075 tmpStr[nci-1]=pToken[nci]; 1076 } 1077 }else{ 1078 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1079 int nci=0; 1080 for(nci=0;nci<strlen(pToken)-1;nci++){ 1081 tmpStr[nci]=pToken[nci]; 1082 } 1083 } 1084 xmlAddChild(nc7,xmlNewText(BAD_CAST tmpStr)); 1085 xmlAddChild(nc8,nc7); 1086 nci0++; 1087 pToken = strtok(NULL,","); 1088 } 1089 if(getMap(tmp1,"rangeSpacing")==NULL){ 1090 nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing"); 1091 xmlAddChild(nc7,xmlNewText(BAD_CAST "1")); 1092 xmlAddChild(nc8,nc7); 1093 } 1094 }else{ 1095 1096 tmp0=getMap(tmp1,"rangeMin"); 1033 1097 if(tmp0!=NULL){ 1034 1098 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); … … 1068 1132 }else 1069 1133 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST "closed"); 1134 } 1135 if(_tmp0==NULL){ 1136 xmlAddChild(nc6,nc8); 1137 _tmp0=e->supported; 1138 tmp1=_tmp0->content; 1139 goto doRange; 1140 }else{ 1141 _tmp0=_tmp0->next; 1142 if(_tmp0!=NULL){ 1143 xmlAddChild(nc6,nc8); 1144 tmp1=_tmp0->content; 1145 goto doRange; 1146 } 1147 1148 } 1149 xmlAddChild(nc6,nc8); 1150 xmlAddChild(nc3,nc6); 1151 isAnyValue=-1; 1070 1152 } 1071 xmlAddChild(nc6,nc8);1072 xmlAddChild(nc3,nc6);1073 isAnyValue=-1;1074 1153 } 1075 1154 } … … 1096 1175 avcnt++; 1097 1176 } 1177 } 1178 1179 map* metadata=e->metadata; 1180 xmlNodePtr n; 1181 int xlinkId=zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink"); 1182 xmlNsPtr ns_xlink=usedNs[xlinkId]; 1183 1184 while(metadata!=NULL){ 1185 nc6=xmlNewNode(ns_ows, BAD_CAST "MetaData"); 1186 xmlNewNsProp(nc6,ns_xlink,BAD_CAST metadata->name,BAD_CAST metadata->value); 1187 xmlAddChild(nc2,nc6); 1188 metadata=metadata->next; 1098 1189 } 1099 1190 }
Note: See TracChangeset
for help on using the changeset viewer.