Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java™ Platform

Book description

Discover how JRuby on Rails can be used to create web applications faster and more efficiently while still taking advantage of the vast power of the Java platform.

Ruby on Rails is proving itself to be one of the most efficient and powerful agile web development application frameworks available and has had a profound influence on the Java community. The JRuby project offers Java developers the best of two worlds: the flexibility of Ruby on Rails coupled with the enterprise-level power and maturity of the Java platform.

JRuby core developer Ola Bini covers everything you need to know to take full advantage of what JRuby has to offer, including:

  • Full coverage on how to use JRuby to create web applications faster and more efficiently, while continuing to take advantage of the vast power of the Java platform

  • Several real-world projects that illustrate the crucial specifics you need to know about the interaction of Java and Ruby

  • Helpful, practical instruction and discussion on how web applications can be deployed using a variety of popular servers such as Apache and Mongrel

What you'll learn

  • Create a Rails application that uses JDBC to talk to legacy databases

  • Use Java Management Extensions (JMX) to more effectively manage your application

  • Deploy a Rails application within a Java Enterprise web container (Tomcat)

  • Create interoperable applications involving EJBs and Rails-driven web services

  • Securely integrate XML processing into your Ruby applications

  • Build cutting-edge Web 2.0 web sites using Rails, Prototype, and to provide a pleasing user experience

  • Build four important projects: Store, CMS, Admin tool, and a web library project

Who this book is for

You'll get the most from this book if you have medium-to-advanced skills in Java web development, with a little Ruby experience, and are interested in taking Web development to the next level, both in terms of speed and features and in interoperability with existing infrastructure.

Table of contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. Foreword by Pat Eyler
  6. Foreword by Martin Fowler
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. CHAPTER 1 Introduction
    1. Background
    2. Why JRuby on Rails?
    3. Overview of the Book
    4. Summary
  11. CHAPTER 2 Getting Started
    1. Installing JRuby
    2. RubyGems
    3. Setting Up a Database
    4. Summary
  12. PROJECT 1 The Store (Shoplet)
    1. CHAPTER 3 Introduction to Rails
      1. The Structure of a Rails Application
      2. The Other Parts of Rails
      3. Rails Helper Scripts
      4. Testing
      5. Plug-Ins
      6. Summary
    2. CHAPTER 4 Store Administration
      1. Creating a New Rails Application
      2. Running with Mongrel
      3. A First Model
      4. Unit Testing Products
      5. Creating a Scaffold for Products
      6. More Models
      7. Adding Some Authentication
      8. Functional Tests
      9. Summary
    3. CHAPTER 5 A Database-Driven Shop
      1. Browsing Products
      2. Adding a Shopping Cart
      3. Validation and Testing
      4. ActiveRecord and JDBC
      5. Summary
  13. PROJECT 2 A Content Management System (CoMpoSe)
    1. CHAPTER 6 Java Integration
      1. Using Java Resources
      2. Extending Java
      3. Java Collections
      4. Gotchas
      5. Using Ruby from Java
      6. Summary
    2. CHAPTER 7 A Rails CMS
      1. The Database
      2. The Model
      3. Some Layout
      4. Administration Interface
      5. Some Security
      6. Summary
    3. CHAPTER 8 Content Rendering
      1. Content Rendering with XML
      2. Other Ways to Render Content
      3. Finishing CoMpoSe
      4. Summary
  14. PROJECT 3 An Administration System (Big Brother)
    1. CHAPTER 9 A JRuby Enterprise Bean
      1. The Sequence Database
      2. A JRuby Sequence Engine
      3. A JRuby Bean Wrapper
      4. Summary
    2. CHAPTER 10 An EJB-Backed Rails Application
      1. The EJB Client Revisited
      2. Creating the Application
      3. Creating a Small Sequence Library
      4. Sequence Controller and Views
      5. JMX for the Server
      6. Simple JMX Access to Rails
      7. Summary
    3. CHAPTER 11 Deployment
      1. Deploying Ruby on Rails
      2. Deploying JRuby on Rails
      3. Best Practice JRuby on Rails Deployment
      4. Summary
  15. PROJECT 4 A Library System (LibLib)
    1. CHAPTER 12 Web Services with JRuby
      1. The LibLib System
      2. Amazon Web Services
      3. SOAP4R
      4. SOAP with Java
      5. Creating a Small Book Library
      6. Summary
    2. CHAPTER 13 JRuby and Message-Oriented Systems
      1. What Is MOM?
      2. The Legacy System
      3. ActiveMessaging
      4. JRuby and Message-Driven Beans
      5. A Library for Legacy Interaction
      6. Inter-Rails Communication
      7. Summary
    3. CHAPTER 14 The LibLib Rails Application
      1. The Database
      2. Deploying More Than One Rails Instance
      3. Creating the Model
      4. Views and Controllers
      5. Summary
    4. CHAPTER 15 Coda: Next Steps
      1. JRuby-extras
      2. Contributing to JRuby
      3. Home Projects
      4. Summary
  16. APPENDIX A Ruby for Java Programmers
    1. Core Ruby
    2. Classes and Modules
    3. Blocks
    4. Metaprogramming
    5. The Symbol to_proc Trick
  17. APPENDIX B JRuby Reference
    1. Classes and Interfaces
    2. Primitive Arrays
    3. Extensions to Java Classes
    4. The JRuby Module
    5. require
  18. APPENDIX C Resources
    1. Ruby and Rails
    2. JRuby
    3. Other
  19. Index

Product information

  • Title: Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java™ Platform
  • Author(s):
  • Release date: September 2007
  • Publisher(s): Apress
  • ISBN: 9781590598818