public JdrRunner(CLI cli, String protocol, String host, int port, String user, String pass) { this.env.setServerRunning(false); this.env.setUsername(user); this.env.setPassword(pass); this.env.setHost(cli.getCommandContext().getControllerHost()); this.env.setPort("" + cli.getCommandContext().getControllerPort()); this.env.setCli(cli); try { ctx = CommandContextFactory.getInstance().newCommandContext(constructUri(protocol, host, port), user, pass == null ? new char[0] : pass.toCharArray()); ctx.connectController(); this.env.setClient(ctx.getModelControllerClient()); } catch (Exception e) { ctx.terminateSession(); // the server isn't available, carry on } }
@Override public void connectController() throws CommandLineException { wrapped.connectController(); }
@Override public void connectController(String controller) throws CommandLineException { wrapped.connectController(controller); }
@Override public void connectController(String controller, String client) throws CommandLineException { wrapped.connectController(controller, client); }
@Override public void connectController(String arg0, String arg1) throws CommandLineException { this.delegate.connectController(arg0, arg1); } }
@Override public void connectController(String host, int port) throws CommandLineException { wrapped.connectController(host, port); }
@Override public void connectController(String controller, String client) throws CommandLineException { wrapped.connectController(controller, client); }
@Override public void connectController(String host, int port) throws CommandLineException { wrapped.connectController(host, port); }
@Override public void connectController(String controller) throws CommandLineException { wrapped.connectController(controller); }
@Override public void connectController() throws CommandLineException { wrapped.connectController(); }
public void connectController() throws CommandLineException { delegate.connectController(); }
public void connectController(String host, int port) throws CommandLineException { delegate.connectController(host, port); }
public void connectController() throws CommandLineException { delegate.connectController(); }
public void connectController(String controller) throws CommandLineException { delegate.connectController(controller); }
public void connectController(String host, int port) throws CommandLineException { delegate.connectController(host, port); }
public void connectController(String controller) throws CommandLineException { delegate.connectController(controller); }
private static CommandContext initCommandContext(CommandContextConfiguration ctxConfig, boolean connect) throws CliInitializationException { final CommandContext cmdCtx = CommandContextFactory.getInstance().newCommandContext(ctxConfig); if(connect) { try { cmdCtx.connectController(); } catch (CommandLineException e) { throw new CliInitializationException("Failed to connect to the controller", e); } } return cmdCtx; }
private static CommandContext initCommandContext(CommandContextConfiguration ctxConfig, boolean connect) throws CliInitializationException { final CommandContext cmdCtx = CommandContextFactory.getInstance().newCommandContext(ctxConfig); if(connect) { try { cmdCtx.connectController(); } catch (CommandLineException e) { throw new CliInitializationException("Failed to connect to the controller", e); } } return cmdCtx; }
@Override public CommandResult execute(CLICommandInvocation commandInvocation) throws CommandException, InterruptedException { CommandContext commandContext = commandInvocation.getCommandContext(); if (help) { commandContext.printLine(commandInvocation.getHelpInfo("connect")); return CommandResult.SUCCESS; } try { commandContext.connectController(controllerUrl, bindAddress); } catch (CommandLineException e) { throw new CommandException(Util.getMessagesFromThrowable(e)); } return CommandResult.SUCCESS; } }
@Override public CommandResult execute(CLICommandInvocation commandInvocation) throws CommandException, InterruptedException { CommandContext commandContext = commandInvocation.getCommandContext(); if (help) { commandContext.printLine(commandInvocation.getHelpInfo("connect")); return CommandResult.SUCCESS; } try { commandContext.connectController(controllerUrl, bindAddress); } catch (CommandLineException e) { throw new CommandException(Util.getMessagesFromThrowable(e)); } return CommandResult.SUCCESS; } }