1 18 package org.apache.activemq.console.command; 19 20 import org.apache.activemq.console.formatter.GlobalWriter; 21 import org.apache.activemq.console.util.JmxMBeansUtil; 22 23 import java.util.List ; 24 import java.util.Set ; 25 import java.util.HashSet ; 26 27 public class ListCommand extends AbstractJmxCommand { 28 29 34 protected void runTask(List tokens) throws Exception { 35 try { 36 Set propsView = new HashSet (); 37 propsView.add("BrokerName"); 38 GlobalWriter.printMBean(JmxMBeansUtil.filterMBeansView(JmxMBeansUtil.getAllBrokers(useJmxServiceUrl()), propsView)); 39 } catch (Exception e) { 40 GlobalWriter.printException(new RuntimeException ("Failed to execute list task. Reason: " + e)); 41 throw new Exception (e); 42 } 43 } 44 45 48 protected void printHelp() { 49 GlobalWriter.printHelp(helpFile); 50 } 51 52 protected String [] helpFile = new String [] { 53 "Task Usage: Main list [list-options]", 54 "Description: Lists all available broker in the specified JMX context.", 55 "", 56 "List Options:", 57 " --jmxurl <url> Set the JMX URL to connect to.", 58 " --version Display the version information.", 59 " -h,-?,--help Display the stop broker help information.", 60 "" 61 }; 62 } 63 | Popular Tags |