Before you start
This tutorial series steps you through the process of developing a fully functioning Facebook application using WebSphere Application Server, Rational Application Developer, Zend Core for IBM, PHP 5, and DB2. You will build part of the application using Java code and part in PHP 5. Representing an existing stock brokerage firm, you'll add a Facebook interface to their online portfolio management system.
- In Part 1 you got an overview of Facebook application development, and got started with a barebones application.
- In Part 2 you will do the initial work of creating the Java side of things -- a Rational Application Developer project and Web application using the popular Spring framework.
In Part 1 you took a first look at Facebook and then installed the tools you used: IBM's Rational Application Developer environment, Zend Core For IBM with its included installations of Apache 2 and IBM's DB2 Express-C database, and IBM WebSphere Application Server. You then took a detailed tour of Facebook's integration points -- the mechanisms Facebook provides to integrate the application into the social network -- and started some barebones development. You created and configured the application on Facebook, created a test index.php for the Callback URL, and then set up the DB2 database, creating some basic tables and populating them with sample data to get started.
In this tutorial, Part 2 of the series, you will set up a Rational
Application Developer project to facilitate Java development,
configure a JNDI connection-pooled DB2 data source in IBM WebSphere
Application Server, and use the Spring framework to apply an MVC
structure to the Java code to impose a structure on JDBC access.
You'll then write some general-purpose PHP classes that let you apply
the same MVC structure in the PHP code and that let you inject
properties into class instances similarly to how you would in Spring.
You'll write a general-purpose
Db2DataSource PHP class for connecting to
DB2, and use mod_rewite and mod_proxy to let PHP and Java coexist
transparently at the same URL. This tutorial will structure the Java
and PHP worlds as identically as possible, because one barrier to
integrating the two is that PHP and Java developers often come from
different backgrounds and see the two worlds in different ways. These
two languages can coexist within the same application (and the same
development team) quite happily, and with a high degree of abstraction
and clean structure across the board.
This tutorial is for Java and PHP developers of varying degrees of experience who want to start writing Facebook applications in Java, PHP or integrate the two as parts of a larger application. It's for PHP developers who want to learn what goes into building a J2EE application using the Spring framework and how to apply an object-oriented structure to their PHP applications, and Java developers who want to start using PHP, perhaps in the interest of adding PHP to an existing Java enterprise.
You should read Mastering Facebook application development, Part 1 before continuing with Part 2.
To complete the steps in this tutorial, you need the following software. If you don't have the products installed, or don't have the latest release, you can download free trial versions:
- Download a free trial version of Spring Framework -- I used version 2.5.3, the most current production release.
- Download a free trial version of Rational Application Developer. You'll use Rational Application Developer as a full featured Eclipse based IDE for developing your Java Web application.
- Download a free trial version of IBM WebSphere Application Server V6.1.
- Download Zend Core For IBM (includes IBM DB2® Express-C)
- Zend Studio is an excellent tool for writing PHP code, though any text editor will do.