AS/400 Java Virtual Machine versus the AS/400 Toolbox for Java classes
You always have at least two ways to access an AS/400 resource when your Java program is running on the AS/400 Java Virtual Machine (JVM).
You can use either of the following interfaces:
- Facilities built into Java
- An AS/400 Toolbox for Java class
When deciding which interface to use,
consider the following factors:
- Location - Where a program runs is the most important factor in deciding which interface set to use.
Does the program do the following:
- Run only on the client?
- Run only on the server?
- Run on both client and server,
but in both cases the resource is an AS/400 resource?
- Run on one AS/400 JVM and access resources on another AS/400?
- Run on different kinds of servers?
If the program runs on both client and server (including the AS/400 as a client to a second AS/400) and accesses only AS/400 resources,
it may be best to use the AS/400 Toolbox for Java interfaces.
If the program must access data on many types of servers,
it may be best to use native Java interfaces.
- Consistency / Portability -
The ability to run AS/400 Toolbox for Java classes on AS/400 means that the same interfaces can be used for both client programs and server programs.
When you have only one interface to learn for both client programs and server programs,
you can be more productive.
Writing to AS/400 Toolbox for Java interfaces makes your program less server portable,
however.
If your program must run to an AS/400 as well as other servers,
you may find it better to use the facilities that are built into Java.
- Complexity -
The AS/400 Toolbox for Java interface is built especially for easy access to an AS/400 resource.
Often,
the only alternative to using the AS/400 Toolbox for Java interface is to write a native program that accesses the resource and communicates with that program through Java Native Interface (JNI).
You must decide whether it is more important to have better Java neutrality and write a native program to access the
resource,
or to use the AS/400 Toolbox for Java interface,
which is less portable.
- Function -
The AS/400 Toolbox for Java interface often provides more function than the Java interface.
For example,
the IFSFileOutputStream class of the AS/400 Toolbox for Java licensed program has more function than
the FileOutputStream class of java.io.
Using IFSFileOutputStream makes your program specific to the AS/400,
however.
You lose server portability by using the AS/400 Toolbox for Java class.
You must decide whether portability is more important or whether you want to take advantage of the additional function.
- Resource -
When running on the AS/400 JVM,
many of the AS/400 Toolbox for Java classes still make requests through the host servers.
Therefore,
a second job (the server job) carries out the request to access a resource.
This request may take more resource than a native Java interface that runs under the job of the Java program.
- AS/400 as a client -
If your program runs on the AS/400 and accesses data on a second AS/400,
your best choice may be to use AS/400 Toolbox for Java classes.
These classes provide easy access to the resource on the second AS/400.
An example of this is Data Queue access.
The Data Queue interfaces of the AS/400 Toolbox for Java licensed program provide easy access to the
data queue resource.
Using the AS/400 Toolbox for Java also means your program works on both a client and server to access an AS/400 data queue.
It also works when running on one AS/400 to access a data queue on another AS/400.
The alternative is to write a separate program (in C,
for example) that accesses the data queue.
The Java program calls this native program when it needs to access the data queue.
This method is more server-portable;
you can have one Java program that handles data queue access and different versions of the native program for each server you support.
[ Legal | AS/400 Glossary ]
|