The monitor application shows how to use the ORB's monitor API's
for getting values of various JMS server properties. The client
simply resolves the jBrokerAdmin
object, which has a reference
to all monitorable components within a server.
Below is the source code for the Monitor
class:
package monitor; import com.sssw.jbroker.api.admin.Manageable; import com.sssw.jbroker.api.admin.ManageableCollection; public class Monitor { private static String iref = "corbaloc:iiop:localhost:53506/jBrokerAdmin"; public static void main(String[] args) throws Exception { | if (args.length > 0) iref = args[0]; | org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); | ManageableCollection collection = (ManageableCollection) | orb.string_to_object(iref); | | String[] list = collection.list(); | | for (int i = 0; i < list.length; i++) { | | System.out.println("*** " + list[i] + " ***"); | | | | Manageable manageable = collection.getManageable(list[i]); | | | | String[] propNames = manageable.propertyNames(); | | Object[] propValues = manageable.getProperties(propNames); | | | | for (int j = 0; j < propValues.length; j++) | | System.out.println(propNames[j] + " = " + propValues[j]); | } } }
The Monitor
client locates the manageable collection object and gets
the JMSAdmin
object. It then invokes the
propertyNames
method to get all property names. Finally,
the getProperties
method is invoked to get values of all
properties and the result is printed out.
Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.