Archive for Java

Running CA Plex Java on (virtually) any platform

Is Java truly write once run everywhere? In years past, it was often not the case but in the modern day it is more or less true. And you can run your Plex Java apps on many platforms with good performance, given a supported database and JRE. This is a very nice situation for the ISV or corporate developer who needs to rehost.

In practice is is advisable and desirable to run and debug a CA Plex java app on a Windows or another platform during the development process, such as Mac OS, Linux, iOS, Unix (Aix), or zOS. By far the easiest way to accomplish this is by using the free Eclipse IDE, or if you already have IBM Rational – then you can use this version. The Eclipse (Rational) product runs on virtually every major computing platform, from PC’s to the big iron iOS or zOS. If you do purchase a Rational version, you will have the added benefit of being able to debug not only Java, but RPG and COBOL as well. This is nice if you are trying to debug a full featured multitiered web app, running both in the web container and back end server. WebClient supports this style of application architecture.

The examples below use Eclipse for Mac and CA Plex 7.0, but the steps are the same regardless of platform or version. Mac OS is particularly useful for mobile device development, for example you can run your CA Plex WebClient apps on iOS devices such as iPhone and iPad by using Xcode and Phonegap.

First Step – Install the Eclipse or Rational IDE

Before installing, download and install a matching JDK from Oracle using this link. The JavaSE version is appropriate for most cases.

Next, download and install Eclipse or Rational IDE. You can download a open source version of Eclipse from this link to match your target platform, or go to IBM for a version that runs on an IBM host (PowerSystems, zOS) (warning, fees may apply). We recommend downloading the J2EE version so you get most necessary tooling included.

Second Step – Create a Java Project and Link your Plex source

Go to menu File / New, select other, then select Java project



Give it a name of your choosing



Third Step – Add ObRun and JDBC / Third Party Jars

Copy and paste any external jar files you may need into the project root. This includes both CA Plex product jars and JDBC jars for database access. Note – you can leave the jar files in place and add to the class path or reference by path. However, if you do this the resulting Java project is easily not portable between machines.

If you are not using WebClient, you will need to make sure the ObRun.jar is copied from the Plex product files. If you are using WebClient, then this will happen automatically when you add the WebClient nature to the project. See the WebClient user manual

After you copy and paste the jars into the project, you need to configure the build path to use the jars.



Select the jars you copied from the first step


Final Result


Fourth Step – Link to your CA Plex generated source

In this step simply link to the CA Plex generated source directory (under your model GEN folder). First remove the src directory from the build path and from the project. Next you will  link the Src subdirectory (with an exclusion to Res), and then link the Res directory.

Go to the build path and start with an empty screen. If you see a src folder, first remove from this screen then go back and delete the directory from the project itself.


If you get the message “directory exists with a different case” later it is because you need to remove the default src directory first!

Next, add a source folder for Plex bitmaps / GIFs. Copy the Plex BMP3 files into this directory


Next, use the link button to link to your CA Plex Gen/Src directory, where your Java source resides


Add an exclusion pattern to exclude the Res source directory (it will be added in the next step)


Link the Res directory in the same manner as Src


Your final build path for source should look like this:


Fifth Step – Compile and check for errors

Eclipse will automatically and incrementally build your CA Plex source as you generate – and will do so much faster that you can generate!

Check the “Problems” tab for any errors. Usually these errors are the result of C++ code injected into the java code. You will need to variant / clean up any native C++.


Sixth Step – Set up a run configuration

Click on the green “Play” button drop down to access the “Configurations” menu. Select this.


Type in the Name, Project (or browse), and the main class “ObRun.ObPanel.ObLaunch”


Click on the arguments tab

Type in the package.class name followed by “path= “, e.g. MobileApp.ConfMenu “path= “. Note the space between the = and final quote.


Congratulations, you are running Plex Java natively (in this case on Mac OSX Lion accessing MySQL)


WebClient Runtime Framework Explained

At application runtime, your WebClient application operates under the control of the WebClient i+ Server, also known as the WebClient i+ Runtime Framework. The WebClient i+ Runtime Framework is implemented as an extension of a standard J2EE Servlet, and provides all the services necessary to deploy your WebClient application as secure, high performance web applications. The servlet model is powerful – fast performance and ease of use make it the architecture of choice over older mechnisms like CGI. For example, servlets can be utilized in high performance, load balanced configurations utlizing multiple web server instances

The WebClient Runtime Framework comes in two editions – the ADC Server edition and the Websydian Server+ edition. There is no difference between the editions, except that the Websydian edition is compatible with WSE applications and can run classic Websydian applications.

The WebClient i+ Runtime Framework consists of the following services:

CA Plex Application Connection

The WCi+ server connects the browser Ajax presentation layer to the business logic generated from your CA Plex action diagrams. For example, user interactions like right-clicking on a grid or selecting a value from a combo box are communicated as events to the CA Plex applications. And corresponding, action diagram statements that affect the presentation layer like updating values or refreshing the grid are communicated to the browser.

Session Management

As is standard for web applications, the WCi+ server creates and manages sessions for each web site user. Session tracking is a mechanism that is used to maintain state about a series of requests from the same user (that is, requests originating from the same browser) across some period of time. Typical session data that can be of interest is the authenticated user (if any), the URL used to start the web application, the session id, method (GET or POST), query parameters, etc. For more information on tracking sessions in WebClient, please visit this blog post:

The WCi+ server also manages session timeouts. For more information on setting inactivity timeouts, please visit this wiki page:

Logging and Tracing

The WCi+ Server logs application events of interest, including errors. See the setting for details. The log can be configured to output performance metrics, which is useful when optimizing response time of your web applications. See servlet.statistics.level in the documentation for more details on this.

WCi+ can also display specific error pages when an error occurs, via the servlet.errorpage.url setting.

Calling WebClient Applications from an External Application

The WCi+ server can respond to requests to show web pages from external applications or packages, also called deep linking. With deep linking, parameters can also be passed into the web request. See the user manual for more information.


The WCi+ Server manages the licensing process, tracking how many concurrent users are logged in against the tier of server you have purchased. If you exceed the number of users you have licensed, error messages will be generated in the log.



Accessing and Controlling Web Sessions

Accessing Sessions from your CA Plex / WebClient application

Since WebClient applications are running on web servers, the concept of the session tracking can be important. Session tracking is a mechanism that is used to maintain state about a series of requests from the same user (that is, requests originating from the same browser) across some period of time. Typical session data that can be of interest is the authenticated user (if any), the URL used to start the web application, the session id, method (GET or POST), query parameters, etc. In this blog entry, we will show you the basics of accessing this information, including supplying an CA Plex XML import file so you can import the example directly into your model.

Technical Details

Your CA Plex application under WebClient has access to the session information from the action diagram by using source” code. The mechanism used is the getFromUserStorage and SetToUserStorage CA Plex API’s (See topic “Storing and Using Third Party Class Instances” in the Plex help). You use the key “javax.servlet.http.HttpServletRequest” to access the session information. The API information can be obtained from a Java Servlet reference, for example here.

Here is an example CA Plex Source Code object to get session information:

Here is the source code to cut and paste:

 //Initialize class with parameter
 import javax.servlet.*;
javax.servlet.http.HttpServletRequest MyReq = (javax.servlet.http.HttpServletRequest)(getApp().getFromUserStorage("javax.servlet.http.HttpServletRequest"));
javax.servlet.http.HttpSession MySess = MyReq.getSession();
if(MyReq != null)

And the end result:


You can also access the CA Plex model import XML from this link. This will create a session entity object in your model with the source code object and the simple user interface seen above.

Running CA Plex Java Apps in Eclipse

Experienced WebClient i+ developers usually find it useful to run their Java applications as client-server prior to publishing to the web server for final testing.

The reasons are as follows:

  • “Smoke test” the application quickly for basic business functionality
  • Test basic database access
  • Eliminate customized html and java script as a potential reason for application failures
  • Test complex functionality like security frameworks

Fortunately the Eclipse / Rational integrated development environment makes it easy to run applications as either Java client-server, or as web applications (i.e. WebClient i+). This is a quick start guide to running your application in Java client-server from Eclipse or Rational (running application in the web browser is already well documented on the WebClient i+ wiki

Set up guide

Step 1

Set up a new application under the Eclipse run application tool bar item.

Select Java application and press the new icon

Step 2

Enter the CA Plex java class information on the first tab

Step 3

Enter the entry class information and function information as arguments on the second tab, for example

Step 4

Run the application. That was easy!

Note: Although WebClient i+ applications can use a variety of standard web graphic types, CA Plex Java client-server applications cannot reference bitmap graphic files (.BMP) on panels. This sometimes presents a cosmetic problem, especially if you are deploying both client-server and web application versions of the same application. So if you want your application to look good in client-server, you need to create .GIF equivalents of your custom.BMP files. CA Plex provides .GIF equivalents of the standard .BMP files that ship with the product.

© 2013 CM First Group - All rights reserved