Changeset 771 for trunk/zoo-project
- Timestamp:
- Jun 10, 2016, 1:40:44 AM (9 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 2 added
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-api/java/Makefile
r612 r771 20 20 all: libZOO.${ext} 21 21 22 ZOO.class:ZOO.java23 javac ZOO.java22 org/zoo_project/ZOO.class: org/zoo_project/ZOO.java 23 javac org/zoo_project/ZOO.java 24 24 25 ZOO.h: ZOO.javaZOO.class26 javah ZOO25 org_zoo_project_ZOO.h: org/zoo_project/ZOO.java org/zoo_project/ZOO.class 26 javah org.zoo_project.ZOO 27 27 28 zoo-api.o: zoo-api.c ZOO.h28 zoo-api.o: zoo-api.c org_zoo_project_ZOO.h 29 29 gcc -fPIC -c zoo-api.c ${JAVACFLAGS} ${XML2CFLAGS} -I../../zoo-kernel/ -I../../../thirds/cgic206/ 30 30 31 31 libZOO.${ext}: zoo-api.o 32 gcc zoo-api.o -shared -o libZOO.${ext} -Wl,../../zoo-kernel/ service_internal.o,${JAVA_FILES},${MS_FILES}${JS_FILES}../../zoo-kernel/ulinet.o ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lcrypto ${MS_LDFLAGS} ${MACOS_LD_FLAGS} -lcurl -lfcgi ${MACOS_LD_NET_FLAGS}32 gcc zoo-api.o -shared -o libZOO.${ext} -Wl,../../zoo-kernel//service_yaml.o,../../zoo-kernel/lex.cr.o,../../zoo-kernel/main_conf_read.tab.o,../../zoo-kernel/lex.sr.o,../../zoo-kernel/service_conf.tab.o,../../zoo-kernel/service_internal.o,../../zoo-kernel/server_internal.o,../../zoo-kernel/response_print.o,${JAVA_FILES},${MS_FILES}${JS_FILES}../../zoo-kernel/ulinet.o ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lcrypto ${MS_LDFLAGS} ${MACOS_LD_FLAGS} -lcurl -lfcgi ${MACOS_LD_NET_FLAGS} -lzoo_service -lyaml 33 33 34 34 clean: 35 rm -f *${ext} *o *.h *class 35 rm -f *${ext} *o *.h *class org/zoo_project/*.class -
trunk/zoo-project/zoo-api/java/org/zoo_project/ZOO.java
r766 r771 1 package org.zoo_project; 2 1 3 import java.lang.*; 2 4 import java.util.*; … … 6 8 public static Integer SERVICE_SUCCEEDED=3; 7 9 public static Integer SERVICE_FAILED=4; 8 public static native String _(String a);10 public static native String translate(String a); 9 11 public static native Integer updateStatus(HashMap conf,String pourcent,String message); 10 12 } -
trunk/zoo-project/zoo-api/java/zoo-api.c
r766 r771 1 #include " ZOO.h"1 #include "org_zoo_project_ZOO.h" 2 2 #include "service.h" 3 3 #include "service_internal.h" 4 4 #include "service_internal_java.h" 5 5 6 JNIEXPORT jstring JNICALL Java_ ZOO__16 JNIEXPORT jstring JNICALL Java_org_zoo_1project_ZOO_translate 7 7 (JNIEnv *env, jclass _class, jstring msg){ 8 8 const char *message = … … 17 17 } 18 18 19 JNIEXPORT jobject JNICALL Java_ ZOO_updateStatus19 JNIEXPORT jobject JNICALL Java_org_zoo_1project_ZOO_updateStatus 20 20 (JNIEnv *env, jclass _class, jobject conf, jstring pourc, jstring msg){ 21 21 -
trunk/zoo-project/zoo-kernel/main_conf_read.l
r676 r771 34 34 %} 35 35 36 attname [a-zA-Z0-9_\-: ]+36 attname [a-zA-Z0-9_\-:.]+ 37 37 38 38 attvalue1 [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=]+ -
trunk/zoo-project/zoo-kernel/service_internal_java.c
r767 r771 92 92 #endif 93 93 #ifndef WIN32 94 int nb=3+njdb; 95 #endif 94 int nb=2+njdb; 95 #endif 96 int nbs[3]={0,0,0}; 97 maps* javaMap=getMaps(*main_conf,"java"); 98 if(javaMap!=NULL){ 99 nbs[0]+=count(javaMap->content); 100 } 101 int nbc1=0; 102 maps* javaXMap=getMaps(*main_conf,"javax"); 103 if(javaXMap!=NULL){ 104 nbs[1]+=count(javaXMap->content); 105 } 96 106 int nbc0=0; 97 107 maps* javaXXMap=getMaps(*main_conf,"javaxx"); 98 108 if(javaXXMap!=NULL){ 99 nbc0+=count(javaXXMap->content); 100 } 101 int nbc1=0; 102 maps* javaXMap=getMaps(*main_conf,"javax"); 103 if(javaXMap!=NULL){ 104 nbc1+=count(javaXMap->content); 109 nbs[2]+=count(javaXXMap->content); 105 110 } 106 111 #ifdef WIN32 107 //#define nb (2+nbc0+nbc1) 108 const int nb=2+nbc0+nbc1; 112 const int nb=2+nbs[1]+nbs[2]+nbs[0]; 109 113 JavaVMOption *options=(JavaVMOption*)malloc(nb*sizeof(JavaVMOption)); 110 114 #else 111 JavaVMOption options[nb+nb c0+nbc1+1];115 JavaVMOption options[nb+nbs[1]+nbs[2]+nbs[0]+1]; 112 116 #endif 113 117 JavaVMInitArgs vm_args; … … 123 127 #endif 124 128 int i,start; 125 map *cursorxx=NULL;126 if(javaXXMap!=NULL)127 cursorxx=javaXXMap->content;128 map *cursorx=NULL;129 if(javaXMap!=NULL)130 cursorx=javaXMap->content;131 129 options[0].optionString = oclasspath; 132 130 options[0].extraInfo=NULL; 133 131 options[1].optionString = "-server"; 134 132 options[1].extraInfo=NULL; 135 char tmp1[100]; 136 sprintf(tmp1,"-Djava.library.path=%s",cwdMap->value); 137 fprintf(stderr,"%s\n",tmp1); 138 options[2].optionString = tmp1; 133 #ifdef USE_JDB 134 options[2].optionString = "-Xdebug"; 139 135 options[2].extraInfo=NULL; 140 #ifdef USE_JDB 141 options[3].optionString = "-Xdebug"; 136 options[3].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7896"; 142 137 options[3].extraInfo=NULL; 143 options[4].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7896";144 options[4].extraInfo=NULL;145 138 #endif 146 139 #ifdef WIN32 … … 148 141 options[1].optionString = "-Xmx512m"; 149 142 #else 150 start=3+njdb; 151 #endif 152 for(i=0;i<nbc0;i++){ 153 char *tmp=parseJVMXXOption(cursorxx); 143 start=2+njdb; 144 #endif 145 map *cursors[3]={NULL,NULL,NULL}; 146 if(javaMap!=NULL) 147 cursors[0]=javaMap->content; 148 if(javaXMap!=NULL) 149 cursors[1]=javaXMap->content; 150 if(javaXXMap!=NULL) 151 cursors[2]=javaXXMap->content; 152 for(i=0;i<nbs[0];i++){ 153 char *tmp=parseJVMOption(cursors[0]); 154 154 options[start+i].optionString = zStrdup(tmp); 155 155 options[start+i].extraInfo=NULL; 156 156 free(tmp); 157 cursor xx=cursorxx->next;158 } 159 for(;i<nb c1+nbc0;i++){160 char *tmp=parseJVMXOption(cursor x);157 cursors[0]=cursors[0]->next; 158 } 159 for(;i<nbs[0]+nbs[1];i++){ 160 char *tmp=parseJVMXOption(cursors[1]); 161 161 options[start+i].optionString = zStrdup(tmp); 162 162 options[start+i].extraInfo=NULL; 163 163 free(tmp); 164 cursorx=cursorx->next; 164 cursors[1]=cursors[1]->next; 165 } 166 for(;i<nbs[0]+nbs[2]+nbs[1];i++){ 167 char *tmp=parseJVMXXOption(cursors[2]); 168 options[start+i].optionString = zStrdup(tmp); 169 options[start+i].extraInfo=NULL; 170 free(tmp); 171 cursors[2]=cursors[2]->next; 165 172 } 166 173 … … 168 175 vm_args.version = JNI_VERSION_1_6; 169 176 vm_args.options = options; 170 vm_args.nOptions = start+nb c0+nbc1;177 vm_args.nOptions = start+nbs[0]+nbs[1]+nbs[2]; 171 178 vm_args.ignoreUnrecognized = JNI_TRUE; 172 179 … … 209 216 if (cls != NULL) { 210 217 #ifdef JAVA7 211 (*env).ExceptionClear();218 @ (*env).ExceptionClear(); 212 219 pmid=(*env).GetStaticMethodID(cls, s->name, "(Ljava/util/HashMap;Ljava/util/HashMap;Ljava/util/HashMap;)I"); 213 220 #else … … 281 288 (*jvm)->DestroyJavaVM(jvm); 282 289 #endif 283 for(i=0;i<nb c1+nbc0;i++){290 for(i=0;i<nbs[2]+nbs[1]+nbs[0];i++){ 284 291 free(options[start+i].optionString); 285 292 } … … 334 341 335 342 /** 343 * Create a string containing the JVM -D* options for a given map 344 * The result will be : -Dname=value 345 * 346 * @param m the map containing the option 347 * @return a char* containing the valide JVM option (-D*) 348 */ 349 char *parseJVMOption(map* m){ 350 char *res=(char*)malloc((strlen(m->name)+strlen(m->value)+4)*sizeof(char)); 351 sprintf(res,"-D%s=%s",m->name,m->value); 352 return res; 353 } 354 355 /** 336 356 * Create a string containing the JVM -XX:* option for a given map 337 357 * Depending on the map' name: … … 458 478 459 479 for(i=0;i<alen1;i++){ 460 map* vMap=getMapArray(tmp->content,"value",i); 480 map* vMap=getMapArray(tmp->content,"value",i); 461 481 map* sMap=getMapArray(tmp->content,"size",i); 462 482 map* mMap=getMapArray(tmp->content,tmap->value,i); -
trunk/zoo-project/zoo-kernel/service_internal_java.h
r580 r771 45 45 char *parseJVMXOption(map*); 46 46 47 char *parseJVMOption(map*); 48 47 49 int zoo_java_support(maps**,map*,service*,maps**,maps**); 48 50 -
trunk/zoo-project/zoo-services/hello-java/HelloJava.java
r537 r771 25 25 import java.lang.*; 26 26 import java.util.*; 27 import org.zoo_project.*; 27 28 28 29 public class HelloJava { … … 31 32 String v=tmp.get("value").toString(); 32 33 HashMap hm1 = (HashMap)(outputs.get("Result")); 33 hm1.put("value",ZOO. _("Hello "+v+" from JAVA World !!"));34 hm1.put("value",ZOO.translate("Hello "+v+" from JAVA World !!")); 34 35 return ZOO.SERVICE_SUCCEEDED; 35 36 } … … 47 48 } 48 49 HashMap hm1 = (HashMap)(outputs.get("Result")); 49 hm1.put("value",ZOO. _("Hello "+v+" from JAVA World !!"));50 hm1.put("value",ZOO.translate("Hello "+v+" from JAVA World !!")); 50 51 return ZOO.SERVICE_SUCCEEDED; 51 52 }
Note: See TracChangeset
for help on using the changeset viewer.