Documentation Archive Developer
Search

Enterprise Objects Framework Example Guide

For WebObjects Release 3.x

WebObjects includes Enterprise Objects Framework database integration technology and several examples that demonstrate Enterprise Objects Framework programming techniques. The Enterprise Objects Framework examples are built around the idea of a video rental store. The rental store uses two separate databases. The first database, Movies, contains background information on all movies available from the store's distributor. The second database, Rentals, contains the inventory, customer list, and rental transaction records for the store. Disclaimer: none of the data in the Movies database is guaranteed to be accurate.

The Enterprise Objects Framework examples are located in: NEXT_ROOT/NextDeveloper/Examples/EnterpriseObjects

This guide describes:

Installing the Sample Databases

Before you can run the examples, you must set up the Movies and Rentals databases on your system. Installing the sample databases involves the following four steps:

  1. Setting up Database Accounts

    The multi-database support in EOF 2.0 makes it possible for you to install the sample databases in three different configurations:

    • both sets of tables together in a single user/database
    • each set of tables in its own user/database on the same database server
    • each set of tables on its own database server (e.g. Movies on Informix, Rentals on Oracle).

    Depending on your desired set up, you use the tools available with your database server to set up one or two new user/databases. For example. on Sybase you might create a new database on your server called "Movies" and login with the user "sa". On Oracle you might create a new user with the name "Movies". Once you have set up these accounts, you are ready to install the examples.

  2. Copying the Example Directory

    The database installation scripts make modifications to some of the example files based on your database set up, so you should copy the example directory to a directory that you can write in.

  3. Configuring the Example Models

    The model files used by the examples must be configured to use your database and its adaptor. To configure the model files, simply run the configure_examples program in a command shell. (To open a shell on NT, choose Sh in the OPENSTEP program group.) cd to your copy of the examples directory, and run configure_examples. It asks you for the name of the adaptor you want to use (Informix, ODBC, Oracle, or Sybase) and for the login information for your database. It then modifies the example models to work with your server.

  4. Populating the Databases

    To fill your example databases with sample data, use the install_database program. in the DatabaseSetUp directory. In your command shell, cd to the DatabaseSetUp directory, and run install_database. It connects to your databases, adds the example tables, and fills them with data. If you later wish to remove the data, run the drop_database program.

The Examples

None of the examples in this directory are web-based. In fact, many of them require OpenStep Enterprise. Unless you have OpenStep Enterprise, you won't be able to build the following examples:

However, the remaining examples may be useful to you as examples of how to program with Enterprise Objects Framework.

For more information on these examples, see the ExampleGuide.rtfd file in the EnterpriseObjects examples directory.

Building the Enterprise Objects Examples

Building the examples requires two steps:

  1. Configuring Your Machine

    Window's Users: to install and run the examples your executable path environment variable must include:

      .;C:\NeXT\LocalDeveloper\Executables
    (The above assumes that C:\NeXT is the root of your OpenStep installation). To check your path variable, use the System Control Panel. If the above isn't included, add it.

    Mach Users: to install and run the examples you must create the directory /LocalDeveloper/Frameworks. This directory must be set to be writable by the user installing the examples.

  2. Building the Example Programs

    With your example projects installed and your database filled with data, you are ready to build and run the examples. In a command shell, cd to the example you want to build and type make.