<?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>Glen Smith &#187; Java</title>
	<atom:link href="http://blogs.bytecode.com.au/glen/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.bytecode.com.au/glen</link>
	<description>Java, XML and all that Jazz... from Canberra, Australia</description>
	<lastBuildDate>Wed, 25 Apr 2012 05:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>First Experiences with QUnit</title>
		<link>http://blogs.bytecode.com.au/glen/2011/04/06/first-experiences-with-qunit.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2011/04/06/first-experiences-with-qunit.html#comments</comments>
		<pubDate>Wed, 06 Apr 2011 02:23:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2011/04/06/first-experiences-with-qunit/</guid>
		<description><![CDATA[I&#8217;ve been incorporating more JavaScript into my Webapps lately, and have finally take some time out to have a look at some Unit Testing options for JavaScript. There&#8217;s quite a few solid libraries to look at including JSUnit, YUITest and QUnit (and many more BDD ones emerging), so the whole experience can be a little daunting at the start. For my particularly used case, I wanted something very lightweight and easy to integrate into my [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve been incorporating more JavaScript into my Webapps lately, and have finally take some time out to have a look at some Unit Testing options for JavaScript. There&#8217;s quite a few solid libraries to look at including <a href="http://www.jsunit.net/">JSUnit</a>, <a href="http://developer.yahoo.com/yui/3/test/">YUITest</a> and <a href="http://docs.jquery.com/Qunit">QUnit</a> (and many more BDD ones emerging), so the whole experience can be a little daunting at the start.
</p>
<p>
For my particularly used case, I wanted something very lightweight and easy to integrate into my existing framework. I ended up going with <a href="http://docs.jquery.com/Qunit">QUnit</a>, basically because it was (a) simple; (b) popular; (c) consisted of two files; and (d) had plenty of &#8220;getting started&#8221; articles I could template off. I&#8217;ve been very happy with it so far.
</p>
<p>
If you have JUnit background and are curious what a JavaScript testing library looks like, check out a sample test:
</p>
<pre class="brush: javascript;">
test("You can't handle the truth", function() {
  var someTrueExpression = true;
  ok( someTrueExpression, "True expressions" );
});

test("Equals, and not so much", function() {

  var actual, expected;
  actual = expected = 2;
  equal(expected, actual, "Basic comparison" );

  notEqual(expected, 3, "Asserting not equals");

});
</pre>
<p>
One thing I really like about QUnit is that it makes things very easy to get started. Basically you create a html file with elements for each of the test results, and QUnit looks after the runner and markup of the output. Just add a single QUnit.js file and a supporting QUnit.css and you have a:
</p>
<p>
<img src="images/2011/qunit-demo.gif" alt="QUnit test runner in action"/>
</p>
<p>
So what does a complete QUnit test page look like? Here&#8217;s something you can cut and paste and get started:
</p>
<pre class="brush: html;">

<html>
  <head> 

  </head> 
<link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../qunit/qunit.js"></script> 

<script language="JavaScript"> 
module("Basic Asserts");

test("You can't handle the truth", function() {
  var someTrueExpression = true;
  ok( someTrueExpression, "True expressions" );    
});

test("Equals, and not so much", function() {

  var actual, expected;
  actual = expected = 2;
  equal(expected, actual, "Basic comparison" );

  notEqual(expected, 3, "Asserting not equals");

});

</script> 

<!-- QUnit will fill in the contents of these elements for you (except for qunit-header) -->
<body>
<h1 id="qunit-header">Basic QUnit Demo</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>

</body>
</html>
</pre>
<p>
JavaScript has some special language support around equality (the string example is a classic since 2 == &#8220;2&#8243; in JavaScript, but 2 !== &#8220;2&#8243;). So you can do strict and non-strict equality:
</p>
<pre class="brush: javascript;">
test("Equals edge cases", function() {

  equal("2", 2, "Equals are not strict");

  // but this will fail...
  strictEqual("2", 2, "Strict type equals");

});
</pre>
<p>
There&#8217;s also great support for test suites with the standard setup() and teardown() type functions you&#8217;re used to:
</p>
<pre class="brush: javascript;">
module("Control Flow", {
    setup: function() {
        console.log("Just some setup stuff")
    },
    teardown: function() {
        console.log("Just some teardown stuff")
    }

});
</pre>
<p>
There&#8217;s also support for exception assertions that can be pretty handy:
</p>
<pre class="brush: javascript;">
test("Exceptional stuff", function() {
   raises(function() {
    throw new Error("World of pain");
  }, "Ensure error is thrown");
});
</pre>
<p>
There&#8217;s certainly plenty to learn around the async parts of JavaScript (such as unit testing Ajax calls), and that&#8217;s next on my list for exploration (along with automated test runners for JavaScript testing).
</p>
<p>
But if you&#8217;re after a first exposure to how JavaScript unit testing libraries hang together, QUnit is definitely worth a look! Great stuff!
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2011/04/06/first-experiences-with-qunit.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making bookmarking of iPhone/iPad apps simpler</title>
		<link>http://blogs.bytecode.com.au/glen/2011/03/21/making-bookmarking-of-iphone-ipad-apps-simpler.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2011/03/21/making-bookmarking-of-iphone-ipad-apps-simpler.html#comments</comments>
		<pubDate>Mon, 21 Mar 2011 01:46:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2011/03/21/making-bookmarking-of-iphone-ipad-apps-simpler/</guid>
		<description><![CDATA[I&#8217;ve been doing some work for a Government client around making their cyber-safety info accessible to Aussie kids. One of the target devices is iPhone (actually Android is even higher priority since Android handsets are becoming far more common with kids, but that&#8217;s another bunch of excitement altogether). The issue with iPod/iPhone bookmarking is that the Safari Mobile bookmarking icon is so ambiguous that very few people know what it does! We were after a [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve been doing some work for a Government client around making their cyber-safety info accessible to Aussie kids. One of the target devices is iPhone (actually Android is even higher priority since Android handsets are becoming far more common with kids, but that&#8217;s another bunch of excitement altogether).
</p>
<p>
The issue with iPod/iPhone bookmarking is that the Safari Mobile bookmarking icon is so ambiguous that very few people know what it does! We were after a solution for allowing the user to easily add the bookmark to their Home screen, but not get too naggy. Enter a cool little JavaScript lib called <a href="http://code.google.com/p/mobile-bookmark-bubble/">Mobile Bookmark Bubble</a>. Here&#8217;s the app in action:
</p>
<p>
<img src="images/2011/cyber-help-iphone.jpg" alt="Bookmark popup in action"/>
</p>
<p>
The library does the appropriate content-sensing so that it only activates on iPhone/iPad/iPod touch, and make use of some HTML5 local storage to make sure that if you cancel it away, it won&#8217;t come back again (using a nice fadeout after a few seconds of display).
</p>
<p>
The library ships with some example code to get you up and running quickly, and let&#8217;s you use custom metadata elements to point to a custom icon for this app (in my case 128&#215;128 since I&#8217;m re-using the standard apple-touch-icon.png mechanism and that size looks slick rescaled on the iPad).
</p>
<p>
Anyways, it&#8217;s a pretty niche lib that does what it does perfectly. Bravo! Just what I was after!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2011/03/21/making-bookmarking-of-iphone-ipad-apps-simpler.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;When Elephants Dance &#8211; Why Java EE6 is not your Grandma&#8217;s Enterprise Stack&#8221; &#8230; in Canberra next week</title>
		<link>http://blogs.bytecode.com.au/glen/2010/10/05/when-elephants-dance-why-java-ee6-is-not-your-grandma-s-enterprise-stack-in-canberra-next-week.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/10/05/when-elephants-dance-why-java-ee6-is-not-your-grandma-s-enterprise-stack-in-canberra-next-week.html#comments</comments>
		<pubDate>Tue, 05 Oct 2010 03:56:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/10/05/when-elephants-dance-why-java-ee6-is-not-your-grandma-s-enterprise-stack-in-canberra-next-week/</guid>
		<description><![CDATA[I&#8217;m speaking at the ACT Oracle User Group conference next week on Java EE6. Normally I&#8217;d do a talk on Grails to this set (and pump the book of course!), but Peter McNeil had already put a Grails talk together and I was already brimming with other ideas&#8230; Anyways, I&#8217;ve been doing some client work on JEE6 lately, and I was so inspired by Adam Bien&#8217;s live coding talk at JavaOne 2010, I&#8217;m going to [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m speaking at the <a href="http://www.actoug.org.au/">ACT Oracle User Group</a> conference next week on Java EE6. Normally I&#8217;d do a talk on Grails to this set (and <a href="http://www.manning.com/gsmith/">pump the book</a> of course!), but <a href="http://nerderg.com/">Peter McNeil</a> had already put a Grails talk together and I was already brimming with other ideas&#8230;
</p>
<p>Anyways, I&#8217;ve been doing some client work on JEE6 lately, and I was so inspired by <a href="http://www.adam-bien.com/roller/abien/">Adam Bien&#8217;s</a> live coding talk at JavaOne 2010, I&#8217;m going to try and reproduce it locally! It&#8217;s no Grails, but EE6 gets a lot of things right! I&#8217;ve been very impressed with it. The abstract for the talk is:
</p>
<p><img src="images/2010/elephant-dancing.png" alt="Elephant Dancing" style="float: right;"/></p>
<blockquote style="margin: 1em; font-style: italic;"><p>
Learn some of the new enterprise features in Java EE6 which can dramatically improve developer productivity by eliminating boilerplate code, fully embracing annotations and adopting the &#8220;convention over configuration&#8221; paradigm. In this live-coding workshop, we&#8217;ll develop a scalable, data-driven, multi-tier, REST-exposed, JSON-friendly Web2.0 application from scratch in under an hour!
</p>
</blockquote>
<p>
Should be a really fun talk! I&#8217;m going to follow Adam&#8217;s pattern start from a clean slate and just code for an hour talking about EE6 features as I add them:
</p>
<ul>
<li>Implementing a simple EJB3.1 service (@Stateless)
<li>Invoking it from a JSF view layer via CDI (@Named)
<li>Injecting an EJB into a controller and binding form parameters (@EJB)
<li>Persisting and Typesafe Querying via JPA2 (@Entity and @NamedQuery)
<li>Exposing the EJB Restfully and invoking creates and qeuries through content negotiation (@Path, @Produces, @Consumes)
<li>Implementing a AOP-style logger over the EJB methods (@AroundAdvice)
</ul>
<p>
It&#8217;s going to be a great time. So if you&#8217;re free and in Canberra on Wednesday the 14th October, drop on by the Dev Stream at the Oracle JUG at 10am for the talk.
</p>
<p>
The code will be flowing freely&#8230; I hope&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/10/05/when-elephants-dance-why-java-ee6-is-not-your-grandma-s-enterprise-stack-in-canberra-next-week.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Groovy/Grails BOF at JavaOne promises a &#8220;full on double rainbow&#8221; experience</title>
		<link>http://blogs.bytecode.com.au/glen/2010/09/14/groovy-grails-bof-at-javaone-promises-a-full-on-double-rainbow-experience.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/09/14/groovy-grails-bof-at-javaone-promises-a-full-on-double-rainbow-experience.html#comments</comments>
		<pubDate>Tue, 14 Sep 2010 01:27:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/09/14/groovy-grails-bof-at-javaone-promises-a-full-on-double-rainbow-experience/</guid>
		<description><![CDATA[The plans for the Groovy and Grails BOF at JavaOne are coming together and it&#8217;s gonna be a &#8220;full on double rainbow all the way across the sky&#8221; experience. &#8220;But what does it mean?&#8221; Glad you asked. This year we have our most comprehensive panel ever! We&#8217;ll have Peter Ledbrook (Grails Evangelist and Grails in Action co-author), Guillaume Laforge (Groovy lead), Andres Almiray (Griffon lead and Griffon in Action author), Dierk Koenig (Groovy in Action [...]]]></description>
			<content:encoded><![CDATA[<p><img src="images/2010/DoubleRainbow.jpg" style="float: right" alt="Public Domain Double Rainbow" title="All the way across the sky"/></p>
<p>
The plans for the Groovy and Grails BOF at JavaOne are coming together and it&#8217;s gonna be a &#8220;<a href="http://www.youtube.com/watch?v=OQSNhk5ICTI">full on double rainbow all the way across the sky</a>&#8221; experience. &#8220;But what does it mean?&#8221;  Glad you asked.
</p>
<p>
This year we have our most comprehensive panel ever! We&#8217;ll have <a href="http://www.cacoethes.co.uk/blog/">Peter Ledbrook</a> (Grails Evangelist and <a href="http://manning.com/gsmith/">Grails in Action</a> co-author), <a href="http://twitter.com/glaforge">Guillaume Laforge</a> (Groovy lead), <a href="http://www.jroller.com/aalmiray/">Andres Almiray</a> (Griffon lead and <a href="http://manning.com/almiray/">Griffon in Action</a> author), <a href="http://twitter.com/mittie">Dierk Koenig</a> (<a href="http://manning.com/koenig2/">Groovy in Action</a> lead), and hopefully a few more surprises.
</p>
<p>
This is a fantastic opportunity to catch up on the latest product roadmaps for Groovy, Grails, and Griffon, and ask questions from the floor directly to the product leads themselves! It&#8217;s going to be one fantastic get-together for the Groovy community.
</p>
<p>
Of course we&#8217;ll be recording it all for a special edition of the <a href="http://www.grailspodcast.com">Grails Podcast</a> and we&#8217;ll be kicking on to a local haunt to test out our awesome Pool skills while shooting the breeze on metaclasses, mixins and other Groovy love.
</p>
<p>
Make sure you put it in your schedule (S313988) for 7:30 PM on Monday night! It&#8217;s gonna be fantastic! See you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/09/14/groovy-grails-bof-at-javaone-promises-a-full-on-double-rainbow-experience.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Book Review: Beginning Java EE6 Platform with Glassfish 3</title>
		<link>http://blogs.bytecode.com.au/glen/2010/08/24/book-review-beginning-java-ee6-platform-with-glassfish-3.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/08/24/book-review-beginning-java-ee6-platform-with-glassfish-3.html#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:38:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/08/24/book-review-beginning-java-ee6-platform-with-glassfish-3/</guid>
		<description><![CDATA[I really have to take a rest from this book review business, but I&#8217;ve been buying heaps of books through Tech Books Deal of the Day, and this title has been very useful for one of my current bits of client work. First of all, Beginning Java EE6 with Glassfish 3 came at a time when one of our clients requested we implement some JPA2 infrastructure (around EJB3) for them to store some JAXB objects [...]]]></description>
			<content:encoded><![CDATA[<p>
I really have to take a rest from this book review business, but I&#8217;ve been buying heaps of books through <a href="http://techbooksdotd.heroku.com/">Tech Books Deal of the Day</a>, and this title has been very useful for one of my current bits of client work.
</p>
</p>
<p>First of all, <a href="http://apress.com/book/view/1430219548">Beginning Java EE6 with Glassfish 3</a> came at a time when one of our clients requested we implement some JPA2 infrastructure (around EJB3) for them to store some JAXB objects coming in via JAX WS. I&#8217;d worked with earlier versions of all of these technologies, but wasn&#8217;t across the latests spec changes in EE6 (which was their preferred stack). So this book was a $10 special on exactly the right day for me!
</p>
<p>
First of all, this a a sensational title if you have a background in Java EE. It was basically the single volume I needed to get up to speed with all the latest specs in a hurry. The examples are all Maven-based, the sample code is simple but genuinely representative of the kinds of issues I was facing, and the coverage is across the whole EE stack.
</p>
<p><img src="images/2010/jee6-specs.gif" alt="JEE 6 Specs" style="float:left;"/></p>
<p>
What I like most about this book, however, is the the author has done a lot of thinking about the ordering of concepts. The book progresses nicely from JPA2, through EJB3, Transactions, the Web Tier (JSF) and finally on to JMS, Web Services , REST, and JAXB. It&#8217;s all covered in the right order! (We spent a lot of time writing and rewriting in an attempt to get this right in <a href="http://manning.com/gsmith/">Grails in Action</a> so I appreciate the effort). The author is on the EE, JPA2 and EJB3.1 Expert Groups, and it shows in this material. Lots of useful tip and tricks covered along the way and heaps of things I didn&#8217;t know.
</p>
<p>
Be warned though, you need to know that this is a book on &#8220;Beginning Java EE6&#8243; even though the byline is &#8220;From Novice to Professional&#8221;. Even in 450 pages, you won&#8217;t find a deep-dive on all the EE concepts, or detailed coverage of every JPA option. The only point this really bothered me was in JPA2 Criteria Queries.  This is a pretty important new part of the spec, but doesn&#8217;t get a mention here. Even things like TypedQuery didn&#8217;t get a shout-out. (BTW, if you&#8217;re looking for a JPA2 Deepdive, <a href="http://www.outskirtspress.com/jpaBook">Java Persistence with JPA</a> is a great, albeit dry, alternative -which is also a $10 ebook!).
</p>
<p>
If you have some background in Java EE, but you haven&#8217;t made the switch to Java EE6, this is definitely a title that you&#8217;ll want in your library. A fantastic survey of all the APIs, with genuinely useful background tips, source code and discussion.
</p>
<p>
Interestingly, it seems that Apress have dumped their DRM protection on PDFs (used to have a password-based protection), which is great news for everyone using PDFs on their e-readers etc.
</p>
<p>
If you&#8217;re looking to step up to JEE6, this one is definitely worth having&#8230; and if you can snag it for $10 it&#8217;s a fantastic bargain!
</p>
<p>
Oh. And once you&#8217;ve had your fill of JEE6, go and grab a <a href="http://manning.com/gsmith/">Grails Book</a> and take your JEE productivity to a whole new level.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/08/24/book-review-beginning-java-ee6-platform-with-glassfish-3.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Book Review: Groovy for Domain Specific Languages</title>
		<link>http://blogs.bytecode.com.au/glen/2010/08/18/book-review-groovy-for-domain-specific-languages.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/08/18/book-review-groovy-for-domain-specific-languages.html#comments</comments>
		<pubDate>Wed, 18 Aug 2010 02:31:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/08/18/book-review-groovy-for-domain-specific-languages/</guid>
		<description><![CDATA[The guys over at Packt Press sent us a free copy of Groovy for Domain Specific Languages to review for the Grails Podcast. We&#8217;ll talk about it in an upcoming show, but I promised the publisher I&#8217;d post some thoughts on my blog, so here we are. First, I&#8217;m super excited that there is now a title dedicated purely to Groovy DSLs. Every time I hear Guillaume or Paul talk about DSLs I get swamped [...]]]></description>
			<content:encoded><![CDATA[<p>
The guys over at Packt Press sent us a free copy of <a href="https://www.packtpub.com/groovy-for-domain-specific-languages-dsl/book">Groovy for Domain Specific Languages</a> to review for the <a href="http://www.grailspodcast.com">Grails Podcast</a>. We&#8217;ll talk about it in an upcoming show, but I promised the publisher I&#8217;d post some thoughts on my blog, so here we are.
</p>
<p>
First, I&#8217;m super excited that there is now a title dedicated purely to Groovy DSLs. Every time I hear <a href="http://twitter.com/glaforge">Guillaume</a> or <a href="http://twitter.com/paulk_asert">Paul</a> talk about DSLs I get swamped with great ideas that I&#8217;ve never really had time to explore. This book gave me a reason.
</p>
<p>
First up, this book is intentionally targeted to straight Java devs, so you get a lot of space devoted to things that even casual Groovy guys will already know. There&#8217;s the inevitable chapters on Groovy essentials, using the standard builders, Java integration, and even a chapter devoted to teaching you Grails! (Some people spend <a href="http://www.manning.com/gsmith/">entire books</a> on just that.. but I digress. <img src='http://blogs.bytecode.com.au/glen/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   To be honest, this would not serve you well as your first book on Groovy, so I&#8217;m not sure some of that content was well served, but I can appreciate the publishing pressure of reaching the widest possible market, and the background material is well done.
</p>
<p>
What I was really hoping for was some coverage of DSLs from the ground up, and I was really happy. The author spends the whole of Chapter 3 just on closures. This is well worth it. There are tons of edge cases here that I wasn&#8217;t across and I really appreciated the dedicated coverage. Straight after you do the closure deepdive, you spend chapter 4 retrofitting Twitter4j with your own basic DSL. The examples were exactly at the right level here, and I was loving the gentle pace.
</p>
<p><img src="images/2010/groovy-book-review.gif" alt="Groovy Book Review logo" style="float: right;"/></p>
<p>
Chapter 5 moves on the standard Groovy builders to give you a feel for some of the standard DSL strategies, but this is space better covered in the <a href="http://www.manning.com/koenig2/">Groovy in Action</a> though usefully introduced here. Seasoned groovy programmers will find this fairly skippable, but Java guys will be served with a good grab-bag of examples to clarify their thinking.
</p>
<p>
Chapter 6 is another &#8220;examples&#8221; chapter, this time with Grails, Gant and a range of BDD tools (including Spock). Given the spread, the chapter is long but terse and I would liked to have seen chapters 5 and 6 collapsed into a tighter chapters of &#8220;DSLs to shape your thinking&#8221;.
</p>
<p>
Chapters 7 and 8 deep dive on Builders and writing your own DSLs &#8211; and these represent the heart of the book. Tons of good information in here that you&#8217;ll only find scattered across tons of Wiki pages. The book is worth it for just these chapters. You&#8217;ll get a feel for builder strategies, along with a &#8220;from scratch&#8221; DSL creation. Great info in here. I&#8217;ll reference these chapters a lot when I work up the keen-ness to tackle my own DSL.
</p>
<p>
Chapter 9 rounds out the book with a Java/Groovy integration chapter. Didn&#8217;t quite follow how this linked to the DSL concept, but if Packt were only going to release one Groovy book, I can see why this material would be good background.
</p>
<p>
Overall? I&#8217;m really glad there is now a dedicate DSL book! This a really solid book on Groovy DSLs that doesn&#8217;t shy away from the hardcore material, but still gives you the stepping stones to get there. To be honest, this book could be a lot better if the editing team took a knife to a lot of the non-DSL stuff and sharpened up the book&#8217;s vision. The material is well-written though, and I&#8217;m sure I&#8217;m going to be referencing this material.
</p>
<p>
While the next version of <a href="http://www.manning.com/koenig2/">Groovy in Action</a> promises a dedicated chapter on DSLs, this Packt title gives you a good fill of DSL-centric material to implement today. A solid book that&#8217;s definitely worth a look if you want to explore DSL creation more seriously.
</p>
<p>
Happy DSLing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/08/18/book-review-groovy-for-domain-specific-languages.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From WSDL to JAXB to JPA with a single schema: Adventures in Hyperjaxb3</title>
		<link>http://blogs.bytecode.com.au/glen/2010/07/29/from-wsdl-to-jaxb-to-jpa-with-a-single-schema-adventures-in-hyperjaxb3.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/07/29/from-wsdl-to-jaxb-to-jpa-with-a-single-schema-adventures-in-hyperjaxb3.html#comments</comments>
		<pubDate>Thu, 29 Jul 2010 09:58:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/07/29/from-wsdl-to-jaxb-to-jpa-with-a-single-schema-adventures-in-hyperjaxb3/</guid>
		<description><![CDATA[The client brief was pretty straightforward: &#8220;We need to persist this class to a Database&#8221;. No problem. Hibernate FTW. &#8220;Actually, we&#8217;d like to use JPA2 to do the heavy lifting&#8221;. No problem, we&#8217;ll annotate up the domain classes with a few @Entity statements and we&#8217;re off. &#8220;Oh, and the class we wish to persist is a graph of objects that are dynamically generated via JAXB&#8221;. Things are getting a little more complex now. Converting your [...]]]></description>
			<content:encoded><![CDATA[<p>
The client brief was pretty straightforward: &#8220;We need to persist this class to a Database&#8221;. No problem. Hibernate FTW. &#8220;Actually, we&#8217;d like to use JPA2 to do the heavy lifting&#8221;. No problem, we&#8217;ll annotate up the domain classes with a few @Entity statements and we&#8217;re off. &#8220;Oh, and the class we wish to persist is a graph of objects that are dynamically generated via JAXB&#8221;. Things are getting a little more complex now.
</p>
<p>
Converting your WSDL into a set of JAXB classes is super simple: Use your IDE or the very cool <a href="https://maven-jaxb2-plugin.dev.java.net/">Maven Plugin</a> to get you up and running. But annotating those generated classes with JPA annotations on the way through? That&#8217;s a little trickier. Fortunately wsimport just invokes the JAXB compiler (xjc) under the cover, and xjc support plugins! You know where we&#8217;re going here..
</p>
<p>
Enter <a href="https://hyperjaxb3.dev.java.net/">hyperjaxb3</a>. This very slick little library provides an xjc plugin to markup your JAXB classes with JPA annotations. It will even generate your persistence.xml file on the way through. Most importantly of all, it knows how to work around the <a href="http://confluence.highsource.org/display/HJ3/JAXB+vs.+JPA">known incompatibilities</a> between JPA and JAXB (for example, that your xsd:date entries will get marshalled to javax.xml.datatype.XMLGregorianCalendar which is not a supported type for JPA).
</p>
<p>
Hyperjaxb3 works around things like this by providing @Transient getters and setters for the XMLGregorianCalendar methods, whilst generating native JPA getters and setter for standard java.util.Date classes. Very tricky.
</p>
<p>
Hyperjaxb will also handle collections cleverly, so List<String> gets marshalled off into its own 1:m table. It means that complex graphs will generate lots of tables, but everything worked for my prototype which was a very complex schema. I&#8217;m super impressed.
</p>
<p>
It took several days to get all the dependencies right, and it did involve copying jaxb and jaxws jars into my jdk1.6.0/jre/lib/endorsed folder &#8211; so I thought I&#8217;d put up a sample POM below to save you some time. I&#8217;m not sure that the approach is even going to work under scale, given the complexity of the graph. I suspect we&#8217;d be better off writing a simple JPA wrapper class that we marshall via <a href="http://dozer.sourceforge.net/">Dozer</a> but it does give the client their preferred option to explore.
</p>
<p>
To save you some time, I&#8217;ll provide a <a href="images/2010/pom.xml">Sample Maven POM</a> that is wired up for everything you need to get yourself up and running. Just add your favorite IDE and you&#8217;re in business. Oh, and don&#8217;t forget that /jre/lib/endorsed thing.
</p>
<p>
Happy transformations!
</p</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/07/29/from-wsdl-to-jaxb-to-jpa-with-a-single-schema-adventures-in-hyperjaxb3.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My &#8220;NoSQL for Java Devs&#8221; slides are now online</title>
		<link>http://blogs.bytecode.com.au/glen/2010/07/15/my-nosql-for-java-devs-slides-are-now-online.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/07/15/my-nosql-for-java-devs-slides-are-now-online.html#comments</comments>
		<pubDate>Wed, 14 Jul 2010 23:53:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/07/15/my-nosql-for-java-devs-slides-are-now-online/</guid>
		<description><![CDATA[Had a fantastic time last night with the guys at my local Canberra JUG giving a presentation titled &#8220;NoSQL &#8211; Life Beyond the Outer Join&#8221;. I&#8217;ll embed the slides further down. In the talk we looked at four different types of NoSQL options for Java guys: Simple Key/Value in-memory stores (Memcached), sophisticated distributed key/value stores (Voldemort), Document Databases (CouchDB), and Graph Databases (Neo4j). We also had a play with the common java clients that are [...]]]></description>
			<content:encoded><![CDATA[<p>
Had a fantastic time last night with the guys at my local <a href="http://www.cjugaustralia.org">Canberra JUG</a> giving a presentation titled &#8220;NoSQL &#8211; Life Beyond the Outer Join&#8221;. I&#8217;ll embed the slides further down.
</p>
<p>
In the talk we looked at four different types of NoSQL options for Java guys: Simple Key/Value in-memory stores (<a href="http://memcached.org/">Memcached</a>), sophisticated distributed key/value stores (<a href="http://project-voldemort.com/">Voldemort</a>), Document Databases (<a href="http://couchdb.apache.org/">CouchDB</a>), and Graph Databases (<a href="http://neo4j.org/">Neo4j</a>).
</p>
<p>
We also had a play with the common java clients that are used to access them: <a href="http://code.google.com/p/spymemcached/">Spy</a> for Memcached, <a href="http://code.google.com/p/ektorp/">Ektorp</a> for CouchDb, and the bundled libs for Neo4j and Voldemort.
</p>
<p>
I&#8217;ve put all the source up on a <a href="http://bitbucket.org/glen_a_smith/cjug-nosql-examples">Bitbucket Project</a> which you can clone. It&#8217;s all Mavenized, so you can knock yourself out with whatever IDE works for you. If you&#8217;re on Windows, I&#8217;ve also included links to the download pages of the various servers on the BitBucket <a href="http://bitbucket.org/glen_a_smith/cjug-nosql-examples/wiki/Home">Wiki Page</a> for the project.
</p>
<p>
<div style="width:425px" id="__ss_4756894"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/glen_a_smith/nosql-life-beyond-the-outer-join" title="NoSQL - Life Beyond the Outer Join">NoSQL &#8211; Life Beyond the Outer Join</a></strong><object id="__sse4756894" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nosql-lifebeyondtheouterjoin-100714183210-phpapp02&#038;stripped_title=nosql-life-beyond-the-outer-join" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4756894" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nosql-lifebeyondtheouterjoin-100714183210-phpapp02&#038;stripped_title=nosql-life-beyond-the-outer-join" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/glen_a_smith">glen_a_smith</a>.</div>
</div>
<p>
Thanks to the bunch of folk that turned up on the night. It was great crowd full of interesting questions and discussions!
</p>
<p>
Happy NoSQLing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/07/15/my-nosql-for-java-devs-slides-are-now-online.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans and solving the dreaded &#8220;unrecognized project; missing plug-in?&#8221;</title>
		<link>http://blogs.bytecode.com.au/glen/2010/07/03/netbeans-and-solving-the-dreaded-unrecognized-project-missing-plug-in.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/07/03/netbeans-and-solving-the-dreaded-unrecognized-project-missing-plug-in.html#comments</comments>
		<pubDate>Fri, 02 Jul 2010 22:54:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/07/03/netbeans-and-solving-the-dreaded-unrecognized-project-missing-plug-in/</guid>
		<description><![CDATA[I has recently handed a truckload of client code all developed in Netbeans. In order to get a feel for the interdependencies, I thought I just fire up a clean copy of Netbeans and open it up. Unfortunately, when I tried to open the project I was greeted with the dreaded &#8220;unrecognized project; missing plug-in&#8221; dialog: Hmnmm&#8230; That&#8217;s ok, so I thought I&#8217;d just open it up as a &#8220;free-form&#8221; Netbeans project, but that&#8217;s no [...]]]></description>
			<content:encoded><![CDATA[<p>
I has recently handed a truckload of client code all developed in Netbeans. In order to get a feel for the interdependencies, I thought I just fire up a clean copy of Netbeans and open it up. Unfortunately, when I tried to open the project I was greeted with the dreaded &#8220;unrecognized project; missing plug-in&#8221; dialog:
</p>
<p>
<img src="images/2010/unrecognized-project-missing-plugin.gif" alt="Unrecognised project; missing plugin"/>
</p>
<p>
Hmnmm&#8230; That&#8217;s ok, so I thought I&#8217;d just open it up as a &#8220;free-form&#8221; Netbeans project, but that&#8217;s no good either, since Netbeans complains that it&#8217;s already a Netbeans project! After a bunch of mucking around, I found out the problem, I was missing a plugin! But which one?
</p>
<p>
If you open up the nbproject/project.xml file will have something like this:
</p>
<pre class="prettyprint">
<project xmlns="http://www.netbeans.org/ns/project/1">
    <type>org.netbeans.modules.j2ee.earproject</type>
     ...
</project>
</pre>
<p>
So that <code>type</code> element gives you the skinny. In this case I was missing the EAR project plugin. Once that was installed, the project opened up just fine. Thought I&#8217;d blog it up to save you some google time down the track.
</p>
<p>
Happy recognised projects!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/07/03/netbeans-and-solving-the-dreaded-unrecognized-project-missing-plug-in.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Canberra JUG Talk: NoSQL &#8211; Life after the Outer Join</title>
		<link>http://blogs.bytecode.com.au/glen/2010/06/28/canberra-jug-talk-nosql-life-after-the-outer-join.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2010/06/28/canberra-jug-talk-nosql-life-after-the-outer-join.html#comments</comments>
		<pubDate>Mon, 28 Jun 2010 01:05:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2010/06/28/canberra-jug-talk-nosql-life-after-the-outer-join/</guid>
		<description><![CDATA[Next month I&#8217;ll be hanging out at my local JUG giving a bit of a survey of the main players in the NoSQL movement along with the Java APIs that they offer. If you&#8217;re in or around Canberra on July 14, make sure drop by for a great night of Pizza and Java Geekery with a somewhat schemaless design Will slideshare up the slides, and bitbucket up the source, once I&#8217;ve done the presento. Till [...]]]></description>
			<content:encoded><![CDATA[<p>
Next month I&#8217;ll be hanging out at my <a href="http://www.cjugaustralia.org">local JUG</a> giving a bit of a survey of the main players in the NoSQL movement along with the Java APIs that they offer. If you&#8217;re in or around Canberra on July 14, make sure drop by for a great night of Pizza and Java Geekery with a somewhat schemaless design <img src='http://blogs.bytecode.com.au/glen/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
</p>
<p>
Will slideshare up the slides, and bitbucket up the source, once I&#8217;ve done the presento. Till then, here&#8217;s the blurb for the night:
</p>
<p>
<b>Abstract</b>
</p>
<p>
The NoSQL (Not Only SQL) movement has been gaining a lot of press over the last year as a means of scaling massive data storage, complex relationships and lightening fast retrieval for the Web&#8217;s biggest sites. This month we&#8217;re taking a trip to the big end of town and looking at some of the backend technologies that are powering sites like Twitter, Facebook, LinkedIn, Reddit, Digg and Google.
</p>
<p>
We&#8217;ll be looking at popular Java clients and servers that play in the NoSQL space and have a brief survey of the following popular NoSQL platforms: Document Databases (<a href="http://www.mongodb.org/">MongoDB</a>/<a href="http://couchdb.apache.org/">CouchDB</a>), Sophisticated Key/Value Stores (<a href="http://cassandra.apache.org/">Cassandra</a>), Graph Databases (<a href="http://neo4j.org/">Neo4j</a>), and simple Key/Value stores (<a href="http://memcached.org/">Memcached</a>). It&#8217;l be a lightening tour of what each technology offers, some source code on how it works, and lots of headshifts about how to store data such that you don&#8217;t ever need another Left Outer Join!
</p>
<p>
We&#8217;ll have a lot of fun, you&#8217;ll pick up a bunch of new buzzwords to impress your peers, and you can take the source away and play at home. Put it in your diary now!
</p>
<p>
<b>About Glen</b>
</p>
<p>
Glen is a hardcore Java trainer and speaker, co-author of <a href="http://www.manning.com/gsmith/">Grails in Action</a> from Manning, co-host of the <a href="http://grailspodcast.com">Grails Podcast</a> and a former winner of Australian Masterchef. He blogs at <a href="http://blogs.bytecode.com.au/glen">http://blogs.bytecode.com.au/glen</a> and Twitters at <a href="http://www.twitter.com/glen_a_smith">http://www.twitter.com/glen_a_smith</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2010/06/28/canberra-jug-talk-nosql-life-after-the-outer-join.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

