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 auto
\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 false
\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 Chapter
\start_of_appendix
\begin_inset CommandInset label
LatexCommand label
name "cha:Source-Files"

\end_inset

Source Files
\end_layout

\begin_layout Standard
This appendix lists where to find files referenced throughout the manual,
 and in some cases defines files as well.
 All files can be found within a subdirectory of the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{source}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Section
Batch Files
\end_layout

\begin_layout Standard
The Windows batch files are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{scripts}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filebatchbridge"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filebatchbridge
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file starts the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filebatchtomcatenv"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filebatchtomcatenv
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file sets the CLASSPATH before 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is launched.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filebatchdeploy"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filebatchdeploy
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file helps create and deploy the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filewarcity}
\end_layout

\end_inset

 file, which contains JavaServer Pages.
 When run, it pauses for a moment.
 Before pressing the space bar to continue, wait until 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 terminates.
 Otherwise, when the script attempts to start 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

, it may fail because the instance that is shutting down has not released
 its lock on the port.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filebatchhighlight"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filebatchhighlight
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file creates images of syntax-highlighted source code.
\end_layout

\begin_layout Section
Shell Scripts
\end_layout

\begin_layout Standard
The Unix shell script files are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{scripts}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\fileshellimages"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
fileshellimages{}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file normalizes images of various shapes and sizes to a consistent
 size and file type.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:fileshellbridge"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
fileshellbridge{}
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file starts the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appphpjavabridge{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filebshelltomcatenv"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
fileshelltomcatenv
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file sets the CLASSPATH before 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appapachetomcat{}
\end_layout

\end_inset

 is launched.
\end_layout

\begin_layout Section
HTML Files
\end_layout

\begin_layout Standard
All HTML files are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{html}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filehtmlfilter"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filehtmlfilter
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file is a web page that provides input parameters to filter the city
 report.
\end_layout

\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:PHP-Source-Files"

\end_inset

PHP Source Files
\end_layout

\begin_layout Standard
All PHP files are in the
\series bold
 
\series default

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{php}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephppdf"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephppdf
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file contains a minimal implementation to create a report as a PDF
 file.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephpcity"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephpcity
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file shows how to call the 
\family typewriter
report_execute
\family default
 function to run the city report.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephpconstants"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephpconstants
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file contains various constants required to configure the database
 connectivity.
\end_layout

\begin_layout Subsection

\series bold
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephpjasper"

\end_inset


\series default

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephpjasper
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file translates abstracted code into a re-usable function.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephpdemo"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephpdemo
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file demonstrates calling Java from PHP.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filephpparameters"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filephpparameters
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file parses parameters before passing them to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

.
\end_layout

\begin_layout Section
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

 Source Code
\end_layout

\begin_layout Standard
The source code is split into the following packages:
\end_layout

\begin_layout Itemize

\series bold
com.whitemagicsoftware.reports.

\series default
 This contains the report customizer described in 
\begin_inset CommandInset ref
LatexCommand vref
reference "sec:Series-Customizer"

\end_inset

.
\end_layout

\begin_layout Itemize

\series bold
com.whitemagicsoftware.report.

\series default
 This contains the report integration framework described in 
\begin_inset CommandInset ref
LatexCommand ref
reference "cha:JasperReports-and-Java"

\end_inset

.
\end_layout

\begin_layout Standard
For implementation technical details, generate and review the Javadocs for
 the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjava{}
\end_layout

\end_inset

 source code.
\end_layout

\begin_layout Section
JavaServer Pages
\end_layout

\begin_layout Standard
All JavaServer Pages files are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{jsp}
\end_layout

\end_inset

 directory.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejspdemo"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejspdemo
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file contains a simple message to demonstrate that installation and
 configuration of the web server is successful.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejspcity"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejspcity
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file produces a PDF file of cities to prove that integration of the
 web server with 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appjasperreports{}
\end_layout

\end_inset

 is successful.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filexhtmlindex"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filexhtmlindex
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file redirects the browser to 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filename{
\backslash
filexhtmlcity}
\end_layout

\end_inset

.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filexhtmlcity"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filexhtmlcity
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file produces a web page that allows users to restrict the results
 from a report listing a number of cities.
\end_layout

\begin_layout Section
SQL Scripts
\end_layout

\begin_layout Standard
All SQL scripts are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{sql}
\end_layout

\end_inset

 directory.
 Unless otherwise stated, all scripts require a PostgreSQL database.
 If you are not using a PostgreSQL database, you will have to change the
 files according to the equivalent set of instructions for your database.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filesqlclimate"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlclimate
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Run the following code to do the following:
\end_layout

\begin_layout Itemize
Create the climate schema.
 
\end_layout

\begin_layout Itemize
Create a city table in the climate schema 
\end_layout

\begin_layout Itemize
Populate the table with ten cities.
 
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filesqlcasts"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlcasts
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Run the SQL to enable implicit type casts in PosgreSQL.
 Without executing this SQL, any attempts to filter reports using a list
 of values will result in an error such as the following:
\end_layout

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
begin{displayed}
\end_layout

\end_inset


\family typewriter
operator does not exist: integer = character varying
\family default

\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
end{displayed}
\end_layout

\end_inset


\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filesqlplrtemplate"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlplrtemplate
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This SQL script creates a 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
appplr{}
\end_layout

\end_inset

 function that returns a set of random integer values.
\end_layout

\begin_layout Section
\begin_inset CommandInset label
LatexCommand label
name "sec:Data-Dictionary-Scripts"

\end_inset

SQL Scripts - Data Dictionary
\end_layout

\begin_layout Standard
A number of SQL scripts were written to help populate and maintain the data
 dictionary.
 These are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{data-dictionary}
\end_layout

\end_inset

 subdirectory:
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{ddl}
\end_layout

\end_inset

 - Script to create the data dictionary against a PostgreSQL database.
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{functions}
\end_layout

\end_inset

 - Supporting functions to create the business area and column cluster relations
hips.
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{maintenance}
\end_layout

\end_inset

 - Views to help create statements that insert and update the data dictionary.
\end_layout

\begin_layout Itemize
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{usage}
\end_layout

\end_inset

 - Views related to using the data dictionary to generate resource bundles
 and search the database.
\end_layout

\begin_layout Subsection
DDL
\end_layout

\begin_layout Standard
This is a file with database instructions to create the data dictionary
 tables.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlcreatedatadictionary"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlcreatedatadictionary
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides an example data dictionary, created in the 
\family typewriter
dictionary
\family default
 schema.
\end_layout

\begin_layout Subsection
Functions
\end_layout

\begin_layout Standard
This section lists database functions that help insert information into
 the data dictionary.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlbusinessclusterrelation"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlbusinessclusterrelation
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides a function to create an association between a business
 area and a column cluster within the data dictionary.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlgetentitycolumnpk"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlgetentitycolumnpk
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides a function to retrieve the primary key for the relationship
 between a database entity (table or view) and one of its columns.
\end_layout

\begin_layout Subsection
Maintenance
\end_layout

\begin_layout Standard
This section lists database views and statements that help keep the data
 dictionary in synchronization with the database.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlentitycolumn"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlentitycolumn
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides a view to generate a list of 
\family typewriter
DELETE
\family default
 and 
\family typewriter
INSERT
\family default
 statements that update the data dictionary's list of entities (tables and
 views).
 Any entities that were added to the database, but are not in the data dictionar
y result in an 
\family typewriter
INSERT
\family default
 statement being generated to add the entities to the data dictionary.
 Any entities that are removed from the database result in a 
\family typewriter
DELETE
\family default
 statement being generated to remove the entity from the data dictionary.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlcolumntext"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlcolumntext
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides a view to generate 
\family typewriter
INSERT
\family default
 statements for missing database columns into the data dictionary.
 The column translations are populated using the name of the column.
 If the database column names have underscores, this code can be modified
 to replace the underscores with spaces, and call 
\family typewriter
initcap
\family default
 to capitalize the first word (prior to insertion into the data dictionary).
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlrelateentitycolumn"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlrelateentitycolumn
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides an 
\family typewriter
INSERT
\family default
 statement to associate all columns with their respective entities within
 the data dictionary.
 This file inserts only new relationships that were not previously recorded
 in the data dictionary.
 Further, only run this statement after the statements generated in 
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:filesqlentitycolumn"

\end_inset

 and 
\begin_inset CommandInset ref
LatexCommand ref
reference "sub:filesqlcolumntext"

\end_inset

 are executed.
 For databases with many tables, views, and columns, the statement as written
 can take several minutes to finish running.
\end_layout

\begin_layout Subsection
Usage
\end_layout

\begin_layout Standard
This section lists database views that query the data dictionary for various
 purposes.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqltranslation"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqltranslation
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides a straightforward join view for the data dictionary's
 column-to-human-readable mapping.
 This allows developers to find database columns, generate resource bundles,
 and more.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlresourcebundle"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlresourcebundle
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file contains a SQL statement that generates resource bundles automatically.
 The resource bundle keys are used by JasperReports to look up the human-readabl
e value of a database column.
 In theory, the notion of resource bundles can be replaced with a data dictionar
y look up.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlgenerateresourcebundle"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlgenerateresourcebundle
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file contains a SQL statement that generates a resource bundle that
 is suitable for use in iReport.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlregeneratebusinessclusters"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlregeneratebusinessclusters
\end_layout

\end_inset


\end_layout

\begin_layout Standard
Generates create statements for inserting business clusters.
 Business area and column cluster relationships must be defined by hand,
 so this view allows those relationships to be recreated.
 Depending on your migration process, such a view might not be useful.
\end_layout

\begin_layout Subsubsection
\begin_inset CommandInset label
LatexCommand label
name "sub:filesqlsearch"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filesqlsearch
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file provides an example of using the data dictionary to find column
 names when only the English name is known.
\end_layout

\begin_layout Section
Report Files
\end_layout

\begin_layout Standard
All files required and used by JasperReports are located in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{reports}
\end_layout

\end_inset

 directory, or one of its subdirectories.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejrxmlcity"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrxmlcity
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file generates a list of cities (for a PDF file).
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejrxmlmaster"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrxmlmaster
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file shows how to eliminate duplication by using a parameter to change
 the report's content.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejrxmlheader"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrxmlheader
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This is a subreport used by the master report.
\end_layout

\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "sub:\\filejrxmlmulticolumn"

\end_inset


\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
filejrxmlmulticolumn
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This file demonstrates using the 
\series bold
Background
\series default
 band on a multi-column report.
\end_layout

\begin_layout Section
XML Files
\end_layout

\begin_layout Standard
All XML files are in the 
\begin_inset ERT
status collapsed

\begin_layout Plain Layout


\backslash
path{xml}
\end_layout

\end_inset

 directory.
\end_layout

\end_body
\end_document