Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/indispensable.git
#LyX 1.6.7 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass scrbook
\begin_preamble
\input{preamble.tex}
\end_preamble
\use_default_options false
\language english
\inputencoding utf8
\font_roman lmodern
\font_sans helvet
\font_typewriter courier
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize letterpaper
\use_geometry false
\use_amsmath 2
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 0 5 11 -1
\bullet 1 5 24 -1
\bullet 2 0 0 -1
\tracking_changes false
\output_changes false
\author "" 
\author "" 
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
input{chapter.tex}
\end_layout

\end_inset


\end_layout

\begin_layout Chapter
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 and 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s -- Linux
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
epigraph{Let us change our traditional attitude to the construction of programs.
 Instead of imagining that our main task is to instruct a computer what
 to do, let us concentrate rather on explaining to human beings what we
 want a computer to do.}{Donald Ervin Knuth}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This chapter describes how to integrate 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 with 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s (JSPs) using 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 in Linux.
 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Integration-Unix-Tomcat-JSP"

\end_inset

 shows the major components involved in this integration.
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename drawings/integration-tomcat-jsp.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Integration-Unix-Tomcat-JSP"

\end_inset

Integration - 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 and 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s (Linux)
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
The components are as follows:
\end_layout

\begin_layout Itemize

\series bold
Browser.

\series default
 Any web browser.
\end_layout

\begin_layout Itemize

\series bold
Web Server.

\series default
 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 web server software that responds to web page requests.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejspdemo}
\end_layout

\end_inset

.

\series default
 A web page containing a form and a button.
 The user clicks the button to retrieve the report.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejspreport}
\end_layout

\end_inset

.

\series default
 A web page that runs a report and returns a PDF directly to the browser.
 
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

 Classes.

\series default
 Required to pass parameters to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

, and call the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 engine.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

.

\series default
 The reporting engine used to query the database and generate a PDF.
\end_layout

\begin_layout Itemize

\series bold
Database.

\series default
 Any data source with a suitable JDBC driver.
\end_layout

\begin_layout Standard
In this chapter:
\end_layout

\begin_layout Itemize

\series bold
Prerequisites.

\series default
 Software packages required to complete the integration.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

.

\series default
 Describes issues with conflicting 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

 Virtual Machines.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

.

\series default
 Brief installation guide and validation.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

.

\series default
 Describes the installation steps for 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Itemize

\series bold
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s.

\series default
 Instructions to produce a PDF using a JSP.
\end_layout

\begin_layout Section
Prerequisites
\end_layout

\begin_layout Standard
The instructions in this chapter require:
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
apppostgres{}
\end_layout

\end_inset

 (installed and running).
\end_layout

\begin_layout Itemize
A Linux distribution.
\end_layout

\begin_layout Standard
\begin_inset CommandInset include
LatexCommand input
filename "include/install_java.lyx"

\end_inset


\end_layout

\begin_layout Section
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This section describes how to install and configure 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

.
 Before installation can proceed, download 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 as listed in 
\begin_inset CommandInset ref
LatexCommand vref
reference "tab:Unix-Applications-Versions"

\end_inset

.
\end_layout

\begin_layout Subsection
Installation
\end_layout

\begin_layout Standard
To install 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\end_layout

\begin_layout Enumerate
Open a new terminal window.
\end_layout

\begin_layout Enumerate
Download 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 into 
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirrootprog{}
\end_layout

\end_inset


\family default
.
\end_layout

\begin_layout Enumerate
Extract and delete the archive.
 Type:
\end_layout

\begin_deeper
\begin_layout LyX-Code
sudo su -
\end_layout

\begin_layout LyX-Code
cd 
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirrootprog{}
\end_layout

\end_inset


\end_layout

\begin_layout LyX-Code
unzip apache-tomcat*.zip
\end_layout

\end_deeper
\begin_layout Enumerate
Create a symbolic link.
 Type:
\end_layout

\begin_deeper
\begin_layout LyX-Code
ln -s apache-tomcat-7.0.8 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
dirapachetomcat{}
\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is installed.
\end_layout

\begin_layout Subsection
Configuration
\end_layout

\begin_layout Standard
Update 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

-related environment variables as follows:
\end_layout

\begin_layout Enumerate
Open a new terminal window.
\end_layout

\begin_layout Enumerate
Login to the root account.
\end_layout

\begin_layout Enumerate
Edit 
\family typewriter
$HOME
\family default

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset


\family typewriter
.bashrc
\family default
.
\end_layout

\begin_layout Enumerate
Append the following text:
\end_layout

\begin_deeper
\begin_layout LyX-Code
JAVA_HOME=
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset

opt
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset

jdk
\end_layout

\begin_layout LyX-Code
PATH=$PATH:$HOME
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset

bin:$JAVA_HOME
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset

bin
\end_layout

\begin_layout LyX-Code
export PATH JAVA_HOME
\end_layout

\end_deeper
\begin_layout Enumerate
Save the file.
\end_layout

\begin_layout Enumerate
Either logout and login again, or type the following to update the environment
 settings:
\end_layout

\begin_deeper
\begin_layout LyX-Code
source $HOME
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\end_layout

\end_inset

.bashrc
\end_layout

\end_deeper
\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is ready to run.
\end_layout

\begin_layout Subsection
Execution
\end_layout

\begin_layout Standard
To run 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\end_layout

\begin_layout Enumerate
Open a new terminal window.
\end_layout

\begin_layout Enumerate
Type:
\end_layout

\begin_deeper
\begin_layout LyX-Code
sudo su -
\end_layout

\begin_layout LyX-Code
cd 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatbin{}
\end_layout

\end_inset


\end_layout

\begin_layout LyX-Code
chmod +x *.sh
\end_layout

\begin_layout LyX-Code
.
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filename{
\backslash
fileshelltomcat}
\end_layout

\end_inset

 start
\end_layout

\end_deeper
\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is running.
\end_layout

\begin_layout Subsection
Validation
\end_layout

\begin_layout Standard
Browse to the following address to verify that 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is installed and running:
\end_layout

\begin_layout Standard
\begin_inset CommandInset href
LatexCommand href
name "http://localhost:8080"
target "http://localhost:8080"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset CommandInset include
LatexCommand input
filename "include/install_ireport.lyx"

\end_inset


\end_layout

\begin_layout Section
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s
\end_layout

\begin_layout Standard
This section provides an overview of how to create 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s that can call 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 to generate report content in the form of a PDF file.
\end_layout

\begin_layout Subsection
Validation
\end_layout

\begin_layout Standard
Before 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 can be integrated with 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

, it makes sense to provide a starting point from which the reports will
 be executed.
 This means creating and deploying a Web Archive (WAR) file that contains
 a 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Standard
To create and deploy a WAR file manually:
\end_layout

\begin_layout Enumerate
Create the following directory hierarchy: 
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevjspcity{}
\end_layout

\end_inset


\family default
.
\end_layout

\begin_layout Enumerate
Create a new file in 
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevjspcity{}
\end_layout

\end_inset


\family default
 called 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejspdemo}
\end_layout

\end_inset

 that contains the text in 
\begin_inset CommandInset ref
LatexCommand ref
reference "alg:JSP-Source-File-Unix"

\end_inset

 (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:\\filejspdemo"

\end_inset

).
\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float algorithm
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename source/jsp/index.jsp.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "alg:JSP-Source-File-Unix"

\end_inset

JSP Source File
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Open a new terminal window.
\end_layout

\begin_layout Enumerate
Type the following to create a WAR file:
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
If the 
\family typewriter
jar
\family default
 command cannot be found, check that the JDK is installed correctly.
\end_layout

\end_inset

 
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
cd 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevjspcity{}
\end_layout

\end_inset


\end_layout

\begin_layout LyX-Code

\family typewriter
jar -cvfM ..
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filename{
\backslash
filewarcity}
\end_layout

\end_inset

 *
\end_layout

\end_deeper
\begin_layout Enumerate
Copy 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filewarcity}
\end_layout

\end_inset

 (located in the parent directory) into 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\end_layout

\begin_deeper
\begin_layout LyX-Code
sudo cp ..
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filename{
\backslash
filewarcity}
\end_layout

\end_inset


\family default
 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatapps{}
\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Restart 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 has a configuration option that allows automatic redeployment of new WAR
 files.
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout Enumerate
Open a terminal window.
\end_layout

\begin_layout Enumerate
Type the following commands to restart 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\end_layout

\begin_layout LyX-Code
sudo su -
\end_layout

\begin_layout LyX-Code

\family typewriter
cd 
\family default

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatbin{}
\end_layout

\end_inset


\end_layout

\begin_layout LyX-Code
.
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filename{
\backslash
fileshelltomcat}
\end_layout

\end_inset

 stop
\end_layout

\begin_layout LyX-Code
.
\family typewriter

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filename{
\backslash
fileshelltomcat}
\end_layout

\end_inset

 start
\end_layout

\end_deeper
\begin_layout Enumerate
Browse to 
\begin_inset CommandInset href
LatexCommand href
target "http://localhost:8080/city/"

\end_inset

.
\end_layout

\begin_layout Standard
The following text appears:
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
begin{displayed}
\end_layout

\end_inset

Hello, world!
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
end{displayed}
\end_layout

\end_inset


\end_layout

\begin_layout Subsection
Configuration -- Classpath
\end_layout

\begin_layout Standard
Configure 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 to find the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 library as follows:
\end_layout

\begin_layout Enumerate
Copy 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileshelltomcatenv}
\end_layout

\end_inset

 to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatbin{}
\end_layout

\end_inset

 (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:filebshelltomcatenv"

\end_inset

).
\end_layout

\begin_layout Enumerate
Make 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileshelltomcatenv}
\end_layout

\end_inset

 executable:
\end_layout

\begin_deeper
\begin_layout LyX-Code
sudo chmod +x 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatbin{}
\backslash
filename{
\backslash
fileshelltomcatenv}
\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Edit 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileshelltomcatenv}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Change the 
\family typewriter
IREPORT_HOME
\family default
 variable value to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

's installation directory.
\end_layout

\begin_layout Enumerate
Save the file.
\end_layout

\begin_layout Enumerate
Restart 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Standard
The 
\family typewriter
CLASSPATH
\family default
 environment variable stores the paths to the JAR files required to generate
 reports.
 Upgrades to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

 will consequently upgrade the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 version used by 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 to generate those reports (upon restarting 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

).
\end_layout

\begin_layout Subsection
PDF File Creation
\end_layout

\begin_layout Standard
To generate a PDF file from the browser:
\end_layout

\begin_layout Enumerate
Copy 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejspcity}
\end_layout

\end_inset

 to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevjspcity{}
\end_layout

\end_inset

 (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:\\filejspcity"

\end_inset

).
\end_layout

\begin_layout Enumerate
Edit 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejspcity}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Update the variables listed in 
\begin_inset CommandInset ref
LatexCommand ref
reference "tab:Database-Connection-Variables-Unix"

\end_inset

 according to your installation.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
The default JDBC URL works as is for 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
apppostgres{}
\end_layout

\end_inset

.
\end_layout

\end_inset


\end_layout

\begin_deeper
\begin_layout Standard
\begin_inset Float table
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "tab:Database-Connection-Variables-Unix"

\end_inset

Database Connection Variables
\end_layout

\end_inset


\begin_inset Tabular
<lyxtabular version="3" rows="7" columns="2">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="left" valignment="top" width="0">
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
rowcolor{tableheader}
\backslash
toprule{}
\end_layout

\end_inset


\series bold
Variable
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Usage
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
midrule{}
\end_layout

\end_inset


\family typewriter
dbhost
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Database server name or IP address.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family typewriter
dbname
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Name of the database running inside 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
apppostgres{}
\end_layout

\end_inset

.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family typewriter
dbuser
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
User permitted to read from the database specified by 
\family typewriter
dbname
\family default
.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family typewriter
dbpass
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Password for 
\family typewriter
dbuser
\family default
.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family typewriter
jdbc
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
The JDBC URL connection string.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\family typewriter
reportPath
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Path to the report's 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
fileextjasper}
\end_layout

\end_inset

 file.
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
tabularnewline
\backslash
bottomrule%
\end_layout

\end_inset


\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
If 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
apppostgres{}
\end_layout

\end_inset

 is not installed, change the database driver accordingly:
\end_layout

\begin_deeper
\begin_layout LyX-Code

\family typewriter
Class.forName( "org.postgresql.Driver" );
\end_layout

\end_deeper
\begin_layout Enumerate
Create a WAR file for the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjsp{}
\end_layout

\end_inset

s:
\end_layout

\begin_deeper
\begin_layout LyX-Code
cd 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevjspcity{}
\end_layout

\end_inset


\end_layout

\begin_layout LyX-Code
jar -cvfM ..
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirseparator{}
\backslash
filewarcity{}
\end_layout

\end_inset

 *.jsp
\end_layout

\end_deeper
\begin_layout Enumerate
Deploy the WAR file:
\end_layout

\begin_deeper
\begin_layout LyX-Code
cp 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filewarcity}
\end_layout

\end_inset

 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirprogapachetomcatapps{}
\end_layout

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Make the report available to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

:
\end_layout

\begin_deeper
\begin_layout Enumerate
Start 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appireport{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Open 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 (see 
\begin_inset CommandInset ref
LatexCommand vref
reference "sub:\\filejrxmlcity"

\end_inset

).
\end_layout

\begin_layout Enumerate
Compile 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejrxmlcity}
\end_layout

\end_inset

 to create 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejaspercity}
\end_layout

\end_inset

.
\end_layout

\begin_layout Enumerate
Copy 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filejaspercity}
\end_layout

\end_inset

 to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
unixdirdevreports{}
\end_layout

\end_inset

.
\end_layout

\end_deeper
\begin_layout Enumerate
Browse to 
\begin_inset CommandInset href
LatexCommand href
target "http://localhost:8080/city/cities.jsp"

\end_inset

.
\end_layout

\begin_layout Enumerate
Fix any errors that appear.
\end_layout

\begin_layout Standard
The PDF file shows a city listing.
\end_layout

\begin_layout Standard
If you only have one report---and will only ever have one report---these
 steps are sufficient to produce a PDF file.
 If you have multiple reports, a more robust implementation is mandatory.
\end_layout

\begin_layout Section
Summary
\end_layout

\begin_layout Standard
Dr.
 Donald Knuth, author of 
\emph on
The Art of Computer Programming
\emph default
 and the person who conceived of literate programming, has stated that developme
nt practices must shift towards writing prose about the software applications
 we develop, rather than inextricably intertwining code and comments.
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
See 
\begin_inset CommandInset href
LatexCommand href
target "http://www.literateprogramming.com/adventure.pdf"

\end_inset

 and 
\begin_inset CommandInset href
LatexCommand href
target "http://en.wikipedia.org/wiki/Literate_programming"

\end_inset

.
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Part of the problem is a lack of mainstream integrated development environments
 that separate source code from comments.
 The hypothetical editor shown in 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Literate-Programming-Example"

\end_inset

 illustrates comments removed from the source code itself in a language-agnostic
 way.
 Consider these advantages:
\end_layout

\begin_layout Itemize

\series bold
Hyperlinks.

\series default
 Comments can include hyperlinks to additional information.
\end_layout

\begin_layout Itemize

\series bold
Requirements.

\series default
 Business requirements can be embedded into the comments, linked from the
 original source document (to avoid duplicating specifications).
 Updates made to the requirements documents will be reflected immediately
 in the source code comments.
 Moreover, tagging source code directly related to business requirements
 allows enumerating the lines of code necessary to satisfy the requirements.
\end_layout

\begin_layout Itemize

\series bold
Transparency.

\series default
 Business analysts and technical team leads can review the source code comments
 to appraise software quality.
 Prose can be automatically extracted into web pages.
 Predominately blank pages is a sign that a closer inspection of the source
 code may be warranted.
\end_layout

\begin_layout Itemize

\series bold
Completion.

\series default
 In corporate systems, lines of source code exist to meet business requirements.
 Tagging lines accordingly can facilitate measuring task completion.
\end_layout

\begin_layout Itemize

\series bold
Maintenance.

\series default
 By documenting source code in a natural language, maintainers can spend
 less time trying to understand the source code and more time resolving
 bugs, finishing features, or enhancing the software.
\end_layout

\begin_layout Itemize

\series bold
Editors.

\series default
 Completely removing comments from source code can encourage development
 of natural language editors specifically for editing prose.
 These editors can leverage a programmatic mark-up language to produce high-qual
ity output (like an HTML-LaTeX cross).
\begin_inset Foot
status collapsed

\begin_layout Plain Layout
Conditional text can be used to describe behaviour in different environments
 (such as different operating systems).
\end_layout

\end_inset


\end_layout

\begin_layout Itemize

\series bold
Documents.

\series default
 Similar to embedding business requirements into comments, technical writers
 can re-use source code commentary for manuals.
 Also, technical writers can clarify comments in parallel with software
 development (after the code is ready).
\end_layout

\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status collapsed

\begin_layout Plain Layout
\begin_inset Graphics
	filename drawings/literate-program-merged.png
	display false

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Literate-Programming-Example"

\end_inset

Literate Programming Example
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
In 
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Literate-Programming-Example"

\end_inset

 the cursor's source code position triggers emphasis of the corresponding
 comments.
\end_layout

\end_body
\end_document