CJX

Demo application: Cheri::JRuby::Explorer (CJX)

CJX is a Swing application written entirely in (J)Ruby using the Cheri::Swing and Cheri::Html builders. It enables you to easily browse classes/modules, configuration/environment settings, and, if ObjectSpace is enabled, any objects in a JRuby instance. A small DRb server component can be installed in other JRuby instances, enabling you to browse them as well. (Note that I have been trying to get the DRb server component working in C/MRI Ruby as well, but have run up against threading/IO conflicts. Suggestions welcome!)

The CJX client requires JRuby 1.0.0RC3 or later. To run it:

  require 'rubygems'
  require 'cheri/jruby/explorer'
  
  Cheri::JRuby::Explorer.run
Alternatively, you can load and run it in one step:
  require 'rubygems'
  require 'cheri/cjx'
This will take several seconds to load and start (performance will be an area of ongoing improvement). Once it loads, it should be fairly clear what to do.

Some known issues:

  • Browsing the class hierarchy is very slow right now -- this actually slowed down in the past couple of days when I switched from HTML to straight Swing layout, the opposite of what I expected to happen. [Note: this has been slightly improved since 0.0.5]

  • There are lots of layout issues; neither HTML (JEditorPane) nor BoxLayout provide exactly what I'm looking for. Will probably have to bite the bullet and go to GridBagLayout. Ugh.

  • Global variables are currently shown, um, globally, when many of them should be shown per thread. This will be fixed in a later release, which will include a Thread section with other goodies as well (thread-local vars, status, etc.).
To install the CJX DRb server component in an instance (assuming the Cheri gem is installed):
  require 'rubygems'
  require 'cheri/explorer'
  
  Cheri::Explorer.start nnnn #=> where nnnn is a port
Note that for the server, you require 'cheri/explorer', not 'cheri/jruby/explorer'. Also note that the above actually does work in C/MRI Ruby, but requests to the server then hang in CJX, unless you join the thread:
  # C/MRI Ruby only
  Cheri::Explorer.thread.join
After that, you can browse just fine in CJX, but you can't do anything more in the C-Ruby instance, so it's kind of pointless. Again, if anyone with more DRb experience than I have can offer any suggestions, I'd be happy to hear them.
Copyright © 2007 Bill Dortch