Using an EJB Proxy project

To create a new EJB Client Proxy project, select either of the following from the Projects page of the New dialog box:

EJB Client Proxy icon

The EJB Client Proxy icon opens the Project painter for EJB proxies so you can create a project, specify options, and build the proxy library.

StepsTo create an EJB Client Proxy project in the Project painter:

  1. Double-click the EJB Client Proxy icon on the Projects page of the New dialog box.

  2. To specify the EJB, select Edit>Select Objects and enter the fully qualified name of the component’s remote interface in the text box, for example com.sybase.jaguar.sample.svu.SVULogin or portfolio.MarketMaker.

  3. Enter the path of the directory or JAR file that contains the EJB’s stubs in the Classpath box and click OK.

    If the stub files are in a directory and the fully qualified name of the EJB is packagename.beanname, enter the directory that contains packagename.

  4. To specify the PBL where the proxy objects should be stored, select Edit>Properties and browse to the location of a library in the target’s library list.

    You can specify an optional prefix that is added to the beginning of each generated proxy name. Adding a prefix makes it easier to identify the proxies associated with a specific EJB and can be used to avoid conflicts between class names and PowerBuilder reserved words. The prefix is not added to the name of proxies that are not specific to this EJB, such as the proxies for exceptions, stream objects, and ejbhome, ejbobject, ejbmetadata, handle, and homehandle.

  5. Close the dialog box and select File>Save to save the project.

The new project lists the EJB component for which a proxy will be generated and specifies the name of the output library that will contain the generated proxy objects.

EJB Client Proxy Wizard icon

The EJB Client Proxy Wizard helps you create the project.

StepsTo create an EJB Client Proxy project using the wizard:

  1. Double-click the EJB Client Proxy Wizard icon on the Projects page of the New dialog box and click Next on the first page of the wizard.

  2. Select a library in which to store the project object and click Next.

  3. Specify a name and optional description for the project and click Next.

  4. As shown, enter the fully qualified name of the component’s remote interface in the text box, for example cocoPortfolio.Portfolio:

    The example shows the EJB Client Wizard at the screen titled Specify E J B Name and Class path. At the top is the prompt Enter the name and location of the E J B stub. The first text box is labeled E J B Component Name: e g, p b E J B Sample dot Hello E J B. In the text box is entered coco Portfolio dot Portfolio. The next text box, labeled E J B stub Class path, shows the sample class path D : backslash Program Files backslash sigh base backslash E A Server backslash h t m l backslash classes. The last text box is labeled Prefix For E J B Component Proxy Name : and shows the entry p f _

    The component’s home interface name is entered automatically using the standard naming convention, although the wizard lets you modify this name if necessary.

  5. Browse to select the JAR file that contains the EJB’s stubs or the directory that contains the stub package.

    If the stub files are in a directory and the fully qualified name of the EJB is packagename.beanname, enter the directory that contains packagename.

  6. Specify an optional prefix that is added to the beginning of each generated proxy name and click Next.

    Adding a prefix makes it easier to identify the proxies associated with a specific EJB and can be used to avoid conflicts between class names and PowerBuilder reserved words. The prefix is not added to the name of proxies that are not specific to this EJB, such as the proxies for exceptions, supporting classes, and EJBHome, EJBObject, EJBMetaData, Handle, and HomeHandle.

  7. Browse to select an existing library and click Next and Finish.

    The proxy objects are generated and stored in this library, which must be added to the target’s library list.

After the wizard has created the project, you can use the Project painter to modify your project settings.

Building proxies

Whether you create the EJB Proxy project using the wizard or the painter, the final step is to build the proxy objects. To do so, click the Build icon on the painter bar or select Design>Deploy Project from the menu bar.

NoteProxy generation requires javap.exe PowerBuilder uses the javap.exe utility to generate proxy objects. This executable must be in your system path. By default, EJB client development uses the Sun JDK 1.4 installed with PowerBuilder. The path and classpath required by the Java VM are added to the path and classpath used in the current session automatically.

If you want to use a different JDK installation, select Tools>System Options, then click Set JDK Location on the Java page of the System Options dialog box. For WebSphere, the path to the IBM JDK installation can be used instead.

In addition to the proxies for the home and remote interfaces of the EJB, proxies are also generated for any Java classes referenced by the EJB, for ancestor classes, for any exceptions that can be thrown by the EJB and its supporting classes, and for the following interfaces:

Object

Description

EJBHome

Proxy for the javax.ejb.EJBHome interface, the base class for all EJB home interfaces.

EJBMetaData

Proxy for the javax.ejb.EJBMetaData interface. Allows a client to obtain the EJB’s home interface and the class objects for its home and remote interfaces and primary key class (for entity beans), and to determine whether the bean is a session or stateless session object.

EJBObject

Proxy for the javax.ejb.EJBObject interface, the base class for all EJB remote interfaces.

Handle

Proxy for the javax.ejb.Handle interface. Used to provide a robust persistent reference to an EJB.

HomeHandle

Proxy for the javax.ejb.HomeHandle interface. Used to provide a robust persistent reference to a home object.

For more information about these interfaces, see the documentation for the javax.ejb package.

The project also generates a structure that stores the mapping of Java classes to proxy names. This structure is used internally and should not be modified.