]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/uwobo/uwobo_common.ml
daemons tamed
[helm.git] / helm / uwobo / uwobo_common.ml
diff --git a/helm/uwobo/uwobo_common.ml b/helm/uwobo/uwobo_common.ml
deleted file mode 100644 (file)
index 8952f81..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-(*
- * Copyright (C) 2003:
- *    Stefano Zacchiroli <zack@cs.unibo.it>
- *    for the HELM Team http://helm.cs.unibo.it/
- *
- *  This file is part of HELM, an Hypertextual, Electronic
- *  Library of Mathematics, developed at the Computer Science
- *  Department, University of Bologna, Italy.
- *
- *  HELM is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  HELM is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with HELM; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- *  MA  02111-1307, USA.
- *
- *  For details, see the HELM World-Wide-Web page,
- *  http://helm.cs.unibo.it/
- *)
-
-open Printf ;;
-
-exception Uwobo_failure of string ;;
-
-let uwobo_namespace = "http://helm.cs.unibo.it/uwobo" ;;
-let xsl_namespace = "http://helm.cs.unibo.it/uwobo" ;;
-
-let supported_properties = [
-  "cdata-section-elements";
-  "doctype-public";
-  "doctype-system";
-  "encoding";
-  "indent";
-  "media-type";
-  "method";
-  "omit-xml-declaration";
-  "standalone";
-  "version"
-]
-
-let is_supported_property name = List.mem name supported_properties
-
-let version = "0.3.0" ;;
-
-let usage_string =
-  sprintf
-    "
-<html>
-  <head>
-    <title>UWOBO's help message</title>
-  </head>
-  <body>
-    <h1>UWOBO (version: %s)</h1>
-    <h2>Information</h2>
-    Version: %s
-    <h2>Usage</h2>
-    <p>
-    Usage: <kbd>http://hostname:uwoboport/</kbd><em>command</em>
-    </p>
-    <p>
-    Available commands:
-    </p>
-    <p>
-      <b><kbd>help</kbd></b><br />
-      displays this help message
-    </p>
-    <p>
-      <b><kbd>newsession?port=p</kbd></b><br />
-      starts a new daemon on a given port <em>p</em>
-    </p>
-    <p>
-      <b><kbd>kill</kbd></b><br />
-      kills the daemon. The log file is mantained.
-    </p>
-    <p>
-      <b><kbd>add?bind=key,uri[&bind=key,uri[&...]]</kbd></b><br />
-      loads a new stylesheet, specified by <em>uri</em>, and bind it to key
-          <em>key</em>
-    </p>
-    <p>
-      <b><kbd>remove?keys=[key1,key2,...]</kbd></b><br />
-      unload stylesheets specified by <em>key1, key2, ...</em> or all
-          stylesheets if no key was given
-    </p>
-    <p>
-      <b><kbd>reload?keys=[key1,key2,...]</kbd></b><br />
-      reloads the stylesheets specified by <em>key1, key2, ...</em>. Reloads all
-          the stylesheets if no key was given
-    </p>
-    <p>
-      <b><kbd>list</kbd></b><br />
-      returns the list of loaded stylesheets
-    </p>
-    <p>
-      <b><kbd>apply?xmluri=uri&keys=key1,key2,...[&errormode={ignore|comment|embed}][&debugmode={ignore|comment|embed}][&profile=id][&password=password][&param.name=value[&param.name=value[&...]]][&param.key.name=value[&param.key.name=value[&...]]][&prop.name[=value][&prop.name[=value][&...]]]</kbd></b><br />
-      applies a chain of stylesheets, specified by <em>key1, key2, ...</em>, to an
-      input document, specified by <em>uri</em>.<br />
-      Error and debugging modes could be ste to three different values.
-      <em>ignore</em> means that LibXSLT messages are ignored; <em>comment</em>
-      meanst that LibXSLT messages are embedded in the result document inside an
-      XML like comment; <em>embed</em> means that LibXSLT messages are embedded
-      at the beginning of the result document (as childs of the root node) in
-      XML elements in the UWOBO namespace<br />
-      Additional parameters can be set for each stylesheet application: global
-      parameters (i.e. parameters passed to all stylesheets) are set using
-      <em>param.name=value</em> syntax, per stylesheet parameters are set using
-      <em>param.key.name=value</em> where <em>key</em> is the key of a loaded
-      stylesheet.<br />
-      Moreover, it is possible to specify a <em>profile</em> that is searched for
-      additional global and local parameters. The parameters stored in the profile
-      have lower precedence with respect to those provided in the URL. A
-      <em>password</em> for the profile must be provided if the read permission
-      of the profile is set to false.<br />
-      Properties of the final chain output can be set as well: valueless properties
-      can be set using <em>prop.name</em> syntax, others can be set using
-      <em>prop.name=value</em> syntax.<br />
-      Current supported properties are: %s.
-    </p>
-    <p>
-      <b><kbd>listprofiles</kbd></b><br />
-      returns the list of profiles available
-    </p>
-    <p>
-      <b><kbd>createprofile?[id=id][&orig=orig][&origpassword=origpassword][&readperm={public|private}][&writeperm={public|private}][&adminperm={public|private}][&password=password]</kbd></b><br />
-      creates a new profile. The id of the created profile is <em>id</em> (if provided); otherwise it is a fresh id.
-      The parameters are inherited from the profile <em>orig</em>, if provided. <em>origpassword</em> is the password of the
-      profile being copied in case the read permission of that profile is set to false. The default for
-      <em>password</em> is no password, the defaults for <em>readper,writeperm,adminperm</em> are public, public, public.
-    </p>
-    <p>
-      <b><kbd>removeprofile?id=id[&password=password]</kbd></b><br />
-      removes the profile <em>id</em>. The password is required if the profile administrative permission
-      is set to false.
-    </p>
-    <p>
-      <b><kbd>setparam?id=id[&password=password]&key=key[&value=value]</kbd></b><br />
-      sets the parameter <em>key</em> to <em>value</em>, if <em>value</em> is provided; otherwise
-      the parameter is unset. The password is required if the profile writing permission is set to
-      false.
-    </p>
-    <p>
-      <b><kbd>setpassword?id=id[&oldpassword=oldpassword][&password=password]</kbd></b><br />
-      changes or unset the password for a profile. The old password is required if it was set.
-    </p>
-    <p>
-      <b><kbd>setpermission?id=id[&password=password]&permission={read|write|admin}&value={public|private}</kbd></b><br />
-      changes the permission <em>permission</em>. The password is required if the administrative permission
-      is set to false.
-    </p>
-    <p>
-      <b><kbd>getparams?id=id[&password=password]</kbd></b><br />
-      returns all the parameters of the profile <em>id</em>. The password is required if the read permission
-      is set to false.
-    </p>
-    <p>
-      <b><kbd>getparam?id=id[&password=password]&key=key</kbd></b><br />
-      returns the value of the parameter <em>key</em> of the profile <em>id</em>. The password is required if the read permission
-      is set to false.
-    </p>
-    <p>
-      <b><kbd>getpermission?id=id[&password=password]&for={read|write|admin}</kbd></b><br />
-      returns the value of the permission <em>key</em> of the profile <em>id</em>. The password is required if the administrative
-      permission is set to false.
-    </p>
-  </body>
-</html>
-"
-    version version
-    (String.concat ", " supported_properties) (* supported properties *)
-;;
-
-let pp_error =
-  sprintf
-    "<html><body><span style=\"color:red\">Error: %s</span>%s</body></html>"
-;;
-let return_error msg ?(body = "") outchan =
-  Http_daemon.respond ~body:(pp_error msg body) outchan;;
-let bad_request body outchan =
-  Http_daemon.respond_error ~code:(`Code 400) ~body outchan
-;;
-
-  (** {2 LibXSLT logging} *)
-
-type xslt_msg =
-  | LibXsltErrorMsg of string
-  | LibXsltDebugMsg of string
-;;
-
-let string_of_xslt_msg = function
-  | LibXsltErrorMsg msg -> "LibXSLT ERROR: " ^ msg
-  | LibXsltDebugMsg msg -> "LibXSLT DEBUG: " ^ msg
-;;
-
-type xslt_msg_mode =
-  | LibXsltMsgIgnore
-  | LibXsltMsgComment
-  | LibXsltMsgEmbed
-;;
-
-class libXsltLogger =
-  let is_libxslt_error = function LibXsltErrorMsg _ -> true | _ -> false in
-  let is_libxslt_debug = function LibXsltDebugMsg _ -> true | _ -> false in
-  let flatten_libxslt_msg = function
-    | LibXsltErrorMsg msg -> msg
-    | LibXsltDebugMsg msg -> msg
-  in
-  object (self)
-
-    initializer
-      Gdome_xslt.setErrorCallback
-        (Some (fun msg -> self#appendMsg (LibXsltErrorMsg msg)));
-      Gdome_xslt.setDebugCallback
-        (Some (fun msg -> self#appendMsg (LibXsltDebugMsg msg)))
-
-    val mutable libXsltMsgs = []  (** libxslt's error and debugging messages *)
-
-      (* libxslt's error and debugging messages handling *)
-
-    method private appendMsg msg = libXsltMsgs <- msg :: libXsltMsgs
-
-    method clearMsgs = libXsltMsgs <- []
-    method clearErrorMsgs =
-      libXsltMsgs <- List.filter is_libxslt_debug libXsltMsgs
-    method clearDebugMsgs =
-      libXsltMsgs <- List.filter is_libxslt_error libXsltMsgs
-
-    method msgs = libXsltMsgs
-    method errorMsgs =
-      List.map flatten_libxslt_msg (List.filter is_libxslt_error libXsltMsgs)
-    method debugMsgs =
-      List.map flatten_libxslt_msg (List.filter is_libxslt_debug libXsltMsgs)
-
-  end
-;;
-