Class: VertxShell::TermServer

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb

Overview

A server for terminal based applications.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 21

def @@j_api_type.accept?(obj)
  obj.class == TermServer
end

+ (::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:

Returns:

Raises:

  • (ArgumentError)


74
75
76
77
78
79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 74

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:

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 40

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:

Raises:

  • (ArgumentError)


52
53
54
55
56
57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 52

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

+ (Object) j_api_type



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 30

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 33

def self.j_class
  Java::IoVertxExtShellTerm::TermServer.java_class
end

+ (Object) unwrap(obj)



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 27

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 24

def @@j_api_type.wrap(obj)
  TermServer.new(obj)
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)


125
126
127
128
129
130
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 125

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:

Returns:

  • (self)

Raises:

  • (ArgumentError)


102
103
104
105
106
107
108
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 102

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)


134
135
136
137
138
139
140
141
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 134

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)


112
113
114
115
116
117
118
119
120
121
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 112

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)


91
92
93
94
95
96
97
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/term_server.rb', line 91

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