Create a custom Java administrative client program using WAS administrative Java APIs
This section describes how to develop a Java program for accessing the WebSphere Application Server administrative system using the product administrative APIs.
When we develop and run administrative clients that use various JMX connectors and that have security enabled, use the following guidelines. When we follow these guidelines, you guarantee the behavior among different implementations of JMX connectors. Any programming model that strays from these guidelines is unsupported.
- Create and use a single administrative client before we create and use another administrative client.
- Create and use an administrative client on the same thread.
- Using one of the following ways to specify a user ID and password to create a new administrative client:
- Specify a default user ID and password in the property file.
- Specify a user ID and password other than the default. Once we create an administrative client with a nondefault user ID and password, specify the nondefault user ID and password when we create subsequent administrative clients.
Tasks
- Develop an administrative client program.
- (iSeries) Build and run the administrative client program.
The steps required to build and run your program depends on the kind of application environment your code runs.
Refer to Using application clients for details on how to build and run the administrative client program.
- If our administrative client uses Simple Object Access Protocol (SOAP) as its Connector, configure JSSE as the transport layer. The product uses supports SSL and Transport Layer Security (TLS) with the JSSE and System SSL packages. Create digital certificates for the user ID used to run the administrative client. To use System Authorization Facility (SAF) to create digital certificates and store them in a SAF keyring, refer to Defining SSL Security for Client Outbound Requests. (We can save the name of the keyring we create for use in the next step.)
- Update the soap.client.props file in the profile_root/properties directory being used by the administrative client with the name of the SAF keyring. Refer to the second step in Using System Authorization Facility keyrings with Java Secure Sockets Extension for directions on updating the soap.client.props file.
- Build the administrative client program.
Compile it with the javac command and provide the location of the necessary JAR files in the classpath argument.
For example, if the installation directory is /DeploymentManager a typical command would look like the following example:
javac -extdirs "$JAVA_HOME/lib/ext; /DeploymentManager/classes;/DeploymentManager/lib; /DeploymentManager/lib/ext" MyAdminClient.java(The previous command is split on multiple lines for publication.)
- Run the administrative client program.
Run the administrative client program by setting up the run-time environment so that the program can find all of the prerequisites. Many of the batch or script files in the bin directory under the installation root perform a similar function. The following is an example of a batch file that runs an administrative client program named MyAdminClient follows:
@echo off call "%~dp0setupCmdLine.bat" "%JAVA_HOME%\bin\java" "%CLIENTSAS%" "-Dwas.install.root=%WAS_HOME%" "-Dwas.repository.root=%CONFIG_ROOT%" -Dcom.ibm.CORBA.BootstrapHost=%COMPUTERNAME% "-Djava.ext.dirs=%JAVA_HOME%\jre\lib\ext;%WAS_HOME%\classes; %WAS_HOME%\lib;%WAS_HOME%\lib\ext" MyAdminClient %*</pre>--><!--(The contents of the previous batch file is split on multiple lines for publication.)--><pre>@echo off binDir=`dirname "$0"` . "$binDir/setupCmdLine.sh" "$JAVA_HOME/bin/java" "$CLIENTSOAP" "-Dwas.install.root=$WAS_HOME" "-Dwas.repository.root=$CONFIG_ROOT" -Dcom.ibm.CORBA.BootstrapHost=$COMPUTERNAME "-Djava.ext.dirs=$JAVA_HOME/lib/ext;$WAS_HOME/classes; $WAS_HOME/lib;$WAS_HOME/lib/ext" MyAdminClient $@(The contents of the previous batch file is split on multiple lines for publication.)
Subtopics
- Develop an administrative client program
We can develop an administrative client program that utilizes WAS administrative APIs and JMX.
Related:
Additional Application Programming Interfaces (APIs) Use application clients (ZOS) Define Secure Sockets Layer security for servers (ZOS) Use System Authorization Facility keyrings with Java Secure Sockets Extension