Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (50 sloc) 1.75 KB
JavaSide
========
Add java support for jruby on rails.
- maven support: third party jar dependency management, java class
- spring support: springframework added, xml load......
- warbler compatible: you can use "warble" command to build your war
Installation
=============
rails plugin install git://github.com/fsword/java_side.git
Maven Support
=============
If you want to add a third-party java library, you just modify the pom file:
$ vim $RAILS_ROOT/java/pom.xml
Then run the task: rake java_side:jars
The jar files will be put to the $RAILS_ROOT/java/jars and will be loaded when rails booting automatically. It also be packaged when you execute the warbler task
Springframework Support
=======================
- Add support
1.modify config/application.rb, and add a line like that:
class Application < Rails::Application
...
config.spring = true
...
end
2.check java/pom.xml to make sure it has springframework's dependency(it has added by default pom.xml).
3.run the task: rake java_side:jars
- Usage
You can use get_bean function on your model, like this:
class User < ActiveRecord::Base
def doSth
get_bean('your_bean_id').invokeTheService
...
end
end
If you want to use your bean on other place, just include JavaSide::Spring:
Loading development environment (Rails 3.0.6)
jruby-1.5.6 :001 > include JavaSide::Spring
=> Object
jruby-1.5.6 :002 > x = get_bean 'your_bean_id'
=> #<Java::......:0x496d864e>
jruby-1.5.6 :003 > x.invokeTheService
=> ......
Ignoration
==========
You can ignore this plugin by set environment -
$ IGNORE_JAVA_SIDE=true rails c
java_side is ignored
Loading development environment (Rails 3.0.6)
jruby-1.5.6 :001 >
Copyright (c) 2010 fsword, released under the MIT license