@Override public void start() throws Exception { ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) )); service.start(); } }
@Override public void start(Future<Void> startFuture) throws Exception { ShellService service = ShellService.create(vertx, new ShellServiceOptions(). setHttpOptions( new HttpTermOptions(). setHost("localhost"). setPort(8080). setAuthOptions(new ShiroAuthOptions(). setConfig(new JsonObject().put("properties_path", "auth.properties"))))); service.start(ar -> { if (ar.succeeded()) { startFuture.succeeded(); } else { startFuture.fail(ar.cause()); } }); } }
@Override public void start(Future<Void> startFuture) throws Exception { ShellService service = ShellService.create(vertx, new ShellServiceOptions(). setSSHOptions( new SSHTermOptions(). setHost("localhost"). setPort(3000). setKeyPairOptions(new JksOptions(). setPath("keystore.jks"). setPassword("wibble")). setAuthOptions(new ShiroAuthOptions(). setConfig(new JsonObject().put("properties_path", "auth.properties"))))); service.start(ar -> { if (ar.succeeded()) { startFuture.succeeded(); } else { startFuture.fail(ar.cause()); } }); } }
authOptions ); ShellService service = ShellService.create(vertx, new ShellServiceOptions(). setTelnetOptions(new TelnetTermOptions().setPort(5000)). setSSHOptions(options). setHttpOptions(new HttpTermOptions(). setPort(8080). setAuthOptions(authOptions)
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ShellServiceOptions obj) { for (java.util.Map.Entry<String, Object> member : json) { switch (member.getKey()) { case "httpOptions": if (member.getValue() instanceof JsonObject) { obj.setHttpOptions(new io.vertx.ext.shell.term.HttpTermOptions((JsonObject)member.getValue())); } break; case "sshOptions": if (member.getValue() instanceof JsonObject) { obj.setSSHOptions(new io.vertx.ext.shell.term.SSHTermOptions((JsonObject)member.getValue())); } break; case "telnetOptions": if (member.getValue() instanceof JsonObject) { obj.setTelnetOptions(new io.vertx.ext.shell.term.TelnetTermOptions((JsonObject)member.getValue())); } break; } } }
protected void startShell(SSHTermOptions options) throws ExecutionException, InterruptedException, TimeoutException { if (service != null) { throw new IllegalStateException(); } service = ShellService.create(vertx, new ShellServiceOptions(). setWelcomeMessage(""). setSSHOptions(options)); CompletableFuture<Void> fut = new CompletableFuture<>(); service.start(ar -> { if (ar.succeeded()) { fut.complete(null); } else { fut.completeExceptionally(ar.cause()); } }); fut.get(10, TimeUnit.SECONDS); }
/** * Like {@link #create(Vertx, ShellServiceOptions)}, with default options. */ static ShellService create(Vertx vertx) { return create(vertx, new ShellServiceOptions()); }
private void startServer(List<CommandResolver> resolvers, Handler<AsyncResult<Void>> startHandler) { TelnetTermOptions telnetOptions = options.getTelnetOptions(); SSHTermOptions sshOptions = options.getSSHOptions(); HttpTermOptions webOptions = options.getHttpOptions(); if (telnetOptions != null) { server.registerTermServer(new TelnetTermServer(vertx, telnetOptions)); } if (sshOptions != null) { server.registerTermServer(new SSHServer(vertx, sshOptions)); } if (webOptions != null) { server.registerTermServer(new HttpTermServer(vertx, webOptions)); } resolvers.forEach(server::registerCommandResolver); server.listen(startHandler); }
public static void toJson(ShellServiceOptions obj, java.util.Map<String, Object> json) { if (obj.getHttpOptions() != null) { json.put("httpOptions", obj.getHttpOptions().toJson()); } if (obj.getTelnetOptions() != null) { json.put("telnetOptions", obj.getTelnetOptions().toJson()); } } }
@Override public void start(Future<Void> startFuture) throws Exception { ShellServiceOptions options = new ShellServiceOptions(context.config()); ShellService service = ShellService.create(vertx, options); service.start(ar -> { if (ar.succeeded()) { startFuture.complete(); } else { startFuture.fail(ar.cause()); } }); } }
ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) ));
public static io.vertx.ext.shell.ShellService create(io.vertx.ext.shell.ShellService j_receiver, io.vertx.core.Vertx vertx, java.util.Map<String, Object> options) { return io.vertx.core.impl.ConversionHelper.fromObject(io.vertx.ext.shell.ShellService.create(vertx, options != null ? new io.vertx.ext.shell.ShellServiceOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null)); } }
@Override public void start() throws Exception { Command helloWorld = CommandBuilder.command("hello-world"). processHandler(process -> { process.write("hello world\n"); process.end(); }).build(vertx); ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) )); CommandRegistry.getShared(vertx).registerCommand(helloWorld); service.start(ar -> { if (!ar.succeeded()) { ar.cause().printStackTrace(); } }); } }
@Override public void start() throws Exception { Command starwars = CommandBuilder.command("echokeyboard"). processHandler(process -> { // Echo process.stdinHandler(keys -> { process.write(keys.replace('\r', '\n')); }); // Terminate when user hits Ctrl-C process.interruptHandler(v -> { process.end(); }); }).build(vertx); ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) )); CommandRegistry.getShared(vertx).registerCommand(starwars); service.start(ar -> { if (!ar.succeeded()) { ar.cause().printStackTrace(); } }); } }
}).build(vertx); ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) ));
ShellService service = ShellService.create(vertx, new ShellServiceOptions().setTelnetOptions( new TelnetTermOptions().setHost("localhost").setPort(3000) ));