This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: ProductRegistryService in custom panel
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 12, 2010
04:24 PM
ProductRegistryService in custom panel
Hi,
I have a custom panel I want to display a list of install location(s) of one of our products, specified by name and version. I am trying to use the ProductRegistryService to read the zerog registry. I read kb article Q204835) and came up with some code that works in a custom action, but fails in a custom panel with a java.lang.NullPointerException in a getProducts() call.
The custom action that works:[CODE]
public class GetInstalledProductsAction extends CustomCodeAction
{
public void install ( InstallerProxy ip ) throws InstallException
{
String productName = ip.substitute("$PRODUCT_NAME$");
String productVersion = ip.substitute("$PRODUCT_VERSION$");
ProductRegistryService prs = (ProductRegistryService) ip.getService(ProductRegistryService.class);
SoftwareObjectSearchCriteria sc = new SoftwareObjectSearchCriteria(SoftwareObjectSearchCriteria.COMPARISON_TYPE_OR);
sc.setName(productName);
sc.setVersion(productVersion);
Product[] installedProducts = prs.getProducts(sc); // <== Works here
String installedProductsStr = "";
for ( int i=0; i {
if ( installedProducts.getName().equals(productName) &&
installedProducts.getVersion().equals(productVersion) )
{
installedProductsStr = installedProductsStr + installedProducts.getName() + ";";
installedProductsStr = installedProductsStr + installedProducts.getLocation() + "|";
}
}
ip.setVariable("INSTALLED_PRODUCTS", installedProductsListStr);
}
// ...
}
[/CODE]
The custom panel that does NOT work:[CODE]
public class ProductIntegrationPanel extends CustomCodePanel
{
private CustomCodePanelProxy ccpp;
private Product[] installedProducts = new Product[10];
public boolean setupUI ( CustomCodePanelProxy proxy )
{
ccpp = proxy;
// ...
installedProducts = getProductFromZerogReg(PRODUCT_NAME, PRODUCT_VERSION);
// ...
}
private Product[] getProductFromZerogReg ( String productName, String productVersion )
{
Product[] foundProducts = new Product[10];
ProductRegistryService prs = (ProductRegistryService) ccpp.getService(ProductRegistryService.class);
SoftwareObjectSearchCriteria sc = new SoftwareObjectSearchCriteria(SoftwareObjectSearchCriteria.COMPARISON_TYPE_OR);
sc.setName(productName);
sc.setVersion(productVersion);
Product[] installedProducts = prs.getProducts(sc); // <== FAILS HERE
for ( int i=0,j=0; i {
if ( installedProducts.getName().equals(productName) &&
installedProducts.getVersion().equals(productVersion) )
{
File propertiesFile = new File(installedProducts.getLocation() +
System.getProperty("file.separator") +
PROPERTIES_FILE);
if ( propertiesFile.exists() )
foundProducts[j++] = installedProducts;
propertiesFile = null;
}
}
return foundProducts;
}
}
[/CODE]
Can anyone tell me what I am doing wrong?
-Jeff
I have a custom panel I want to display a list of install location(s) of one of our products, specified by name and version. I am trying to use the ProductRegistryService to read the zerog registry. I read kb article Q204835) and came up with some code that works in a custom action, but fails in a custom panel with a java.lang.NullPointerException in a getProducts() call.
The custom action that works:[CODE]
public class GetInstalledProductsAction extends CustomCodeAction
{
public void install ( InstallerProxy ip ) throws InstallException
{
String productName = ip.substitute("$PRODUCT_NAME$");
String productVersion = ip.substitute("$PRODUCT_VERSION$");
ProductRegistryService prs = (ProductRegistryService) ip.getService(ProductRegistryService.class);
SoftwareObjectSearchCriteria sc = new SoftwareObjectSearchCriteria(SoftwareObjectSearchCriteria.COMPARISON_TYPE_OR);
sc.setName(productName);
sc.setVersion(productVersion);
Product[] installedProducts = prs.getProducts(sc); // <== Works here
String installedProductsStr = "";
for ( int i=0; i
if ( installedProducts.getName().equals(productName) &&
installedProducts.getVersion().equals(productVersion) )
{
installedProductsStr = installedProductsStr + installedProducts.getName() + ";";
installedProductsStr = installedProductsStr + installedProducts.getLocation() + "|";
}
}
ip.setVariable("INSTALLED_PRODUCTS", installedProductsListStr);
}
// ...
}
[/CODE]
The custom panel that does NOT work:[CODE]
public class ProductIntegrationPanel extends CustomCodePanel
{
private CustomCodePanelProxy ccpp;
private Product[] installedProducts = new Product[10];
public boolean setupUI ( CustomCodePanelProxy proxy )
{
ccpp = proxy;
// ...
installedProducts = getProductFromZerogReg(PRODUCT_NAME, PRODUCT_VERSION);
// ...
}
private Product[] getProductFromZerogReg ( String productName, String productVersion )
{
Product[] foundProducts = new Product[10];
ProductRegistryService prs = (ProductRegistryService) ccpp.getService(ProductRegistryService.class);
SoftwareObjectSearchCriteria sc = new SoftwareObjectSearchCriteria(SoftwareObjectSearchCriteria.COMPARISON_TYPE_OR);
sc.setName(productName);
sc.setVersion(productVersion);
Product[] installedProducts = prs.getProducts(sc); // <== FAILS HERE
for ( int i=0,j=0; i
if ( installedProducts.getName().equals(productName) &&
installedProducts.getVersion().equals(productVersion) )
{
File propertiesFile = new File(installedProducts.getLocation() +
System.getProperty("file.separator") +
PROPERTIES_FILE);
if ( propertiesFile.exists() )
foundProducts[j++] = installedProducts;
propertiesFile = null;
}
}
return foundProducts;
}
}
[/CODE]
Can anyone tell me what I am doing wrong?
-Jeff
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 27, 2010
09:40 AM
In your custom panel I see
. Make sure that PRODUCT_NAME and PRODUCT_VERSION variables are set to
installedProducts = getProductFromZerogReg(PRODUCT_NAME, PRODUCT_VERSION);
. Make sure that PRODUCT_NAME and PRODUCT_VERSION variables are set to
proxy.substitute("$PRODUCT_NAME$") and proxy.substitute("$PRODUCT_VERSION$")
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 01, 2010
03:09 PM
I have an update on this.
I entered an incident report with Tech Support and Engineering has determined this is a bug:
This problem has been reproduced and determined to be an issue in our software. This issue has been submitted to our Engineering team as Issue #IOA-000049603. Currently, there is no workaround.
But there is a workaround: Create an action that will set variable(s) or write to a properties file that your panel reads. At least that worked in my case.
-Jeff
I entered an incident report with Tech Support and Engineering has determined this is a bug:
This problem has been reproduced and determined to be an issue in our software. This issue has been submitted to our Engineering team as Issue #IOA-000049603. Currently, there is no workaround.
But there is a workaround: Create an action that will set variable(s) or write to a properties file that your panel reads. At least that worked in my case.
-Jeff
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)