Registering and deregistering a product using Java
The IFAEDJReg class provides access to the z/OS® product registration and deregistration services through Java™. The IFAEDJReg class allows Java programs to use the product registration services by wrapping the system IFAEDREG (register) and IFAEDDRG (deregister) callable services.
A product is identified through various parameters such as product name, product owner, and feature name. These fields are set in the IFAEDJReg object and then the register method can be called.
After a successful registration, a registration token (also referred to as a product token) is returned by the system. This token is used by the deregister method to deregister the product.
The registration or deregistration return code provided by the system is returned by the methods.
- IBM® SDK for z/OS Java 2 Technology Edition, Version 1.4 PTF UQ93743, product number 5655-I56
To run an application that uses the product registration Java classes, you must add the jar file containing the product registration classes to your path, and add the native library to your libpath.
Note in the examples below, the default installation paths are shown. If you have changed the default by adding a path prefix, modify the commands accordingly.
export CLASSPATH=/usr/include/java_classes/ifaedjreg.jar:$CLASSPATH
export LIBPATH=/usr/lib/java_runtime:$LIBPATH
The documentation for the using the methods in the Java classes is contained in the Javadoc for the IFAEDJReg class. The Java doc is installed to /usr/include/java_classes/ifadjregDoc.jar by default.
All of the Javadoc files for product registration have been included in the jar. To view the Javadoc, it is necessary to download the jar file in binary to your workstation, unjar the file to make the individual files accessible, and then use your browser to open the index.html file.
Example: Registering a product using Java
IFAEDJReg reg = new IFAEDJReg();
reg.setRegisterType(IFAEDJReg.IFAEDREG_TYPE_STANDARD + IFAEDJReg.IFAEDREG_TYPE_NOTFOUNDDISABLED);
reg.setProductName("TESTPROD");
reg.setProductOwner("IBM");
reg.setProductID("9999-999");
int rc = reg.register(); // Invoke registration service
if (rc != IFAEDJReg.IFAEDREG_SUCCESS) {
System.out.println("TESTPROD registration failed due to the return code from IFAEDJReg, rc="+rc);
System.exit(1);
}
Example: Deregistering a product using Java
nt rc = reg.deregister(); // Invoke deregistration service
if (rc != IFAEDJReg.IFAEDDRG_SUCCESS) {
System.out.println("TESTPROD deregistration failed due to the return code from
IFAEDJReg, rc="+rc);
System.exit(2);
}