This directory contains the Derby 'fortunes' database. It also includes the 
source for building it from scratch. 

This file is organized as shown below:

    1. Software requirements
    2. Directory Contents
    3. Source Cookie Files
    4. Create database 'from scratch' and load data 

========================
1. Software requirements
========================
The tutorial requires the software listed below:

    - JDK 1.4:                http://java.sun.com/j2se/
    - Derby:                  http://incubator.apache.org/derby
    - Jakarta Math Library:   http://jakarta.apache.org/commons/math/
    - Jakarta RegExp:         http://jakarta.apache.org/regexp/
    - Jakarta Tomcat 5.0.28:  http://jakarta.apache.org/tomcat

Set your CLASSPATH to include the jar files listed below:

    - derby.jar
    - derbytools.jar
    - commons-math-1.0-RC1/commons-math-1.0-RC1.jar
    - jakarta-regexp-1.3/jakarta-regexp-1.3.jar


=====================
2. Directory Contents
=====================

  data       Source cookie files.
  doc        Documentation for the Fortune Server.
  fortunes   This is the Derby database -- don't touch this directory
             unless you want to rebuild the database from scratch.
  java       Source code for SQL functions, client applications, and Tomcat.
  legal      Copyright files for each of the components used.
  lib        Derby and Jakarta jar files.
  sql        SQL scripts for creating/updating tables.

=========================
3. Source Cookie Files
=========================

The fortune files listed below were obtained from www.gentoo.org:

Name              Source                                             License
----              ----------------------------------------------     --------- 
fortune           gentoo:fortune-mod                                 BSD
kernelcookies     http://www.schwarzvogel.de/software-misc.shtml     GPL-2
osfortune         gentoo: fortune-mod-osfortune                      GPL-1
starwars          http://www.splitbrain.org/Fortunes/starwars/       GPL-2
tao               http://aboleo.net/software/                        GPL-1


These files come already loaded into the Derby 'fortunes' database.
They are also in the data subdirectory.

The copyright for each set is in the legal subdirectory.

==============================================
4. Create database and load data 'from scratch'
==============================================

If you want to create a database from scratch and load your own fortunes, 
or you just want to reload all the fortunes that come with the Fortune Server,
this section is for you.

The steps in this section use DERBY_SYSTEM_HOME; you should change this
to reflect the location of the directory where the database is (or will be)
stored.

(1) Create 'fortunes' database and objects

    cd DERBY_SYSTEM_HOME/sql

    The 'create_fortunes.sql' creates a database called 'fortunes' if it 
    doesn't exist yet.  It creates tables and loads metadata, creates 
    functions, loads the SQL functions jar file.

    This file loads metadata for all the cookie files in the data subdirectory.
    Modify this file to change the database name and to change the metadata to 
    reflect the fortunes you will load. Then run it:

    java -Dderby.system.home=$DERBY_SYSTEM_HOME  org.apache.derby.tools.ij \
         create_fortunes.sql >& create_fortunes.log &

(2) Load data into the fortunes table

    - cd DERBY_SYSTEM_HOME/java/LoadData
    - derby_load.sh is setup to load the cookie files in the data subdirectory.
    - Modify it
      + to include your derby.system.home location
      + for the fortune files you want to load from your system
    - derby_load.sh >& derby_load.log

(3) Update the fortunes.offense column

    cd $DERBY_SYSTEM_HOME/sql
    java -Dderby.system.home=$DERBY_SYSTEM_HOME  org.apache.derby.tools.ij \
         update_offensive.sql >& update_offensive.log &
