1 24 25 package org.objectweb.cjdbc.console.text.commands.controller; 26 27 import java.util.StringTokenizer ; 28 29 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 30 import org.objectweb.cjdbc.console.text.ConsoleException; 31 import org.objectweb.cjdbc.console.text.commands.ConsoleCommand; 32 import org.objectweb.cjdbc.console.text.module.AbstractConsoleModule; 33 34 40 public class Bind extends ConsoleCommand 41 { 42 43 48 public Bind(AbstractConsoleModule module) 49 { 50 super(module); 51 } 52 53 56 public void parse(String commandText) throws Exception 57 { 58 StringTokenizer st = new StringTokenizer (commandText.trim()); 59 60 String host = null; 61 String port = null; 62 63 if (st == null || st.countTokens() != 2) 64 { 65 console.printError(getUsage()); 66 return; 67 } 68 69 try 70 { 71 host = st.nextToken(); 72 port = st.nextToken(); 73 74 jmxClient.connect(port, host, jmxClient.getCredentials()); 75 console.printInfo(ConsoleTranslate.get("controller.command.bind.success", 76 new String []{host, port})); 77 } 78 catch (Exception e) 79 { 80 throw new ConsoleException(ConsoleTranslate.get( 81 "controller.command.bind.failed", new String []{host, port})); 82 } 83 } 84 85 88 public String getCommandName() 89 { 90 return "connect controller"; 91 } 92 93 96 public String getCommandParameters() 97 { 98 return ConsoleTranslate.get("controller.command.bind.params"); 99 } 100 101 104 public String getCommandDescription() 105 { 106 return ConsoleTranslate.get("controller.command.bind.description"); 107 } 108 109 } 110 | Popular Tags |