Source for file Options.inc

Documentation is available at Options.inc

  1. <?php /*-*- mode: php; tab-width:4 -*-*/
  2.  
  3. /*
  4.  * Copyright (C) 2003-2007 Jost Boekemeier.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person
  7.  * obtaining a copy of this file (the "Software"), to deal in the
  8.  * Software without restriction, including without limitation the
  9.  * rights to use, copy, modify, merge, publish, distribute,
  10.  * sublicense, and/or sell copies of the Software, and to permit
  11.  * persons to whom the Software is furnished to do so, subject to the
  12.  * following conditions:
  13.  *
  14.  * The above copyright notice and this permission notice shall be included in
  15.  * all copies or substantial portions of the Software.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  20.  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21.  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22.  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23.  * OTHER DEALINGS IN THE SOFTWARE.
  24.  */
  25.  
  26.  
  27. /**
  28.  * Helper function: Extract the URL from base and
  29.  * and set host, port and servlet accordingly.
  30.  * For example when the user has called:
  31.  * require_once("http://localhost:8080/JavaBridge/java/Java.inc");
  32.  * the JAVA_HOSTS is set to localhost:8080 and
  33.  * JAVA_SERVLET to /JavaBridge/JavaBridge.phpjavabridge.
  34.  * @access private
  35.  */
  36. function java_defineHostFromInitialQuery($java_base{
  37.   if($java_base!="java/"{
  38.     $url parse_url($java_base);
  39.     if(isset($url["scheme"]&& ($url["scheme"]=="http")) {
  40.       $host $url["host"];
  41.       $port $url["port"];
  42.       $path $url["path"];
  43.       define ("JAVA_HOSTS""$host:$port");
  44.       $dir dirname($path);
  45.       define ("JAVA_SERVLET""$dir/JavaBridge.phpjavabridge")// On ;; On or User
  46.       return true;
  47.     }
  48.   }
  49.   return false;
  50. }
  51.  
  52. /**
  53. * The version number of this PHP library.
  54. */
  55. define ("JAVA_PEAR_VERSION""5.3.3");
  56.  
  57. if(!defined("JAVA_SEND_SIZE")) 
  58.   define("JAVA_SEND_SIZE"8192);
  59.  
  60. if(!defined("JAVA_RECV_SIZE")) 
  61.   define("JAVA_RECV_SIZE"8192);
  62.  
  63. if (defined ("JAVA_PARSE_INI_FILE"&& JAVA_PARSE_INI_FILE{
  64.   $ini=@parse_ini_file("java.ini");
  65.     /**
  66.      * The address of the HTTP back end.
  67.      * 
  68.      * For example "127.0.0.1:8080"
  69.      * @see JAVA_SERVLET
  70.      */
  71.   if(array_key_exists("java.hosts"$ini)) define("JAVA_HOSTS"$ini["java.hosts"]);
  72.     /**
  73.      * Rewrite rules for incoming HTTP requests.
  74.      * 
  75.      *Used in conjunction with
  76.     * JAVA_HOSTS and a servlet/J2EE back end
  77.     * <ul>
  78.     * <li>
  79.     * "On"; Hard-codes the context to "JavaBridge":
  80.     * http://foo.com/test.php => http://host1:port1/JavaBridge/test.phpjavabridge
  81.     * cookie path: always "/"
  82.     *<li>
  83.     * "bar/JavaBridge.phpjavabridge"; Hard-codes the context to "bar":
  84.     * http://foo.com/test.php => http://host1:port1/bar/test.phpjavabridge
  85.     * cookie path: always "/"
  86.     *<li>
  87.     * "User"; Separates different web apps:
  88.     * http://foo.com/mApp1/test.php => http://host1:port1/mApp1/test.phpjavabridge
  89.     * cookie path: /mApp1
  90.     * http://foo.com/mApp2/test.php => http://host1:port1/mApp2/test.phpjavabridge
  91.     * cookie path: /mApp2
  92.     *<li>
  93.     * "Off" doesn't use a web context at all (no cookies are generated, no
  94.     * PHP/Java session sharing). Back-end must have been started with
  95.     * INET:PORT or INET_LOCAL:PORT, no Servlet engine, no J2EE server.
  96.     * </ul>
  97.     */
  98.     if(array_key_exists("java.servlet"$ini)) define("JAVA_SERVLET"$ini["java.servlet"]);
  99.     /** The request log level between 0 (log off) and 4 (log debug).
  100.      * 
  101.      * The
  102.     * default request log level is initialized with the value from to the
  103.     * Java system property "php.java.bridge.default_log_level".  The
  104.     * servlet's init-param: servlet_log_level (see WEB-INF/web.xml)
  105.     * overrides this value. The default level is 2.
  106.     * */
  107.  
  108.       if(array_key_exists("java.log_level"$ini)) define("JAVA_LOG_LEVEL"$ini["java.log_level"]);
  109.  }
  110.  
  111.  if(!defined("JAVA_HOSTS")) {
  112.   if(!java_defineHostFromInitialQuery($JAVA_BASE)) {
  113.     define("JAVA_HOSTS""127.0.0.1:8080")// host1:port1;host2:port2;...
  114.   }
  115.  }
  116.  
  117.  if(!defined("JAVA_SERVLET")) {
  118.   define("JAVA_SERVLET""On")// On ;; On or User
  119. }
  120.  
  121. if(!defined("JAVA_LOG_LEVEL"))
  122.   define ("JAVA_LOG_LEVEL"null)// integer between 0 and 4
  123.  
  124.  
  125. /** Use named pipes instead of local TCP sockets.
  126.  * 
  127.  * Set this to
  128. * the directory in which the named pipes should be created.
  129. * Note that pipes are a little bit slower than persistent TCP
  130. * sockets. But they are more secure.
  131. * Example: define("JAVA_PIPE_DIR", "/tmp");
  132. * Default is to use /dev/shm on Linux, false otherwise.
  133. * */
  134.  
  135. if(!defined("JAVA_PIPE_DIR")) {
  136.   if (file_exists ("/dev/shm")) define("JAVA_PIPE_DIR""/dev/shm" );
  137.   elseif (file_exists ("/tmp")) define("JAVA_PIPE_DIR""/tmp" );
  138.   else                          define ("JAVA_PIPE_DIR"null);
  139. }
  140.  
  141. /** Set to 1 for compatibility with earlier versions.
  142.  * 
  143.  * 
  144. * When this flag is set, a value (null, int, ...) is returned immediately. Otherwise
  145. * a proxy (Request$PHPNULL, Integer, ...) is returned and PHP must fetch its content
  146. * using java_values($proxy);
  147. **/
  148.  
  149. if (!defined("JAVA_PREFER_VALUES"))
  150.   define("JAVA_PREFER_VALUES"0);
  151.   
  152. /**
  153. * Debug mode for the client.
  154. * This debug flag is for PHP only. To enable the VMBridge log restart Java with the -Dphp.java.bridge.default_log_level=... option.
  155. * */
  156.  
  157. if(!defined("JAVA_DEBUG")) 
  158.   define("JAVA_DEBUG"false);

Documentation generated on Sun, 30 Nov 2008 10:51:49 +0100 by phpDocumentor 1.4.0a2