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:
- In the User Object painter,
create custom class user objects containing the functions and variables
you need. - In the JavaBeans Proxy Project painter, select the
objects for which you want to generate proxies, specify project
properties, and generate the Java classes. - In your Java development environment, build a Java
applet or application that use the generated classes. - Build your PowerBuilder server application.
- Deploy your Java applet or application.
- 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:
1 |
public string is_name |
1 |
private integer ii_privateint |
1 |
public integer ii_publicint |
1 |
public privatewrite string is_label |
1 |
constant real lr_pi = 3.14159265 |
These are the methods that are generated:
1 |
public String getIs_name( ) |
1 |
public void setIs_name( String var ) |
1 |
public Short getIi_publicint( ) |
1 |
public void setIi_publicint( Short var ) |
1 |
public String getIs_label( ) |
1 |
public Float getLr_pi( ) |
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:
1 |
f_addtwo (long al_num1, long al_num2) returns long |
This member function is generated in the Java class:
1 |
public Integer f_addtwo( Integer al_num1, Integer |
1 |
al_num2 ) throws RemoteException |
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
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:
1 |
public class uo_base extends JDPB_Instance implements |
1 |
SessionConstants |
1 |
{ . . . |
1 |
}; |
1 |
public class uo_derived extends uo_base implements |
1 |
SessionConstants |
1 |
{ . . . |
1 |
}; |
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.
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.