Exposing Rails as Java Class

hello,

we are looking to integrate with Adobe LiveCycle Dataservices which is
basically a java application wrapped up in a WAR. Their application
ideally
will call java classes directly instead of through a REST service to
obtain
the data, is this possible to do when deploying JRuby/Rails app through
,
say Tomcat?

Thanks
Adam

is this something that can be accomplished with JSR 223 ?

Hi AD,
jsr223 gives You ability to connect java world with ruby world inside
one JVM,
if that’s Your goal then yes.
In particular it is possible to run some ruby script and pass java
objects inside to it.

Best greetings,
Pawe³ Wielgus.

2008/9/17 AD [email protected]:

well i am trying to see how I can expose a rails object as a java class
to
be called by another java application. Is this possible ?

2008/9/17 PaweÅ‚ Wielgus [email protected]

You could also have a class within the Rails world that implements some
known Java interface (perhaps an interface you’ve created). Then you can
pass that object back out to the Java side of the world and use it as a
service.

Paweł Wielgus wrote:

rubyEngine.getContext().setAttribute(“root”, root, ScriptContext.ENGINE_SCOPE);
2008/9/17 AD [email protected]:

basically a java application wrapped up in a WAR. Their application


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi AD,
one solution would be to pass some proxy into ruby script and connect
from java to ruby through that proxy. In my case i was putting my java
object into ruby script so that ruby can operate on my java object.
When running jsr223 You can add java objects to ruby world by adding
attribute to jruby engine context like this:

ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine rubyEngine = m.getEngineByName(“jruby”);
rubyEngine.setContext(new SimpleScriptContext());
rubyEngine.getContext().setAttribute(“root”, root,
ScriptContext.ENGINE_SCOPE);

where root might be Your proxy,
then in ruby $root is Your java object.

Hope that helps.

Best greetings,
Pawe³ Wielgus.

2008/9/17 AD [email protected]:

How does one pass it back out? Is there an example on the wiki?