<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cantina Consulting &#187; Groovy on Grails</title>
	<atom:link href="http://www.cantinaconsulting.com/category/groovy-on-grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cantinaconsulting.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 18:47:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Grails &#8211; Exporting / Importing Domain Objects using DefaultGrailsDomainClass</title>
		<link>http://www.cantinaconsulting.com/2010/07/15/grails-exporting-importing-domain-objects-using-defaultgrailsdomainclass/</link>
		<comments>http://www.cantinaconsulting.com/2010/07/15/grails-exporting-importing-domain-objects-using-defaultgrailsdomainclass/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 18:48:38 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=422</guid>
		<description><![CDATA[Lately I&#8217;ve been working on a multi-tenant web app that contains a good-size number of domain objects. Within these objects, there exists a sub-set belonging to a root object, and the need arose to be able to quickly duplicate / populate the data within these objects between different instances of the app. It has become [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been working on a multi-tenant web app that contains a good-size number of domain objects. Within these objects, there exists a sub-set belonging to a root object, and the need arose to be able to quickly duplicate / populate the data within these objects between different instances of the app. It has become quite an interesting problem: certainly one could create some SQL scripts to export/import data, but how does one do it in a user-friendly, Groovy/Grails manner?</p>
<p id="_mcePaste">The key turned out to be the discovery of the <a title="DefaultGrailsDomainClass" href="http://www.grails.org/doc/1.3.x/api/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClass.html" target="_blank">DefaultGrailsDomainClass</a> . This class performs a series of introspections on your domain objects, and allows you to programmatically access quite a bit of information on them. For example, suppose we had the following domain object:</p>
<div>
<pre style="padding-left: 30px;">class Pizza{</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">String name

BigDecimal diameter

List toppings

hasMany = [toppings:Topping]</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 30px;">}</pre>
</div>
<p id="_mcePaste">Class &#8216;Pizza&#8217; contains a name / description, diameter, and a many-to-many relationship with the &#8216;Topping&#8217; class (although not defined here). Nice and simple&#8230; now, the good stuff.</p>
<p id="_mcePaste">By passing a Domain Object class to DefaultGrailsDomainClass, we can access a good deal of info about that Domain Object. Among other things there are methods to access a Map of the constraints, determine whether or not a property is a relation (1:1,1:m,m:m), and access the properties directly by obtaining a set of <a title="GrailsDomainClassProperties" href="http://grails.org/doc/1.3.x/api/org/codehaus/groovy/grails/commons/GrailsDomainClassProperty.html" target="_blank">GrailsDomainClassProperties</a> . Of particular use to me is the DefaultGrailsDomainClass.getPersistantProperties() method, which returns a GrailsDomainClassProperty List of all the properties that are persisted to the database. That&#8217;s pretty excellent.</p>
<p id="_mcePaste">To illustrate this, let&#8217;s get the persistent properties for a Pizza:</p>
<address id="_mcePaste" style="padding-left: 30px;"><span style="color: #333333;">def pizzaProperties = new DefaultGrailsDomainClass(Pizza.class).getPersistantProperties()</span></address>
<address style="padding-left: 30px;"><span style="color: #333333;"><br /></span></address>
<p id="_mcePaste">pizzaProperties now contains a list of &#8216;DefaultGrailsDomainClassProperty&#8217; objects. If we iterate through them, we can see the following information:</p>
<address>
<p><span style="color: #333333;">[name=diameter,type=double,persistent=true, optional=false, association=false, bidirectional=false, association-type=&lt;null&gt;]</span></p>
<p><span style="color: #333333;">[name=name,type=class java.lang.String,persistent=true, optional=false, association=false, bidirectional=false, association-type=&lt;null&gt;]</span></p>
<p><span style="color: #333333;">[name=toppings,type=interface java.util.List, persistent=true, optional=true, association=true, bidirectional=false, association-type=one-to-many]</span></p>
<p> </p>
<p> </p>
</address>
<p id="_mcePaste">Think of the possibilities of what can be accomplished by programmatically accessing the properties on your domain object! However, I am not exceedingly clever:</p>
<div>
<address style="padding-left: 30px;">def exportClassSingle(ConfigObject co, String className, objInstance){</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">if(objInstance){</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">/*</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 90px;">The DefaultGrailsDomainClass allows discovery of the persistent properties for a domain object.</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">*/</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">def props = new DefaultGrailsDomainClass(objInstance.class).getPersistantProperties()</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">/*</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 90px;">getPersistantProperties generates a list of &#8220;DefaultGrailsDomainClassProperty&#8221; which contains a
<p>good deal of info about each property.</p>
<p> </p>
</p></address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">*/</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 60px;">for(p in props){</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 90px;">if(!p.isAssociation()){</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 120px;">co[className][p.name] = preExportClean(objInstance[p.name])</address>
</div>
<div id="_mcePaste">
<address style="padding-left: 90px;">}</address>
</div>
<pre id="_mcePaste">
<address style="padding-left: 90px;">else{//do something clever!}

}</address>
</pre>
<pre id="_mcePaste">
<address style="padding-left: 30px;">}</address>
</pre>
<p id="_mcePaste">The exportClassSingle method above accepts the ConfigObject which will be populated with the domain object&#8217;s data, the name of the class, and an instance of the domain object. It is relatively simple: it takes the class, loads its persistent properties, loops through through them and if the property is not an association, it is added to the config object.  By repeatedly calling the method for each of our Domain objects, we build up the ConfigObject which contains class and instance data. The preExportClean() method looks for and escapes any usage of &#8216;$&#8217;, which can cause some odd behavior if not escaped. We ignore associations here because in the real app, everything is connected to one root object; if there were associations among the child objects that we wished to capture then the above method would be quite different.</p>
<div>
<p>The resulting ConfigObject can then be converted into a String containing a DSL describing your objects and data. The string can then be loaded back into a ConfigObject using the ConfigSlurper.</p>
</div>
<p id="_mcePaste">Given the following DSL:</p>
<div id="_mcePaste">
<pre style="padding-left: 30px;">pizza{</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">pizza_0{</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">name="Small"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">diameter="8.0"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">}</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">pizza_1{</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">name="Medium"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">diameter="14.5"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">}</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">pizza_2{</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">name="Large"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 90px;">diameter="21.0"</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">}</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 30px;">}</pre>
</div>
<p id="_mcePaste">and assuming it&#8217;s saved in a String called &#8216;pizzaDSL&#8217;, we can import this data into our system using the following steps:</p>
<div id="_mcePaste">
<p>1. Import the DSL using ConfigSlurper.</p>
</div>
<pre style="padding-left: 30px;">ConfigObject config = new ConfigSlurper().parse( pizzaDSL )</pre>
<p id="_mcePaste">The ConfigObject config now contains a map of ConfigObjects. Using the key of &#8216;pizza&#8217; returns a map of 3 more ConfigObjects.</p>
<p>2. Construct objects using the configObject.</p>
<div id="_mcePaste">
<pre style="padding-left: 30px;">config["pizza"].each{key,map-&gt;</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">Pizza p = new Pizza()</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">p.properties = map</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">//set toppings</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 60px;">p.save()</pre>
</div>
<div id="_mcePaste">
<pre style="padding-left: 30px;">}</pre>
</div>
<div id="_mcePaste">
<p>One could also iterate through the root config object (in the case where we had more objects, e.g. &#8216;topping&#8217;) and use the key to determine which object to create and populate. This simple case has only one class, Pizza (and thus only one key).</p>
</div>
<p id="_mcePaste">3. Celebrate</p>
<p id="_mcePaste">Well, that&#8217;s it. I hope this helps explain the usage of the Default Domain Class and that you all find a usage for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2010/07/15/grails-exporting-importing-domain-objects-using-defaultgrailsdomainclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugin Development in Grails</title>
		<link>http://www.cantinaconsulting.com/2009/05/19/plugin-development-in-grails/</link>
		<comments>http://www.cantinaconsulting.com/2009/05/19/plugin-development-in-grails/#comments</comments>
		<pubDate>Wed, 20 May 2009 00:22:18 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=159</guid>
		<description><![CDATA[We&#8217;ve had a bit of time to jump back into Grails plugin development (or maintenance as it were) and couldn&#8217;t be happier to find the recent improvements in Grails 1.1.  The biggest improvement (though perhaps not advertised as such) to me, was the inclusion of functionality that allows plugin developers to build test applications [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve had a bit of time to jump back into Grails plugin development (or maintenance as it were) and couldn&#8217;t be happier to find the recent improvements in Grails 1.1.  The biggest improvement (though perhaps not advertised as such) to me, was the inclusion of functionality that allows plugin developers to build test applications against the live, &#8220;unpacked&#8221; version of the plugin, which is to say, the Grails application that implements the plugin itself.</p>
<p>This may sound esoteric, but to someone doing plugin development in Grails, it&#8217;s a life saver, and here&#8217;s why.</p>
<p>When building a plugin for Grails, the plugin itself is built as a Grails application.  This has many benefits, including in some cases being able to run the plugin and test controllers and domain classes directly in the running plugin.  However, most, if not all plugins are intended to <em>plug into</em> another Grails application.  Given that, the only real way to test the usability of your plugin API, and whether the plugin works in the context of larger Grails application, is to install the plugin into another Grails application.  Here&#8217;s an example:</p>
<ol>
<li>I&#8217;m developing Plugins A and B to be installed in a new Grails CMS application I&#8217;m building</li>
<li>Plugin A depends on Plugin B to function</li>
<li>Once Plugin B is in good enough shape, I&#8217;ll install it into Plugin A using the Grails <em>install-plugin</em> command</li>
<li>Once Plugin A is in good enough shape, I can install it and Plugin B into my Grails CMS application</li>
<li>After testing the CMS for a while, I discover a bug in Plugin B which also requires a small change in Plugin A to accommodate the bug fix (are you still with me?)</li>
<li>I fix the bug in Plugin B and repackage</li>
<li>I remove Plugin B from Plugin A and install the latest version of Plugin B into Plugin A to make the changes required in Plugin A and repackage</li>
<li>In the CMS application, I remove both of the plugins and reinstall both Plugins into the CMS</li>
<li>I become tired of installing and uninstalling plugins and go out for beers</li>
</ol>
<p>With Grails 1.1, this development cycle is improved drastically.  Now, during development you can provide explicit locations for Grails plugin projects, without needing to install the plugin, to develop against that plugin.  Here&#8217;s an excerpt from the <a href="http://grails.org/1.1+Release+Notes">Grails 1.1 release notes</a>:</p>
<blockquote><p>An application can now load plugins from anywhere on the file system, even if they have not been installed. Simply add the location of the (unpacked) plugin to you BuildConfig.groovy file:</p>
<p><code>// Useful to test plugins you are developing.<br />
grails.plugin.location.jsecurity = "/home/dilbert/dev/plugins/grails-jsecurity"</p>
<p>// Useful for modular applications where all plugins and<br />
// applications are in the same directory.<br />
grails.plugin.location.'grails-ui' = "../grails-grails-ui"</code></p>
<p>This is particularly useful in two cases:</p>
<ol>
<li>You are developing a plugin and want to test it in a real application without packaging and installing it first.</li>
<li>You have split an application into a set of plugins and an application, all in the same &#8220;super-project&#8221; directory.
</li>
</ol>
</blockquote>
<p>Now if you want to test your plugins in the context of a larger application, you can do so without the pain of constant reinstallation.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2009/05/19/plugin-development-in-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GORM multiple datasource access</title>
		<link>http://www.cantinaconsulting.com/2008/10/24/gorm-multiple-datasource-access/</link>
		<comments>http://www.cantinaconsulting.com/2008/10/24/gorm-multiple-datasource-access/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 16:19:41 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=36</guid>
		<description><![CDATA[It appears that the limitations of Grails object relational mapping (GORM) &#8211; only allowing connections to a single datasource &#8211; has been resolved with a new plugin from Burt Beckwith.  This feature which allows application architects to design systems that can shard data across federated databases has been around for awhile in ActiveRecord &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>It appears that the limitations of Grails object relational mapping (GORM) &#8211; only allowing connections to a single datasource &#8211; has been resolved with a <a href="http://burtbeckwith.com/blog/?p=70">new plugin</a> from Burt Beckwith.  This feature which allows application architects to design systems that can shard data across federated databases has been around for awhile in ActiveRecord &#8211; Rails object relational mapping framework. So it is good to see someone has addressed the issue.  I hope to try it out soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2008/10/24/gorm-multiple-datasource-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fitting Grails into an Ant Build Environment</title>
		<link>http://www.cantinaconsulting.com/2008/09/01/fitting-grails-into-an-ant-build-environment/</link>
		<comments>http://www.cantinaconsulting.com/2008/09/01/fitting-grails-into-an-ant-build-environment/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 17:41:54 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=33</guid>
		<description><![CDATA[I&#8217;ve been working on a project that involves rolling a Grails-based application into a much larger build process, one which ties together several Java components and test suites through an Ant build process.  This integration involves Ant calling the Grails command line tasks (clean, test-app, war, etc).  The standard build.xml that is found [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project that involves rolling a Grails-based application into a much larger build process, one which ties together several Java components and test suites through an <a href="http://ant.apache.org">Ant</a> build process.  This integration involves Ant calling the Grails command line tasks (clean, test-app, war, etc).  The standard build.xml that is found after creating a new Grails application currently uses the <em>exec</em> task to invoke the command line tasks.  While this works, it takes you out of the world of Ant (and consequently out of the world of Java).</p>
<p>Fortunately, for a little while now, the Grails distribution has been packaged with an Ant macro, graciously contributed by <a href="http://www.linkedin.com" title="Linked In">LinkedIn</a>, which allows you to more tightly integrate Grails tasks with an Ant build.  You can find the script here:</p>
<p><a href="http://svn.codehaus.org/grails/trunk/grails/src/grails/grails-macros.xml" title="grails-macros.xml">http://svn.codehaus.org/grails/trunk/grails/src/grails/grails-macros.xml</a></p>
<p>
This macro sets up a Java environment using the GrailsStarter and GrailsScriptRunner bootstrap classes to startup a Grails environment and execute the given Grails <a href="http://groovy.codehaus.org/Gant" title="Groovy - Gant">Gant</a> script.  This is similar to the way the Grails command line batch/shell scripts function, however the macro does it within an Ant <a href="http://ant.apache.org/manual/CoreTasks/java.html" title="Java Task">java</a> task, which allows us to add additional information to the JVM as it executes, such as additional classpath information, system properties, and JVM arguments to name a few.
</p>
<p>
You can use this macro by importing it into your Ant build script and invoking it as follows (assuming your GRAILS_HOME environment variable is set properly):
</p>
<pre>
&lt;import file=&quot;${env.GRAILS_HOME}/src/grails/grails-macros.xml&quot; /&gt;

&lt;grails command=&quot;clean&quot; /&gt;
&lt;grails command=&quot;war&quot; args=&quot;mywarfile.war&quot;/&gt;
...
</pre>
<p>
This is certainly handy but doesn&#8217;t offer much beyond using Ant&#8217;s <a href="http://ant.apache.org/manual/CoreTasks/exec.html" title="Exec Task">exec</a> task.  However, once we look at what we can pass into the macro, the added value becomes more apparent.  The macro accepts several argument attributes and elements to augment the way the macro executes.  The example below shows how we can add additional system properties and classpath items to a <i>run-app</i> command.
</p>
<pre>
&lt;grails command=&quot;run-app&quot;&gt;
  &lt;sysprops&gt;
    &lt;sysproperty key=&quot;server.port&quot; value=&quot;9999&quot; /&gt;
  &lt;/sysprops&gt;
  &lt;extend-classpath&gt;
    &lt;pathelement location=&quot;SOME_OTHER_LIB_LOCATION/foo.jar&quot;/&gt;
    &lt;pathelement location=&quot;SOME_OTHER_LIB_LOCATION/bar.jar&quot;/&gt;
  &lt;/extend-classpath&gt;
&lt;/grails&gt;
</pre>
<p>
This example shows that we can add in system properties to specify to things like the <i>server.port</i> value for the <i>run-app</i> command.  In this example it is hardcoded, however in most non-trivial Ant build processes, this would be specified via properties file or some other mechanism to provide values that are specific to the build environment in question (e.g., development, test, integration, production).
</p>
<p>
What&#8217;s more interesting in this example is that we&#8217;ve added additional elements to the classpath which then get passed along to the Ant java task.  This provides tremendous flexibility to include items in the classpath that do not appear in the standard Grails locations like these:
</p>
<ul>
<li>GRAILS_HOME\dist</li>
<li>GRAILS_HOME\lib</li>
<li>PROJECT_HOME\lib</li>
</ul>
<p>
This flexibility allows for other build artifacts in an Ant build process to be dynamically included into the Grails runtime from other locations in the build process.
</p>
<p>
It should be said that I&#8217;ve had to make some modifications to the macro in order to tailor it to my needs as well as to get it working properly across environments. You can see the changes I&#8217;ve made <a href="http://files.cantinaconsulting.com/grails-macros.xml">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2008/09/01/fitting-grails-into-an-ant-build-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One step closer to Grails 1.0</title>
		<link>http://www.cantinaconsulting.com/2007/12/04/one-step-closer-to-grails-10/</link>
		<comments>http://www.cantinaconsulting.com/2007/12/04/one-step-closer-to-grails-10/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 15:18:22 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/2007/12/04/one-step-closer-to-grails-10/</guid>
		<description><![CDATA[Graeme and the Grails community have been hard at work lately getting Grails ready for a 1.0 release, and the latest release candidate, RC2 is quite indicative of their labors.&#160; There are some impressive additions to this release, including a initial pass at a full set of reference documentation, Spring 2.5, and over 140 bug [...]]]></description>
			<content:encoded><![CDATA[<p>Graeme and the Grails community have been hard at work lately getting Grails ready for a 1.0 release, and the latest release candidate, RC2 is quite indicative of their labors.&nbsp; There are some impressive additions to this release, including a initial pass at a full set of <a href="http://grails.org/doc/1.0.x/">reference documentation</a>, Spring 2.5, and over 140 <a href="http://jira.codehaus.org/browse/GRAILS?report=com.atlassian.jira.plugin.system.project:changelog-panel">bug fixes and improvements</a>.&nbsp; This is truly a herculean effort, and I can&#8217;t wait to start testing our plugins in RC2.&nbsp;</p>
<p>You can check get the latest and greatest, as always, at <a href="http://grails.org">grails.org.</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/12/04/one-step-closer-to-grails-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Red5 Plugin for Grails</title>
		<link>http://www.cantinaconsulting.com/2007/11/20/red5-plugin-for-grails/</link>
		<comments>http://www.cantinaconsulting.com/2007/11/20/red5-plugin-for-grails/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 20:59:58 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/2007/11/20/red5-plugin-for-grails/</guid>
		<description><![CDATA[Continuing with my Grails plugin love fest,  I spent several 3-4 AM nights digging into how to integrate Red5 RTMP streaming into my Grails Video plugin.  The two options I came up with were:

Leave the Red5 functionality as a separate WAR and use a shared directory which the video plugin would deposit the [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing with my Grails plugin love fest,  I spent several 3-4 AM nights digging into how to integrate Red5 RTMP streaming into my Grails Video plugin.  The two options I came up with were:</p>
<ol>
<li>Leave the Red5 functionality as a separate WAR and use a shared directory which the video plugin would deposit the encoded movies</li>
<li>Copy the war artifacts into the Grails plugin so the Grails app embeds the Red5 functionality within the WAR</li>
</ol>
<p>I opted for the latter because I would like to have the Red5 application code use GORM to read meta data about the Movie asset. Additionally, to have a tight integration with Spring Security I would like to have the artifacts share the same application context.  Finally, it is easier to debug code (btw, IntelliJ IDE rocks) if you don&#8217;t have to manage the startup of two different WARs. I&#8217;d like to say developing this plugin was easy, but in all honesty, it was a totally pain in the bum, and at the time, it seemed overly complex.  In hindsight though, I realize that the reason for the &ldquo;pain in the bum&rdquo; was my lack of understanding of the life cycle of the context loader in Spring.</p>
<p>Once that hurdle was jumped, due to the tight Java/J2EE integration, the rest of the plugin development, installation scripts, custom artifact, etc. was ridiculously easy. The work was mostly setting up Spring configuration for the plugin.  Because of how elegant the plugin architecture is, I think stitching together tiny pieces of functionality that is packaged in plugins is the best way to grow functionality base of Grails.</p>
<p>With this in mind I decided to release the Red5 integration work as a separate plugin and have the Video plugin depend on that for the RTMP streaming.  So if one person doesn&#8217;t want to use all the Video plugin functionality they can at least use the Red5 Integration functionality.  If you&#8217;d like to check it out  please find it in the grails plugins section of our site.  One thing to note is the Red5 plugin comes packaged with the source code for Red5.</p>
<p>I am going to send an email to the Red5 team and see if they will keep me abreast of new functionality as it comes down the road so I can maintain the plugin. I&#8217;ll keep folks posted on what they say.  Finally, I&#8217;d like to thank, the Red5 team for the their 0.6.3 WAR release of the Red5 server and Alexander zhukov who created Red5-minimal. The fact that Alexander was able to accomplish what he did let me know it was &ldquo;in theory&rdquo; possible to incorporate the functionality in a plugin and gave me inspiration during the dark times.  If you become the next youtube with this Grails plugin, throw a brother a couple bucks&#8230;. do the right thing <img src='http://www.cantinaconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/11/20/red5-plugin-for-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sweet Potato Pie!: A Video Plugin for Groovy on Grails</title>
		<link>http://www.cantinaconsulting.com/2007/11/10/sweet-potato-pie-a-video-plugin-for-groovy-on-grails/</link>
		<comments>http://www.cantinaconsulting.com/2007/11/10/sweet-potato-pie-a-video-plugin-for-groovy-on-grails/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 20:49:55 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/2007/11/10/sweet-potato-pie-a-video-plugin-for-groovy-on-grails/</guid>
		<description><![CDATA[Hi All,  adding to the new found obsession we have for Groovy on Grails, we ripped out a Video Plugin to convert and display flash videos. Hopefully it will give folks something fun to play with on the weekend  
You can find information about the plugin on our Grails Video Plugin Page.
And as [...]]]></description>
			<content:encoded><![CDATA[<p>Hi All,  adding to the new found obsession we have for Groovy on Grails, we ripped out a Video Plugin to convert and display flash videos. Hopefully it will give folks something fun to play with on the weekend <img src='http://www.cantinaconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can find information about the plugin on our <a href="http://www.cantinaconsulting.com/grails-plugins/video-plugin/"><font color="#bb6f02">Grails Video Plugin Page</font></a>.</p>
<p>And as with the Amazon S3 Plugin, this is a very preliminary version, and we&rsquo;re hoping to get some good feedback from the <a target="_blank" href="http://grails.codehaus.org/Mailing+lists"><font color="#bb6f02">Grails Community</font></a> and you on what we can do better.  However, there may be some bugs that we haven&rsquo;t quite gotten to yet.</p>
<p>Feel free to leave comments regarding the plugin on this posting.  We know we have a lot more testing to do and features to add, so any feedback is most welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/11/10/sweet-potato-pie-a-video-plugin-for-groovy-on-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hot Off The Press: An Amazon S3 Plugin for Groovy on Grails</title>
		<link>http://www.cantinaconsulting.com/2007/11/06/hot-off-the-press-an-amazon-s3-plugin-for-groovy-on-grails/</link>
		<comments>http://www.cantinaconsulting.com/2007/11/06/hot-off-the-press-an-amazon-s3-plugin-for-groovy-on-grails/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 18:22:44 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/2007/11/06/hot-off-the-press-an-amazon-s3-plugin-for-groovy-on-grails/</guid>
		<description><![CDATA[We&#8217;ve released our first ever plugin for the Groovy on Grails web application framework!&#160; You can see the details over on our new Grails Plugins page.&#160;
In short, we wanted to build something that would manage static file assets such as images, movies, audio, Flash, and perhaps down the road, site backups, on the Amazon Simple [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve released our first ever plugin for the Groovy on Grails web application framework!&nbsp; You can see the details over on our new <a href="http://www.cantinaconsulting.com/grails-plugins/">Grails Plugins</a> page.&nbsp;</p>
<p>In short, we wanted to build something that would manage static file assets such as images, movies, audio, Flash, and perhaps down the road, site backups, on the Amazon Simple Storage Service (S3).&nbsp;</p>
<p>This is a very preliminary version of the plugin, and we&#8217;re hoping to get some good feedback from the <a href="http://grails.codehaus.org/Mailing+lists" target="_blank">Grails Community</a> and you on what we can do better.&nbsp; However, there may be some bugs that we haven&#8217;t quite gotten to yet.&nbsp;</p>
<p>Feel free to leave comments regarding the plugin on this posting.&nbsp; We know we have a lot more testing to do and features to add, so any feedback is most welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/11/06/hot-off-the-press-an-amazon-s3-plugin-for-groovy-on-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Healthy is Grails?</title>
		<link>http://www.cantinaconsulting.com/2007/10/29/how-healthy-is-grails/</link>
		<comments>http://www.cantinaconsulting.com/2007/10/29/how-healthy-is-grails/#comments</comments>
		<pubDate>Mon, 29 Oct 2007 16:22:35 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=15</guid>
		<description><![CDATA[One question we get a lot at Cantina is that of whether Grails is a passing fad, or if it is something that has some staying power. We have gotten that question (in some form or another) quite a bit, so it might help to explain where we&#8217;re coming from.
I agree with Adam&#8217;s thoughts in [...]]]></description>
			<content:encoded><![CDATA[<p>One question we get a lot at Cantina is that of whether Grails is a passing fad, or if it is something that has some staying power. We have gotten that question (in some form or another) quite a bit, so it might help to explain where we&#8217;re coming from.</p>
<p>I agree with Adam&#8217;s thoughts in his previous post and have been very impressed with the activity in the Grails community. I subscribed to the user mailing list. Each day I receive from this list anywhere from 40-60 emails from users running into various issues on projects and folks from the Grails community providing their suggestions or troubleshooting tips.   The activity of user/developer mailing lists is one of the most important benchmarks in determining the health of an open source framework &#8211; along with supplied functionality (obvious), core technology, the architects driving the vision, commercial support, documentation, check-in velocity and discussion in the blogosphere. To give an indication of the acceleration of activity in the Grails community, in October 2006 the same mailing list was averaging around 5-6 emails &#8211; almost a 10 fold increase in one year.***</p>
<p>Also, last week on the Grails user mailing list, there was some spirited debate on the level of Grails documentation (or lack of it) and whether it was appropriate for the release level of the framework.  The amount of documentation right now doesn&#8217;t really concern me. What struck me the most about the dialog was the intensity of the debate. It shows the community is excited about what has been developed, are passionate to help out in whatever way they can, and care deeply about the frameworks success.  And the community&#8217;s passion/enthusiasm for Groovy/Grails is clearly indicative of the framework&#8217;s ability to meet a need and fill a gap, something the community is looking for.  IMHO this enthusiasm will be the driving force of success and perpetuate Grail&#8217;s momentum.  And while more formal documentation is sure to come down the road, I&#8217;ve found the answer to most of the issues i&#8217;ve run into by querying the mailing list. It has been an excellent source of living documentation.  &#8211; <a href="http://www.nabble.com/codehaus---grails-f11860.html">http://www.nabble.com/codehaus&#8212;grails-f11860.html</a></p>
<p>Of course with every new open source project there is always a lot of user/developer mailing list activity in the beginning. The question always becomes: Does this activity last, does it have staying power?  With over a year and half of Grails development under their belt, a pending 1.0 release, and the clear need for a rapid application development framework in the J2EE architecture landscape, I have the feeling Grails is here to stay.  Now I&#8217;m just trying to find the best way to support the growth&#8230; <img src='http://www.cantinaconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>That being said, one of our goals here at Cantina will be to leave some tips/issues that we run into as we develop plugins for the framework.  Although it will not be formal documentation &#8211; we get our kicks from developing functionality &#8211;  there may be some issue/tips that we run into that can be helpful to you. And please feel free to weigh in by leaving a comment if you know a better approach.</p>
<p>*** fyi, this calculation was performed with a VERY informal last year inspection of the mailing list on Nabble</p>
<p>UPDATE &#8211; 10/31/2007</p>
<p>I guess I should be been paying attention to the email threads a little better&#8230; <img src='http://www.cantinaconsulting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Two email threads -</p>
<p><a href="http://www.nabble.com/number-of-people-companies-using-Grails-tf4721318.html">http://www.nabble.com/number-of-people-companies-using-Grails-tf4721318.html</a></p>
<p>and</p>
<p><a href="http://www.nabble.com/Mailing-lists-statistics-tf4693805.html#a13416495">http://www.nabble.com/Mailing-lists-statistics-tf4693805.html#a13416495</a></p>
<p>also discuss the growing activity of the mailing list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/10/29/how-healthy-is-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I like about Groovy on Grails</title>
		<link>http://www.cantinaconsulting.com/2007/10/26/what-i-like-about-groovy-on-grails/</link>
		<comments>http://www.cantinaconsulting.com/2007/10/26/what-i-like-about-groovy-on-grails/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 16:35:51 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Groovy on Grails]]></category>

		<guid isPermaLink="false">http://www.cantinaconsulting.com/?p=14</guid>
		<description><![CDATA[First let me congratulate all the folks that have been going crazy getting the Groovy on Grails (grails.org) framework to version 1.0 (almost there!).  Just when I think my 0.5.6 version is going to be around for a while, they start releasing more versions, with a fury.
We&#8217;ve used Java here at Cantina on innumerable [...]]]></description>
			<content:encoded><![CDATA[<p>First let me congratulate all the folks that have been going crazy getting the Groovy on Grails (<a href="http://grails.org" target="_blank">grails.org</a>) framework to version 1.0 (almost there!).  Just when I think my 0.5.6 version is going to be around for a while, they start releasing more versions, with a fury.</p>
<p>We&#8217;ve used Java here at Cantina on innumerable projects with a great deal of success.  The toolset is very complete and Spring and Hibernate have been a godsend for allowing us to focus on the intellectual &quot;meat&quot; of a project.  Then, in an effort to explore some new technology for a couple prototypes we were working on we found Grails.</p>
<p>I think the first thing that drew us (me) to Grails was the mantra that I heard over and over again at a talk given by Venkat Subramaniam at Sun a while ago regarding Groovy on Grails have more &quot;signal to noise&quot;.  Less syntactical noise, more  code signal (i.e., the &quot;meat&quot;).  In his talk he threw together an AJAX enabled form in about 10-15 minutes with all the CRUD and validation you need.</p>
<p>Once we started using Grails in house, it quickly became apparent how deep the mantra of having a greater &quot;signal to noise&quot; went.  We love Spring and Hibernate but we hate XML configuration.  Yes, XML is ubiquitous, very readable, and supported everywhere, but, as technologies like Spring and Hibernate put more of our application structure into XML, it makes it very hard to <em>debug</em> all of our application when some of the structure sits in very static XML.</p>
<p>Grails provides a great approach to this.  Through the Grails BeanBuilder, you specify all of that lovely Spring configuration within a very readable and debuggable Groovy syntax.  This makes for a much more powerful way to configure the structure of your application as well as allows you to actually step through parts of your configuration with a debugger.</p>
<p>Of course, Grails does a whole lot more than that (including a lot of the auto-wiring in Spring so that you  don&#8217;t have to do <em>any</em> configuration), and here are just some of the things that caught our eye:</p>
<ul>
<li>GORM (Grails Object Relational Mapper): as if Hibernate wasn&#8217;t powerful enough, Grails adds some useful methods of querying and mapping your object model that go above and beyond Hibernate.  With dynamic methods, you can query against properties of your object model classes (domain classes) via methods that you never have to write, like this:<br />
    <span class="Code"><br />
    // Assuming you have a domain class called &quot;Person&quot; <br />
    // with a name property and a type property that </span><span class="Code"><br />
    // can be &quot;employee&quot; or &quot;customer&quot;&nbsp;&nbsp; </p>
<p>    def allPeople = Person.findAll()&nbsp; <br />
    def onlyEmployees = Person.findByType(&quot;employee&quot;)&nbsp; <br />
    def howManyEmployees = Person.countByType(&quot;employee&quot;)</span></p>
<p>    I didn&#8217;t have to write any of these find* or count* methods, they come free of charge with GORM which makes the simple queries a lot easier to manage.</li>
<li>Auto-reloading: one thing that has always plagued us as Java developers is the development cycle of fix -&gt; deploy -&gt; start -&gt; test.  There are certainly ways to reduce this cycle in Java, but sometimes the project just doesn&#8217;t allow for it.  Grails is built with the mindset that changes to most code assets should be reflected instantly in the running application, thus reducing the time it takes to test code changes</li>
<li>TagLibs: Creating GSP (analogous to JSP) tag libraries requires much less code and no configuration to get your tags and and running</li>
<li>Intellij IDEA Integration: I love <a href="http://www.macromates.com">TextMate</a> as much as the next guy, but code completion and debugging are things I&#8217;ve just gotten too used to (call me lazy).  The Groovy/Grails plugin for Intellij IDEA has come a long way towards making Grails a first class IDE citizen.</li>
<li>Legacy Integration:  A lot of the projects we work on involves an existing Java application and SQL database.  There is often business logic already implemented in Java classes (Spring or otherwise) that really don&#8217;t need to be rewritten.  Since, at the end of the day, Grails is Java, we can make use of the existing codebase in a way that is much more seamless than if we were to introduce another web technology.  Also, the fact that it&#8217;s all Hibernate under the hood makes it easier to adapt a set of domain classes to an existing database schema.  This makes Grails an easier sell on those technical re-architecture projects in the Java world.</li>
</ul>
<p>Beyond the technology, there&#8217;s just a lot of momentum in the Grails community.  Within the last year that I&#8217;ve been watching, Grails has gone from a 0.4 to just about 1.0 (I&#8217;ve been using PHP frameworks that haven&#8217;t bumped the minor version number in over 2 years).  There&#8217;s a healthy and growing list of plugins (<a href="http://grails.org/Plugins">grails.org/Plugins</a>) that seem to be addressing the core needs of new application development.&nbsp; We&#8217;re really looking forward to the next Grails project and experiencing a lot more signal and a lot less noise.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cantinaconsulting.com/2007/10/26/what-i-like-about-groovy-on-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
