cancel
Showing results for 
Search instead for 
Did you mean: 
mrcoder
Pilgrim

proxy.getService(ConsoleUtils.class) returns null

Hi,

I m trying to get ConsoleUtils instance in CustomCodeAction sub class, like below code:


public class TestAction extends CustomCodeAction {
public void install(InstallerProxy proxy) throws InstallException {
ConsoleUtils cu = (ConsoleUtils) proxy.getService(ConsoleUtils.class);
System.out.println(cu); // prints 'null'
}
......
}


Quoting from the javadocs, http://helpnet.flexerasoftware.com/InstallAnywhereAPI/IA2011/javadoc/com/zerog/ia/api/pub/ConsoleUti...,

The ConsoleUtils object is obtained through the one of the custom code Proxy objects by a request for the ConsoleUtils class, as follows:

Given the InstallerProxy proxy object,
ConsoleUtils cu = (ConsoleUtils)proxy.getService(ConsoleUtils.class);
int userChoice = cu.createChoiceListAndGetValue(myVector);



How to get ConsoleUtils instance into CustomCodeAction sub class?

Mani
Labels (1)
0 Kudos
2 Replies

Re: proxy.getService(ConsoleUtils.class) returns null

mrcoder wrote:


public class TestAction extends CustomCodeAction {
public void install(InstallerProxy proxy) throws InstallException {
ConsoleUtils cu = (ConsoleUtils) proxy.getService(ConsoleUtils.class);
System.out.println(cu); // prints 'null'
}
......
}



Hi,

ConsoleUtils class provides methods for custom code 'console' actions. So in your code, you'll have to change two things for the right usage of ConsoleUtils class-

1. Your class should extend CustomCodeConsoleAction instead of CustomCodeAction
2. The proxy should be changed to 'consoleproxy'

Then you will have the instance of ConsoleUtils in the object 'cu'. You can then use this object to access methods on ConsoleUtils.

Did this help?

Thanks,
Ramya
0 Kudos
Highlighted
usha_poli
Pilgrim

Re: proxy.getService(ConsoleUtils.class) returns null

RamyaVenkatesh wrote:
Hi,

ConsoleUtils class provides methods for custom code 'console' actions. So in your code, you'll have to change two things for the right usage of ConsoleUtils class-

1. Your class should extend CustomCodeConsoleAction instead of CustomCodeAction
2. The proxy should be changed to 'consoleproxy'

Then you will have the instance of ConsoleUtils in the object 'cu'. You can then use this object to access methods on ConsoleUtils.

Did this help?

Thanks,
Ramya


Hi Ramya,

Does it mean that we cannot get ConsoleUtils in CustomCodeAction.
Is there any way to get the ConsoleUtils in CustomCodeAction as I am not able to use CustomCodeConsole actions during Install phase of my installer.

Thanks & Regards,
Usha.
0 Kudos