Title: [waffle-scm] [585] trunk: reformat
Revision
585
Author
paul
Date
2008-02-06 23:47:31 -0600 (Wed, 06 Feb 2008)

Log Message

reformat

Modified Paths


Diff

Modified: trunk/waffle-distribution/src/site/content/accessing-java-from-ruby.html (584 => 585)

--- trunk/waffle-distribution/src/site/content/accessing-java-from-ruby.html	2008-02-06 21:08:32 UTC (rev 584)
+++ trunk/waffle-distribution/src/site/content/accessing-java-from-ruby.html	2008-02-07 05:47:31 UTC (rev 585)
@@ -1,23 +1,22 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
 <title>Accessing Java from Ruby</title></head>
-
 <body>
 
 Waffle: How to access your Java components from your Ruby Actions.<br /><br />In
 my last post I gave an overview of how you can easily integrate JRuby
 with Waffle. Now we will examine Ruby based controller in a bit more
 depth. Lets assume we have the following Waffle Registrar for our
-application:<br /><br />public class MyRegistrar extends AbstractRubyAwareRegistrar {<br /><br />&nbsp; public MyRegistrar(Registrar delegate) {<br />&nbsp;&nbsp;&nbsp; super(delegate);<br />&nbsp; }<br /><br />&nbsp; @Override<br />&nbsp; public void application() {<br />&nbsp;&nbsp;&nbsp; register("the_dao", PersonDAOImpl.class);<br /><br />&nbsp;&nbsp;&nbsp; registerRubyScript("person", "PersonController");<br />&nbsp; }<br />}<br /><br />A
+application:<br /><pre>public class MyRegistrar extends AbstractRubyAwareRegistrar {<br />&nbsp; public MyRegistrar(Registrar delegate) {<br />&nbsp;&nbsp;&nbsp; super(delegate);<br />&nbsp; }</pre><pre><br />&nbsp; @Override<br />&nbsp; public void application() {<br />&nbsp;&nbsp;&nbsp; register("the_dao", PersonDAOImpl.class);<br />&nbsp;&nbsp;&nbsp; registerRubyScript("person", "PersonController");<br />&nbsp; }<br />}</pre>A
 DAO, PersonDAOImpl, is registered under the name "the_dao" and we have
 one Ruby based controller available. Now its probably safe to assume
 that this Ruby PersonController will need access to the DAO. Gaining
 access to this DAO from the controller is easy in Waffle, just call the
-locate method:<br />class PersonController<br /><br />&nbsp; def index<br />&nbsp;&nbsp;&nbsp; @person_dao = locate(example.PersonDAO)<br /><br />&nbsp;&nbsp;&nbsp; @people = @person_dao.findAll<br />&nbsp;&nbsp;&nbsp; render 'person.rhtml'<br />&nbsp; end<br /><br />end<br /><br />Notice
+locate method:<br /><pre>class PersonController<br />&nbsp; def index<br />&nbsp;&nbsp;&nbsp; @person_dao = locate(example.PersonDAO)<br />&nbsp;&nbsp;&nbsp; @people = @person_dao.findAll<br />&nbsp;&nbsp;&nbsp; render 'person.rhtml'<br />&nbsp; end<br />end</pre>Notice
 that we were able to retrieve the DAO by its interface. Additionally,
 since this DAO was registered with a key you can use a convention to
 retrieve the component. The convention is "locate_&lt;component
-key&gt;", here is the same controller using the locate_ convention:<br />class PersonController<br /><br />&nbsp; def index<br />&nbsp;&nbsp;&nbsp; @person_dao = locate_the_dao<br /><br />&nbsp;&nbsp;&nbsp; @people = @person_dao.findAll<br />&nbsp;&nbsp;&nbsp; render 'person.rhtml'<br />&nbsp; end<br /><br />end<br /><br />As
+key&gt;", here is the same controller using the locate_ convention:<br /><pre>class PersonController<br />&nbsp; def index<br />&nbsp;&nbsp;&nbsp; @person_dao = locate_the_dao<br />&nbsp;&nbsp;&nbsp; @people = @person_dao.findAll<br />&nbsp;&nbsp;&nbsp; render 'person.rhtml'<br />&nbsp; end<br />end</pre>As
 you can see this makes writing Ruby based Controllers/Actions with
 Waffle really easy. In my next post I'll detail how to access request
 parameter and context attributes with ease.

Modified: trunk/waffle-distribution/src/site/content/ruby-controllers.html (584 => 585)

--- trunk/waffle-distribution/src/site/content/ruby-controllers.html	2008-02-06 21:08:32 UTC (rev 584)
+++ trunk/waffle-distribution/src/site/content/ruby-controllers.html	2008-02-07 05:47:31 UTC (rev 585)
@@ -1,7 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html><head>
 <title>Ruby Controllers</title></head>
-
 <body>Ever wish you could utilize Ruby from your Java based web applications?<br /><br />Waffle,
 a Java based Web Framework, now provides built in support for JRuby.
 This will allow you to easily write your Controllers in Ruby. The
@@ -20,16 +19,16 @@
 pluggability. The following three context-param nodes need to be added
 to your applications web.xml. This alerts Waffle that a few of its
 foundational components should be replaced with alternate
-implementations.<br /><br />&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.context.ContextContainerFactory&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory&lt;/param-value&gt;<br />&lt;/context-param&gt;<br />&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.bind.DataBinder&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.bind.RubyDataBinder&lt;/param-value&gt;<br />&lt;/context-param&gt;<br />&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.controller.ControllerDefinitionFactory&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.controller.RubyControll
 erDefinitionFactory&lt;/param-value&gt;<br />&lt;/context-param&gt;<br /><br />Step
+implementations.<br /><pre>&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.context.ContextContainerFactory&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory&lt;/param-value&gt;<br />&lt;/context-param&gt;</pre><pre>&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.bind.DataBinder&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.bind.RubyDataBinder&lt;/param-value&gt;<br />&lt;/context-param&gt;</pre><pre>&lt;context-param&gt;<br />&nbsp; &lt;param-name&gt;org.codehaus.waffle.controller.ControllerDefinitionFactory&lt;/param-name&gt;<br />&nbsp; &lt;param-value&gt;org.codehaus.waffle.co
 ntroller.RubyControllerDefinitionFactory&lt;/param-value&gt;<br />&lt;/context-param&gt;</pre>Step
 2 - Your application's Registrar should extended
 AbstractRubyAwareRegistrar. This exposes a new registration method to
 use within your Registrar ... registerRubyScript(String key, String
-className). See the example below: <br />public class MyRegistrar extends AbstractRubyAwareRegistrar {<br /><br />&nbsp; public MyRegistrar(Registrar delegate) {<br />&nbsp;&nbsp;&nbsp; super(delegate);<br />&nbsp; }<br />&nbsp;&nbsp; &nbsp;<br />&nbsp; @Override<br />&nbsp; public void application() {<br />&nbsp;&nbsp;&nbsp; registerRubyScript("foobar", "FooBar");<br />&nbsp; }<br />&nbsp; ...<br />}<br /><br />In
+className). See the example below: <br /><pre>public class MyRegistrar extends AbstractRubyAwareRegistrar {<br />&nbsp; public MyRegistrar(Registrar delegate) {<br />&nbsp;&nbsp;&nbsp; super(delegate);<br />&nbsp; }&nbsp;&nbsp; &nbsp;</pre><pre>&nbsp; @Override<br />&nbsp; public void application() {<br />&nbsp;&nbsp;&nbsp; registerRubyScript("foobar", "FooBar");<br />&nbsp; }<br />&nbsp; ...<br />}</pre>In
 this example the Ruby class named 'FooBar' will be exposed as a
 Controller under the name 'foobar' (e.g.
 http://localhost:8080/jruby/foobar.waffle).<br /><br />Step 3 - Write
 your Ruby Controller class. Notice in the following example that your
-class does not need to extend or include anything.<br />class FooBar<br /><br />&nbsp; def index # This is the default action<br />&nbsp;&nbsp;&nbsp; "&lt;h1&gt;Hello World&lt;/h1&gt;"<br />&nbsp; end<br />&nbsp; <br />end<br /><br />And
+class does not need to extend or include anything.<br /><pre>class FooBar<br />&nbsp; def index # This is the default action<br />&nbsp;&nbsp;&nbsp; "&lt;h1&gt;Hello World&lt;/h1&gt;"<br />&nbsp; end&nbsp; <br />end</pre>And
 that is all the steps required to integrate JRuby within your Waffle
 Applications. In my next post I will uncover details on how to access
 registered components from your Ruby based controllers as well as

Modified: trunk/waffle.ipr (584 => 585)

--- trunk/waffle.ipr	2008-02-06 21:08:32 UTC (rev 584)
+++ trunk/waffle.ipr	2008-02-07 05:47:31 UTC (rev 585)
@@ -406,8 +406,5 @@
   <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
     <option name="myLastEditedConfigurable" />
   </component>
-  <UsedPathMacros>
-    <macro name="M2_REPOSITORY" />
-  </UsedPathMacros>
 </project>
 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to