<?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>Random Musings&#187; groovy</title> <atom:link href="http://www.nslms.com/tag/groovy/feed/" rel="self" type="application/rss+xml" /><link>http://www.nslms.com</link> <description></description> <lastBuildDate>Wed, 06 Jul 2011 20:47:34 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>Hidden Danger of Grails Plugins</title><link>http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/#comments</comments> <pubDate>Thu, 19 Aug 2010 17:43:40 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Grails/Groovy]]></category> <category><![CDATA[artifacts]]></category> <category><![CDATA[code coverage]]></category> <category><![CDATA[downside]]></category> <category><![CDATA[grails]]></category> <category><![CDATA[groovy]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[plugins]]></category> <category><![CDATA[technical debt]]></category> <category><![CDATA[test driven development]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=622</guid> <description><![CDATA[As a new developer to Grails you&#8217;re probably in awe over the vast number of very powerful plugins which are available to you. Without writing a single line of your own code you can do all sorts of cool things like interact with Twitter, Facebook, Amazon&#8217;s S3 storage system, Apple Push notifications, Spring Security, and [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F08%2F19%2Fhidden-danger-of-grails-plugins%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F08%2F19%2Fhidden-danger-of-grails-plugins%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>As a new developer to Grails you&#8217;re probably in awe over the vast number of very powerful plugins which are available to you.  Without writing a single line of your own code you can do all sorts of cool things like interact with Twitter, Facebook, Amazon&#8217;s S3 storage system, Apple Push notifications, Spring Security, and the list goes on and on.  As of this writing there are 447 plugins available in the official Grails plugin repository.</p><p>It is understandably tempting to leverage all of this code to simply bolt together an integrated solution which solves the problem you&#8217;re facing.  But there is a downside to consuming someone else&#8217;s code, particularly when you&#8217;re doing test driven development.  Here are some things to consider before you pull the trigger and <i>grails install-plugin</i>.<br
/> <span
id="more-622"></span></p><h3>Using a cannon to kill a mosquito</h3><p>When you adopt someone else&#8217;s code by installing their plugin, you don&#8217;t always know about all of it&#8217;s capabilities.  You very likely did a quick google search, or a keyword search in the grails plugins and found something which appeared to solve the particular problem you were facing.  It is very likely though that the plugin you just installed can do what you need, and much MUCH more.</p><p>Worse still, it may end up bloating your code with a bunch of functionality that you don&#8217;t need, while still not fully solving your problem!</p><h3>I see a black box and I want to paint it white</h3><p>If you&#8217;re working on a sizable project and collaborating with a team, you&#8217;re probably doing TDD, and you probably have a code coverage requirement for your tests.  When you install a plugin a lot of the appeal is that it will create a TON of functionality and Grails artifacts for you (controllers, domain classes, services, taglibs etc).  If you do have a code coverage requirement, that means that you have to address those new artifacts with tests.</p><p>This is a double edged sword.  On the bright side, you are forced to really understand what the plugin is doing with the artifacts it provides, and you might discover that you need to rewrite them or refactor them for your application.  The negative of course is that you have to expend the mental energy to understand what the author is doing, and how they&#8217;re doing it.  Very quickly the functionality that you got &#8220;for free&#8221; isn&#8217;t looking so appealing, and you might end up spending as much (or more) time understanding the plugins implementation as you would have to build your own functionality and tests.</p><h3>The bad that comes with the good</h3><p>You might have noticed that all but the most mainstream plugins for Grails are not always documented particularly well.  This can be a serious barrier to including a plugin in your project as well.  If you can&#8217;t figure out how to make it work, or get a clear understanding of the inner workings, you may spend more time fiddling with it than leveraging it.</p><p>Another consequence of adopting the plugins code is that you inherit the plugins <a
href="http://martinfowler.com/bliki/TechnicalDebt.html">technical debt</a>.  The plugin author had a specific problem domain in mind when she wrote the code.  If your problem domain is slightly different the compromises built into the plugin may be ones which you&#8217;re not willing (or able) to accept.</p><h3>Looking to the future</h3><p>If you&#8217;ve considered all of these things, and decided that it&#8217;s worth the effort to write the tests and accept the technical debt of a plugin, there is one last thing to consider.  What happens in the future?  What if six months go by and your requirements change, requiring more functionality than your current plugin choice supplies?  You could try to find another plugin which covers the new requirement, or you may have to extend the functionality of your chosen plugin.  If the plugin you&#8217;ve chosen is poorly documented or poorly coded this could be difficult, or impossible, forcing you to pay the price by rewriting all of the functionality provided by the plugin.</p><p>Consider too what happens if the plugin author stops maintaining the codebase.  When new versions of grails are released, the functionality of the plugin could break and you&#8217;re once again forced to maintain code you didn&#8217;t write.</p><h3>Sometimes it&#8217;s worth the risk</h3><p>Of course, I would hardly discourage you from using the plugins that are available, they can be hugely beneficial and save you immense amounts of time.  The warning is just to consider the cost of &#8220;buying&#8221; another developers code and folding it into your solution.</p><p>Once you&#8217;ve considered all of these things and still decide that a plugin is right for your project you&#8217;ll be much better prepared for the effort that comes with using it, and you might just appreciate the functionality that the plugin provides a teeny bit more.</p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden%20Danger%20of%20Grails%20Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Danger+of+Grails+Plugins&amp;link=http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/&amp;notes=As%20a%20new%20developer%20to%20Grails%20you%27re%20probably%20in%20awe%20over%20the%20vast%20number%20of%20very%20powerful%20plugins%20which%20are%20available%20to%20you.%20%20Without%20writing%20a%20single%20line%20of%20your%20own%20code%20you%20can%20do%20all%20sorts%20of%20cool%20things%20like%20interact%20with%20Twitter%2C%20Facebook%2C%20Amazon%27s%20S3%20storage%20system%2C%20Apple%20Push%20notifications&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/08/19/hidden-danger-of-grails-plugins/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Grails Domain Mocking Limitations</title><link>http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/#comments</comments> <pubDate>Tue, 27 Jul 2010 22:29:29 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Grails/Groovy]]></category> <category><![CDATA[grails]]></category> <category><![CDATA[groovy]]></category> <category><![CDATA[limitation]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[mock]]></category> <category><![CDATA[withCriteria]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=589</guid> <description><![CDATA[So, I just threw out most of this morning trying to figure out why something which clearly should work was blowing up my unit test on a grails app. To spare you the same pain I&#8217;m documenting it here. The scenario is that I have Roles and Privileges as domain classes. A role has many [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F07%2F27%2Fgrails-domain-mocking-limitations%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F07%2F27%2Fgrails-domain-mocking-limitations%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>So, I just threw out most of this morning trying to figure out why something which clearly <em>should</em> work was blowing up my unit test on a grails app.  To spare you the same pain I&#8217;m documenting it here.</p><p>The scenario is that I have Roles and Privileges as domain classes.  A role has many privileges, and any privilege may belong to one or more roles.  This is represented in domain classes pretty succinctly as;</p><p
class="filename">/grails-app/domain/com/nslms/mockdomainlimtations/Role.groovy</p><pre>
package com.nslms.mockdomainlimitations
class Role {
  static hasMany = [privileges: Privilege]
  static constraints = {
  }
  String name
}
</pre><p
class="filename">/grails-app/domain/com/nslms/mockdomainlimtations/Privilege.groovy</p><pre>
package com.nslms.mockdomainlimitations
class Privilege {
  static constraints = {
  }
  String name
}
</pre><p>So I can access all the privileges which belong to a role pretty easily, but what if I want to know all roles which a particular privilege belongs to?  Easy enough, we can look that up in a variety of ways.  Below I show adding a new closure to the privilege domain class which uses the <a
href="http://grails.org/doc/latest/ref/Domain%20Classes/withCriteria.html">withCriteria</a> functionality of GORM to return all roles which have this privilege in the privileges map.  The new closure is in the highlighted lines.</p><p
class="filename">/grails-app/domain/com/nslms/mockdomainlimtations/Privilege.groovy (with new closure)</p><pre>
package com.nslms.mockdomainlimitations
class Privilege {
  static constraints = {
  }
  String name
  def getRolesWithThisPrivilege = {
    Role.withCriteria() {
      privileges {
        eq('id', this.id)
      }
    }
  }
}
</pre><p>Now, if you&#8217;re doing proper test driven development (you are doing TDD, right?!), you&#8217;d probably already have a test written for this new closure that would look something like the highlighted lines of the test fixture below.  Notice lines 8 and 9 which are also highlighted to show that we&#8217;re asking the framework to mock out the GORM methods on the role and privilege classes.</p><p
class="filename">/test/unit/com/nslms/mockdomainlimitaions/PrivilegeTests.groovy</p><pre>
package com.nslms.mockdomainlimitations
import grails.test.*
class PrivilegeTests extends GrailsUnitTestCase {
  protected void setUp() {
    super.setUp()
    MockUtils.mockDomain(Role.class)
    MockUtils.mockDomain(Privilege.class)
  }
  protected void tearDown() {
    super.tearDown()
  }
  void testAbilityToGetAListOfRolesAPrivilegeBelongsTo() {
    def role1 = new Role(name: 'Administrator')
    def role2 = new Role(name: 'User')
    def priv1 = new Privilege(name: 'ReadAll').save(flush: true)
    role1.addToPrivileges(priv1)
    role2.addToPrivileges(priv1)
    role1.save(flush: true)
    role2.save(flush: true)
    def roleList = priv1.getRolesWithThisPrivilege()
    assert roleList.size() == 2
    assert roleList == [role1, role2]
  }
}
</pre><p>Even after you&#8217;ve implemented <b>getRolesWithThisPrivilege</b> on the Privileges domain class though, you&#8217;ll find your test still fails with an error that looks like the following.</p><p
style="font-size: larger; font-style: italic; color: red;">No signature of method: com.nslms.mockdomainlimitations.Role.withCriteria() is applicable for argument types: (com.nslms.mockdomainlimitations.Privilege$_closure1_closure3) values: [com.nslms.mockdomainlimitations.Privilege$_closure1_closure3@8327473]</p><p>In short, it&#8217;s telling us that the <a
href="http://grails.org/doc/latest/ref/Domain%20Classes/withCriteria.html">withCriteria</a> method of GORM isn&#8217;t implemented in the context of our test.  Of course if you put the exact same code in an integration test you&#8217;re golden.</p><p
class="filename">/test/integration/com/nslms/mockdomainlimitations/PrivilegeTest.groovy</p><pre>
package com.nslms.mockdomainlimitations
class PrivilegeTest extends GroovyTestCase {
  void testAbilityToGetAListOfRolesAPrivilegeBelongsTo() {
    def role1 = new Role(name: 'Administrator')
    def role2 = new Role(name: 'User')
    def priv1 = new Privilege(name: 'ReadAll').save(flush: true)
    role1.addToPrivileges(priv1)
    role2.addToPrivileges(priv1)
    role1.save(flush: true)
    role2.save(flush: true)
    def roleList = priv1.getRolesWithThisPrivilege()
    assert roleList.size() == 2
    assert roleList == [role1, role2]
  }
}
</pre><p>With this in place, you can run a &#8220;grails test-app -integration&#8221; and the exact same test which failed during unit testing will succeed.  This is of course because the entire grails bootstrapping occurs, and all of the artifacts (like domain classes) are wired up fully by the framework.</p><p>So the moral of the story?  If you&#8217;re planning to test anything more than simple saves with GORM in your testing phase, consider putting the more complex stuff into an integration test.  Either that, or keep your eyes peeled for problems like this and be prepared to refactor.</p><p>Feel free to grab a copy of the test grails app I created for this example.</p><p><del
datetime="2010-12-26T23:15:20+00:00">svn export https://linode.nslms.com/svn_ro/MockDomainLimitations</del></p><p><em><strong><span
style="color: #ff0000;">* UPDATE: This example app has a new home..</span></strong></em></p><p>Grab the project</p><pre>
git clone git://ec2.nslms.com/grails/blog_example_mock_limitations
</pre><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Grails%20Domain%20Mocking%20Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Grails+Domain+Mocking+Limitations&amp;link=http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/&amp;notes=So%2C%20I%20just%20threw%20out%20most%20of%20this%20morning%20trying%20to%20figure%20out%20why%20something%20which%20clearly%20should%20work%20was%20blowing%20up%20my%20unit%20test%20on%20a%20grails%20app.%20%20To%20spare%20you%20the%20same%20pain%20I%27m%20documenting%20it%20here.%0D%0A%0D%0AThe%20scenario%20is%20that%20I%20have%20Roles%20and%20Privileges%20as%20domain%20classes.%20%20A%20role%20has%20many%20privileges%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/07/27/grails-domain-mocking-limitations/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Modularizing your Grails Application &#8211; Domain Classes</title><link>http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/#comments</comments> <pubDate>Thu, 11 Mar 2010 01:39:07 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Grails/Groovy]]></category> <category><![CDATA[Reviews]]></category> <category><![CDATA[grails]]></category> <category><![CDATA[groovy]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[modular]]></category> <category><![CDATA[mvc]]></category> <category><![CDATA[reusable]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=417</guid> <description><![CDATA[This is the second installment of my What Grooves You? series of posts, this time discussing how to modularize your Grails application. While Grails does an awesome job of enforcing MVC once your application reaches a certain size, or you have multiple applications which may have shared components, you&#8217;re going to have to start thinking [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F03%2F10%2Fmodularizing-your-grails-application-domain-classes%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F03%2F10%2Fmodularizing-your-grails-application-domain-classes%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>This is the second installment of my <a
href="http://www.nslms.com/2010/02/05/what-grooves-you/">What Grooves You?</a> series of posts, this time discussing how to modularize your Grails application.  While Grails does an awesome job of enforcing <a
href="http://www.grails.org/Developer+-+Spring+MVC+Integration">MVC</a> once your application reaches a certain size, or you have multiple applications which may have shared components, you&#8217;re going to have to start thinking about how your going to modularize the reusable parts of your code.</p><p><span
id="more-417"></span></p><p>I encountered this pretty quickly because the application I am working on is broken out into two distinct parts, a public facing web form for submitting data (the &#8220;Front End&#8221;) and a private back office application for managing those user submissions (the &#8220;Back End&#8221;).  These two parts of the application (for compliance reasons) cannot run on the same internet facing system, and the &#8220;Back End&#8221; must only be available on the internal network.  Of course, both of these applications are going to work with the same database and therefore the same Domain classes.  It would be dangerous and tedious to try to keep the separate domain classes in each project synchronized with one another.</p><h2>What won&#8217;t work</h2><p><b>The RESTful JSON Service</b></p><p>My first thought was to deploy a 3rd application which would be internet visible and act as a proxy for all the database requests.  I could then query that application with REST and handle a JSON payload which would be my domain object.  This actually seemed pretty elegant since I wouldn&#8217;t have to actually share any code between the Front End and Back End applications and I still got a well defined object on either end.  The problem of course is that all I get is the data for my domain class, and I don&#8217;t have access to any of the functionality that GORM gives me &#8220;for free&#8221;.  I&#8217;d have to duplicate search functionality, limits, grouping, sorting, and all sorts of other querying tools in my service.  That seemed like an awful lot of work for functionality that is offered by GORM and works very well!</p><p><b>Just JAR it man</b></p><p>The next obvious conclusion is to just toss my domain classes into a library JAR file and reference that library in both of my other applications.  This way I actually have the whole domain class and access to the dynamic find methods and all that other good stuff.  But, how do you package these?  Do you compile the Groovy classes then package the .class files? Will the data source information have to be set for the domain class(es) in the JAR, or will the data source of the application referencing the library be used?</p><p>Now some more seasoned Java and Hibernate developers might simply laugh at that barrage of questions, but for me it presented a serious barrier to entry.  Fortunately there is a better way.</p><h2>Just plug it in!</h2><p>It didn&#8217;t take me long to discover that putting my reusable code into a <a
href="http://grails.org/doc/latest/guide/12.%20Plug-ins.html" target="_blank">Grails Plugin</a> was the best and most scalable approach. For the sake of demonstration I&#8217;m going to take you through an example comment submission and administration application, kinda like blog comments.</p><p><b>The plugin project</b></p><p>First, let&#8217;s go ahead and create our plugin project.</p><pre>grails create-plugin Modular-DAL</pre><p>Once you&#8217;ve got your shiny new plugin created, open it up with your favorite IDE (I use <a
href="http://www.springsource.com/products/sts">Spring Source Tool Suite</a>) and add a new domain class that you&#8217;re going to be sharing.</p><pre>grails create-domain-class com.nslms.modular.domain.Comment</pre><p>Now we specify some properties for our new shared domain class.</p><p
class="filename">Comment.groovy</p><pre>
package com.nslms.modular.domain
class Comment {
	static constraints = {
		name(blank:false)
		email(blank:false)
		comment(blank:false)
	}
	String name
	String email
	String website
	String comment
	Boolean isApproved = false
}
</pre><p>With our new shared domain class created, we want to package up our plugin so we can load it into the other projects which we&#8217;ll be creating in a moment.</p><pre>grails package-plugin</pre><p>That&#8217;s it, you&#8217;ve just created a (very small) module of your application which contains a shared domain class.  This could, of course, contain any number of domain classes, controllers, or services, views, javascript, css, etc. that would be used by other parts of your application, or by other applications.</p><p><b>The Front End</b></p><p>Now, lets create an application which will serve as the &#8220;front end&#8221; or externally facing form for collecting data.</p><pre>grails create-app Modular-FrontEnd</pre><p>Then the very important part of installing the plugin we just created</p><pre>grails install-plugin ../Modular-DAL/grails-modular-dal-0.1.zip</pre><p>Because you can <a
href="#download-instructions">download</a> the project I created, I&#8217;m not going to go into excruciating detail about the controller and view(s) I setup in my front end, but sufficed to say I am accessing the &#8220;Comment&#8221; domain class that is supplied by the Modular-DAL plugin project!</p><p
class="filename">CommentsController.groovy (snippet)</p><pre>
import com.nslms.modular.domain.*
class CommentsController {
    def index = { [comments: Comment.findAllByisApproved(true)] }
}
</pre><p>The result of the front end app should be a list of comments which are approved (by the backend) and a submission form to allow you to submit new comments.  Kinda like <a
href="http://www.nslms.com/grails/examples/modular/frontend/comments" target="_blank">this</a>.</p><p><b>The Back End</b></p><p>Now we need to create the system which will allow you as the administrator to approve the comments submitted by the unwashed masses.</p><pre>grails create-app Modular-BackEnd</pre><p>And install the plugin with the shared domain class.</p><pre>grails install-plugin ../Modular-DAL/grails-modular-dal-0.1.zip</pre><p>Again because you can <a
href="#download-instructions">download</a> the project I created, here&#8217;s just a snippet of the admin controller showing the juicy bits where we use the shared domain class</p><p
class="filename">AdminController.groovy (snippet)</p><pre>
import com.nslms.modular.domain.*;
class AdminController {
    def comments = { [comments: Comment.findAllByisApproved(false)] }
}
</pre><p>The back end app should have a list of all unapproved comments, and a method to approve them.  Kinda like <a
href="http://www.nslms.com/grails/examples/modular/backend/admin/comments" target="_blank">this</a>.</p><p><b>Trying it out</b></p><p>Now if you&#8217;ve followed along and created your own controllers and views, or <a
href="#download-instructions">downloaded</a> my basic project, you&#8217;re going to want to try running both the front end and back end at the same time, persisting data to a common datasource so that you can see the whole thing in action.  If you just use the grails run-app command, you&#8217;ll find very quickly that you can only run one or the other project, but not both at the same time.  This is because they&#8217;ll both be trying to run on the common Tomcat port (8080).  To overcome this, and run both apps at the same time, try the following starting from the Modular-FrontEnd directory.</p><pre>
grails -Dserver.port=8081 run-app
cd ../Modular-BackEnd
grails -Dserver.port=8082 run-app
</pre><p>Now you should be able to access both applications at <a
href="http://localhost:8081/FrontEnd">http://localhost:8081/FrontEnd</a> and <a
href="http://localhost:8082/BackEnd">http://localhost:8082/BackEnd</a> respectively.</p><p><b
id="download-instructions">Download The Project(s)</b></p><p>If you want to download the project(s) and follow along, fire up your favorite subversion client and export everything at <del
datetime="2010-12-26T22:17:49+00:00"><a
href="svn://linode.nslms.com/blog/grails/Modular">svn://linode.nslms.com/blog/grails/Modular</a></del> or download it <a
href="http://www.nslms.com/downloads/Modular.zip">here</a>.  A couple things to note if you&#8217;re grabbing my project, it&#8217;s currently setup to use a MySQL database named &#8220;modular&#8221; running on the same system as the application.  If you don&#8217;t already have MySQL setup, give <a
href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> a look to get you started quickly.  Also, I didn&#8217;t include the JDBC driver, go fetch it <a
href="http://www.mysql.com/downloads/connector/j/">here</a> and drop it into the &#8220;lib&#8221; directory of both the FrontEnd and BackEnd applications.  Lastly, these projects are all written with Grails 1.2.1 so you&#8217;ll have to be using 1.2.1 or newer.</p><p><em><strong><span
style="color: #ff0000;">* UPDATE: The example apps have a new home..</span></strong></em></p><p>Grab the projects at</p><pre>
git clone git://ec2.nslms.com/grails/blog_example_modular
</pre><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing%20your%20Grails%20Application%20-%20Domain%20Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Modularizing+your+Grails+Application+-+Domain+Classes&amp;link=http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/&amp;notes=This%20is%20the%20second%20installment%20of%20my%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20this%20time%20discussing%20how%20to%20modularize%20your%20Grails%20application.%20%20While%20Grails%20does%20an%20awesome%20job%20of%20enforcing%20MVC%20once%20your%20application%20reaches%20a%20certain%20size%2C%20or%20you%20have%20multiple%20applications%20which%20may%20have%20shared%20components%2C&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/03/10/modularizing-your-grails-application-domain-classes/feed/</wfw:commentRss> <slash:comments>30</slash:comments> </item> <item><title>Fitting Grails in an Active Directory and NTLM SSO Groove</title><link>http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/#comments</comments> <pubDate>Wed, 10 Feb 2010 22:52:11 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Grails/Groovy]]></category> <category><![CDATA[Reviews]]></category> <category><![CDATA[Acegi]]></category> <category><![CDATA[Active Directory]]></category> <category><![CDATA[Authentication]]></category> <category><![CDATA[grails]]></category> <category><![CDATA[groovy]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[NTLM]]></category> <category><![CDATA[Spring Security]]></category> <category><![CDATA[SSO]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=383</guid> <description><![CDATA[This is my first installment in the What Grooves You? series of posts, and it deals with the first thing you&#8217;re going to need to consider if you are deploying your Grails/Groovy applications in the average corporate IT infrastructure, Single Sign On with Active Directory and NTLM. Like it or not, because all of our [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F02%2F10%2Ffitting-grails-in-an-active-directory-and-ntml-sso-groove%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F02%2F10%2Ffitting-grails-in-an-active-directory-and-ntml-sso-groove%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>This is my first installment in the <a
href="http://www.nslms.com/2010/02/05/what-grooves-you/">What Grooves You?</a> series of posts, and it deals with the first thing you&#8217;re going to need to consider if you are deploying your Grails/Groovy applications in the average corporate IT infrastructure, Single Sign On with Active Directory and NTLM.  Like it or not, because all of our existing applications are based on Microsoft technologies our users have gotten used to just going to the URL for the application they intend to use and being instantly recognized and authenticated.  Forcing them to sign in again, or worse still forcing them to setup a new username and password for your system would be completely unacceptable!  Below, I&#8217;ll take you through the steps I took to solve this problem, including the detours that cost me time!</p><p><span
id="more-383"></span></p><p>Throughout this post I&#8217;ll be referring to domain objects, controllers, and views which would have been created by running the <a
href="http://www.grails.org/AcegiSecurity+Plugin+-+LDAP+Tutorial">Acegi LDAP tutorial</a>.  So if you want to follow along, go walk through the tutorial, then come back here to see how we tweak it.  Be sure to take the &#8220;optional&#8221; step of creating the views and controllers for the auth domains, you&#8217;ll need it not only in the tutorial, but also for some customization we&#8217;ll be doing later.</p><pre>grails generate-manager</pre><p>You can also download a copy of the Spring Source STS project I used for this application <a
href="http://www.nslms.com/downloads/GrailsInActiveDirectoryGroove.zip">here</a>.</p><h2>LDAP Single Identity but not Single Sign On</h2><p>As I started searching to figure out how to authenticate my users, everything seemed to point to using the <a
href="http://grails.org/plugin/acegi">Acegi Plugin</a> for Grails, and using it with LDAP, tweaked to talk to Active Directory.  So, I started down this path and followed the <a
href="http://www.grails.org/AcegiSecurity+Plugin+-+LDAP+Tutorial">LDAP tutorial</a> for the Acegi plugin.  Without a lot of trouble I got this working by following the steps in the tutorial, though I did make a couple significant changes to the SecurityConfig.groovy file to make it play nice with Active Directory</p><p
class="filename">SecurityConfig.groovy</p><pre>
security {
	// see DefaultSecurityConfig.groovy for all settable/overridable properties
	active = true
	useLdap = false
	ldapRetrieveDatabaseRoles = false
	ldapRetrieveGroupRoles = true
	ldapServer = 'ldap://&lt;your-domain-controller&gt;'
	ldapManagerDn = '&lt;your-service-account-dn&gt;'
	ldapManagerPassword = '&lt;your-service-account-password&gt;'
	ldapSearchBase = 'OU=People,DC=yourdomain,DC=com'
	ldapSearchFilter = '(sAMAccountName={0})'
	ldapSearchSubtree = true
	ldapGroupSearchBase = 'CN=Users,DC=yourdomain,DC=com'
	ldapGroupSearchFilter = 'member={0}'
	ldapUsePassword = false
	loginUserDomainClass = &quot;User&quot;
	authorityDomainClass = &quot;Role&quot;
	requestMapClass = &quot;Requestmap&quot;
}
</pre><p>By setting ldapSearchFilter to &#8216;(sAMAccountName={0})&#8217;, we&#8217;re telling the Acegi plugin to look for the field in Active Directory that stores the username, this means that users can login just like they&#8217;re used to by using their Active Directory user name and password.</p><p>The ldapGroupSearchBase and ldapGroupSearchFilter are set such that any domain user groups that a user is a member of become Acegi &#8220;Roles&#8221; which can be used to determine if a user has authority to do stuff in the application.</p><p>Setting ldapUsePassword to false is important too.  What we&#8217;re telling the Acegi plugin is not to extract the users password from Active Directory.  If you don&#8217;t set this to false, you&#8217;ll get a lovely exception which isn&#8217;t particularly useful, <b><i>java.lang.IllegalArgumentException: Cannot pass null or empty values to constructor</i><i></i></b>.  What this is trying to tell you is that the users password is null, which is correct since the default setting for the Acegi plugin is to try to extract the users password from Active Directory, and we haven&#8217;t told Acegi what attribute Active Directory stores the password in.  By setting ldapUsePassword to false, the plugin provides a bogus password for the user details, and we&#8217;re able to proceed without incident.</p><p>So, great!  If you&#8217;ve made these changes and followed the steps in the tutorial to add a user  to the application domain with the same username as your Active Directory user you can authenticate users with the username and password they&#8217;re already using to login to their computer, we have a single identity for this person.  But remember, our users are used to simply going to a URL and not being prompted to login.  How do we reproduce that experience?</p><h2>NTLM Really Single Sign On</h2><p>Having realized that using Active Directory/LDAP authentication works, but isn&#8217;t an actual single sign on solution I started looking into the other settings in the <a
href="http://www.grails.org/AcegiSecurity+Plugin+-+Customizing+with+SecurityConfig">SecurityConfig.groovy</a> file.  Turns out there is an NTLM option, but no corresponding tutorial!  Here&#8217;s my configuration for using NTLM.</p><p
class="filename">SecurityConfig.groovy</p><pre>
security {
	// see DefaultSecurityConfig.groovy for all settable/overridable properties
	active = true
	useNtlm = true
	ntlm.stripDomain = false
	ntlm.defaultDomain = &quot;yourdomain.com&quot;
	ntlm.netbiosWINS = &quot;&lt;your-domain-controller-ip&gt;&quot;
	loginUserDomainClass = &quot;User&quot;
	authorityDomainClass = &quot;Role&quot;
	requestMapClass = &quot;Requestmap&quot;
}
</pre><p>Nothing really outstanding here, I chose to set ntlm.stripDomain to false, so that the users name is not prefixed by the domain, I.E. DOMAIN\username.  Also ntlm.defaultDomain and ntlm.netbiosWINS are both required, and I found that the ntlm.netbiosWINS works better if you actually give it the IP address of your domain controller, rather than the DNS name.</p><p>With NTLM configured, our Grails app now accepts the users cached authentication from their windows session.  True single sign on!</p><h2>Securing the Security Controllers and BootStrapping</h2><p>Now we&#8217;ve got an application which will use NTLM to authenticate the user, we restrict access using the requestmap, and we add users and their roles using the user and role controllers.  The problem, of course is that if you deploy this application anyone can go right to http://yourdomain.com/sso-app/user and add themselves as a user with any roles they see fit!  So we need to make sure that our security controllers are secured, and that there is an authorized user that can get in to add users and roles.</p><p><b>Securing the Security Controllers</b></p><p>The first thing we&#8217;re going to want to do is secure our authentication controllers.  My preference is to do this with annotations on the controllers, so lets secure the UserController and RoleController with annotations.  Shown below we annotate them to show that the &#8220;ROLE_USER_ADMINISTRATOR&#8221; role is necessary to access any of the pages for either controller.</p><p
class="filename">UserController.groovy</p><pre>
import org.codehaus.groovy.grails.plugins.springsecurity.Secured;
@Secured([&quot;ROLE_USER_ADMINISTRATOR&quot;])
/**
 * User controller.
 */
class UserController {
	/* Snip */
}
</pre><p
class="filename">RoleController.groovy</p><pre>
import org.codehaus.groovy.grails.plugins.springsecurity.Secured;
@Secured([&quot;ROLE_USER_ADMINISTRATOR&quot;])
/**
 * Authority Controller.
 */
class RoleController {
	/* Snip */
}
</pre><p><b>Enabling the @Secured annotation</b></p><p>Now if you were simply to run the application like this, you&#8217;d find that you can still freely navigate to /user and /role without having to be authenticated, that&#8217;s because we are still configured to use the Requestmap to restrict access to specific parts of our application.  To configure this for use with annotations instead, we only need to make a couple of small changes to the SecurityConfig.groovy file.</p><p
class="filename">SecurityConfig.groovy</p><pre>
security {
	// see DefaultSecurityConfig.groovy for all settable/overridable properties
	active = true
	useNtlm = true
	ntlm.stripDomain = false
	ntlm.defaultDomain = &quot;yourdomain.com&quot;
	ntlm.netbiosWINS = &quot;&lt;your-domain-controller-ip&gt;&quot;
	loginUserDomainClass = &quot;User&quot;
	authorityDomainClass = &quot;Role&quot;
	//requestMapClass = &quot;Requestmap&quot;
	userRequestMapDomainClass = false
	useControllerAnnotations = true
}
</pre><p>Setting useControllerAnnotations to true gives the @Secured annotations on the user and role controllers meaning.  By setting userRequestMapDomainClass to false we tell the Acegi security plugin to not even query for restrictions in the database, but to use only the static configuration defined by the annotations.  We also delete the requestMapClass line.  I commented it here instead of deleting it so it can be highlighted as a change in the file, but we&#8217;re not quite done with the requestmap yet.  Now that we&#8217;ve configured our application not to use the request map we can delete the controller, domain, and views for it.  Go ahead and delete the following files.</p><ul><li>/grails-app/controller/RequestmapController.groovy</li><li>/grails-app/domain/Requestmap.groovy</li><li>/grails-app/views/requestmap/*</li></ul><p><b>BootStrapping</b></p><p>Now that we have our app secured, and we&#8217;re using annotations to restrict access we need to make sure that some user can successfully login after we first deploy our application.  Otherwise no one will be able to access the pages to add new users!  So we use boot strapping to add a user administrator who can add more users and roles for the application.</p><p
class="filename">BootStrap.groovy</p><pre>
class BootStrap {
	def authenticateService
	def init = { servletContext -&gt;
		def role = new Role(authority: 'ROLE_USER_ADMINISTRATOR', description:'User Administrator')
		role.save()
		def user = new User(username: 'admin',
				userRealName: 'Administrator',
				passwd: authenticateService.encodePassword('foobar'),
				enabled: true,
				description: '',
				email: '',
				emailShow: false)
		user.addToAuthorities(role)
		user.save()
     }
     def destroy = {
     }
}
</pre><p>So there you have it, an application which allows users to connect using their cached authentication using NTLM, uses annotations to secure your controllers, and actually allows access to at least one user once it&#8217;s deployed.  Now, there are still some weaknesses.  Particularly the level of permissions you can assign is limited to roles, I.E. &#8220;Administrator&#8221;, &#8220;User&#8221;, &#8220;Reporting User&#8221;, &#8220;User Administrator&#8221;, etc.  Also in a corporate environment, having to go through this configuration for every grails app, and adding users and assigning their roles for each app can be tedious.  I&#8217;ll be looking into improving these things with Acegi ACL&#8217;s and possibly using a centralized database for users and roles in future articles so stay tuned!</p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting%20Grails%20in%20an%20Active%20Directory%20and%20NTLM%20SSO%20Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Fitting+Grails+in+an+Active+Directory+and+NTLM+SSO+Groove&amp;link=http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/&amp;notes=This%20is%20my%20first%20installment%20in%20the%20What%20Grooves%20You%3F%20series%20of%20posts%2C%20and%20it%20deals%20with%20the%20first%20thing%20you%27re%20going%20to%20need%20to%20consider%20if%20you%20are%20deploying%20your%20Grails%2FGroovy%20applications%20in%20the%20average%20corporate%20IT%20infrastructure%2C%20Single%20Sign%20On%20with%20Active%20Directory%20and%20NTLM.%20%20Like%20it%20or%20not%2C%20b&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/02/10/fitting-grails-in-an-active-directory-and-ntml-sso-groove/feed/</wfw:commentRss> <slash:comments>28</slash:comments> </item> <item><title>What Grooves You?</title><link>http://www.nslms.com/2010/02/05/what-grooves-you/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/02/05/what-grooves-you/#comments</comments> <pubDate>Fri, 05 Feb 2010 19:44:01 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Grails/Groovy]]></category> <category><![CDATA[Reviews]]></category> <category><![CDATA[grails]]></category> <category><![CDATA[groovy]]></category> <category><![CDATA[learning curve]]></category> <category><![CDATA[linkedin]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=376</guid> <description><![CDATA[In my &#34;Day Job&#34;, we design and build our applications using Microsoft technologies. In particular, we&#8217;re using C#, Silverlight, and IIS to build and deploy our web applications. This makes good sense because the vendors we use are well versed in the Microsoft technology, and like the IT infrastructure of a lot of medium and [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F02%2F05%2Fwhat-grooves-you%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F02%2F05%2Fwhat-grooves-you%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>In my &quot;Day Job&quot;, we design and build our applications using Microsoft technologies.  In particular, we&#8217;re using C#, Silverlight, and IIS to build and deploy our web applications.  This makes good sense because the vendors we use are well versed in the Microsoft technology, and like the IT infrastructure of a lot of medium and large companies Microsoft solutions are at the forefront.  It&#8217;s becoming apparent though that we&#8217;re going to have to consider our options and possibly embrace a different technology stack to properly scale and support the applications we&#8217;re building.</p><p>While I knew that Java servlets and the Spring Framework were the answers, credit goes to my boss <a
href="http://www.linkedin.com/profile?viewProfile=&#038;key=11181889">Scott Ellis</a> for really doing a deep dive into what technologies are on offer, and coming up with using Grails and Groovy as the best solution for us.  Which brings me to the reason for this blog post.  I&#8217;ve been spending some time playing around with Grails and Groovy, and familiarizing myself with the technology and what is on offer.  I intend to do a series of posts here about my discovery process, what problems I encounter, and how I resolve them.</p><p>From the searching I&#8217;ve had to do in order to get answers or better understanding about the challenges I&#8217;ve faced, I think I have a chance to be a real resource to others who are just starting out with Grails and Groovy.  What&#8217;s more I&#8217;m writing from the perspective of a relative newbie to the Java world.  Stay tuned as you follow my journey into Grails and Groovy. <i><b>*Spoiler alert* &#8211; I like it, a LOT!</b></i></p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/02/05/what-grooves-you/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=What%20Grooves%20You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=What+Grooves+You%3F&amp;link=http://www.nslms.com/2010/02/05/what-grooves-you/&amp;notes=In%20my%20%26quot%3BDay%20Job%26quot%3B%2C%20we%20design%20and%20build%20our%20applications%20using%20Microsoft%20technologies.%20%20In%20particular%2C%20we%27re%20using%20C%23%2C%20Silverlight%2C%20and%20IIS%20to%20build%20and%20deploy%20our%20web%20applications.%20%20This%20makes%20good%20sense%20because%20the%20vendors%20we%20use%20are%20well%20versed%20in%20the%20Microsoft%20technology%2C%20and%20like%20the%20IT%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/02/05/what-grooves-you/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
