Class List Method List File List

# Class: VertxShell::TermServer

Inherits:
  Object
  - Object
  - VertxShell::TermServer
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb

## Overview

A server for terminal based applications.

## Class Method Summary (collapse)

- + (::VertxShell::TermServer) create_http_term_server(param_1 = nil, param_2 = nil, param_3 = nil)
  Create a term server for the HTTP protocol, using an existing router.
- + (::VertxShell::TermServer) create_ssh_term_server(vertx = nil, options = nil)
  Create a term server for the SSH protocol.
- + (::VertxShell::TermServer) create_telnet_term_server(vertx = nil, options = nil)
  Create a term server for the Telnet protocol.

## Instance Method Summary (collapse)

- - (Fixnum) actual_port
  The actual port the server is listening on.
- - (self) auth_provider(provider = nil)
  Set an auth provider to use, any provider configured in options will override this provider.
- - (void) close { ... }
  Like #close but supplying a handler that will be notified when close is complete.
- - (self) listen { ... }
  Bind the term server, the #term_handler must be set before.
- - (self) term_handler { ... }
  Set the term handler that will receive incoming client connections.

## Class Method Details

### + (`::VertxShell::TermServer`) createHttpTermServer(vertx) + (`::VertxShell::TermServer`) createHttpTermServer(vertx, options) + (`::VertxShell::TermServer`) createHttpTermServer(vertx, router) + (`::VertxShell::TermServer`) createHttpTermServer(vertx, router, options)

Create a term server for the HTTP protocol, using an existing router.

Overloads:

- + (`::VertxShell::TermServer`) createHttpTermServer(vertx)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the vertx instance
- + (`::VertxShell::TermServer`) createHttpTermServer(vertx, options)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the vertx instance
  - options (`Hash`) —
    the term options
- + (`::VertxShell::TermServer`) createHttpTermServer(vertx, router)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the vertx instance
  - router (`::VertxWeb::Router`) —
    the router
- + (`::VertxShell::TermServer`) createHttpTermServer(vertx, router, options)

  Parameters:

  - vertx (`::Vertx::Vertx`) —
    the vertx instance
  - router (`::VertxWeb::Router`) —
    the router
  - options (`Hash`) —
    the term options

Returns:

- (`::VertxShell::TermServer`) —
  the term server

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 58

    def self.create_http_term_server(param_1=nil,param_2=nil,param_3=nil)
      if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createHttpTermServer, [Java::IoVertxCore::Vertx.java_class]).call(param_1.j_del),::VertxShell::TermServer)
      elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createHttpTermServer, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtShellTerm::HttpTermOptions.java_class]).call(param_1.j_del,Java::IoVertxExtShellTerm::HttpTermOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxShell::TermServer)
      elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createHttpTermServer, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtWeb::Router.java_class]).call(param_1.j_del,param_2.j_del),::VertxShell::TermServer)
      elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createHttpTermServer, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtWeb::Router.java_class,Java::IoVertxExtShellTerm::HttpTermOptions.java_class]).call(param_1.j_del,param_2.j_del,Java::IoVertxExtShellTerm::HttpTermOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxShell::TermServer)
      end
      raise ArgumentError, "Invalid arguments when calling create_http_term_server(param_1,param_2,param_3)"
    end

### + (`::VertxShell::TermServer`) create_ssh_term_server(vertx = nil, options = nil)

Create a term server for the SSH protocol.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the vertx instance
- options (`Hash`) (defaults to: `nil`) —
  the ssh options

Returns:

- (`::VertxShell::TermServer`) —
  the term server

Raises:

- (`ArgumentError`)

    24
    25
    26
    27
    28
    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 24

    def self.create_ssh_term_server(vertx=nil,options=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createSSHTermServer, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxShell::TermServer)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createSSHTermServer, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtShellTerm::SSHTermOptions.java_class]).call(vertx.j_del,Java::IoVertxExtShellTerm::SSHTermOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxShell::TermServer)
      end
      raise ArgumentError, "Invalid arguments when calling create_ssh_term_server(vertx,options)"
    end

### + (`::VertxShell::TermServer`) create_telnet_term_server(vertx = nil, options = nil)

Create a term server for the Telnet protocol.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the vertx instance
- options (`Hash`) (defaults to: `nil`) —
  the term options

Returns:

- (`::VertxShell::TermServer`) —
  the term server

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 36

    def self.create_telnet_term_server(vertx=nil,options=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createTelnetTermServer, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxShell::TermServer)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::TermServer.java_method(:createTelnetTermServer, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtShellTerm::TelnetTermOptions.java_class]).call(vertx.j_del,Java::IoVertxExtShellTerm::TelnetTermOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxShell::TermServer)
      end
      raise ArgumentError, "Invalid arguments when calling create_telnet_term_server(vertx,options)"
    end

## Instance Method Details

### - (`Fixnum`) actual_port

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:

- (`Fixnum`) —
  the actual port the server is listening on.

Raises:

- (`ArgumentError`)

    109
    110
    111
    112
    113
    114
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 109

    def actual_port
      if !block_given?
        return @j_del.java_method(:actualPort, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling actual_port()"
    end

### - (`self`) auth_provider(provider = nil)

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.

Parameters:

- provider (`::VertxAuthCommon::AuthProvider`) (defaults to: `nil`) —
  the auth to use

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    86
    87
    88
    89
    90
    91
    92
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 86

    def auth_provider(provider=nil)
      if provider.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:authProvider, [Java::IoVertxExtAuth::AuthProvider.java_class]).call(provider.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling auth_provider(provider)"
    end

### - (`void`) close { ... }

This method returns an undefined value.

Like #close but supplying a handler that will be notified when close is complete.

Yields:

- the handler to be notified when the term server is closed

Raises:

- (`ArgumentError`)

    118
    119
    120
    121
    122
    123
    124
    125
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 118

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`self`) listen { ... }

Bind the term server, the #term_handler must be set before.

Yields:

- the listen handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 96

    def listen
      if !block_given?
        @j_del.java_method(:listen, []).call()
        return self
      elsif block_given?
        @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxShell::TermServer) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen()"
    end

### - (`self`) term_handler { ... }

Set the term handler that will receive incoming client connections. When a remote terminal connects the `handler` will be called with the VertxShell::Term which can be used to interact with the remote terminal.

Yields:

- the term handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term_server.rb', line 75

    def term_handler
      if block_given?
        @j_del.java_method(:termHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxShell::Term)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling term_handler()"
    end