cvs: phpdoc /en/reference/java book.xml constants.xml examples.xml reference.xml servlet.xml setup.xml

From: Date: Sun, 23 Dec 2007 20:44:22 +0000
Subject: cvs: phpdoc /en/reference/java book.xml constants.xml examples.xml reference.xml servlet.xml setup.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-771@lists.php.net to get a copy of this message
bjori Sun Dec 23 20:44:22 2007 UTC Modified files: /phpdoc/en/reference/java book.xml constants.xml examples.xml servlet.xml setup.xml reference.xml Log: MFB: Upgrade to the new-reference-structure - (Created missing setup sections in setup.xml, if any) - Moved the intro to book.xml - Changed the intro ID from <extname>.intro to intro.<extname> - Created empty constants appendix (constants.xml) - Moved the examples into its own chapter (examples.xml) NOTE: The chapter uses the ID 'java.examples' while the first example was renamed to 'java.examples-basic' - Moved the requirements and resources sections to setup.xml - Moved the configure and ini entities to setup.xml - Moved the java.servlet section into its own chapter (servlet.xml)

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/book.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/java/book.xml diff -u /dev/null phpdoc/en/reference/java/book.xml:1.2 --- /dev/null Sun Dec 23 20:44:22 2007 +++ phpdoc/en/reference/java/book.xml Sun Dec 23 20:44:22 2007 @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> +<!-- Purpose: remote.other --> +<!-- Membership: pecl, external --> +<!-- State: experimental --> + +<book xml:id="book.java" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>Java</title> + + <!-- {{{ preface --> + <preface xml:id="intro.java"> + &reftitle.intro; + <para> + There are two possible ways to bridge PHP and Java: you can either + <link linkend="java.servlet">integrate PHP into a Java Servlet + environment</link>, which is the more stable and efficient solution, + or integrate Java support into PHP. The former is provided by a SAPI + module that interfaces with the Servlet server, the latter by this + Java extension. + </para> + <para> + The Java extension provides a simple and effective means for creating and + invoking methods on Java objects from PHP. The JVM is created using JNI, + and everything runs in-process. + </para> + &warn.experimental; + </preface> + <!-- }}} --> + + &reference.java.setup; + &reference.java.constants; + &reference.java.servlet; + &reference.java.examples; + &reference.java.reference; + +</book> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/constants.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/java/constants.xml diff -u /dev/null phpdoc/en/reference/java/constants.xml:1.2 --- /dev/null Sun Dec 23 20:44:22 2007 +++ phpdoc/en/reference/java/constants.xml Sun Dec 23 20:44:22 2007 @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<appendix xml:id="java.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.constants; + &no.constants; +</appendix> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/examples.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/java/examples.xml diff -u /dev/null phpdoc/en/reference/java/examples.xml:1.2 --- /dev/null Sun Dec 23 20:44:22 2007 +++ phpdoc/en/reference/java/examples.xml Sun Dec 23 20:44:22 2007 @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="java.examples" xmlns="http://docbook.org/ns/docbook"> + &reftitle.examples; + <section xml:id="java.examples-basic"> + <para> + <example> + <title>Java Example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// get instance of Java class java.lang.System in PHP +$system = new Java('java.lang.System'); + +// demonstrate property access +echo 'Java version=' . $system->getProperty('java.version') . '<br />'; +echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />'; +echo 'OS=' . $system->getProperty('os.name') . ' ' . + $system->getProperty('os.version') . ' on ' . + $system->getProperty('os.arch') . ' <br />'; + +// java.util.Date example +$formatter = new Java('java.text.SimpleDateFormat', + "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); + +echo $formatter->format(new Java('java.util.Date')); +?> +]]> + </programlisting> + </example> + <example> + <title>AWT Example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// This example is only intended to be run as a CGI. + +$frame = new Java('java.awt.Frame', 'PHP'); +$button = new Java('java.awt.Button', 'Hello Java World!'); + +$frame->add('North', $button); +$frame->validate(); +$frame->pack(); +$frame->visible = True; + +$thread = new Java('java.lang.Thread'); +$thread->sleep(10000); + +$frame->dispose(); +?> +]]> + </programlisting> + </example> + + Notes: + + <itemizedlist> + <listitem> + <simpara> + <literal>new Java()</literal> will create an instance of a class if + a suitable constructor is available. If no parameters are passed and + the default constructor is useful as it provides access to classes + like <literal>java.lang.System</literal> which expose most of their + functionallity through static methods. + </simpara> + </listitem> + <listitem> + <simpara> + Accessing a member of an instance will first look for bean properties + then public fields. In other words, <literal>print $date.time</literal> + will first attempt to be resolved as <literal>$date.getTime()</literal>, + then as <literal>$date.time</literal>. + </simpara> + </listitem> + <listitem> + <simpara> + Both static and instance members can be accessed on an object with + the same syntax. Furthermore, if the java object is of type + <literal>java.lang.Class</literal>, then static members of the class + (fields and methods) can be accessed. + </simpara> + </listitem> + <listitem> + <para> + Exceptions raised result in PHP warnings, and &null; results. The + warnings may be eliminated by prefixing the method call with an + "@" sign. The following APIs may be used to retrieve and reset + the last error: + <itemizedlist> + <listitem><simpara><function>java_last_exception_get</function></simpara></listitem> + <listitem><simpara><function>java_last_exception_clear</function></simpara></listitem> + </itemizedlist> + </para> + </listitem> + <listitem> + <simpara> + Overload resolution is in general a hard problem given the + differences in types between the two languages. The PHP Java + extension employs a simple, but fairly effective, metric for + determining which overload is the best match. + </simpara> + <simpara> + Additionally, method names in PHP are not case sensitive, potentially + increasing the number of overloads to select from. + </simpara> + <simpara> + Once a method is selected, the parameters are coerced if necessary, + possibly with a loss of data (example: double precision floating point + numbers will be converted to boolean). + <!-- FIXME Why aren't java-doubles converted to PHP-floats? Is this + correct? --> + </simpara> + </listitem> + <listitem> + <simpara> + In the tradition of PHP, arrays and hashtables may pretty much + be used interchangably. Note that hashtables in PHP may only be + indexed by integers or strings; and that arrays of primitive types + in Java can not be sparse. Also note that these constructs are + passed by value, so may be expensive in terms of memory and time. + </simpara> + </listitem> + </itemizedlist> + </para> + </section> +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/servlet.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/java/servlet.xml diff -u /dev/null phpdoc/en/reference/java/servlet.xml:1.2 --- /dev/null Sun Dec 23 20:44:22 2007 +++ phpdoc/en/reference/java/servlet.xml Sun Dec 23 20:44:22 2007 @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="java.servlet" xmlns="http://docbook.org/ns/docbook"> + <title>Java Servlet SAPI</title> + <para> + The Java Servlet SAPI builds upon the mechanism defined by the Java + extension to enable the entire PHP processor to be run as a servlet. + The primary advantage of this from a PHP perspective is that web servers + which support servlets typically take great care in pooling and reusing + JVMs. Build instructions for the Servlet SAPI module can be found in + <filename>php4/sapi/README</filename>. + + Notes: + + <itemizedlist> + <listitem> + <simpara> + While this code is intended to be able to run on any servlet engine, + it has only been tested on Apache's Jakarta/tomcat to date. Bug + reports, success stories and/or patches required to get this code + to run on other engines would be appreciated. + </simpara> + </listitem> + <listitem> + <simpara> + PHP has a habit of changing the working directory. sapi/servlet will + eventually change it back, but while PHP is running the servlet engine + may not be able to load any classes from the CLASSPATH which are + specified using a relative directory syntax, or find the work directory + used for administration and JSP compilation tasks. + </simpara> + </listitem> + </itemizedlist> + </para> +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/setup.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/java/setup.xml diff -u /dev/null phpdoc/en/reference/java/setup.xml:1.2 --- /dev/null Sun Dec 23 20:44:22 2007 +++ phpdoc/en/reference/java/setup.xml Sun Dec 23 20:44:22 2007 @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="java.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.setup; + + <!-- {{{ Requirements --> + <section xml:id="java.requirements"> + &reftitle.required; + <para> + You need a Java VM installed on your machine to use this extension. + </para> + </section> + <!-- }}} --> + + <!-- {{{ Installation --> + &reference.java.configure; + <!-- }}} --> + + <!-- {{{ Configuration --> + &reference.java.ini; + <!-- }}} --> + + <!-- {{{ Resources --> + <section xml:id="java.resources"> + &reftitle.resources; + &no.resource; + </section> + <!-- }}} --> + +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/java/reference.xml?r1=1.15&r2=1.16&diff_format=u Index: phpdoc/en/reference/java/reference.xml diff -u phpdoc/en/reference/java/reference.xml:1.15 phpdoc/en/reference/java/reference.xml:1.16 --- phpdoc/en/reference/java/reference.xml:1.15 Mon Dec 10 17:06:04 2007 +++ phpdoc/en/reference/java/reference.xml Sun Dec 23 20:44:22 2007 @@ -1,214 +1,12 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.15 $ --> -<!-- Purpose: remote.other --> -<!-- Membership: pecl, external --> -<!-- State: experimental --> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.16 $ --> - <reference xml:id="ref.java" xmlns="http://docbook.org/ns/docbook"> - <title>PHP / Java Integration</title> - <titleabbrev>Java</titleabbrev> - <partintro> - - <section xml:id="java.intro"> - &reftitle.intro; - <para> - There are two possible ways to bridge PHP and Java: you can either - <link linkend="java.servlet">integrate PHP into a Java Servlet - environment</link>, which is the more stable and efficient solution, - or integrate Java support into PHP. The former is provided by a SAPI - module that interfaces with the Servlet server, the latter by this - Java extension. - </para> - <para> - The Java extension provides a simple and effective means for creating and - invoking methods on Java objects from PHP. The JVM is created using JNI, - and everything runs in-process. - </para> - &warn.experimental; - </section> - - <section xml:id="java.requirements"> - &reftitle.required; - <para> - You need a Java VM installed on your machine to use this extension. - </para> - </section> - - &reference.java.configure; +<reference xml:id="ref.java" xmlns="http://docbook.org/ns/docbook"> + <title>PHP / Java Integration</title> - &reference.java.ini; + &reference.java.entities.functions; - <section xml:id="java.resources"> - &reftitle.resources; - &no.resource; - </section> - - <section xml:id="java.constants"> - &reftitle.constants; - &no.constants; - </section> - - <section xml:id="java.examples"> - &reftitle.examples; - <para> - <example> - <title>Java Example</title> - <programlisting role="php"> -<![CDATA[ -<?php -// get instance of Java class java.lang.System in PHP -$system = new Java('java.lang.System'); - -// demonstrate property access -echo 'Java version=' . $system->getProperty('java.version') . '<br />'; -echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />'; -echo 'OS=' . $system->getProperty('os.name') . ' ' . - $system->getProperty('os.version') . ' on ' . - $system->getProperty('os.arch') . ' <br />'; - -// java.util.Date example -$formatter = new Java('java.text.SimpleDateFormat', - "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); - -echo $formatter->format(new Java('java.util.Date')); -?> -]]> - </programlisting> - </example> - <example> - <title>AWT Example</title> - <programlisting role="php"> -<![CDATA[ -<?php -// This example is only intended to be run as a CGI. - -$frame = new Java('java.awt.Frame', 'PHP'); -$button = new Java('java.awt.Button', 'Hello Java World!'); - -$frame->add('North', $button); -$frame->validate(); -$frame->pack(); -$frame->visible = True; - -$thread = new Java('java.lang.Thread'); -$thread->sleep(10000); - -$frame->dispose(); -?> -]]> - </programlisting> - </example> - - Notes: - - <itemizedlist> - <listitem> - <simpara> - <literal>new Java()</literal> will create an instance of a class if - a suitable constructor is available. If no parameters are passed and - the default constructor is useful as it provides access to classes - like <literal>java.lang.System</literal> which expose most of their - functionallity through static methods. - </simpara> - </listitem> - <listitem> - <simpara> - Accessing a member of an instance will first look for bean properties - then public fields. In other words, <literal>print $date.time</literal> - will first attempt to be resolved as <literal>$date.getTime()</literal>, - then as <literal>$date.time</literal>. - </simpara> - </listitem> - <listitem> - <simpara> - Both static and instance members can be accessed on an object with - the same syntax. Furthermore, if the java object is of type - <literal>java.lang.Class</literal>, then static members of the class - (fields and methods) can be accessed. - </simpara> - </listitem> - <listitem> - <para> - Exceptions raised result in PHP warnings, and &null; results. The - warnings may be eliminated by prefixing the method call with an - "@" sign. The following APIs may be used to retrieve and reset - the last error: - <itemizedlist> - <listitem><simpara><function>java_last_exception_get</function></simpara></listitem> - <listitem><simpara><function>java_last_exception_clear</function></simpara></listitem> - </itemizedlist> - </para> - </listitem> - <listitem> - <simpara> - Overload resolution is in general a hard problem given the - differences in types between the two languages. The PHP Java - extension employs a simple, but fairly effective, metric for - determining which overload is the best match. - </simpara> - <simpara> - Additionally, method names in PHP are not case sensitive, potentially - increasing the number of overloads to select from. - </simpara> - <simpara> - Once a method is selected, the parameters are coerced if necessary, - possibly with a loss of data (example: double precision floating point - numbers will be converted to boolean). - <!-- FIXME Why aren't java-doubles converted to PHP-floats? Is this - correct? --> - </simpara> - </listitem> - <listitem> - <simpara> - In the tradition of PHP, arrays and hashtables may pretty much - be used interchangably. Note that hashtables in PHP may only be - indexed by integers or strings; and that arrays of primitive types - in Java can not be sparse. Also note that these constructs are - passed by value, so may be expensive in terms of memory and time. - </simpara> - </listitem> - </itemizedlist> - </para> - </section> - - <section xml:id="java.servlet"> - <title>Java Servlet SAPI</title> - <para> - The Java Servlet SAPI builds upon the mechanism defined by the Java - extension to enable the entire PHP processor to be run as a servlet. - The primary advantage of this from a PHP perspective is that web servers - which support servlets typically take great care in pooling and reusing - JVMs. Build instructions for the Servlet SAPI module can be found in - <filename>php4/sapi/README</filename>. - - Notes: - - <itemizedlist> - <listitem> - <simpara> - While this code is intended to be able to run on any servlet engine, - it has only been tested on Apache's Jakarta/tomcat to date. Bug - reports, success stories and/or patches required to get this code - to run on other engines would be appreciated. - </simpara> - </listitem> - <listitem> - <simpara> - PHP has a habit of changing the working directory. sapi/servlet will - eventually change it back, but while PHP is running the servlet engine - may not be able to load any classes from the CLASSPATH which are - specified using a relative directory syntax, or find the work directory - used for administration and JSP compilation tasks. - </simpara> - </listitem> - </itemizedlist> - </para> - </section> - </partintro> - -&reference.java.entities.functions; - - </reference> +</reference> <!-- Keep this comment at the end of the file Local variables:
« previous php.doc.cvs (#771) next »