You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Claudiu Olteanu <ol...@ymail.com> on 2012/07/12 22:50:19 UTC

Implement a shell in the Master UI

Hello!

My name in Claudiu Olteanu and I want to implement a shell in the Master UI. The problem is that
I  don't know how to capture the output of the IRB's commands. I tried to create a new ruby class 

which runs the commands and save the stdout but it can't call any IRB's methods. 

I've never used ruby before, so please give me some tips!

You can find a sample of my code here [1].

Best regards,
Claudiu


[1] - http://stackoverflow.com/questions/11457960/rubynomethoderror-call-a-ruby-method-from-java

Re: Implement a shell in the Master UI

Posted by Stack <st...@duboce.net>.
On Thu, Jul 12, 2012 at 10:50 PM, Claudiu Olteanu
<ol...@ymail.com> wrote:
> Hello!
>
> My name in Claudiu Olteanu and I want to implement a shell in the Master UI. The problem is that
> I  don't know how to capture the output of the IRB's commands. I tried to create a new ruby class
>
> which runs the commands and save the stdout but it can't call any IRB's methods.
>
> I've never used ruby before, so please give me some tips!
>

I'd say knowing a bit about ruby is probably a prerequisite.

After that, see bin/hirb.rb  Its what is called when you fire up a
shell.  Check it out.  See how you can pass the shell an argument
--format to say how irb should output (currently we only do 'console'
output).  If you look in hirb.rb you will see further down how we
assign console as the @formatter class:

# Presume console format.
# Formatter takes an :output_stream parameter, if you don't want STDOUT.
@formatter = Shell::Formatter::Console.new

See in hbase-server/src/main/ruby/shell/formatter.rb how we have a
base formatter class.  The class has methods that are called to print
a header and tail, then a per row result.  Should be easy enough to
implement html outputs.

St.Ack

Re: Implement a shell in the Master UI

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Hi Claudiu,

Our IRB shell is hackish enough that trying to use it from the web UI
make it sounds like a project that's doomed from the beginning (but I
say this from my limited experience with IRB, JRuby and calling JRuby
from Java).

On the other hand, it sounds like it could be useful...

J-D

On Thu, Jul 12, 2012 at 2:29 PM, Claudiu Olteanu
<ol...@ymail.com> wrote:
> Hello!
>
>
> My name in Claudiu Olteanu and I want to implement a shell in the Master UI. The problem is that
> I  don't know how to capture the output of the IRB's commands. I tried to create a new ruby class
>
> which runs the commands and save the stdout but it can't call any IRB's methods.
>
> I've never used ruby before, so please give me some tips!
>
> You can find a sample of my code here [1].
>
> Best regards,
> Claudiu
>
>
> [1] - http://stackoverflow.com/questions/11457960/rubynomethoderror-call-a-ruby-method-from-java

Implement a shell in the Master UI

Posted by Claudiu Olteanu <ol...@ymail.com>.
Hello!


My name in Claudiu Olteanu and I want to implement a shell in the Master UI. The problem is that
I  don't know how to capture the output of the IRB's commands. I tried to create a new ruby class 

which runs the commands and save the stdout but it can't call any IRB's methods. 

I've never used ruby before, so please give me some tips!

You can find a sample of my code here [1].

Best regards,
Claudiu


[1] - http://stackoverflow.com/questions/11457960/rubynomethoderror-call-a-ruby-method-from-java