This page describes SilverStream support for Borland's JBuilder Foundation and Enterprise editions, both third-party integrated development environments (IDEs) for creating Java applications. The SilverStream integration with JBuilder allows you to develop Enterprise JavaBeans (EJBs) and business objects in JBuilder 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.
The EJBs and business objects can be created in JBuilder or imported into JBuilder from another external IDE.
JBuilder Enterprise Edition provides a visual development environment for creating EJBs; with the Foundation Edition, you must create your EJB JAR files by hand.
This page includes the following topics:
To use JBuilder with SilverStream, you need to install SilverStream's JBuilder integration software and update your classpath with the appropriate SilverStream JAR and ZIP files.
If you are using JBuilder Enterprise Edition, you must also install the J2EE libraries from the Sun Microsystems Web site as described in JBuilder 3.5 Hints and Tips, which you can access from the JBuilder Help menu.
To install the JBuilder integration software:
The dialog box you see above appears automatically when you select Typical Install as your installation type.
NOTE You can also install the JBuilder integration software by selecting Custom Install. To do this, select JBuilder integration in the list of options available for the Integration Packages component.
When you install the JBuilder integration software, the install program performs these steps:
SilverDesignerAll.zip contains SilverStream classes required by the integration software.
After you install the JBuilder integration software, you must add SilverServerAll.zip to the classpath for your JBuilder project so that you can build and compile SilverStream EJBs and business objects in JBuilder and then deploy them to run on the SilverStream Application Server.
To develop additional SilverStream classes--both server and client--in JBuilder, you may need to add other SilverStream ZIP and JAR files to your classpath to give JBuilder 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:
To update the classpath for your JBuilder project:
The Project Properties dialog opens.
NOTE To update the classpath for all projects, select Project>Default project properties instead.
The Select one or more libraries dialog opens.
The Edit library dialog opens.
SilverStream installation directory
\lib\SilverServerAll.zip
The SilverStream integration with JBuilder allows you to deploy EJBs created in JBuilder--or imported into JBuilder--to a SilverStream server. The integration software uses the information in the deployment descriptor, along with additional information provided during deployment, to ensure that the beans execute properly in the SilverStream runtime environment.
This section includes the following topics:
SilverStream help provides additional information about deploying EJBs in SilverStream. See the chapter on deploying EJBs in the Programmer's Guide.
You can deploy any EJB JAR that conforms to the EJB 1.1 specification to SilverStream. The JAR must contain the following components:
You can create the EJB JAR in JBuilder or in another third-party tool.
You specify all additional information required for deployment in a deployment plan. The Deployment Plan Designer provides a simple user interface for specifying the deployment plan. The deployment plan is stored in XML format in a file on disk. It is not uploaded to the server.
The information required for the deployment plan varies depending on what's in the EJB JAR.
For all EJB deployments
For each EJB contained in the EJB JAR
For container-managed entity beans
You can deploy the same EJB JAR multiple times with different deployment plans.
For complete details about specifying this information in the Deployment Plan Designer, see
Deploying EJBs.
When you deploy EJBs to a SilverStream server, SilverStream creates the runtime classes that implement the bean's home and remote interfaces, and any other environment-specific classes that the container needs to run the bean(s) supplied in the EJB JAR.
At deployment time, the SilverStream server constructs a deployed object and a remote EJB JAR in the SilverStream database. The original EJB JAR is not actually deployed; it just provides the raw materials for the construction of the deployed object and remote JAR.
The deployed object includes the implementation classes for the bean's remote and home interfaces. It is used only by the SilverStream server.
The remote JAR file includes stub or reference classes that you can use to call the server-side implementation classes. All clients should use the remote JAR. This includes SilverStream clients within the same server, forms served to JRunner by the same server, SilverStream clients within another SilverStream server, and standalone Java programs. You need to include this remote JAR in SilverStream forms, pages, and business objects. You need to add this JAR to your path if you are accessing EJBs from an external client.
For convenience, the remote JAR also includes each bean's home and remote interface and any classes directly referenced by them. For example, it includes any classes referenced as parameters or return values. In general, the remote JAR includes any of the classes a caller needs to use the bean.
To deploy EJBs to SilverStream from JBuilder:
For instructions, see the following in SilverStream help:
The SilverStream EJB Deployment Plan Wizard appears.
The Deployment Plan Designer opens in the JBuilder Content pane, incorporating the deployment information specified in the EJB JAR.
You can select two views of your deployment plan using the tabs at the bottom of the Content pane:
Before you can deploy your EJB, you must specify certain information depending on what's in your EJB JAR, as described in Required information for deployment.
NOTE This button is only available in Design view.
The deployed object and the remote JAR are uploaded to the designated server. In the SilverStream Designer, you can see the deployed object and the remote JAR in the Jars folder under EJB JARs & Media.
For complete details about using the Deployment Plan Designer, see
Deploying EJBs.
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:
There are two categories of business objects that you can create in JBuilder using the SilverStream API and then deploy to a SilverStream server:
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 JBuilder, you must implement specific listener 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. After meeting these basic requirements, you can add the necessary business logic to write the methods and complete your business object.
Here is a procedure to use for setting up the class file for triggered business objects using the SilverStream API:
To set up the class file in JBuilder for triggered objects:
The Class Wizard opens.
The Select a base class dialog opens.
The interface is entered as the base class. The interfaces required for each type of triggered business object are described in the next sections.
The class file is created, including the proper import statements, listener interface, and method stubs.
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
Interface to implement
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:
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
Interface to implement
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:
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:
Table-modified business objects do not respond to changes in database structure or to data modified by external database applications.
Packages to import
Interface to implement
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:
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
Interface to implement
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:
This object is triggered by calls to the SilverStream method invokeBusinessObject() from an object on the server.
Packages to import
Interface to implement
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:
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
Interface to implement
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:
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
Interfaces 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:
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
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:
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 the SilverStream help:
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:
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:
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 JBuilder:
AgaData db = evt.getAgaData("db");
db.initialize("db", evt.getDatabase());
evt.setDataSource(db.detachDataSource());
Here is what the code looks like for this example:
For more information, see the chapter on using data source business objects in the Programmer's Guide in SilverStream help.
To deploy business objects to SilverStream from JBuilder:
For instructions, see the following in SilverStream help:
The SilverStream Business Object Deployment dialog appears, with fields filled in based on what you entered in the Server and Database Setup dialog.
You can browse the file hierarchy by selecting the Choose object to deploy button.
Any changes you make to server and database here are automatically reflected in the setup parameters.
If the destination is protected, you must enter a user name and password.
The Business Object Deployer dialog appears.
One or more trigger check boxes are selected, based on the interfaces implemented by your business object. In this example, the object is a Data Source Business Object that implements only the AgiDataSourceListener interface. Note that you must specify additional deployment information for each object type--in this case, whether the object is a pass-through data source object. For utility objects, no triggers are checked.
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. By default, JBuilder specifies a package name that is the same as the project name.
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.
If you are working in JBuilder, you can learn how to access comprehensive SilverStream help by selecting Accessing SilverStream Help from the JBuilder Help menu.