About the JavaBeans proxy generator – PB Docs 70

About the JavaBeans proxy generator

Use the JavaBeans proxy generator to build a Web-based application
with Java as the front end and business logic written in PowerScript
running on a distributed PowerBuilder server in the middle tier.

You create business logic in custom class user objects in
the User Object painter, then use the JavaBeans proxy generator
to create a set of pure Java classes representing the PowerBuilder custom
class user objects. You can generate source or bytecode representations
of the classes in the Project painter. You use the generated Java
classes to enable communication between a Java client application
and a PowerBuilder server application.

In the Java application, you write presentation logic for
the user interface to the application or applet; users interact
with menus and AWT controls, which make calls to user object functions
(through the PowerBuilder-generated JavaBeans) and display the results.
The proxy makes the location and the language of the remote object
transparent.

About the development process

To generate and use Java classes, you need to complete the
following steps:

  1. In the User Object painter,
    create custom class user objects containing the functions and variables
    you need.
  2. In the JavaBeans Proxy Project painter, select the
    objects for which you want to generate proxies, specify project
    properties, and generate the Java classes.
  3. In your Java development environment, build a Java
    applet or application that use the generated classes.
  4. Build your PowerBuilder server application.
  5. Deploy your Java applet or application.
  6. Deploy your PowerBuilder server application.

What gets generated

For every custom class user object you select, the JavaBeans
proxy generator generates a class representing the public functions
and instance variables in the object. The Java class has the same
name as the original user object. The JavaBeans proxy generator
also generates classes for global structures implemented in your
custom class user objects.The JavaBeans proxy generator can generate
the classes in either source code or bytecode format.

Source code versus bytecode

You choose whether to generate a representation of your user
objects as source code (the default) or bytecode in the Project
painter.

How variables are represented

Public instance variables in the custom class user object
are represented by public member functions in the generated class.
For private and protected variables and variables declared as privateread
or protectedread and privatewrite or protectedwrite, no member functions
are generated.

For example, if an object has these instance variables:

These are the methods that are generated:

How functions are represented

The only difference between the PowerBuilder function signature
and the Java function signature is that the Java functions use Java
data types.

For example, if an object has this user object function:

This member function is generated in the Java class:

What additional classes get generated

The JavaBeans proxy generator creates additional classes for:

  • Ancestor user objects
  • Global structures used as public instance variables,
    public function return values, or public function arguments

note.gif Visual types If the JavaBeans proxy generator finds any ancestors, parents,
nested types, or other referenced objects that are visual types,
it fails and issues an error message.

Inherited user objects

If the ancestor of a selected user object is another custom
class user object, the Java class for the derived object type will
inherit from the base object type. If the selected user object inherits
from the NonVisualObject object, the generated Java class inherits
from the standard class type JDPB_Instance. The Java generator
generates both classes even if you only select the derived class.

For example, if uo_derived inherits from uo_base,
the JavaBeans proxy generator generates the following declarations:

Structures

If the user object contains global structures, PowerBuilder generates
an appropriate class declaration and separate holder classes for
use when passing the structure by reference.

note.gif No classes generated for object structures The JavaBeans proxy generator creates no classes for object-level
structures in the custom class user object, because such structures
are private.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x