/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.reactivex.ext.shell.term;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.ext.shell.term.TelnetTermOptions;
import io.vertx.ext.shell.term.HttpTermOptions;
import io.vertx.ext.shell.term.SSHTermOptions;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

A server for terminal based applications.

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * A server for terminal based applications. * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.ext.shell.term.TermServer original} non RX-ified interface using Vert.x codegen. */
@io.vertx.lang.rx.RxGen(io.vertx.ext.shell.term.TermServer.class) public class TermServer { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TermServer that = (TermServer) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rx.TypeArg<TermServer> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new TermServer((io.vertx.ext.shell.term.TermServer) obj), TermServer::getDelegate ); private final io.vertx.ext.shell.term.TermServer delegate; public TermServer(io.vertx.ext.shell.term.TermServer delegate) { this.delegate = delegate; } public io.vertx.ext.shell.term.TermServer getDelegate() { return delegate; }
Create a term server for the SSH protocol.
Params:
  • vertx – the vertx instance
Returns:the term server
/** * Create a term server for the SSH protocol. * @param vertx the vertx instance * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createSSHTermServer(io.vertx.reactivex.core.Vertx vertx) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createSSHTermServer(vertx.getDelegate())); return ret; }
Create a term server for the SSH protocol.
Params:
  • vertx – the vertx instance
  • options – the ssh options
Returns:the term server
/** * Create a term server for the SSH protocol. * @param vertx the vertx instance * @param options the ssh options * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createSSHTermServer(io.vertx.reactivex.core.Vertx vertx, SSHTermOptions options) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createSSHTermServer(vertx.getDelegate(), options)); return ret; }
Create a term server for the Telnet protocol.
Params:
  • vertx – the vertx instance
Returns:the term server
/** * Create a term server for the Telnet protocol. * @param vertx the vertx instance * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createTelnetTermServer(io.vertx.reactivex.core.Vertx vertx) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createTelnetTermServer(vertx.getDelegate())); return ret; }
Create a term server for the Telnet protocol.
Params:
  • vertx – the vertx instance
  • options – the term options
Returns:the term server
/** * Create a term server for the Telnet protocol. * @param vertx the vertx instance * @param options the term options * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createTelnetTermServer(io.vertx.reactivex.core.Vertx vertx, TelnetTermOptions options) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createTelnetTermServer(vertx.getDelegate(), options)); return ret; }
Create a term server for the HTTP protocol.
Params:
  • vertx – the vertx instance
Returns:the term server
/** * Create a term server for the HTTP protocol. * @param vertx the vertx instance * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createHttpTermServer(io.vertx.reactivex.core.Vertx vertx) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createHttpTermServer(vertx.getDelegate())); return ret; }
Create a term server for the HTTP protocol.
Params:
  • vertx – the vertx instance
  • options – the term options
Returns:the term server
/** * Create a term server for the HTTP protocol. * @param vertx the vertx instance * @param options the term options * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createHttpTermServer(io.vertx.reactivex.core.Vertx vertx, HttpTermOptions options) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createHttpTermServer(vertx.getDelegate(), options)); return ret; }
Create a term server for the HTTP protocol, using an existing router.
Params:
  • vertx – the vertx instance
  • router – the router
Returns:the term server
/** * Create a term server for the HTTP protocol, using an existing router. * @param vertx the vertx instance * @param router the router * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createHttpTermServer(io.vertx.reactivex.core.Vertx vertx, io.vertx.reactivex.ext.web.Router router) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createHttpTermServer(vertx.getDelegate(), router.getDelegate())); return ret; }
Create a term server for the HTTP protocol, using an existing router.
Params:
  • vertx – the vertx instance
  • router – the router
  • options – the term options
Returns:the term server
/** * Create a term server for the HTTP protocol, using an existing router. * @param vertx the vertx instance * @param router the router * @param options the term options * @return the term server */
public static io.vertx.reactivex.ext.shell.term.TermServer createHttpTermServer(io.vertx.reactivex.core.Vertx vertx, io.vertx.reactivex.ext.web.Router router, HttpTermOptions options) { io.vertx.reactivex.ext.shell.term.TermServer ret = io.vertx.reactivex.ext.shell.term.TermServer.newInstance(io.vertx.ext.shell.term.TermServer.createHttpTermServer(vertx.getDelegate(), router.getDelegate(), options)); return ret; }
Set the term handler that will receive incoming client connections. When a remote terminal connects the handler will be called with the Term which can be used to interact with the remote terminal.
Params:
  • handler – the term handler
Returns:this object
/** * Set the term handler that will receive incoming client connections. When a remote terminal connects * the <code>handler</code> will be called with the {@link io.vertx.reactivex.ext.shell.term.Term} which can be used to interact with the remote * terminal. * @param handler the term handler * @return this object */
public io.vertx.reactivex.ext.shell.term.TermServer termHandler(Handler<io.vertx.reactivex.ext.shell.term.Term> handler) { delegate.termHandler(new Handler<io.vertx.ext.shell.term.Term>() { public void handle(io.vertx.ext.shell.term.Term event) { handler.handle(io.vertx.reactivex.ext.shell.term.Term.newInstance(event)); } }); return this; }
Set an auth provider to use, any provider configured in options will override this provider. This should be used when a custom auth provider should be used.
Params:
  • provider – the auth to use
Returns:this object
/** * Set an auth provider to use, any provider configured in options will override this provider. This should be used * when a custom auth provider should be used. * @param provider the auth to use * @return this object */
public io.vertx.reactivex.ext.shell.term.TermServer authProvider(io.vertx.reactivex.ext.auth.AuthProvider provider) { delegate.authProvider(provider.getDelegate()); return this; }
Bind the term server, the termHandler must be set before.
Returns:this object
/** * Bind the term server, the {@link io.vertx.reactivex.ext.shell.term.TermServer#termHandler} must be set before. * @return this object */
public io.vertx.reactivex.ext.shell.term.TermServer listen() { delegate.listen(); return this; }
Bind the term server, the termHandler must be set before.
Params:
  • listenHandler – the listen handler
Returns:this object
/** * Bind the term server, the {@link io.vertx.reactivex.ext.shell.term.TermServer#termHandler} must be set before. * @param listenHandler the listen handler * @return this object */
public io.vertx.reactivex.ext.shell.term.TermServer listen(Handler<AsyncResult<io.vertx.reactivex.ext.shell.term.TermServer>> listenHandler) { delegate.listen(new Handler<AsyncResult<io.vertx.ext.shell.term.TermServer>>() { public void handle(AsyncResult<io.vertx.ext.shell.term.TermServer> ar) { if (ar.succeeded()) { listenHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.shell.term.TermServer.newInstance(ar.result()))); } else { listenHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); return this; }
Bind the term server, the termHandler must be set before.
Returns:this object
/** * Bind the term server, the {@link io.vertx.reactivex.ext.shell.term.TermServer#termHandler} must be set before. * @return this object */
public Single<io.vertx.reactivex.ext.shell.term.TermServer> rxListen() { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { listen(handler); }); }
The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port
Returns:the actual port the server is listening on.
/** * The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number * signifying an ephemeral port * @return the actual port the server is listening on. */
public int actualPort() { int ret = delegate.actualPort(); return ret; }
Close the server. This will close any currently open connections. The close may not complete until after this method has returned.
/** * Close the server. This will close any currently open connections. The close may not complete until after this * method has returned. */
public void close() { delegate.close(); }
Like close but supplying a handler that will be notified when close is complete.
Params:
  • completionHandler – the handler to be notified when the term server is closed
/** * Like {@link io.vertx.reactivex.ext.shell.term.TermServer#close} but supplying a handler that will be notified when close is complete. * @param completionHandler the handler to be notified when the term server is closed */
public void close(Handler<AsyncResult<Void>> completionHandler) { delegate.close(completionHandler); }
Like close but supplying a handler that will be notified when close is complete.
Returns:
/** * Like {@link io.vertx.reactivex.ext.shell.term.TermServer#close} but supplying a handler that will be notified when close is complete. * @return */
public Completable rxClose() { return io.vertx.reactivex.impl.AsyncResultCompletable.toCompletable(handler -> { close(handler); }); } public static TermServer newInstance(io.vertx.ext.shell.term.TermServer arg) { return arg != null ? new TermServer(arg) : null; } }