The Pesticide project is available on the enclosed CD-ROM. Copy the project directory from the CD-ROM to your hard disk. Under Windows, start the server by double-clicking pesticide.bat . Next, open a browser and type one of following URLs (see Figure 8.4): http://localhost:8080/ buglist /cool http://localhost:8080/buglist/fast http://localhost:8080/buglist/fr Figure 8.4. Navigate the list of bugs .
Warning This project uses Xalan 1.0 as the XSLT processor. If you are using another processor, you will need to adapt XslServletLiaisonImpl . The project also uses Jetty as the Web server. However, because it is based on servlets, it should be easy to adapt to another Web server. You can add servlet support to most Web servers through JRun. The project on the CD-ROM includes a database, but if you need to re-create it, you can use Listing 8.9. Use HypersonicSQL Database Manager to execute the script. To connect to the database, perform the following (see Figure 8.5):
Figure 8.5. Use the Database Manager to connect to the database.
Listing 8.9 Creating the Initial DatabaseCREATE TABLE software (id INTEGER IDENTITY,name VARCHAR); CREATE TABLE programmer (id INTEGER IDENTITY,name VARCHAR); CREATE TABLE bug (id INTEGER IDENTITY,name VARCHAR,created DATE, description LONGVARCHAR, solution LONGVARCHAR,solved BIT, softwareid INTEGER,programmerid INTEGER); INSERT INTO software (name) VALUES ('XML Editor 1.0 [Win]'); INSERT INTO software (name) VALUES ('XML Editor 1.0 [Mac]'); INSERT INTO software (name) VALUES ('XSL Editor 1.0 [Win]'); INSERT INTO programmer (name) VALUES ('John Doe'); INSERT INTO programmer (name) VALUES ('Jack Smith'); INSERT INTO bug (name,created,description,solved,softwareid, programmerid) SELECT 'User login', '2000-05-10', 'Creating a new user throws an exception "Access Denied"', FALSE, software.id, programmer.id FROM software, programmer WHERE software.name='XML Editor 1.0 [Win]'AND programmer.name='John Doe'; INSERT INTO bug (name,created,description,solved,solution, softwareid,programmerid) SELECT 'Window size lost', '2000-05-10', 'Does not properly save the window size and placement between sessions', TRUE,'Added new registry key', software.id, programmer.id FROM software, programmer WHERE software.name='XML Editor 1.0 [Win]'AND programmer.name='John Doe'; INSERT INTO bug (name,created,description,solved,softwareid, programmerid) SELECT 'Crash at startup', '2000-05-11', 'Random crash at startup when low-memory', FALSE, software.id, programmer.id FROM software, programmer WHERE software. name='XML Editor 1.0 [Win]'AND programmer.name='John Doe'; INSERT INTO bug (name,created,description,solved,solution, softwareid,programmerid) SELECT 'Splash screen', '2000-05-07', 'Splash screen does not go away until the user clicks it', TRUE, 'Added timer', software.id, programmer.id FROM software, programmer WHERE software.name='XML Editor 1.0 [Mac]'AND programmer.name='Jack Smith'; INSERT INTO bug (name,created,description,solved,softwareid, programmerid) SELECT 'Import error', '2000-05-10', 'Cannot open legacy XSL files', FALSE, software.id, programmer.id FROM software, programmer WHERE software.name='XSL Editor 1.0 [Win]'AND programmer.name='Jack Smith'; INSERT INTO bug (name,created,description,solved,solution, softwareid,programmerid) SELECT 'Mangled display', '2000-05-13', 'For large style sheets, the display is not readable', TRUE, 'Added zoom', software.id, programmer.id FROM software, programmer WHERE software.name='XSL Editor 1.0 [Win]'AND programmer.name='Jack Smith'; Warning The project uses Hypersonic SQL for the database. Because Hypersonic SQL is a JDBC database, it should be easy to adapt it to other JDBC databases (including Access, Oracle, and SQL Server). However, you will need to adapt Listing 8.9 and the servlets to your database flavor of SQL. In particular, the identity column must be converted into the auto-increment columns for your database. You might also want to take advantage of foreign keys, which Hypersonic SQL currently does not support. |