Git Product home page Git Product logo

java_side's Introduction

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

java_side's People

Contributors

fsword avatar

Stargazers

mlzboy avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.