JRuby class with BeanInfo capabilities

Hi!

This is the scenario: I’m using JRuby to create a small DSL for creating
Apache Camel routes in an OSGi environment. Things are working nicely,
and it’s possible to load jruby scripts such as:

 require 'lib/dsl'
 Route.create do
     from("file:some/path").to("seda://queue_name")
 end

This works for simple camel-routes, but what I’d like to do is to use
some of the ‘bean-binding’ capabilities in Camel components (for example
Xstream - to marshall to/from XML):

 class PersonType
     attr_accessor :id, :name
 end

 xs = XStream.new
 xs.setClassLoader(...)
 xs.alias("person", PersonType.java_class)
 fmt = XStreamDataFormat.new(xs)

 #
 # The XML files would look like:
 # <list>
 #   <person>
 #       <id>2</id>
 #       <name>Foo</name>
 #   </person>
 #   <person>....</person>
 # </list>
 #
 from("file:some/path").marshal().string().unmarshal(fmt).process do
     # Process the XML data as a list of Person instances.
 end

This fails because (I believe) the PersonType.java_class does not return
a JavaBean compatible class.

I’ve made some experiments to create a Ruby class and have it “quack”
like a java-bean by looking at it with the java.beans.Introspector -
but without success.

Any ideas on how to approach this?

Best Regards //Anders