- Advanced Setup
This chapter is out of date and is no longer being maintained. It is only being retained for historical purposes. The replacement chapter can be found in Patching and Building Customized 3rd Party Libraries.
FWD depends upon a range of 3 rd party software. Some of that 3 rd party software has been modified, fixed or otherwise customized for the needs of FWD. For most of the common development tasks a FWD developer will have no need to make modifications to these 3 rd party projects. However, there are times when the ability to debug into or modify such projects is important. This chapter describes the setup process for each of the customized projects upon which FWD is dependent.
The modified version of each of these projects is already built and included in the FWD distribution. The setup described in this chapter is not necessary to have a working FWD development environment. It is only necessary if modifications are needed to the 3 rd party software or if it is necessary to use a debugger or other tools (e.g. a profiler) to step through or otherwise analyze that software.
TODO: this section is out of date. FWD now uses a customized version of Hibernate 4.1.8.
A customized version of Hibernate v3.0.5 is included in the FWD project. At this time, there are significant dependencies upon this version of Hibernate, so it is a requirement to use this specific version.
Hibernate is used to provide object to relational database mapping, database caching and other data persistence support.
hibernate-3.0.5.zip. Execute the following commands:
cd ~/projects unzip hibernate-3.0.5 cd hibernate-3.0/grammar patch hql-sql.g $P2J/lib/hibernate_3.0.5_hql-sql.g.20060906_patch patch hql-sql.g $P2J/lib/hibernate_3.0.5_hql-sql.g.20061018_patch patch sql-gen.g $P2J/lib/hibernate_3.0.5_sql-gen.g.20060906_patch patch sql-gen.g $P2J/lib/hibernate_3.0.5_sql-gen.g.20061018_patch patch sql-gen.g $P2J/lib/hibernate_3.0.5_sql-gen.g.20061101_patch cd .. patch src/org/hibernate/hql/ast/SqlGenerator.java $P2J/lib/hibernate_3.0.5_SqlGenerator.java.20061024_patch
To build the modified Hibernate:
cd ~/projects/hibernate-3.0/ java -cp "lib/ant-launcher-1.6.3.jar" org.apache.tools.ant.launch.Launcher -lib lib
The rebuilt Hibernate jar file must be copied to
cp ../hibernate/hibernate3.jar $P2J/lib/
It is a good practice to completely rebuild FWD once the new version of Hibernate is copied in.
The H2 database (see
www.h2database.com) is used in embedded mode for temporary table support and for internal runtime housekeeping. Also, the H2 database can be used for permanent databases, either in embedded or TCP mode, but is not recommended for production use. It is recommended to limit H2 usage to testing or development purposes.
The H2 version v.1.2.147 version is currently used by the FWD project. The
h2.jar with these version is part of the FWD project and can be found in the
h2-2010-11-21.zip. Execute the following commands:
cd ~/projects unzip h2-2010-11-21
Apply any custom patches you may need.
To build the H2 project:
cd ~/projects/h2/ ./build.sh jar
The rebuilt H2 jar file must be copied to
cp bin/h2-1.2.147.jar $P2J/lib/h2.jar
It is a good practice to completely rebuild FWD once the new version of H2 is copied in.
PL/Java is used to provide user defined functions written in Java for use with the PostgreSQL database. This is used to improve performance by significantly reducing the number rows that are returned from the database, since the filtering of those rows can be implemented on the database server using custom Java logic.
At this time, the version of PL/Java that is used does include some fixes that were written by Golden Code. Since those fixes have been accepted into the main source tree, there is are custom FWD patches for PL/Java.
However, due to the need to support different versions of PostgreSQL over time, it may be necessary to checkout the latest version of PL/Java and rebuild it on the platform on which it will run. The current production version of PL/Java does not support the latest PostgreSQL versions. Another reason to build PL/Java is the case where a 64-bit platform is being used, since the production builds of PL/Java are only 32-bit.
In order to build PL/Java from sources you will need the following software to be installed:
- PostgreSQL >= 8.0.3 (no PostgreSQL source is needed).
- A Java runtime 1.4.x, 1.5.x or 1.6.x. However if you have PostgreSQL => 8.4.x, only Java 1.6.x and higher is supported for builds of PL/Java. Also make sure that
JAVA_HOMEenvironment variable is set.
- Make sure that the
pg_configutility is installed and is available in your search path. If you have installed PostgreSQL using a software package manager (rpm, deb etc.), then
pg_configmost likely will have been installed as part of the PostgreSQL server development package.
Obtaining the Source Code¶
You can download the latest source code from the download area of the PL/Java project: http://pgfoundry.org/frs/?group_id=1000038. The source name is expected to be
pljava-src-x.x.x.tar.gz, where x.x.x is the PL/Java version. Extract the source code using the following command:
tar xzvf pljava-src-x.x.x.tar.gz
However at the time this manual was written the latest version of PL/Java (1.4.2) could not be compiled with Java 1.6. In order to solve this problem, the source code with the tag
java6 should be extracted from the project CVS. Use these commands to do this:
cvs -d :pserver:anonymous cvs.pgfoundry.org:/cvsroot/pljava login
(when prompted for a password, press Enter)
cvs -d :pserver:anonymous cvs.pgfoundry.org:/cvsroot/pljava checkout -r java6 org.postgresql.pljava
In order to compile sources, just go to the root directory of the sources (where main
Makefile resides) and run
After that you should be able to pick
build/objs/pljava.so. See “PL/Java installation” chapter on how to use them during installation.
A modified version of Jetty 6.1.14 (Apache 2.0 License) is used in this project to provide an embedded web server. This is used to deliver a browser-based administrative console for FWD. The modified
jetty-6.1.14.jar is included as part of the $P2J/lib/ but the following instructions can be used to create the modified version.
The following assumes that the Jetty project will be installed as a sub-directory in the
Jetty uses Maven to do its build so Maven needs to be installed first using the command below (this example is for Ubuntu).
sudo apt-get install maven2
Change the shell's current directory:
Download jetty-6.1.14.zip from http://dist.codehaus.org/jetty/jetty-6.1.14/. Unzip the package and a folder named
~/projects/jetty-6.1.14/ will be created.
The modification is done in the following source file and the main change is to add a new member function,
setSSLContext(SSLContext ctx) to the
SslSocketConnector class so that the Jetty code can use the existing SSL context object created in the FWD code.
Run the following patch command to modify the code:
cd $P2J/lib patch ../../jetty-6.1.14/modules/jetty/src/main/java/org/mortbay/jetty/security/SslSocketConnector.java jetty_6.1.14_SslSocketConnector.java.20090111_patch
Run the following commands to build Jetty:
cd ~/projects/jetty-6.1.14 mvn install
The rebuilt Jetty archive must be copied to
cp jetty-6.1.14/lib/jetty-6.1.14.jar $P2J/lib/
It is a good practice to completely rebuild FWD once the new version of Jetty is copied in.
© 2004-2017 Golden Code Development Corporation. ALL RIGHTS RESERVED.