AMIS Library System – JHeadstart 9.0.5.x (BC4J, JSP+JSTL) Demo Application released

2

Today, AMIS released the JHeadstart 9.0.5.x version of the ALS application for BC4J and JSP/JSTL. Download the zip-file with the entire application, the database setup and the JDeveloper 10g Workspace and project in the following Zip-file:

Who should be interested? Anyone who uses JHeadstart or contemplates using it and wants to know more about it. Furthermore especially all who attended the AMIS JHeadstart Workshop (and wants to try out the exercises at home or just expand on the workshop contents). Anyone interested in designing and building J2EE Web Applications, possibly using JDeveloper 10g, BC4J, Struts and JSP + JSTL, may want to take a look at this application for demonstration purposes.

To get a feel for what this application looks like, see Overview of the AMIS Library System Reference Application (ALS) 9.0.5.x.

Overview

The ALS application started life in August 2003. It was first created as workshop-vehicle: all five executions of the AMIS JHeadstart Workshop were based on this application. Late 2003, when AMIS started its JHeadstart Cookbook, the ALS application was chosen again as vehicle, to demonstrate the recipes in the Cookbook.

When AMIS contributed the description on using Toplink with JHeadstart for the 9.0.5 JHeadstart Release (June 2004) (see the document: JHeadstart_Home/jheadstart/doc/tutorial/jhs_tutorial_4.pdf or download from the AMIS Website), again the ALS application was picked to demonstrate all subtleties involved with using Toplink and JHeadstart. We created a Toplink version of the ALS application and it was shipped as the third demo with JHeadstart (see JHeadstart_Home/demos/als).

Now the time has come to do an upgrade of the ALS application for BC4J as model-technology. We also prepared this ALS edition for JSTL (according to our own recipe Use JSTL with the JHeadstart JSP pages, so you will find a number of additional libraries as well as TLD files. This ALS release will be used for new JHeadstart Recipes from AMIS, as well as the JHeadstart Application Generator extensions that we will release early November 2004.

Installation Instructions

Unzip the ALS9051bc4j.zip
The first step in the installation process is to unzip the ALS9051bc4j.zip file.

• Create a directory that you will use as ALS_HOME directory, for example c:als_ref or anything else you fancy.
• Open Als9051bc4j.zip using winzip and Extract all files to ALS_HOME.

Create a new database schema for ALS
Before you can start installation of the ALS Database Schema, you must create a new Schema (or Database User) – or select an existing one to use. The database user requires only simple privileges such as create session, create table, create, package, create sequence, create trigger. Life will be easiest if you database user is called ALS with password ALS; however, this is not a requirement.
All other installation and configuration tasks for the ALS Application are done from Oracle 10g JDeveloper 9.0.5.1.

Open the ALS JDeveloper project
Start JDeveloper and open the workspace AlsBc4jRef905(.jws) or create a new Workspace and include the file ALS_HOME/ALS.jpr to the workspace. This will add all components of the ALS Application to the workspace.

Preparing the ALS database schema
Locate the file build.properties – in ALS_HOMEdeploy. In this file you have to edit the value for the properties database.username, database.password, database.url to refer to the database and database schema into which the ALS application should be installed.
Find the file buildAlsDB.xml – under Miscellaneous Files probably. It should be recognized by JDeveloper as an ANT build file. Open the RMB menu on this file and select the option Build Default Target.
The ANT script will run and it should install the database objects into the schema identified in build.properties.

Edit the ALS Connection
The ALS BC4J Application Module (AlsAppModule) is configured to use the ALS_LOCAL connection. You may not have such a Connection.

You should go to the Connections tab in JDeveloper and create a new Database Connection for the ALS database schema setup in the previous step. If you use a different name for this connection than ALS_LOCAL, you next have to select the AlsAppModule and pick the option Configurations from the RMB menu (RMB=right mouse button). Select the AlsAppModuleLocal configuration and click on edit. In the poplist for Connection Name, select the connection that you just created.

Load images into the ALS database (optional)
The Books in the AMIS Library System have associated Thumbnails and Publishers have Logos. These are stored in Blob-columns and rendered as images. They can be uploaded through the ALS application. As part of the pre-installed demo-data, we ship a number of thumbnails and logos in the directories ALS_HOMEddlbookThumbnails and ALS_HOMEddlpublisherLogos.

I tried to include loading these images in the Ant-script buildAlsDB.xml but for some reason, I failed. (See task _loadImages; If you have any pointers, please let me know).

The somewhat more roundabout way for loading these images is the following: find the LoadImages class in the package nl.amis.als.model.bc4j. Locate the main method and edit the first argument (C://als_demo//AlsBc4JJstl//ddl//) in the constructor call for LoadImages. This argument should refer to the directory ALS_HOMEddl.

After making that change, recompile the class and run it. Now it should load the thumbnails and images and inform you of its progress while doing so.

Edit the JHeadstart Runtime Library
Open the Project Settings for the ALS project. Go to the Libraries node. Select the JHeadstart Runtime library in the right pane. Press the Edit button to edit the definition of this library: it currently refers to libraries in my JHeadstart_Home which is c:jhs9051. You will have to change these entries to point to your own JHeadstart_Home (probably the J: share).

Edit the Application Structure File
Before generating the ALS application with the JHeadstart Application Generator you should edit the properties Source Directory and Domain File. These two properties contain hard-coded path-references; chances are that they refer to a different directory than the one that you have set up on your computer.

While you are in the application structure file, you may also want to generate a resource bundle for a new default language. If so, change the property Generator Language Code and possibly Generator Country Code.

Generating the ALS Application (optional)
The ALS application is ready to run. However, if you want to – for example because you made changes in the definitions or want to generate for an additional language, you can generate it.

Running the ALS ApplicationTo run the ALS Application, follow the normal procedure with JHeadstart: locate the index.html file under Web Content and run it.

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.