import com.ibm.jsdt.support.deploymenthelper.installedproduct.WASExpressInstalledProduct;
import com.ibm.jsdt.support.deploymenthelper.DeploymentHelper;
public static void main(String[] args)
{
// Assume that the directory that WAS is installed in is passed in as the first argument to main.
String wasInstallDir = args[0];
// First, an instance of the WASInstalledProduct class is instantiated.
WASInstalledProduct wasProduct = WASInstalledProduct.getInstalledProduct(wasInstallDir);
// Assert that an instance of WebSphere Application Server exists.
if (wasProduct != null)
{
// Second, stop the WebSphere Application Server. Furthermore, the method stopServer() which is used to
// stop the server, returns a success or failure token which can be used to determine whether
// the stopServer() method was successful. The success and failure tokens reside in the supportHelper
// class.
if (wasProduct.stopServer() == DeploymentHelper.SUCCESS)
{
System.out.println("WAS Server was successfully stopped");
}
.
.
.
// Third, when starting the server it is a good idea to check to see that the server is stopped.
// The method isWASServerRunning returns a boolean true if the server is running and a false otherwise.
if (wasProduct.isWasServerRunning())
{
if(wasProduct.startServer() == DeploymentHelper.SUCCESS)
{
System.out.println("WAS Server was successfully started");
}
}
.
.
.
|