Package com.ibm.jsdt.support.installedproduct

The InstalledProduct classes provide functions that are commonly required during installation.

See:
          Description

Class Summary
ConsoleAgentInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
ConsoleMgmtExtInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
DB2InstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
ERConsoleInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
IDSInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
IHSInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
InstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
WASExpressInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
WebserverPluginForWASInstalledProduct Deprecated. Due to new package com.ibm.jsdt.support.deploymenthelper.installedproduct
 

Package com.ibm.jsdt.support.installedproduct Description

The InstalledProduct classes provide functions that are commonly required during installation. The capabilities that the InstalledProduct classes provide include the ability to perform the following actions:

Refer to the Examples section for ways to apply this functionality in programs.

Overview

The InstalledProduct classes provide methods you can use to ease interaction between a user and instances of installed products. Each installed product class is designed to operate on all operating systems that are supported by a given middleware.

Examples

The following examples demonstrate how to use the installed product framework functionality:

Determine if a product is installed

In this example the WebSphere Application Server (WAS) installed product class is used to determine if an instance of WebSphere Application Server is installed. There are a variety of methods that you can use to determine if an instance is installed, depending on whether you have prior knowledge of a possible installation location or whether an instance of the support base is to be passed.

import com.ibm.jsdt.support.installedproduct.WASExpressInstalledProduct;

// In this example the WASExpressInstalledProduct class is used to determine if WAS Express
// is installed on the computer. It is assumed that no prior knowledge of the installation location
// is known.
{
  public static void main(String args[])
  {
  .
  .
  .
  // First, create an instance of a WASExpressInstalledProduct object.  
  WASExpressInstalledProduct[] wasProduct = WASExpressInstalledProduct.getInstalledProducts();

  // Second, it is important to determine that an instance of the middleware was actually found
  // before preceding. 
  if (wasProduct != null && wasProduct.length > 0)
  .
  .
  .

Determine the installation version and location

In this example the installed product class is used to determine the installation location and version of the middleware. The IHSInstalledProduct class is used to determine the IBM HTTP Server version and installation location.

import com.ibm.jsdt.support.installedproduct.IHSExpressInstalledProduct;

public static void main(String[] args)
{
  // First, an instance of the IHSInstalledProduct class is instantiated.
  IHSInstalledProduct[] ihsProduct = IHSInstalledProduct.getInstalledProducts();

  // It is very important to first determine that a valid instance of the middlware was in fact found. 
  if (ihsProduct != null && ihsProduct.length > 0)
  {
    // Second, use the getInstalledLocation() method to display the installation location to the user.
    System.out.println("IHS is installed at: " + ihsProduct[0].getInstalledLocation());

    // Third, use the getInstalledVersion() method to display the installation version to the user.
    System.out.println("IHS install version is: " + ihsProduct[0].getInstalledVersion());
    .
    .
    .

Starting the WebSphere Application Server

You can use the installedProduct classes to perform various function associated with middleware. For instance, using the WebSphere Application Server installedProduct class, you can retrieve profile names, run installation verification tests and both start and stop the server. For this example, starting and stopping the WebSphere Application Server using the WASInstalledProduct class is demonstrated.

import com.ibm.jsdt.support.installedproduct.WASExpressInstalledProduct;
import com.ibm.jsdt.support.SupportHelper;

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() == SupportHelper.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() == SupportHelper.SUCCESS)
      {
        System.out.println("WAS Server was successfully started");
      }
    }
    .
    .
    .

Starting the Express Runtime Console Agent

In this example, the Console Agent Installed Product class is used to start the Console Agent.

import com.ibm.jsdt.support.installedproduct.ConsoleAgentInstalledProduct;

public static void main(String[] args)
{
  // An instance of the ConsoleAgentInstalledProduct class is instantiated. In this example it is assumed that
  // there is no previous knowledge of the installation location of the Express Runtime Console.
  ConsoleAgentInstalledProduct[] consoleAgentProduct = ConsoleAgentInstalledProduct.getInstalledProducts();

  //It is important to first assert that an Express Runtime console instance exists.
  if (consoleAgentProduct != null && consoleAgentProduct.length > 0)
  {
    Start the Express Runtime console agent, only if it is currently not running.
    if (!consoleAgentProduct[0].isConsoleAgentRunning())
    {
      consoleAgentProduct[0].startConsoleAgent();
    }
  .
  .
  .