Application Wizard Overview


Table of Contents

1. Introduction
2. Running the Application Wizard
3. Conclusion

Chapter 1. Introduction

The Enhydra Application Wizard (appwizard) is a tool with both a command-line and a graphical user interface. The wizard creates a basic framework for an Enhydra application. The wizard lets you create and run a new "stub" application in a matter of minutes, giving your development project a jump-start. The application wizard creates a new source tree for a simple Enhydra Web application. This application serves two purposes: it is an example program so that developers can test-drive Enhydra easily, and it is a good base on which to build projects. New developers are recommended to start a project by running the Application Wizard, then add and rename files as needed

Chapter 2. Running the Application Wizard

The Application Wizard has changed significantly with the release of Enhydra 3.5. Previously, the Application Wizard was a command-line tool, started by entering newapp with a parameter for the project name. The command for starting the Application Wizard and the parameters required to run it as a command-line tool have changed. The basic framework of files and directories generated by the Application Wizard has changed as well - specially with Enhydra 6.0 release.

To create a simple application with the Application Wizard:

  • Create a directory to contain your new application and name it anything you want.

    For example:

    mkdir myapps (UNIX)

    or

    md myapps (WINDOWS)
  • Open a shell window (UNIX) or command window (WINDOWS) and make the new directory the current directory.

    For example:

    cd myapps
  • Start the Application Wizard GUI by entering "appwizard" at the command prompt (or double click on appwizard). Entering appwizard with no arguments brings up the Application Wizard GUI. The Application Wizard can generate two distinct types of Enhydra projects: a Web Application, and an Enhydra super-servlet application. Note If the Application Wizard does not start, the path environment variable is not set correctly. The Enhydra installation instructions provide information about setting your path environment variable. For installation instructions refer to the top-level index.html.

  • Use the Application Wizard GUI to generate a simple Enhydra application. The Application Wizard GUI steps you through the process of generating an Enhydra project.

    • Select a a Component type

      Select Enhydra Application from the Component type pull-down menu and click Next.

    • Specify Client type and directory details.

      Accept the default client type of HTML. Enter simpleApp for the Project directory name. Enter simpleapp (note the difference in case) for Package. Set the Root path to

      /enhydra/myapps
    • Specify the copyright material to use.

      Click Next to accept the default, No copyright setting

    • Specify which Supplemental files to generate.

      Select Generate start script and command line build files and click Finish. The Application Wizard creates a new directory called simpleApp. This directory is sometimes referred to as the application root directory.

  • Make the application root directory the active directory.

    For example:

    cd simpleApp 
  • Application root directory has EJOSA folder structure. Browse the application root directory and note the following items created by the Application Wizard:

    • file 'build.xml'

    • 'readme.html' file that contains explanation of some simple instructions to build and run the application

    • 'specification' directory, contains source (interfaces and classes) that can be used for partial development of project. You can make presentation and specification layer only. Specification layer is link to (in these case missing) business layer. Specification layer also can be used with business layer to replace data layer in development stage of application.

    • 'data' directory, contains source that implements data logic

    • 'business' directory, contains source that implements business logic

    • 'presentation' directory, contains source that implements presentation logic

    • 'application' directory, contains batch files (start-enhydra.bat and stop-enhydra.bat) to start or stop application on Windows, and also shell scripts (start-enhydra and stop-enhydra) to start or stop application on Linux.

To build the application:

  • In the shell window (UNIX) or in the command window (WINDOWS), enter the enhydra-ant command from the application root directory. During the installation of Enhydra Enterprise Server in your path will be set path to the <enhydra_root>/multiserver/enhydra/bin which contains enhydra-ant.bat (enhydra-ant shell script for Linux):

    cd /enhydra/myapps/simpleApp
    enhydra-ant

    This will create bin directory in simpleApp/application/ which contains start-enhydra.bat and stop-enhydra.bat (start-enhydra and stop-enhydra shell scripts for Linux) and also webapps folder with subfolder autoload. Application is built in this folder (simpleApp.war and simpleApp in appwizard folder).

    File build.xml contains directives that tell ant to recursively descend the application directory tree. When you build the application ant compiles the files located in the simpleApp source directories (simpleApp/"Layer"/src where Layer is data, presentation, business or specification folder) and creates a corresponding classes directory structure. Finally, build.xml will invoke simpleApp/application/build-deploy.xml which will make simpleApp/application/bin/webapps/autoload/simpleApp directory and simpleApp/application/bin/webapps/simpleApp.war file if 'enhydra-ant makeWAR' command issued . This directory (and war file) will contain all nedded files from presentation, data, business and specification folder.

  • To start the application, enter the following commands in the Enhydra shell (UNIX) or in the command window (WINDOWS).

    • UNIX:

      cd application
      cd bin
      ./start-enhydra
    • WINDOWS:

      cd application
      cd bin
      start-enhydra
  • To stop the application, enter the following commands in the Enhydra shell (UNIX) or in the command window (WINDOWS).

    • UNIX:

      ./stop-enhydra
    • WINDOWS:

      stop-enhydra
  • To access the application, enter the following URL in your browser's location field:

    http://localhost:9000/simpleApp

NOTE: We are assuming that Enhydra Enterprise Server is installed with default connection port setting (9000).

The browser will display the Welcome page for the simpleApp application.

You should see "Welcome to simpleApp..." and the current date and time. Hit the reload button and watch the time update. The time is a sample of dynamic HTML: it could be replaced with anything you can access or compute in Java.

Clicking on the link "Sample redirect back to here" sends the browser to a special page that always responds with a redirect request back to the main page. Sometimes this occurs so quickly you may not notice anything happening. Redirects are very useful when you are building a Web application.

Chapter 3. Conclusion

Congratulations! You have just created a Web application using Enhydra! We recommend you to take some time to examine the build.xml files, the Java code, and the html files.