protected static Map < String , ProductInfo > getAllProductInfo ( File wlpInstallationDirectory ) throws VersionParsingException { File versionPropertyDirectory = new File ( wlpInstallationDirectory , ProductInfo . VERSION_PROPERTY_DIRECTORY ) ; if ( ! versionPropertyDirectory . exists ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NO_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } if ( ! versionPropertyDirectory . isDirectory ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NOT_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } if ( ! versionPropertyDirectory . canRead ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } Map < String , ProductInfo > productIdToVersionPropertiesMap ; try { productIdToVersionPropertiesMap = ProductInfo . getAllProductInfo ( wlpInstallationDirectory ) ; } catch ( IllegalArgumentException e ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_PROPERTIES_DIRECTORY" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } catch ( ProductInfoParseException e ) { String missingKey = e . getMissingKey ( ) ; if ( missingKey != null ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.missing.key" , missingKey , e . getFile ( ) . getAbsoluteFile ( ) ) ) ; } throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_UNABLE_READ_FILE" , e . getFile ( ) . getAbsoluteFile ( ) , e . getCause ( ) . getMessage ( ) ) ) ; } catch ( DuplicateProductInfoException e ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.duplicated.productId" , ProductInfo . COM_IBM_WEBSPHERE_PRODUCTID_KEY , e . getProductInfo1 ( ) . getFile ( ) . getAbsoluteFile ( ) , e . getProductInfo2 ( ) . getFile ( ) . getAbsoluteFile ( ) ) ) ; } catch ( ProductInfoReplaceException e ) { ProductInfo productInfo = e . getProductInfo ( ) ; String replacesId = productInfo . getReplacesId ( ) ; if ( replacesId . equals ( productInfo . getId ( ) ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "version.replaced.product.can.not.itself" , productInfo . getFile ( ) . getAbsoluteFile ( ) ) ) ; } throw new VersionParsingException ( CommandUtils . getMessage ( "version.replaced.product.not.exist" , replacesId , productInfo . getFile ( ) . getAbsoluteFile ( ) ) ) ; } if ( productIdToVersionPropertiesMap . isEmpty ( ) ) { throw new VersionParsingException ( CommandUtils . getMessage ( "ERROR_NO_PROPERTIES_FILE" , versionPropertyDirectory . getAbsoluteFile ( ) ) ) ; } return productIdToVersionPropertiesMap ; }
This method will create a map of product ID to the VersionProperties for that product .