com.ibm.jsdt.support.deploymenthelper.installedproduct
Class DB2InstalledProduct

java.lang.Object
  extended by com.ibm.jsdt.support.deploymenthelper.installedproduct.InstalledProduct
      extended by com.ibm.jsdt.support.deploymenthelper.installedproduct.DB2InstalledProduct

public class DB2InstalledProduct
extends InstalledProduct

Handles pre-installation and post-installation activities for DB2 UDB Express.


Field Summary
 
Fields inherited from class com.ibm.jsdt.support.deploymenthelper.installedproduct.InstalledProduct
helper
 
Constructor Summary
protected DB2InstalledProduct(java.lang.String version, java.lang.String location)
          Constructs a new DB2InstalledProduct containing the version and the location of the installed product.
 
Method Summary
 java.lang.String[] getAllInstancesforDB2Copy(java.lang.String db2Location)
          This methods returns Windows: All the instance names created under this DB2 Copy Linux: All the instance user names created under this DB2 copy It is possible (but rare) that under each copy more than one instance name (Windows) or instance user (Linux) is created.
 java.lang.String getDB2CopyName()
          Gets the copy name for this particular db2 installation.
 java.lang.String getDB2DASUser()
          Gets the DAS user name.
 java.lang.String[] getDB2InstanceNames()
          Gets the instance names for this particular DB2 copy in Windows.
static DB2InstalledProduct getInstalledProduct(java.lang.String location)
          Determines whether DB2 is installed.
static DB2InstalledProduct[] getInstalledProducts()
          Determines all instances of DB2 installed on the target computer.
 java.lang.String getLinuxInstanceUser()
          Gets the instance user name that exists for this DB2 install.
 int ipClean(java.lang.String location)
          This method will clean all the DB2 interprocess communications in order for the instance to be udpated.
 boolean isDatabaseInUse(java.lang.String databaseName, java.lang.String db2InstanceUser)
          Checks whether a DB2 database is being accessed.
 java.lang.String runDB2Command(java.lang.String command)
          Run a given db2 command.
 java.lang.String runDB2Command(java.lang.String command, java.lang.String db2InstanceUser)
          Run a given db2 command.
 int setDB2CopyDefault(java.lang.String db2CopyName)
          Set specified db2 copy as a default db2 copy
protected  void setDB2CopyName(java.lang.String copyName)
          Sets the copy name for this particular db2 installation.
protected  void setDB2DASUser(java.lang.String dasUser)
          Sets the DAS user name the DB2 copies will use.
protected  void setDB2InstanceNames(java.lang.String[] instanceNames)
          Sets the instance names for this particular DB2 copy in Windows.
protected  void setDB2LinuxInstanceUser(java.lang.String instanceUser)
          Sets the instance user name that exists for this DB2 install.
 int startDAS()
          This method starts the DB2 Administration Server.
 int startDB2(java.lang.String location)
          This method starts all DB2 processes and instances.
 int stopDAS()
          This method stops the DB2 Administration Server.
 int stopDB2(java.lang.String location)
          This method stops all DB2 processes.
 int updateDAS(java.lang.String location)
          This method updates the DB2 Administration Server (DAS) to the new level of DB2.
 int updateInstances(java.lang.String location)
          This method updates each instance that belongs to the specified DB2 copy to the new level of DB2.
 
Methods inherited from class com.ibm.jsdt.support.deploymenthelper.installedproduct.InstalledProduct
compareVersion, getDeploymentHelper, getInstalledLocation, getInstalledProduct, getInstalledProducts, getInstalledVersion, getOSDeploymentHelper, grepRPM, setDeploymentHelper, setInstalledLocation, setInstalledVersion, trimVersionToNVersionPlaces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB2InstalledProduct

protected DB2InstalledProduct(java.lang.String version,
                              java.lang.String location)
Constructs a new DB2InstalledProduct containing the version and the location of the installed product.

Parameters:
version - The version of the installed product.
location - The location of the installed product.
Method Detail

getInstalledProduct

public static DB2InstalledProduct getInstalledProduct(java.lang.String location)
Determines whether DB2 is installed.

Parameters:
location - The location of the product installed.
Returns:
Returns an instance of the installed product.

getInstalledProducts

public static DB2InstalledProduct[] getInstalledProducts()
Determines all instances of DB2 installed on the target computer.

Returns:
Returns an instance of the installed product.

setDB2CopyName

protected void setDB2CopyName(java.lang.String copyName)
Sets the copy name for this particular db2 installation.

Parameters:
copyName - The copy name for this particular db2 installation (Windows).

getDB2CopyName

public java.lang.String getDB2CopyName()
Gets the copy name for this particular db2 installation.

Returns:
The copy name for this particular DB2 install (Windows).

setDB2InstanceNames

protected void setDB2InstanceNames(java.lang.String[] instanceNames)
Sets the instance names for this particular DB2 copy in Windows. Each DB2 copy can have multiple instances (Windows only).

Parameters:
instanceNames - - The instance name for this particular db2 installation

getDB2InstanceNames

public java.lang.String[] getDB2InstanceNames()
Gets the instance names for this particular DB2 copy in Windows. Each DB2 copy can have multiple instances (Windows only).

Returns:
The instance names for this particular DB2 install.

setDB2LinuxInstanceUser

protected void setDB2LinuxInstanceUser(java.lang.String instanceUser)
Sets the instance user name that exists for this DB2 install.

Parameters:
instanceUser - The instance user name for this particular DB2 install (Linux).

getLinuxInstanceUser

public java.lang.String getLinuxInstanceUser()
Gets the instance user name that exists for this DB2 install.

Returns:
The instance user name for this particular DB2 install (Linux).

setDB2DASUser

protected void setDB2DASUser(java.lang.String dasUser)
Sets the DAS user name the DB2 copies will use. There can only be one in the system.

Parameters:
dasUser - The DAS user name.

getDB2DASUser

public java.lang.String getDB2DASUser()
Gets the DAS user name. There can only be one DAS user on the system, so this method will return the user name the DB2 copies will use, or null if it has not been created.

Returns:
Returns the DAS user name, or null if the DAS user name has not been created.

setDB2CopyDefault

public int setDB2CopyDefault(java.lang.String db2CopyName)
Set specified db2 copy as a default db2 copy

Parameters:
db2CopyName - - DB2 copy name
Returns:
SUCCESS if provided copy name name successfully set as a default FAILURE otherwise

runDB2Command

public java.lang.String runDB2Command(java.lang.String command)
Run a given db2 command.

Parameters:
command - - The command to run.
Returns:
Returns the output of running the command.

runDB2Command

public java.lang.String runDB2Command(java.lang.String command,
                                      java.lang.String db2InstanceUser)
Run a given db2 command.

Parameters:
command - - The command to run.
db2InstanceUser - - The DB2 instance user. This parameter must be provided when running on Unix operating system.
Returns:
Returns the output of running the command.

isDatabaseInUse

public boolean isDatabaseInUse(java.lang.String databaseName,
                               java.lang.String db2InstanceUser)
Checks whether a DB2 database is being accessed.

Parameters:
databaseName - - The name of the database.
db2InstanceUser - - The DB2 instance user. This parameter must be provided when running on Unix operating system.
Returns:
true - The database is in use. false - The database is not in use.

getAllInstancesforDB2Copy

public java.lang.String[] getAllInstancesforDB2Copy(java.lang.String db2Location)
This methods returns Windows: All the instance names created under this DB2 Copy Linux: All the instance user names created under this DB2 copy It is possible (but rare) that under each copy more than one instance name (Windows) or instance user (Linux) is created.

Returns:
String [] list of instance names (Windows) or instance user names (Linux)

stopDB2

public int stopDB2(java.lang.String location)
This method stops all DB2 processes.

Parameters:
location - - Where DB2 is installed
Returns:
SUCCESS if the commands ran successfully, FAILURE otherwise

startDB2

public int startDB2(java.lang.String location)
This method starts all DB2 processes and instances. It is required as a post-upgrade step for Linux platforms.

Parameters:
location - - Where DB2 is installed
Returns:
SUCCESS if the commands ran successfully, FAILURE otherwise

stopDAS

public int stopDAS()
This method stops the DB2 Administration Server. As per instructions in the readme file for DB2 fixpack 1, this step is only required in Linux.

Returns:
SUCCESS if the commands ran successfully, FAILURE otherwise

startDAS

public int startDAS()
This method starts the DB2 Administration Server. As per instructions in the readme file for DB2 fixpack 1, this step is only required in Linux as a post-upgrade step.

Returns:
SUCCESS if the commands ran successfully, FAILURE otherwise

ipClean

public int ipClean(java.lang.String location)
This method will clean all the DB2 interprocess communications in order for the instance to be udpated. This is one of the steps required in Linux platforms before updating a DB2 copy to a new fixpack.

Returns:
SUCCESS if the commands ran successfully, FAILURE otherwise

updateInstances

public int updateInstances(java.lang.String location)
This method updates each instance that belongs to the specified DB2 copy to the new level of DB2. This method should be performed as a post-install step, which is required for Linux platforms. This method is only intended for Linux systems.

Parameters:
location - - the location of the DB2 copy
Returns:
SUCCESS if the command ran successfully, FAILURE otherwise

updateDAS

public int updateDAS(java.lang.String location)
This method updates the DB2 Administration Server (DAS) to the new level of DB2. This is a required post-upgrade step in Linux platforms. It is intended to be used for Linux system to update the DAS after an upgrade. This method can also be used to move the DAS to the current DB2 copy (where it is being called), provided the version is the same or higher.

Parameters:
location - Location of DB2 copy
Returns:
SUCCESS if the command ran successfully, FAILURE otherwise