PowerBuilder, Appeon, SQLAnywhere, ASE, EAServer and .Net

Chris Pollach

Subscribe to Chris Pollach: eMailAlertsEmail Alerts
Get Chris Pollach: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

STD Framework - PowerBuilder to Java Example!

** New Feature **

STD Integrated Framework

PowerBuilder to Java Interop!

 

    Software Tool & Die Inc. are pleased to announce the release of the updated PowerBuilder to Java interoperability example application (PB2Java)! The updated PB2J example (2018R1) application is also built from the latest STD Integrated Framework (version 2018.2.0.97 released on 2018-03-11) and the newest Appeon PB2017R2 release (build 1769). Now the ability of a PowerBuilder Classic based application to "consume" a Java class and call its methods is even easier than before and totally encapsulated into the STD Integrated Framework for PB developer productivity!

    The PowerBuilder IDE since early 2000 has had the ability to call EJB (Enterprise Java Beans) due to the introduction of the Java based Application Server by Sybase named EAServer. With EAS came the ability to call a remote EJB in any J2EE based application server by using RMI (remote method invocation) that was exposed as the "Home" interface. The EJB Home Interface though can be either local or remote in nature. Thus when dealing with a native MS-Windows PB application that has Java classes deployed along side of it, we can use the local Home interface to interact with it from a PB application. This is, as long was we expose the Java application as an EJB (that is .. follow the EJB construction rules).
   When the Java developer creates a Java class, they can also create a Home interface or what PowerBuilder would refer to as an EJB "proxy". A Proxy is a Class/Method signature that allows PB to treat the Java application as a "bean". According to the generally accepted definition of a Java proxy is as follows: "A proxy class is a class that implements a list of interfaces". Since CORBA (Common Request Object Broker Architecture) support was added to PowerBuilder a long time ago - PB understands "proxies" very well. So if we can get your PB application a list of proxy classes it needs to deal with an EJB, it can then communicate with it. First of all, we can build a Java Class and then build a HOME interface for that using your standard development environment - even "notepad" for us poorer folk. Once completed, you can just compile the EJB class and its Home class using the JAVAC compiler, as follows:
  Now that we have an EJB and a Home class to serve as a "proxy" road-map for PowerBuilder, we can use the Classic IDE to build the necessary interfaces for us in a PowerBuilder Library (PBL) to use in our application. To perform this step, we need to call on the IDE's Project Painter to help us with this task. When creating a new project, we can then select EJB Client Proxy option. This will build a a PB Project object that can build all the necessary proxy interfaces for you. All we need to do is specify the Java Bean  class and its HOME (interface) class to the proxy painter. for example:

  Once the EJB Client Proxy project is properly configured, the next step will be to run the project, as follows:

    Now that we have the "proxies" required for the Java interface (Home) class, we can now instantiate the EJB by using its proxy in your PB Application. The only challenge beforehand, is loading the Java Virtual Machine (JVM) and activating its JNI (Java Native Interface) JDK to inter-operate with your Java EJB. Luckily, this is where the STD Integrated Framework steps in to help you. All you need to do is call a new "of_create_instance" method in the Application Controller supplied by the framework and it will perform all of the JVM the house keeping for you including: loading, reusing, unloading, garbage collection, etc of the PB to JVM infrastructure! So now the PB Developer can just concentrate on using the EJB's methods & processes, for example:
 
  To make this easier to follow, STD have created a working example of this PB to Java mechanism for you to examine, learn and move forward with your organizations Java interoperability within your PowerBuilder project. You can download the PB2Java example built from the STD Integrated Framework by clicking here!
   
Enjoy!

Regards ... Chris

Read the original blog entry...

More Stories By Chris Pollach

Chris Pollach is a Senior Consultant with over 30 years experience in Systems and Software Analysis, Development, Maintenance and Technical Support, mainly in the areas of GUI Design, MS-Windows Programming, Java / .NET Programming, Wireless, Application / Web Server Design & Programming, Object Oriented Development Tools and Methodologies, Data Base, Data Communications and Network application development. He has participated in numerous technical, planning and management roles, as well as consulted and educated in these fields for a diverse clientele. He is also the owner of “Software Tool & Die Inc.” a company dedicated to provide custom software and education solutions on Object Oriented business systems.

As an educator, Chris is certified to teach PowerBuilder (first in Canada), MS-SQLServer, Sybase’s Enterprise Application Studio and EAServer integrated application/web development environment. He is former Certified SilverStream developer (CSSD) and current Certified PowerBuilder Developer – Associate / Professional (CPD-P) as well as a Certified Sybase Tools Instructor (CSI).

Chris has written numerous articles in various popular personal computer magazines, newsletters and is the author of the PowerGuide and PowerExpert products as well as the STD Foundation Classes. Currently, Chris has developed a Foundation Class library for Sybase's PocketBuilder, SAP's PowerBulder and EAServer products and now Appeon Web & mobile products that integrates JSP or ASP web development, Section 508 / CLF web standards and mobile applications. A new Web Service framework has also been released for IIs to support PowerBuilder based web service NVUO's!

Chris recently became a 2nd Degree Black in the TaeKwonDo martial art and has developed a Martial Art multimedia study guide using the Component-One “Doc2Help” and Sybase PowerBuilder products. Since the fall of 2004 he became a TaeKwonDo instructor for the City of Ottawa’s Goulbourn program. He has also been certified with the World TaeKwonDo Federation (February 2005 - 1st Dan and October 2008 - 2nd Dan).

Chris was awarded the Sybase “Innovation and Achievement” award for 2005 as voted for by the International Sybase User Group (ISUG). This award was presented for innovations to the PocketBuilder mobile development product, contributions to the PowerBuilder News groups and support of the Ottawa Sybase User Group.

To round his management and leadership skills, Chris is the former president of the Kiwanis Club of Goulbourn and still volunteers his time with the service clubs in his area. He is also the coordinator of the Ottawa Sybase User group and a certified NAUI scuba instructor. For the last three years, Chris has been voted onto the ISUG Board of Directors and holds the position of "Director - North American User Groups".