Ignore:
Timestamp:
Jun 10, 2016, 1:40:44 AM (9 years ago)
Author:
djay
Message:

Remove the default java.library.path definition and use an optional [java] section instead (where the key java.library.path, amongst other, may be defined). Change _ function name to translate in the Java ZOO-API. Use a ogr.zoo_project package containing the ZOO class. Fix the hello-java service and update doc consequently

Location:
trunk/zoo-project/zoo-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/main_conf_read.l

    r676 r771  
    3434%}
    3535
    36 attname [a-zA-Z0-9_\-:]+
     36attname [a-zA-Z0-9_\-:.]+
    3737
    3838attvalue1       [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=]+
  • trunk/zoo-project/zoo-kernel/service_internal_java.c

    r767 r771  
    9292#endif
    9393#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  }
    96106  int nbc0=0;
    97107  maps* javaXXMap=getMaps(*main_conf,"javaxx");
    98108  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);
    105110  }
    106111#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];
    109113  JavaVMOption *options=(JavaVMOption*)malloc(nb*sizeof(JavaVMOption));
    110114#else
    111   JavaVMOption options[nb+nbc0+nbc1+1];
     115  JavaVMOption options[nb+nbs[1]+nbs[2]+nbs[0]+1];
    112116#endif
    113117  JavaVMInitArgs vm_args;
     
    123127#endif
    124128  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;
    131129  options[0].optionString = oclasspath;
    132130  options[0].extraInfo=NULL;
    133131  options[1].optionString = "-server";
    134132  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";
    139135  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";
    142137  options[3].extraInfo=NULL;
    143   options[4].optionString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7896";
    144   options[4].extraInfo=NULL;
    145138#endif
    146139#ifdef WIN32
     
    148141  options[1].optionString = "-Xmx512m";
    149142#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]);
    154154    options[start+i].optionString = zStrdup(tmp);
    155155    options[start+i].extraInfo=NULL;
    156156    free(tmp);
    157     cursorxx=cursorxx->next;
    158   }
    159   for(;i<nbc1+nbc0;i++){
    160     char *tmp=parseJVMXOption(cursorx);
     157    cursors[0]=cursors[0]->next;
     158  }
     159  for(;i<nbs[0]+nbs[1];i++){
     160    char *tmp=parseJVMXOption(cursors[1]);
    161161    options[start+i].optionString = zStrdup(tmp);
    162162    options[start+i].extraInfo=NULL;
    163163    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;
    165172  }
    166173
     
    168175  vm_args.version = JNI_VERSION_1_6;
    169176  vm_args.options = options;
    170   vm_args.nOptions = start+nbc0+nbc1;
     177  vm_args.nOptions = start+nbs[0]+nbs[1]+nbs[2];
    171178  vm_args.ignoreUnrecognized = JNI_TRUE;
    172179
     
    209216  if (cls != NULL) {
    210217#ifdef JAVA7
    211     (*env).ExceptionClear();
     218@    (*env).ExceptionClear();
    212219    pmid=(*env).GetStaticMethodID(cls, s->name, "(Ljava/util/HashMap;Ljava/util/HashMap;Ljava/util/HashMap;)I");
    213220#else
     
    281288  (*jvm)->DestroyJavaVM(jvm);
    282289#endif
    283   for(i=0;i<nbc1+nbc0;i++){
     290  for(i=0;i<nbs[2]+nbs[1]+nbs[0];i++){
    284291    free(options[start+i].optionString);
    285292  }
     
    334341
    335342/**
     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 */
     349char *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/**
    336356 * Create a string containing the JVM -XX:* option for a given map
    337357 * Depending on the map' name:
     
    458478           
    459479            for(i=0;i<alen1;i++){
    460               map* vMap=getMapArray(tmp->content,"value",i);       
     480              map* vMap=getMapArray(tmp->content,"value",i);
    461481              map* sMap=getMapArray(tmp->content,"size",i);
    462482              map* mMap=getMapArray(tmp->content,tmap->value,i);
  • trunk/zoo-project/zoo-kernel/service_internal_java.h

    r580 r771  
    4545  char *parseJVMXOption(map*);
    4646
     47  char *parseJVMOption(map*);
     48
    4749  int zoo_java_support(maps**,map*,service*,maps**,maps**);
    4850
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png