1 24 25 package org.objectweb.cjdbc.console.text.commands.monitor; 26 27 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 28 import org.objectweb.cjdbc.console.text.ConsoleException; 29 import org.objectweb.cjdbc.console.text.module.MonitorConsole; 30 31 37 public class ChangeTarget extends AbstractMonitorCommand 38 { 39 40 45 public ChangeTarget(MonitorConsole module) 46 { 47 super(module); 48 } 49 50 53 public void parse(String commandText) throws Exception 54 { 55 try 56 { 57 String target = commandText.trim(); 58 String possibleTarget = target.trim(); 59 if (target == null || target.equals("")) 60 { 61 module.setCurrentTarget(jmxClient.getRemoteName()); 62 } else 63 { 64 if (jmxClient.getDataCollectorProxy() 65 .hasVirtualDatabase(possibleTarget)) 66 { 67 module.setCurrentTarget(possibleTarget); 69 } else 70 console.printError(ConsoleTranslate.get( 71 "module.database.invalid", possibleTarget)); 72 } 73 } catch (Exception e) 74 { 75 throw new ConsoleException("monitor.command.settarget.failed",e); 76 } 77 78 } 79 80 83 public String getCommandName() 84 { 85 return "setTarget"; 86 } 87 88 91 public String getCommandDescription() 92 { 93 return ConsoleTranslate.get("monitor.command.settarget"); 94 } 95 96 } | Popular Tags |