Tools Guide



Chapter 7   Business Object Designer

The Business Object Designer gives you an object-oriented, visual environment for creating SilverStream business objects. You can create packages to contain your business objects, Java interfaces, and Common Object Request Broker Architecture (CORBA) Interface Definition Language (IDL).

You use the Programming Editor, in the lower portion of the Designer, to write Java Code for the objects you create. For information about using the programming editor, see Programming Editor.

This page describes the following:

Creating packages   Top of page

The SilverStream Business Object Designer lets you create your own Java packages for business objects. Packages let you organize, group, and separate your business objects. It also lets you control the use of the Java class name space. Packages appear in the SilverStream Designer as directory trees.

To create a Java package:

  1. Select the Object and New icons in the SilverStream Designer. A popup menu appears.

  2. Select New Package from the menu. The Create a New Package dialog box appears.

  3. Enter a name for your package and press OK.

    Your new package appears in the right pane of the SilverStream Designer. If you already had a package selected, the new one appears below the current selection. If you had a business object selected, the new package appears on the same level in the directory. If you do not have anything currently selected, the new package appears at the top level of the hierarchy. If you select this package, any object you create will be put there.

Creating interfaces   Top of page

To create a Java interface:

  1. Select the Object and New icons from the SilverStream Designer. A pop-up menu appears.

  2. Select New Interface from the menu. The Interface Wizard dialog box appears.

  3. Press Add Interface to add the name of an existing interface that will be extended by the interface you are creating.

  4. Press OK. The interface name you entered appear in the Interface wizard dialog box. Repeat steps 3 and 4 if your new interface extends more than one other interface.

  5. Press Next> when you finish specifying Java interfaces. The next Interface Wizard screen appears.

  6. Enter a name for your new Java interface and press Finish. The Business Object Designer appears. Write the methods that the new interface defines in the edit area of the Business Object Designer.

Creating CORBA IDLs   Top of page

CORBA specifies a framework for distributed objects. You can use CORBA as a model for defining and using multi-language objects, as a protocol for inter-machine communication, and as a set of runtime services. The CORBA IDL allows the client program, for example, a Java applet or application, to make direct calls to the object. For more information, see the CORBA chapter in the Programmer's Guide.

NOTE   You must create a CORBA IDL within a package. Do not place two top-level CORBA objects within the same package.

To create a CORBA IDL:

  1. Select CORBA IDL from the Business Object pop-up menu. The CORBA IDL Wizard appears.

  2. Enter the name of the JAR file that will contain the Java classes generated by the interface.

  3. Check the Top level object check box if the CORBA IDL you are defining is going to be the main interface definition. If you are going to include this file within another file, leave this check box blank. Press Next>.

  4. Enter a name for the CORBA IDL and press Finish. The Business Object Designer appears. You can enter and edit your interface definitions in the Business Object Designer's edit area.

Creating utility classes   Top of page

Utility classes are general-purpose Java Classes that you create as a "trigger-less" object. You can use utility classes with any code running on the server, such as business objects and pages, as long as they are in the same database. To use utility classes with client-side Java applications (forms), or to use them with objects in another database, you must make them accessible from JAR files.

Create a utility class:

  1. From the SilverStream Designer, select Objects in one of the databases.

  2. Click the New icon (at the lower part of the Window) and select New Object.

  3. Click Next on the initial dialog. (Do not select a trigger).

  4. Follow each step in the Wizard to create the class you want. That is, you specify which class it extends, which interface(s) it implements, and so on.

  5. Once you have created the class, write the methods for the class.

You must write any import statements that you need.

Creating data source objects   Top of page

A SilverStream data source object (DSO) is a triggered business object that extends the SilverStream data access model. You can use a DSO to retrieve data from any target data source. You can then pass the result set to SilverStream Java and HTML forms.

To create a DSO:

  1. Select the Object icon and the New icon from the SilverStream Designer. A pop-up menu appears.

  2. Select New Object. The first Business Object Wizard screen appears.

  3. Select the Data Source check box and press Next>. The second Business Object Wizard screen appears. This screen changes, depending on the type of business object you specified in the first screen. For Data source objects, the second Business Wizard screen prompts you to define the database table columns that your DSO will use. If you specify column definitions, it means that you can bind a control to one of those columns at design time.

  4. Select Add. The Add Column Description dialog box appears. Enter the column name and its type.

  5. Press OK. Repeat this procedure until all of the table columns you want are specified.

  6. Check the Updatable check box if you want your data source object to update the target database.

  7. Press Next>. The next Business Object Wizard screen appears.

  8. Enter a name for your data source object in the Object name field.

  9. Select the modifier appropriate for your business object in the Modifier field.

    NOTE   Triggered business objects like data source objects must have the Public modifier selected. This is the default.

  10. Click on the down arrow in the Lifetime field to specify the object's lifetime. This is also known as persistence.

  11. When you are through specifying information for your business object, press Next>. You can also just press Next> without making any changes if you want to accept the defaults for the object. The Business Object Designer appears.

  12. Enter the code for your data source object in the Business Object Designer's edit area.

Creating servlets   Top of page

You can use the SilverStream Business Object Wizard to create a Java servlet. Servlets are triggered when the SilverStream server receives an HTTP request.

To create a servlet:

  1. Select Servlet (HTTP request) from the first Business Object Wizard screen and press Next>. The next Business Object Wizard screen appears.

  2. Press Add to specify the URLs that you want the servlet to respond to. The Add URL dialog box appears.

  3. When you finish specifying URLS, press OK. Each URL must be relative to the database where the business object is located. One servlet can respond to multiple URLs. The second Business Object Wizard screen appears.

  4. Enter a name for the servlet and specify its modifier options and lifetime, or just press Next> to accept the defaults.

    NOTE   Servlet names must follow the standard Java object naming conventions. You cannot use any SilverStream reserved words.

    The next Business Object Wizard screen appears.

  5. Specify any interfaces that you want your servlet to implement. If your servlet does not require any interfaces, press Finish. The Business Object Designer appears.

  1. SilverStream implements the appropriate listener interfaces for the triggers that you define for your business object by default. SilverStream automatically implements the AgiHttpListener servlet interface.

The default servlet object event appears in the edit area of the Object Designer. This is the service() event on the AgoServletInvoker object. This event is defined in the javax.servlet.Servlet interface.

Creating table-triggered business objects   Top of page

Another common type of business object is the table-modified business object. It listens for any modifications that are made to the database table you specify.

To create a table-modified business object:

  1. Select Table modified from the first Business Object Wizard screen and press Next>. The next Business Wizard screen that appears prompts you to select a database table to associate with the business object.

  2. Select a table from the list of tables residing on the current database and press Next>. The next Business Object Wizard screen that appears prompts you to enter a name for the business object.

  3. Enter a name for the business object and specify any other options you want it to use or press Next> to accept all the defaults. The next Business Object Wizard appears.

  4. Specify any interfaces that the business object might use. Press Finish. The Object Designer appears. You enter code for the business object in the edit pane.

Adding objects to a package   Top of page

To add new objects to a package:

  1. Select a package and the New icon from the right pane of the SilverStream Designer. A popup menu appears.

  2. Select either Object, Interface, or CORBA IDL, depending on the type of object you want to add. Follow the procedures outlined in the previous sections to create the specific object that you want to add to a package.

NOTE   You can add existing objects to a package by opening the object in the Object Designer and selecting Save As from the File menu. If the package already exists, uncheck the "Create Package if it doesn't exist" check box.

Adding subpackages to a package   Top of page

To add a subpackage to a package:

  1. Select the package that you want to contain the sub-package. Select the New icon. The Object popup menu appears.

  2. Select New Package. The Create New Package dialog box appears. Enter a name for your new package and press OK. The new package appears as a subpackage in the SilverStream directory.






Copyright © 2000, SilverStream Software, Inc. All rights reserved.