Using VisualCafe for SilverStream Development

This page describes SilverStream support for WebGain's VisualCafe Expert Edition, a third-party integrated development environment (IDE) for creating Java applications. SilverStream provides a plug-in to VisualCafe that allows you to develop SilverStream business objects in VisualCafe Expert edition and deploy them to the SilverStream Application Server for execution in the SilverStream runtime environment.

A SilverStream business object is a specific type of Java class that resides on a SilverStream server and, in some cases, responds to one or more events (or triggers) produced by the server.

This page includes the following topics:

Configuring VisualCafe to work with SilverStream   Top of page

To use the SilverStream plug-in for VisualCafe, you need to install SilverStream's VisualCafe integration software and update your classpath with the appropriate SilverStream JAR and ZIP files.

Installing the VisualCafe integration software   Top of page

To install the VisualCafe integration software:

  1. Run the SilverStream install program and select the VisualCafe integration option.

    The dialog you see above appears automatically when you select Typical Install as your installation type.

    NOTE   You can also install the VisualCafe integration software by selecting Custom Install. To do this, select Café integration in the list of options available for the Integration Packages component.

  2. Specify the VisualCafe installation directory in the Choose Destination Location dialog.

When you install the VisualCafe integration software, the install program performs these steps:

Updating your classpath   Top of page

After you install the VisualCafe integration software, you must add SilverServerAll.zip to your classpath so that you can build and compile SilverStream business objects in VisualCafe and then deploy them to run on the SilverStream Application Server.

To develop additional SilverStream classes--both server and client--in VisualCafe, you may need to add other SilverStream ZIP and JAR files to your classpath to give VisualCafe access to the necessary packages of the SilverStream API.

SilverStream help provides comprehensive information about how to update your classpath for developing specific types of SilverStream applications in external IDEs. Here is the reference:

Book

Programmer's Guide

Major topic

Core Programming

Chapter

Coding Java for SilverStream Applications

Search for

"Setting your classpath"

You can update your classpath either from Windows NT, by modifying the VisualCafe configuration file, or from inside VisualCafe, as described in the following procedures.

To update your classpath from Windows NT:

  1. Add the necessary files to your classpath environment variable in Windows NT System Properties.

  2. Open the VisualCafe configuration file:

      VisualCafe installation directory\bin\sc.ini 
    
  3. Set VCAFE_USEBOOTCLASSPATH = 1.

  4. Restart VisualCafe.

To update your classpath by modifying the VisualCafe configuration file:

  1. Open the VisualCafe configuration file:

      VisualCafe installation directory\bin\sc.ini 
    
  2. Add the necessary files to CLASSPATH.

  3. Restart VisualCafe.

To update your classpath from inside VisualCafe:

  1. Select Tools>Environment Options.

  2. Select the Virtual Machines tab.

  3. Add the necessary files to the Classpath for the Compiler and click OK.

Deploying business objects to SilverStream from VisualCafe   Top of page

SilverStream provides an API for developing business objects that run on a SilverStream server. This section describes how to create and deploy these objects. It includes the following topics:

About business objects   Top of page

There are two categories of business objects that you can create in VisualCafe using the SilverStream API and then deploy to a SilverStream server:

Creating triggered business objects   Top of page

SilverStream supports different types of business objects, each of which is activated by a unique trigger event on the server:

To create these objects in VisualCafe, you must implement specific interfaces from the SilverStream API--or in the case of servlet business objects, the standard javax.servlet.Servlet interface. A single business object class definition can implement more than one of these interfaces.

This section describes the requirements for creating each type of triggered business object. Each section also contains an example of how the Java source file should look with the minimal required set of import statements, interfaces, and method stubs. Note that these examples do not include constructor methods. If you choose to add a constructor, you must define a public constructor that takes no arguments.

After meeting these basic requirements, you can add the necessary business logic to write the methods and complete your business object.

Scheduled business object

This object is scheduled to run at a certain time. You can specify particular time intervals or dates for triggering this object.

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiScheduledListener

Methods to define

public void scheduleReached (AgoScheduledEvent evt)

Example

Here is the minimal code required for compiling a scheduled business object class:

For more information

To learn more about scheduled business objects, see the following in SilverStream help:

Mail business object

This object is triggered when the application server is notified of the receipt of Post Office Protocol 3 (POP3) mail for a particular mailbox address. Before you can run a mail business object, you must configure the SilverStream Server to poll for e-mail in one or more mail accounts from one or more POP3 servers.

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiMailListener

Methods to define

Example

Here is the minimal code required for compiling a mail business object class:

For more information

To learn more about mail business objects, see the following in SilverStream help:

Table-modified business object

This object is triggered by modifications to a database table, such as updating, inserting, or deleting rows. To run on the SilverStream server, your table-modified business object must meet the following requirements:

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiTableListener

Methods to define

Example

Here is the minimal code required for compiling a table-modified business object class:

For more information

To learn more about table-modified business objects, see the following in SilverStream help:

Server events business object

This object is triggered by server-wide events such as starting and stopping the server, issuing server errors, and user login and logout.

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiServerListener

Methods to define

Example

Here is the minimal code required for compiling a server events business object class:

For more information

To learn more about server events business objects, see the following in SilverStream help:

Invoked business object

This object is triggered by calls to the SilverStream method invokeBusinessObject() from an object on the server.

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiInvokedListener

Methods to define

public void invoked(AgoInvokedEvent evt)

Example

Here is the minimal code required for compiling an invoked business object class:

For more information

To learn more about invoked business objects, see the following in SilverStream help:

Data source business object

In the SilverStream data access model, the role of the data source object is to connect a data cache object AgaData to a data provider, which in turn connects to an external data source. This model allows Java client applications to access raw data from an external source by interacting with the data cache object and its methods.

The data source object is triggered when a client calls its invokeQuery() method, which you must program to connect the data provider to the data cache, as described in Accessing data from your business object.

    For more information about the SilverStream data model, see the following in SilverStream help:

Packages to import

com.sssw.srv.busobj.*

Interface to implement

AgiDataSourceListener

Methods to define

public void invokeQuery(AgoDataSourceEvent evt)

Example

Here is the minimal code required for compiling a data source business object class:

Beyond this basic code, you must add programming logic to the invokeQuery() method to connect a data provider to the client's data cache, as described in Accessing data from your business object.

For more information

To learn more about data source business objects, see the following in SilverStream help:

Servlet business object

This object is triggered when a SilverStream application performs an operation on an URL that has been associated with the servlet. These operations can include requesting, updating, and removing an URL.

Packages to import

cjavax.servlet.*

Interface to implement

Methods to define

Example

Here is the minimal code required for compiling a servlet business object class:

NOTE   getServletConfig() must return a javax.servlet.ServletConfig object--in this case, ag_servletConfig, declared as a private javax.servlet.ServletConfig object.

For more information

To learn more about servlet business objects, see the following in SilverStream help:

Cluster events business object

This object is triggered by cluster events, such as when a SilverStream server in a cluster starts up, stops, or can no longer be reached by the Cache Manager.

Packages to import

com.sssw.srv.busobj.*

Interface to implement

Methods to define

Example

Here is the minimal code required for compiling a cluster events business object class:

For more information

To learn more about cluster events business objects, see the following in SilverStream Help:

Creating utility objects   Top of page

SilverStream utility classes are used to encapsulate general-purpose Java code on the server, such as for providing a financial calculation that is shared by multiple business applications.

You develop SilverStream utility classes like any standard Java class except for the following restrictions:

If your utility object uses custom classes, you must add the associated ZIP and JAR files to your classpath. Depending on what type of utility object you develop, you might also need to include additional SilverStream ZIP and JAR files to your classpath. For more information, see Updating your classpath.

In the SilverStream runtime environment, you can use utility classes with any code running on the server--such as business objects--as long as they reside in the same database.

For more information about creating utility classes, see the following in SilverStream help:

Accessing data from your business object   Top of page

When you create a data source object (DSO), you must program its invokeQuery() method to perform the following functions:

SilverStream provides utility objects to help you produce commonly used data providers:

Utility object

Data provider

ExecuteSQL DSO

Returns results of SQL queries

SetResultSet DSO

Obtains its data from a java.sql.ResultSet

Pass-through DSO

Dynamically connects data cache of non-SilverStream client to standard SilverStream data set at runtime

The next section provides an example of a pass-through DSO.

    For more information about creating and using each of these DSOs, see the following in SilverStream help:

Example: Pass-through data source object

The pass-through DSO helps you create a data provider commonly required by clients developed in third-party IDEs--a provider that connects the data cache of a non-SilverStream client to a SilverStream data set.

To create a pass-through DSO in VisualCafe:

  1. Create a class that meets the requirements for a data source business object, as described in Data source business object.

  2. Add the following JAR file to your classpath:

      SilverStream installation directory\lib\ejb.jar 
    
  3. Program the invokeQuery() method to:

Here is what the code looks like for this example:

How to deploy business objects from VisualCafe   Top of page

To deploy business objects to SilverStream from VisualCafe:

  1. Start the SilverStream Application Server and add the database where you want to deploy your business object.

    For instructions, see the following in SilverStream help:

  2. Start VisualCafe.

  3. Configure your VisualCafe environment appropriately as described in Configuring VisualCafe to work with SilverStream.

  4. Create a new project.

  5. As part of the project, create your triggered business object or utility object, according to the guidelines in Creating triggered business objects and Creating utility objects.

  6. Compile the object and fix any errors that occur.

    NOTE   If your project contains objects that have compile errors, you will not be able to deploy any object from that project, even an object that compiles cleanly. Either fix the compile errors or remove the offending object(s) from the project.

  7. Specify the target server and database you started up in step 1 by performing these actions:

  8. Start the Business Object Deployer.

  9. In the Business Object Deployer, enter additional deployment information as necessary and click OK.

    The object is uploaded to the designated server. In the SilverStream Designer, you can see the deployed business object under Objects in a folder that bears the same name as the package you specified for the object.

    NOTE   If you deploy an object with the same name as one that already exists in the same location on the server, the new object overwrites the existing object.

    For complete details about using the Business Object Deployer, see Deploying Business Objects.

Accessing SilverStream help   Top of page

If you are working in VisualCafe, you can learn how to access comprehensive SilverStream help by selecting Accessing SilverStream Help from the VisualCafe Help menu.



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