Advising JRuby code from AspectJ?


#1

We’re developing a RESTful web application, and we’re looking at running
Rails under JRuby for many of our services. The front end is likely to
be Java, as we’re kitbashing an existing OSS project into something that
fits our needs a bit better.

One of our big requirements is a billing subsystem that supports a wide
number of pricing models, and the ability for our sales/marketing people
to introduce new ones on the fly. Another is a robust auditing
subsystem. Both problems absolutely scream to be pulled out into
aspects, which is fine for the bits of the system written in Java, but
what about the Ruby code? I hear tell (handwave) that there are Ruby
constructs that resemble aspects (handwave, handwave), but I’m new
enough to Ruby to not have learned those patterns yet, and really, we’d
like to only have to write our billing/auditing instrumentation code
once.

Is there a good way to get AspectJ or Spring AOP aspects to advise JRuby
classes? Alternatively, has anyone tried to use Spring AOP to use a
JRuby class to advise Java code? Or is there some third possibility
that I’m overlooking?

For that matter, where on Usenet is the good place to ask about AOP in
general? I don’t see a specific group; is c.l.j.p the right place, or
does one simply not exist yet?

Thanks in advance,
– Sue –


Susan D. removed_email_address@domain.invalid

Sue needs developers! See http://futabachan.livejournal.com/145014.html


#2

“Advising” methods with behavior before, after, or around the method
invocation itself is easy to do in Ruby. If your advice just needs to
invoke
other ruby code, then using these techniques would be better (probably)
than
trying to combine a Java-based AOP mechanism with JRuby classes, etc.
There
are also several basic AOP frameworks for Ruby, although they tend to be
somewhat old or poorly documented.

However, if you need your ruby classes to invoke java services, then it
might make sense to try Spring AOP.

I’ve been doing some work on AOP in Ruby and I’m interested in issues
like
this. Feel free to follow up with me privately if you would to discuss
it
further!

dean