com.ibm.are.platform.impl
Class IBMi

java.lang.Object
  extended by com.ibm.are.platform.Platform
      extended by com.ibm.are.platform.impl.IBMi

public class IBMi
extends Platform

The IBMi class implements platform specific operations that are required by the ARE Core. This class also implements many useful IBM i specific utility methods, such as determining determining the current OS release, determining if a specified product is installed, as well as providing a fully initialized, ready to use IBM Toolbox for Java AS400 object.

Version:
1.0
Author:
IBM

Field Summary
static java.lang.String COPYRIGHT
          Copyright for class bytecode
static int POLICY_SHARE_GLOBAL_AS400
          The getAS400() method will share a global AS400 object
static int POLICY_SHARE_THREAD_AS400
          The getAS400() method always return an AS400 object which has the same user id as the current thread user
 
Fields inherited from class com.ibm.are.platform.Platform
fileSystem, logger, productInfo, shell, user
 
Constructor Summary
IBMi()
          Constructs an IBMi object
 
Method Summary
protected static com.ibm.as400.access.AS400 buildAndValidateAS400()
          Builds and validates an AS400 object for the current user
 UserInfo currentUser()
          Retrieves an object that contains various pieces of information about the user profile that is running ARE.
static void destroyThreadUserAS400()
          Destroys the AS400 object associated with the current thread
static IBMi get()
          Retrieves a reference to the singleton IBMi object
static com.ibm.as400.access.AS400 getAS400()
          Get the shared AS400 object based on the sharing policy
static java.lang.String getCurrentThreadUserID()
          Retrieves the ID of the user running in the current thread
 java.lang.String getJavaProductId()
          Retrieves the full seven digit Java product ID for the IBM i OS version where ARE is currently running.
 java.lang.String getJavaReleaseLevel()
          Retrieves the release level for the Java product for the IBM i OS where ARE is currently running.
 java.lang.String getOsVersion()
          Retrieves the IBM i OS version
 java.lang.String getProductIdPrefix()
          Retrieves the OS-specific product ID prefix.
 java.lang.String getProductIdPrefix(java.lang.String forVersion)
          Retrieves the IBM i product ID prefix for the specified OS version.
 boolean isIBMi()
          Determines if the OS where ARE is currently running is an IBM i OS
 boolean isIBMp()
          Determines if the OS where ARE is currently running is an IBM p OS
 boolean isIBMx()
          Determines if the OS where ARE is currently running is an IBM x OS
 boolean isLanguageInstalled(java.lang.String productId, java.lang.String language)
          Determines if the specified language for the specified product is installed
 boolean isLanguageInstalled(java.lang.String productId, java.lang.String productOption, java.lang.String language)
          Determines if the specified language for the specified product is installed
 boolean isLinux()
          Determines if the OS where ARE is currently running is a Linux OS
 boolean isOsPrimaryLanguage(java.lang.String language)
          Determines if the specified language is the IBM i OS primary language
 boolean isPriorToV6R1()
          Determines if the IBM i OS where ARE is running is older than IBM i 6.1
 boolean isPriorToV7R1()
          Determines if the IBM i OS where ARE is running is older than IBM i 7.1
 boolean isProductInstalled(java.lang.String productId, java.lang.String productOption)
          Determines if the specified IBM i product and option are installed
 boolean isProductInstalled(java.lang.String productId, java.lang.String productOption, java.lang.String osVersion)
          Determines if the specified IBM i product and option are installed
 boolean isProductInstalled(java.lang.String productId, java.lang.String productOption, java.lang.String osVersion, java.lang.String loadType, java.lang.String langId)
          Determines if the specified IBM i product and option are installed
 boolean isProductPrimaryLanguage(java.lang.String productId, java.lang.String language)
          Determines if the specified language for the specified product is the product's primary language
 boolean isPtfInstalled(java.lang.String ptfName)
          Determines if the specified PTF is installed
 boolean isV5R4()
          Determines if the IBM i OS where ARE is running is IBM 5.4
 boolean isV6R1()
          Determines if the IBM i OS where ARE is running is IBM 6.1
 boolean isV6R1OrEarlier()
          Determines if the IBM i OS where ARE is running is IBM 6.1 or older
 boolean isV6R1OrHigher()
          Determines if the IBM i OS where ARE is running is IBM 6.1 or newer
 boolean isV7R1()
          Determines if the IBM i OS where ARE is running is IBM 7.1
 boolean isV7R1OrHigher()
          Determines if the IBM i OS where ARE is running is IBM 7.1 or newer
 void onShutdown()
          Platform specific hook for ARE shutdown.
 void onStartup()
          Platform specific hook for ARE startup.
 boolean runtimeUserAuthorityChecks()
          Checks if the IBM i user profile running ARE has *ALLOBJ authority.
static void setAS400(com.ibm.as400.access.AS400 newi5)
          Set the globally shared AS400 object
static void setAS400SharePolicy(int policy)
          Sets the share policy for the AS400 object managed by the IBMi object
 
Methods inherited from class com.ibm.are.platform.Platform
current, fileSystem, getOsName, productInfo, shell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright for class bytecode

See Also:
Constant Field Values

POLICY_SHARE_GLOBAL_AS400

public static final int POLICY_SHARE_GLOBAL_AS400
The getAS400() method will share a global AS400 object

See Also:
Constant Field Values

POLICY_SHARE_THREAD_AS400

public static final int POLICY_SHARE_THREAD_AS400
The getAS400() method always return an AS400 object which has the same user id as the current thread user

See Also:
Constant Field Values
Constructor Detail

IBMi

public IBMi()
Constructs an IBMi object

Method Detail

get

public static IBMi get()
Retrieves a reference to the singleton IBMi object

Returns:
A reference to the singleton IBMi object

setAS400SharePolicy

public static void setAS400SharePolicy(int policy)
Sets the share policy for the AS400 object managed by the IBMi object

Parameters:
policy - The share policy. Must be either POLICY_SHARE_GLOBAL_AS400 or POLICY_SHARE_THREAD_AS400

getAS400

public static com.ibm.as400.access.AS400 getAS400()
Get the shared AS400 object based on the sharing policy

Returns:
the shared AS400 object

setAS400

public static void setAS400(com.ibm.as400.access.AS400 newi5)
Set the globally shared AS400 object

Parameters:
newi5 - The new globally shared AS400 object

getCurrentThreadUserID

public static java.lang.String getCurrentThreadUserID()
Retrieves the ID of the user running in the current thread

Returns:
The ID of the user running in the current thread

destroyThreadUserAS400

public static void destroyThreadUserAS400()
Destroys the AS400 object associated with the current thread


isIBMi

public boolean isIBMi()
Determines if the OS where ARE is currently running is an IBM i OS

Specified by:
isIBMi in class Platform
Returns:
true if the OS is an IBM i OS, false if it is not

isIBMp

public boolean isIBMp()
Determines if the OS where ARE is currently running is an IBM p OS

Specified by:
isIBMp in class Platform
Returns:
true if the OS is an IBM p OS, false if it is not

isLinux

public boolean isLinux()
Determines if the OS where ARE is currently running is a Linux OS

Specified by:
isLinux in class Platform
Returns:
true if the OS is a Linux OS, false if it is not

isIBMx

public boolean isIBMx()
Determines if the OS where ARE is currently running is an IBM x OS

Specified by:
isIBMx in class Platform
Returns:
true if the OS is an IBM x OS, false if it is not

onStartup

public void onStartup()
Platform specific hook for ARE startup. Not implemented for IBM i.

Specified by:
onStartup in class Platform

onShutdown

public void onShutdown()
Platform specific hook for ARE shutdown. Will disconnect all services for any AS400 object cached in this class.

Specified by:
onShutdown in class Platform

isV5R4

public boolean isV5R4()
Determines if the IBM i OS where ARE is running is IBM 5.4

Returns:
true if the IBM i OS is 5.4, false if it is not

isV6R1

public boolean isV6R1()
Determines if the IBM i OS where ARE is running is IBM 6.1

Returns:
true if the IBM i OS is 6.1, false if it is not

isV7R1

public boolean isV7R1()
Determines if the IBM i OS where ARE is running is IBM 7.1

Returns:
true if the IBM i OS is 7.1, false if it is not

isV7R1OrHigher

public boolean isV7R1OrHigher()
Determines if the IBM i OS where ARE is running is IBM 7.1 or newer

Returns:
true if the IBM i OS is 7.1 or newer, false if it is not

isPriorToV7R1

public boolean isPriorToV7R1()
Determines if the IBM i OS where ARE is running is older than IBM i 7.1

Returns:
true if the IBM i OS is older than IBM i 7.1, false if it is not

isV6R1OrEarlier

public boolean isV6R1OrEarlier()
Determines if the IBM i OS where ARE is running is IBM 6.1 or older

Returns:
true if the IBM i OS is 6.1 or older, false if it is not

isV6R1OrHigher

public boolean isV6R1OrHigher()
Determines if the IBM i OS where ARE is running is IBM 6.1 or newer

Returns:
true if the IBM i OS is 6.1 or newer, false if it is not

isPriorToV6R1

public boolean isPriorToV6R1()
Determines if the IBM i OS where ARE is running is older than IBM i 6.1

Returns:
true if the IBM i OS is older than IBM i 6.1, false if it is not

getProductIdPrefix

public java.lang.String getProductIdPrefix()
Retrieves the OS-specific product ID prefix. The return value is dependent on the IBM i release where ARE is currently running.

Returns:
The OS-specific product ID prefix

getProductIdPrefix

public java.lang.String getProductIdPrefix(java.lang.String forVersion)
Retrieves the IBM i product ID prefix for the specified OS version.

Parameters:
forVersion - The IBM i OS version. Valid values for this parameter are:

  • V5R4
  • V6R1
  • V7R1
  • Returns:
    The IBM i product ID prefix for the specified OS version
    See Also:
    getProductIdPrefix()

    getJavaProductId

    public java.lang.String getJavaProductId()
    Retrieves the full seven digit Java product ID for the IBM i OS version where ARE is currently running.

    Returns:
    The full seven digit Java product ID for the IBM i OS version where ARE is currently running.

    getJavaReleaseLevel

    public java.lang.String getJavaReleaseLevel()
    Retrieves the release level for the Java product for the IBM i OS where ARE is currently running.

    Returns:
    The release level for the Java product for the IBM i OS where ARE is currently running.

    getOsVersion

    public java.lang.String getOsVersion()
    Retrieves the IBM i OS version

    Overrides:
    getOsVersion in class Platform
    Returns:
    the IBM i OS version

    currentUser

    public UserInfo currentUser()
    Retrieves an object that contains various pieces of information about the user profile that is running ARE.

    Overrides:
    currentUser in class Platform
    Returns:
    An object containing information about the current user

    isProductInstalled

    public boolean isProductInstalled(java.lang.String productId,
                                      java.lang.String productOption)
    Determines if the specified IBM i product and option are installed

    Parameters:
    productId - The IBM i product ID. This parameter can be either the full seven character product ID (such as 5761SS1), or it can be only the last three characters (such as SS1). If only three characters are provided, the first four characters will be automatically added based on the product ID prefix (5722, 5761, 5770) of the IBM i OS where ARE is currently running.
    productOption - The product option number, or *BASE for the base product option
    Returns:
    true if the product is installed, false if it is not

    isProductInstalled

    public boolean isProductInstalled(java.lang.String productId,
                                      java.lang.String productOption,
                                      java.lang.String osVersion)
    Determines if the specified IBM i product and option are installed

    Parameters:
    productId - The IBM i product ID. This parameter can be either the full seven character product ID (such as 5761SS1), or it can be only the last three characters (such as SS1). If only three characters are provided, the first four characters will be automatically added based on the product ID prefix (5722, 5761, 5770) of the IBM i OS where ARE is currently running.
    productOption - The product option number, or *BASE for the base product option
    osVersion - The release level of the product
    Returns:
    true if the product is installed, false if it is not

    isProductInstalled

    public boolean isProductInstalled(java.lang.String productId,
                                      java.lang.String productOption,
                                      java.lang.String osVersion,
                                      java.lang.String loadType,
                                      java.lang.String langId)
    Determines if the specified IBM i product and option are installed

    Parameters:
    productId - The IBM i product ID. This parameter can be either the full seven character product ID (such as 5761SS1), or it can be only the last three characters (such as SS1). If only three characters are provided, the first four characters will be automatically added based on the product ID prefix (5722, 5761, 5770) of the IBM i OS where ARE is currently running.
    productOption - The product option number, or *BASE for the base product option
    osVersion - The release level of the product
    loadType - The load type of the product. Must be either *CODE or *LNG
    langId - The IBM i language ID of the product.
    Returns:
    true if the product is installed, false if it is not

    isPtfInstalled

    public boolean isPtfInstalled(java.lang.String ptfName)
    Determines if the specified PTF is installed

    Parameters:
    ptfName - The PTF to check
    Returns:
    true if the PTF is installed, false if it is not

    isLanguageInstalled

    public boolean isLanguageInstalled(java.lang.String productId,
                                       java.lang.String language)
    Determines if the specified language for the specified product is installed

    Parameters:
    productId - The seven character IBM i product ID
    language - The IBM i language identifier
    Returns:
    true if the language is installed, false if it is not

    isLanguageInstalled

    public boolean isLanguageInstalled(java.lang.String productId,
                                       java.lang.String productOption,
                                       java.lang.String language)
    Determines if the specified language for the specified product is installed

    Parameters:
    productId - The seven character IBM i product ID
    productOption - The product option number, or *BASE for the base product option
    language - The IBM i language identifier
    Returns:
    true if the language is installed, false if it is not

    isProductPrimaryLanguage

    public boolean isProductPrimaryLanguage(java.lang.String productId,
                                            java.lang.String language)
    Determines if the specified language for the specified product is the product's primary language

    Parameters:
    productId - The seven character IBM i product ID
    language - The IBM i language identifier
    Returns:
    true if the specified language is the product's primary language, false if it is not

    isOsPrimaryLanguage

    public boolean isOsPrimaryLanguage(java.lang.String language)
    Determines if the specified language is the IBM i OS primary language

    Parameters:
    language - The IBM i language identifier
    Returns:
    true if the specified language is the OS primary language, false if it is not

    runtimeUserAuthorityChecks

    public boolean runtimeUserAuthorityChecks()
    Checks if the IBM i user profile running ARE has *ALLOBJ authority. The result of the check is added to the ARE report, and true is unconditionally returned.

    Specified by:
    runtimeUserAuthorityChecks in class Platform
    Returns:
    true is always returned

    buildAndValidateAS400

    protected static com.ibm.as400.access.AS400 buildAndValidateAS400()
    Builds and validates an AS400 object for the current user

    Returns:
    An AS400 object for the current user