What is JWPS?
The java WPS package, called jWPS for short, is a set of java classes that will allow
a java application to operate with OS/2 and eComStation's (eCS) Workplace Shell (WPS).
Why do I need this?
There are many reasons that this is a useful tool. Among these are the following
- The original C-based API is very hard to learn. In contrast, jWPS has an intentionally easy and regular syntax.
- Java is object-oriented. Working with WPS objects fits it naturally.
- Java is probably the most widely studied computer language. It is also easy to learn and has excellent instructional
tools (yes other languages have these too).
- Native extensions to OS/2-eCS are getting fewer and further bewteen. The learning curve for writing new code
is prohibitive. Java is cutting edge and has effectively replaced C/C++ as the platform of choice for
deploying newer technologies. This will keep OS/2-eCS users in the loop.
- REXX, which we all just love it, is aging and while easy to learn, has some extremely irritating limitations
for writing large-scale programs. Java does not have this issue at all.
- There is a large base of excellent Java programs. A lot of these just don't make it onto OS/2-eCS user's radar
screens since installing them often requires some very hard REXX programming. This obstacle has been effectively removed.
- By having a tool that encourages and promotes Java usage under OS/2-eCS, this will prompt vendors to keep Java
up to date.
- For people trying to port their custom WPS applications off OS/2-eCS, this provides a very clean way to port it to
Java. The backend calls to the WPS can be replaced by code with equivalent functionality allowing for a completely
platform-neutral migration path.
An example
Here is an example of how to work with jWPS. A common task is to open the view of an object, say a folder, and maybe set a few
extended attributes. Here is a program in toto to do that. It will take the name of a folder from the command line
and set the subject line, then open the default view and popup.
import net.jqhome.jwps.*; // get the base classes
import net.jqhome.jwps.ea.*; // get the EA support
import net.jqhome.jwps.ea.standard.*; // get the standard EAs.
import net.jqhome.jwps.fs.*; // get everything for the file system
public class MyJWPSTestClass{
public static main(String[] args){
try{
JWPFolder folder = new JWPFolder(args[0]); // in a real app we'd check the arguments are ok
SubjectEA subject = new SubjectEA(args[1]); // put the phrase in quotation marks when invoking the program
folder.setEA(subject);
folder.open();
folder.showPopup();
}catch(JWPException x){
x.printStackTrace(); // in case of an error, dump it all out.
}
} //end main
} //end class
It really is that simple. A nice, clean set of calls and well-defined way for things to fail.
Requirements
At this point it runs under GoldenCode Development's Java 1.4.1. It does not run under Innotek's Java port because
jWPS does make native calls. Innotek's port is effectively running in a souped-up a Win-OS2 session, which has no concept
of the WPS. You will also need
Rich Walsh's package RWS (check on Hobbes for the most recent version – this was written against
version 0.60). This is what allows jWPS to make WPS calls. If you do not have this, though, there are several
extremely useful utilities included.
Installation
The main files are the jar, jwp.jar and the corresponding dll, jwp.dll. The dll goes someplace in your LIBPATH and the jar
must be in your java classpath. The dll's for RWS must be in your libpath too.