aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to define sig[] and args[] in invoke() method in JMX? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to define sig[] and args[] in invoke() method in JMX?" Watch "How to define sig[] and args[] in invoke() method in JMX?" New topic
Author

How to define sig[] and args[] in invoke() method in JMX?

sam joe
Greenhorn

Joined: Jul 23, 2003
Posts: 24
Does anybody know how to define args[] and sig[] for the following situation.

If I have

public void upload(String filename, byte[] data);
public int add(int a, int b);

in the mbean,

how should I define args[] and sig[] for them?

Thanks for your help.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
For

public void upload(String filename, byte[] data);

args or param will look something like below

String strType;
byte[] byteArrayType;
Object[] params = new Object[]{strType, byteArrayType};
String[] signature = new String[] { "java.lang.String","[B"}

"[B" is internal representation for byte array.
and for

public int add(int a, int b);


Object[] params = new Object[]{new Integer(5), new Integer(10)};
String signature = new String[] {"int", "int"};

Should work.

But it's better to consider using MBeanServerInvocationHandler.newProxyInstance method to get MBean Proxy and work with that.
Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319

But it's better to consider using MBeanServerInvocationHandler.newProxyInstance method to get MBean Proxy and work with that.


Thanks for the this tip Purushothoman, it helped me out of a frustrating issue!


Joy is a radiation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to define sig[] and args[] in invoke() method in JMX?