Class: VertxShell::ShellServer
- Inherits:
-
Object
- Object
- VertxShell::ShellServer
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb
Overview
The shell server.
A shell server is associated with a collection of : the #register_term_server
method registers a term server. Term servers life cycle are managed by this server.
When a receives an incoming connection, a instance is created and
associated with this connection.
The #create_shell method can be used to create instance for testing purposes.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxShell::ShellServer) create(vertx = nil, options = nil)
Create a new shell server with default options.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) close { ... }
Close the shell server, this is an asynchronous close.
-
- (::VertxShell::Shell) create_shell(term = nil)
Create a new shell, the returned shell should be closed explicitely.
-
- (self) listen { ... }
Start the shell service, this is an asynchronous start.
-
- (self) register_command_resolver(resolver = nil)
Register a command resolver for this server.
-
- (self) register_term_server(termServer = nil)
Register a term server to this shell server, the term server lifecycle methods are managed by this shell server.
-
- (void) shell_handler { ... }
Called when a new shell is created.
Class Method Details
+ (Boolean) accept?(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 30 def @@j_api_type.accept?(obj) obj.class == ShellServer end |
+ (::VertxShell::ShellServer) create(vertx = nil, options = nil)
Create a new shell server with default options.
49 50 51 52 53 54 55 56 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 49 def self.create(vertx=nil,=nil) if vertx.class.method_defined?(:j_del) && !block_given? && == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShell::ShellServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxShell::ShellServer) elsif vertx.class.method_defined?(:j_del) && .class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShell::ShellServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtShell::ShellServerOptions.java_class]).call(vertx.j_del,Java::IoVertxExtShell::ShellServerOptions.new(::Vertx::Util::Utils.to_json_object())),::VertxShell::ShellServer) end raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{})" end |
+ (Object) j_api_type
39 40 41 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 39 def self.j_api_type @@j_api_type end |
+ (Object) j_class
42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 42 def self.j_class Java::IoVertxExtShell::ShellServer.java_class end |
+ (Object) unwrap(obj)
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 36 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 33 def @@j_api_type.wrap(obj) ShellServer.new(obj) end |
Instance Method Details
- (void) close { ... }
This method returns an undefined value.
Close the shell server, this is an asynchronous close.
104 105 106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 104 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 |
- (::VertxShell::Shell) create_shell(term = nil)
Create a new shell, the returned shell should be closed explicitely.
80 81 82 83 84 85 86 87 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 80 def create_shell(term=nil) if !block_given? && term == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createShell, []).call(),::VertxShell::Shell) elsif term.class.method_defined?(:j_del) && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createShell, [Java::IoVertxExtShellTerm::Term.java_class]).call(term.j_del),::VertxShell::Shell) end raise ArgumentError, "Invalid arguments when calling create_shell(#{term})" end |
- (self) listen { ... }
Start the shell service, this is an asynchronous start.
91 92 93 94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 91 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) })) return self end raise ArgumentError, "Invalid arguments when calling listen()" end |
- (self) register_command_resolver(resolver = nil)
Register a command resolver for this server.
60 61 62 63 64 65 66 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 60 def register_command_resolver(resolver=nil) if resolver.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:registerCommandResolver, [Java::IoVertxExtShellCommand::CommandResolver.java_class]).call(resolver.j_del) return self end raise ArgumentError, "Invalid arguments when calling register_command_resolver(#{resolver})" end |
- (self) register_term_server(termServer = nil)
Register a term server to this shell server, the term server lifecycle methods are managed by this shell server.
70 71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 70 def register_term_server(termServer=nil) if termServer.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:registerTermServer, [Java::IoVertxExtShellTerm::TermServer.java_class]).call(termServer.j_del) return self end raise ArgumentError, "Invalid arguments when calling register_term_server(#{termServer})" end |
- (void) shell_handler { ... }
This method returns an undefined value.
Called when a new shell is created. Can be used to prepopulate the shell session with objects or set the prompt.
116 117 118 119 120 121 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/shell_server.rb', line 116 def shell_handler if block_given? return @j_del.java_method(:shellHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxShell::Shell)) })) end raise ArgumentError, "Invalid arguments when calling shell_handler()" end |