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 thejBrokerAdmin
object, which has a reference to all monitorable components within a server.Below is the source code for the
Monitor
class:The Monitor client locates the manageable collection object and gets thepackage 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]); | } } }JMSAdmin
object. It then invokes thepropertyNames
method to get all property names. Finally, thegetProperties
method is invoked to get values of all properties and the result is printed out.
Copyright © 2000-2003, Novell, Inc. All rights reserved. |