Page 211 - Open Soource Technologies 304.indd
P. 211
Open Source Technologies
Notes
Product: Quercus, a feature of Resin application server.
Industry: Medical
Engineering Challenge:
When David Berry assumed the role of CTO at LiveProcess, he inherited version 1.0 of the
LiveProcess platform, a PHP based web application consisting of eight person years of code.
As the project moved forward, several of the existing functions and new feature requirements
could be implemented better as background tasks. However, PHP on.
Apache is a user-initiated programming environment and requires user input to run PHP.
As an experienced Java developer, David Berry knew that Java could handle the background
tasks through multithreading and wanted the added Java benefits of integrated security and
connection pooling.
The challenge became – could we integrate PHP with Java EE or would we need to replace
PHP?
Analysis:
Rewriting the PHP application to JSP, Struts, Spring, or JSF would take too much time so
we focused our analysis on making PHP work with Java. We identified two solutions: a
Java-PHP bridge or Quercus.
The Java-PHP bridge would consist of Java calling a running instance of Apache/PHP via
RMI, but this would be cumbersome to deploy in a production environment.
Because Quercus runs as a Java Servlet and compiles PHP into Java, it could run the
application with minor modifications and would allow the application to directly access Java
objects. The Quercus solution would let us easily integrate container managed security, an
open-source persistence library and a scheduler library.
Findings:
In our trial, 90% of the application immediately ran on Quercus. The last 10% required a
little recoding and the release of Resin 3.1.
After the application completely passed our regression tests using Quercus, we started to
enhance the LiveProcess platform PHP code with Java. The first enhancement was to use
Java EE container managed security to authenticate users and determine which PHP pages
they could access. We did this by implementing a custom authentication class that used the
existing user tables in our application. This allowed us to remove the “isLoggedIn” check
that we did at the head of every PHP page.
The second area that we focused on was connecting PHP to a Java persistence library.
This allowed us to use enterprise level Java features including connection pooling and
prepared statement pooling, features which are not easily done in PHP.
During our development process, we discovered that using object oriented PHP to develop
a page template framework was superior to JSP or Struts. Our PHP template framework let
Contd...
206 LOVELY PROFESSIONAL UNIVERSITY