]> matita.cs.unibo.it Git - helm.git/commitdiff
Porting of uriSetQueue to Helm_registry.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 16 Feb 2004 22:50:06 +0000 (22:50 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 16 Feb 2004 22:50:06 +0000 (22:50 +0000)
helm/graphs/tools/Makefile
helm/graphs/tools/uriSetQueue.conf.xml.sample [new file with mode: 0644]
helm/graphs/tools/uriSetQueue.ml

index 1d945f8fd66e8abb350a93cf26df7be76b0606fd..0726670319c97eda7006eeeb0a78bc8d6a6aaabd 100644 (file)
@@ -3,7 +3,7 @@ DOT=dot
 #SED=sed "s/font-family:Times;//g"
 SED=cat
 
-REQUIRES = http
+REQUIRES = http helm-registry
 PREDICATES = mt
 OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread
 OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS)
diff --git a/helm/graphs/tools/uriSetQueue.conf.xml.sample b/helm/graphs/tools/uriSetQueue.conf.xml.sample
new file mode 100644 (file)
index 0000000..9bfc3d8
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="uriSetQueue">
+    <key name="port">58082</key>
+  </section>
+</helm_registry>
index 12b7e91c0b95bd591c7f45b82349ac800eea8851..77d15dcad104d87bfecb45d2a6f138d9c71c0f47 100644 (file)
@@ -29,9 +29,8 @@ Http_common.debug := debug;;
 
 open Printf;;
 
+let configuration_file = "/projects/helm/etc/uriSetQueue.conf.xml";;
 let daemon_name = "Uri Set Queue";;
-let default_port = 48082;;
-let port_env_var = "URI_SET_QUEUE_PORT";;
 
 module OrderedUri: Set.OrderedType with type t = string =
   struct
@@ -77,15 +76,6 @@ let queue_mem item queue =  (* mem function over queues *)
   with Found -> true
 ;;
 
-let port =
-  try
-    int_of_string (Sys.getenv port_env_var)
-  with
-  | Not_found -> default_port
-  | Failure "int_of_string" ->
-      prerr_endline "Warning: invalid port, reverting to default";
-      default_port
-in
 let callback (req: Http_types.request) outchan =
   try
     let res = new Http_response.response () in
@@ -191,6 +181,8 @@ let callback (req: Http_types.request) outchan =
         outchan
 in
 
+Helm_registry.load_from configuration_file;
+let port = Helm_registry.get_int "uri_set_queue.port" in
 printf "%s started and listening on port %d\n" daemon_name port;
 flush stdout;
 Http_daemon.start' ~port ~mode:`Thread callback;