Patching and Building Customized 3rd Party Libraries for FWD v3 1 0¶
FWD depends upon a range of third party software. Some of that third 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 third 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 versions of Hibernate and H2 projects are already built. These get downloaded automatically as dependencies when FWD is built. For those projects, 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 3rd 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.
The patching of NCURSES is necessary on the FWD build system and on the FWD client systems.
NCURSES¶
On Linux and UNIX, the native terminal support in the libp2j.so
library depends on a customers version of NCURSES. The full details on this can be found in Patching NCURSES.
TERMINFO¶
On Linux and UNIX, the native terminal support depends upon NCURSES which in turn is configured by the TERMINFO database. This defines the specifics of how each terminal type handles particular control characters/escape sequences. This step is only needed if you choose to run the FWD client with the native (console) driver.
Please see Patching TERMINFO for the details.
Foreign Function Interface¶
On Windows, the Foreign Function Interface (libffi) project does not provide a Windows binary for download. As a convenience, the FWD project has created and does provide the 32-bit and 64-bit pre-built libffi6.dll
archives.
Please see Building and Installing libffi on Windows for details on building libffi
from source code.
Hibernate¶
A customized version of Hibernate v4.1.8 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.
Obtaining the Source Code¶
Hibernate sources will be automatically downloaded by git
. Or you can download zip from our download area: hibernate_orm_4.1.8.final_src_repo.zip.
Download the patch from the download area: hibernate_orm_4.1.8.final_fwd_patches_20160416.zip.
Build¶
Execute the following commands to get the patched version:
unzip hibernate-orm-4.1.8.Final_patch.zip -d patch git clone git://github.com/hibernate/hibernate-orm.git cd hibernate-orm git checkout 4.1.8.Final patch hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java ../patch/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.* patch hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java ../patch/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.* patch hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/proxy/ConnectionProxyHandler.java ../patch/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/proxy/ConnectionProxyHandler.* patch hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.java ../patch/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.* patch hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java ../patch/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.* patch hibernate-core/src/main/java/org/hibernate/hql/internal/QuerySplitter.java ../patch/hibernate-core/src/main/java/org/hibernate/hql/internal/QuerySplitter.* patch hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java ../patch/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.* patch hibernate-core/src/main/antlr/sql-gen.g ../patch/hibernate-core/src/main/antlr/sql-gen.* patch hibernate-core/src/main/antlr/hql.g ../patch/hibernate-core/src/main/antlr/hql.* patch hibernate-core/src/main/antlr/hql-sql.g ../patch/hibernate-core/src/main/antlr/hql-sql.* cp ../patch/hibernate-core/src/main/java/org/hibernate/internal/MutableSessionFactoryImpl.java hibernate-core/src/main/java/org/hibernate/internal/
Hibernate4 uses gradle as its build system. You will need to build with Gradle version 1.x due to some deprecated constructs in the Gradle's DSL since version 2. Gradle of the proper version is automatically downloaded and executed by Gradle wrapper (gradlew
) included in the Hibernate distribution. To build the modified Hibernate run
./gradlew jar
Post-Build¶
The rebuilt Hibernate jar file must be properly renamed and copied to $P2J
. The FWD build script allows the use of local jar dependencies. The idea is to put the desired jars into the project directory named local-repo
following the maven repository structure.
mkdir -p $P2J/local-repo/com/goldencode/fwd-hibernate-core/4.1.8 cp hibernate-core/target/libs/hibernate-core-4.1.8.Final.jar $P2J/local-repo/com/goldencode/fwd-hibernate-core/4.1.8/fwd-hibernate-core-4.1.8.jar
Then completely rebuild FWD once the new version of Hibernate is copied in.
H2¶
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.
A modified version of the H2 database is currently used by the FWD project. It is based on H2 version 1.4.192.
Obtaining the Source Code¶
Download sources from Github: h2database-version-1.4.192.zip or our download area: h2_database_src_version_1.4.192.zip .
Download the patch from the download area: h2_synchronization_fix_20160816a.patch.
Build¶
Make sure JAVA_HOME
environment variable is set. If not, you can specify path to Java home directory using export
command. E.g.:
export JAVA_HOME=/usr/lib/jvm/default-java
Then run the following commands to unzip, patch and build H2:
unzip h2database-version-1.4.197.zip cd h2database-version-1.4.197 patch -p 1 < ../h2_1.4.197_synchronization_fix_20180815a.patch cd h2 ./build.sh jar
Post-Build¶
The rebuilt H2 jar file must be properly renamed and copied to $P2J
. The FWD build script allows the use of local jar dependencies. The idea is to put the desired jars into the project directory named local-repo
following the maven repository structure.
mkdir -p $P2J/local-repo/com/goldencode/fwd-h2/1.4.192 cp bin/h2-1.4.192.jar $P2J/local-repo/com/goldencode/fwd-h2/1.4.192/fwd-h2-1.4.192.jar
Then completely rebuild FWD once the new version of H2 is copied in.
PL/Java¶
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 of rows that are returned from the database, since the filtering of those rows can be implemented on the database server using custom Java logic.
Due to the need to support different versions of PostgreSQL over time, it is usually necessary to checkout the latest version of PL/Java and rebuild it on the platform on which it will run.
Prerequisites¶
In order to build PL/Java from sources you will need Java runtime 1.7.x or higher. Also make sure that JAVA_HOME
environment variable is set. If not, you can specify path to Java home directory using export
command. E.g.:
export JAVA_HOME=/usr/lib/jvm/default-java
Install prerequisites using
sudo apt-get install libecpg-dev libkrb5-dev maven git
(this assumes you have a JDK and gcc already installed).
Obtaining the Source Code¶
The source code distribution for PL/Java v1.5.0:
The original distribution can be found at https://github.com/tada/pljava/archive/V1_5_0.zip.
Unzip it using unzip pljava_src_1_5_0.zip
.
Build¶
Build it using cd pljava-1_5_0/ && mvn clean install
.
Install¶
Note that despite the use of the term install
, the previous maven command actually builds the PL/Java software; it does not install it in your database cluster. For information on PL/Java installation and configuration, please refer to Database Server Setup for PostgreSQL on Linux.
Jetty¶
FWD uses Jetty embedded server version 9.3.8. If you want to debug Jetty-related functionality you may discover that it is a problem to find sources for this version. As a temporary workaround, it is possible to upgrade to version 9.3.28. It seems that FWD works fine with this version and the sources can be found here: https://www.eclipse.org/jetty/previousversions.html
© 2004-2017 Golden Code Development Corporation. ALL RIGHTS RESERVED.