enable configure query type tru CLI
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 9 Feb 2006 15:55:14 +0000 (15:55 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 9 Feb 2006 15:55:14 +0000 (15:55 +0000)
org.glite.jp.index/doc/README
org.glite.jp.index/src/conf.c

index 267b88a..67091b2 100644 (file)
@@ -71,7 +71,9 @@ hard-coded options.
 The index server takes the following options:
 
 ./glite-jp-indexd [option]
+       -s, --ps-server  primary storage server address (http://hostname:port)
         -d, --debug      don't run as daemon, additional diagnostics
+       -q, --query-type hist/cont/both (default history)       
         -n, --noauth     don't check user identity with result owner
         -m, --mysql      database connect string
         -p, --port       port to listen
@@ -79,9 +81,11 @@ The index server takes the following options:
         -o, --logfile    file to store logs
 
 
-which can be substituted (if both set, command line option has priority)
+some of which can be substituted (if both set, command line option has priority)
 with env. variables:
 
+GLITE_JPIS_PS          - location of JP-PS server (required parameter)
+                       (for example http://umbar.ics.muni.cz:8901)
 GLITE_JPIS_DEBUG       - if set to "0" don't daemonize (default - deamonize)
 GLITE_JPIS_PORT        - used port (default 8902)
 GLITE_JPIS_DB          - database connection string 
@@ -91,12 +95,6 @@ GLITE_JPIS_LOGFILE   - log file (default for root /var/log/glite-jp-indexd.log
 GLITE_JPIS_PIDFILE     - pid file (default for root /var/run/glite-jp-indexd.log
                        non-root user ~/glite-jp-indexd.pid)
 
-
-Parameter which is now configurable only through env. variable is:
-
-GLITE_JPIS_PS   - location of JP-PS server (required parameter)
-                  (for example http://umbar.ics.muni.cz:8901)
-
 Other parameters will be configurable in close future. Its
 current hard-coded values are in org.glite.jp.index/src/conf.[ch]
 
index fba9b91..ed3a6e5 100644 (file)
 #include "db_ops.h"
 
 
-static const char *get_opt_string = "s:dc:k:C:V:nm:p:i:o:";
+static const char *get_opt_string = "s:dq:c:k:C:V:nm:p:i:o:";
 
 static struct option opts[] = {
        {"is-server",   1, NULL,        's'},
        {"debug",       0, NULL,        'd'},
+       {"query-type",  1, NULL,        'q'},
 //     {"cert",        1, NULL,        'c'},
 //     {"key",         1, NULL,        'k'},
 //     {"CAdir",       1, NULL,        'C'},
@@ -40,6 +41,7 @@ static void usage(char *me)
        fprintf(stderr,"usage: %s [option]\n"
                "\t-s, --ps-server\t primary storage server address (http://hostname:port)\n"
                "\t-d, --debug\t don't run as daemon, additional diagnostics\n"
+               "\t-q, --query-type hist/cont/both (default history)\n"
 //             "\t-k, --key\t private key file\n" 
 //             "\t-c, --cert\t certificate file\n"
 //             "\t-C, --CAdir\t trusted certificates directory\n"
@@ -56,7 +58,7 @@ static void usage(char *me)
 
 int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration)
 {
-       char                    *env, *ps = NULL;
+       char                    *env, *ps = NULL, *qt = NULL;;
        int                     opt;
        glite_jp_is_conf        *conf;
 
@@ -67,6 +69,7 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf
        while ((opt = getopt_long(argc,argv,get_opt_string,opts,NULL)) != EOF) switch (opt) {
                case 's': ps = optarg; break;
                case 'd': conf->debug = 1; break;
+               case 'q': qt = optarg; break;
 //             case 'c': server_cert = optarg; break;
 //             case 'k': server_key = optarg; break;
 //             case 'C': cadir = optarg; break;
@@ -177,8 +180,18 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf
        conf->feeds[0]->query[0][0].op = GLITE_JP_QUERYOP_GREATER;
        conf->feeds[0]->query[0][0].value = strdup("0");
 
-       conf->feeds[0]->history = 1;
-       conf->feeds[0]->continuous = 0;
+       if (qt && !strcmp(qt,"both")) {
+               conf->feeds[0]->history = 1;
+               conf->feeds[0]->continuous = 1;
+       }
+       else if (qt && !strcmp(qt,"continuous")) {
+               conf->feeds[0]->history = 0;
+               conf->feeds[0]->continuous = 1;
+       }
+       else {
+               conf->feeds[0]->history = 1;
+               conf->feeds[0]->continuous = 0;
+       }
 
        conf->feeds[1] = NULL;