Chapter 6. Developing an Expresso Application

Table of Contents

Introduction
Planning the Application
Create the Packages
Create a Schema Object
Create any required DB Objects
Create any required Controller Objects
Create any required Job Objects
Conclusion
Contributors

Note

If you find this EDG documentation helpful please consider DONATING! to keep the doc alive and current.

 Maintainer:David Lloyd

This guide describes the process of developing an Expresso application.

Introduction

This guide describes the process of developing an Expresso application. Although there are many different ways to use Expresso's components, the steps described here should provide your best results.

Developing an Expresso Application consists of the following general steps:

Planning the Application

An Expresso application consists normally of a group of Database Objects (embodying the Model and persistence of the application), See the section on Database Objects for more information about Database Objects. Controller objects (providing the Controller aspects of the MVC architecture, and encapsulating all interaction with users), Job objects (handling all longer tasks and "background" jobs), and a single Schema object to tie them all together. At this point the application can be tested, using the default "view handlers".

Then the "view" of the application is created, using one of the several different UI technologies available - for example, JSP pages with Struts and the extended JSP tag library, or XML/XSL stylesheets.

Of course, the application can have many other objects that don't fall into these categories, but these are the main classes of objects that Expresso is concerned with and can help with. Please see the specific documentation in the EDG for each of these kinds of objects for where and how they can best be used.

Create the Packages

Typically an Expresso application resides in a single top-level package, with a number of sub-packages. For example, if you are creating a membership management application, you might call the package com.yourcompanyname.members. Within the base package are usually the following packages:

  • dbobj: Contains the database objects for the application

  • controller: Contains the Controller objects for the application

  • job: Contains the job objects for the application, if any.

Of course the application may require other packages, but these are the basics.

Create a Schema Object

The Schema object for the application allows the entire application to be referenced by Expresso. This then allows Expresso to administer the application's security and other administration automatically when the Schema object is registered with Expresso (see Expresso's "Application" page for details on registering the Schema object with Expresso)

Usually you would create the Schema object in the "root" package for the application.

The easiest way to create your own Schema object is to copy an existing Schema class, such as the one included with eForum, which is in the com.jcorporate.eforum package, called "ForumSchema.java". You can then modify the following areas of the Schema to customize it for your application:

  • Name: The name of the class should be changed of course, any valid class name is appropriate. For example, if your application handles a membership list, you might call your Schema object "MemberSchema".

  • Title: The "getTitle()" method returns the title of this schema object - edit the String returned as appropriate.

  • Version and Required Versions: Other methods in the Schema specify the version of your application, as well as the version of Expresso that is required. These methods can also be used to specify dependencies of your application on other applications - for example, if your application requires the eForum application. See the Javadoc for

  • Default Component Code: The component code for an application defines the name of a sub-directory of the "components" directory, which is by default the location of any JSP and HTML pages associated with this application. In eForum, for example, the component code is "eforum", and the JSP's for eForum are in the expresso/components/eforum directory.

  • Message Bundle Path: Each application may have it's own MessageBundle.properties file, which contains keys and associated message strings for each of the languages supported by the application.

Create any required DB Objects

Database objects are normally created in the "dbobj" sub-package of the application. An Expresso application can use as many DB objects as required, and each should be listed in the Schema object for the application, so that the DBTool and DBCreate utilities in Expresso can create the required tables automatically for you when the application is first set up on a particular database. Database objects are designed to be the persistence layer of Expresso, and should take full advantage of the facilities provided by Expresso for them, such as caching, valid values, declarative referential integrity, and built-in security. See the page in the EDG on database objects to understand how to use these objects to their best advantage.

Create any required Controller Objects

Controller objects should be used to encapsulate the logic of your application, especially any user-interaction required. The idea is to take advantage of things that are provided by the framework and not re-invent anything that is not required. You must design your user-interface in a presentation-independent way, thinking in terms of abstract inputs and outputs, to take best advantage of Controller objects. This allows you to take advantage of the GUI-independent user-interface abilities in Expresso, easily modifying the "view" of your application even once the logic is completed.

The controller chapter is dedicated to explaining the details of Controller objects can help you create and test your Controllers easily.

Create any required Job Objects

Job objects can be created and used for any task that can run independent of the user - e.g. longer tasks that do not require user interaction, or tasks that require extensive processing of databases or other data sources and might take some time. Typically a Job object is designed to send some kind of notification of it's completion to the originating user - the methods built into the Job object make this easy to do.

The page giving details of the Job object can help you create and deploy your Jobs effectively.

Conclusion

Contributors

The following persons have contributed their time to this chapter:

Note

Was this EDG documentation helpful? Do you wish to express your appreciation for the time expended over years developing the EDG doc? We now accept and appreciate monetary donations. Your support will keep the EDG doc alive and current. Please click the Donate button and enter ANY amount you think the EDG doc is worth. In appreciation of a $35+ donation, we'll give you a subscription service by emailing you notifications of doc updates; and donations $75+ will also receive an Expresso T-shirt. All online donation forms are SSL secured and payment can be made via Credit Card or your Paypal account. Thank you in advance.

Copyright © 2001-2004 Jcorporate Ltd. All rights reserved.