Working with Verastream Java Beans

Java Bean components, or Beans, are reusable software components that can be manipulated visually in a Java application development tool. Beans can be combined to create traditional applications and incorporated into Web applications as Java servlets.

When you generate, the following files are copied to the <VHI install folder>\projects\<ProjectName>\javabeans\src\<ProjectName> directory, for each model and its associated procedures:

The corresponding class files are located in the bld directory.

Java Beans Setup

Prior to using Verastream Java Beans for a production application:

  1. If necessary, rebuild the Java Beans project to access the model on the production server:
    1. In Web Builder, open the Project Properties dialog box for the Java Beans project.
    2. In the Project Properties dialog box, enter the correct server name.
    3. Click Build to regenerate the Java Beans using the production server name.
  2. Copy the <VHI install folder>\projects\<projectname>\javabeans folder to the web server.

  3. Change the server's CLASSPATH to include these lines:


Java Beans Code Example

This example illustrates how to use Web Builder generated Java Beans. The example uses a project named CICSAccts_beans, which generated Java Beans for the CICSAccts model. The GetAccount procedure takes an account number as an input parameter and returns account information.

// Create an object to represent the session
CICSAccts_beans session = new CICSAccts_beansSession();

// Create a bean to hold the filter values
GetAccountFilters filters = new GetAccountFilters();

// Initialize the filters bean with the values you want to pass to the host
filters.setAcctNumber(new Integer (20000));

// Call the procedure on the session, passing in the filters
GetAccountRecordSet recordSet = session.getAccount(filters);

// Access the array of records and process through them

GetAccountRecord[] records = recordSet.getGetAccountRecords();
for (int i = 0; i < records.length; i++)