The Java Middleware module (JavaMW) provides PHP connectivity to Java. The API is analogous to the standard PHP Java API (http://www.zend.com/manual/ref.java.php), however the implementation is different. JavaMW uses a stand-alone Java server process, which allows it to efficiently process Java requests. It adds stability and reliability to the PHP/Java connection. Unlike a standard PHP/Java connector, it uses a single Java virtual machine for all the requests, which makes memory and processor requirements significantly more modest while improving scalability.
The diagram below illustrates the Java Bridge technology:
Java Bridge Process Level
The Java Bridge Process Level diagram illustrates the following:
Platform Nodes include two bridging components: the PHP-side Bridge and the Java-side Bridge. Platform Nodes operate as follows:
A JVM (Java Virtual Machine) is installed first-before installing the Platform Node-on the machine that is to be set up with Platform.
For the Java Bridge to function, you must install a compatible version of JVM. Platform will find the compatible version automatically. Supported versions are SUN J2SE 1.4 or SUN J2SE1.5 (J2SE 5).
Platform then installs the two components required-the PHP-side and the Java-side-to create the Java Bridge.
A PHP application can call a Java object from any Java library that resides on the Node.
For example, JVM can be downloaded with all its component libraries.
When a PHP application calls a Java object over the Java Bridge, a proxy for that object is created in PHP. In the diagram, the Java object is represented as a dark square; the proxy for that object in PHP is shown as a light square.
The J2EE Application Server in its more advanced configuration, allows you to create a PHP/Java Bridge between a Platform Node and an external J2EE Application Server. This type of configuration is typical of companies that have existing Java-based infrastructure. The J2EE Application Server operates as follow:
A PHP application can call a Java object from a Java library external to Platform.
The Java-side Bridge component communicates with the J2EE Server. It finds objects in the J2EE Server, for example an EJB. The entire process is Java based.
The PHP application then calls the Java object over the Java Bridge created between the two Platform bridging components.
A proxy for that object is created in PHP. In the diagram, the Java object is represented as a dark square; the proxy for that object in PHP is shown as a light square.
The complete integration of Java and PHP is described in the following diagram:
Java Bridge System Level
The Java Bridge System Level diagram illustrates the following about the network architecture:
Platform Nodes - In order for a Platform Node to function as a Java Bridge, it must have a properly functioning Java installation. Once Java is installed,the Platform installation installs the required components for the Java Bridge, some of which are implemented in Java.
J2EE Server - The Java-based enterprise that adds Platform will have its own application servers. A J2EE Server is shown in the diagram as part of the Front Office. It can communicate with any of the Platform Nodes that have Java installed on them and which are defined in Java as legitimate accounts.
Platform’s Java Bridge supports a PHP-Java integration that benefits enterprises on both the business and technical level.
Business Level Benefits:
Companies with J2EE application servers can begin to realize the advantages PHP offers over other Web-enablement languages, including: shortened development time, shortened time-to-market, lower TCO (Total Cost of Ownership), etc.
PHP-centric companies can take advantage of J2EE services that are not present in scripting languages.
Technical Level Benefits:
Platform’s PHP/Java Bridge provides the ability to interact with plain Java objects.
Platform’s Java Bridge operates without the overhead of a JVM for each Apache process.
Platform’s Java Bridge consumes a finite amount of memory, which is almost disproportional to the amount of activity that’s going through it.