The cmpopt script
The cmpopt script analyzes an enterprise bean JAR file to determine whether methods in a container-managed persistance (CMP) bean are read or update. If a method is specified as read-only in its deployment descriptor, the container can avoid a write operation to the database.
This function is a technology preview. For details on how cmpopt performs the analysis, see the /QIBM/ProdData/WebAS5/Base/bin/cmpopt.README.txt file.
Product
The cmpopt script is available with WebSphere Application Server only.
Authority
No special authority is needed to run this script. However, have appropriate authority to the JAR file being analyzed or updated.
Syntax
The syntax of the cmpopt script is:
cmpopt jarfile [ -report | -noreport ] [ -noupdate | -update ] [ -noFindForUpdate | -findForUpdate ] [ -ignoreOpenFields ] [ -ignoreNativeMethods ] [ -noWarn ] [ -version ] [ -usage ] [-help | -?]Parameters
The parameters of the cmpopt script are:
jarfile
This is a required parameter. The value jarfile specifies the name of the enterprise bean JAR file that you want to analyze.-report | -noreport
This optional parameter specifies whether or not the script generates a report on the method analysis. The default is -report. The script writes the report to standard out.-noupdate | -update
This optional parameter specifies whether the script updates the information in the enterprise bean JAR file. The default is -noupdate.-noFindForUpdate | -findForUpdate
This optional paramter specifies how to mark findByPrimaryKey methods based on the remote method analysis. The default is -noFindForUpdate.-ignoreOpenFields
If a CMP variable in an enterprise bean is public, cmpopt marks all methods in the enterprise bean as update because any code, including code outside the enterprise bean JAR being analyzed, could update public fields at any time. If you specify this option, cmpopt analyzes the use of public fields without regard to possible update by code outside the enterprise bean. Specify this option if you know that any public variables in a CMP bean are not updated outside of the enterprise bean.-ignoreNativeMethods
The cmpopt script is not able to analyze JNI code. By default cmpopt chooses update if a method involves JNI code. If you specify this option, cmpopt reports these observations as warnings but ignores them in its analysis. Choose this option if you know that any JNI method calls do not update CMP fields.-nowarn
This optional parameter suppresses warning messages.-version
Optional. If you specify this parameter, the script displays version information.-usage
This optional parameter provides detailed usage information for all of the options.-help or -?
This optional paramter prints the usage statement for the script.
Examples
These examples demonstrate correct syntax:
cmpopt /home/cmpopt/corp.jarThis example analyzes the CMP field usage of the enterprise beans in corp.jar and writes the result of this analysis to stdout.
cmpopt /home/cmpopt/corp.jar -updateThis example analyzes the CMP field usage of the enterprise beans in corp.jar. The result of this analysis is written to stdout, and the JAR file is updated with the results by setting the enterprise bean methods to be read or update.