<?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>Adam Jordens@littlesquare:~/ &#187; Java</title>
	<atom:link href="http://littlesquare.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://littlesquare.com</link>
	<description>Just a little square in a sea of blogs.</description>
	<lastBuildDate>Sun, 05 Sep 2010 22:17:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Upgrading to Hibernate Search 3.2.0 (w/ Seam)</title>
		<link>http://littlesquare.com/2010/05/upgrading-to-hibernate-search-3-2-0-w-seam/</link>
		<comments>http://littlesquare.com/2010/05/upgrading-to-hibernate-search-3-2-0-w-seam/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 03:08:47 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2010/05/31/upgrading-to-hibernate-search-3-2-0-w-seam/</guid>
		<description><![CDATA[A couple weeks back I set out to upgrade the version of Hibernate Search that one of our applications was using. The boys at JBoss had recently released Hibernate Search 3.2.0 and it looked pretty sweet. The possibility of performance improvements around indexing was enough to make me upgrade. Unfortunately, like most software frameworks, Hibernate [...]]]></description>
			<content:encoded><![CDATA[<p>A couple weeks back I set out to upgrade the version of Hibernate Search that one of our applications was using.   </p>
<p>The boys at JBoss had recently <a href="http://in.relation.to/Bloggers/HibernateSearch32ReleasedMappingMassIndexingClustering">released</a> Hibernate Search 3.2.0 and it looked pretty sweet. The possibility of performance improvements around indexing was enough to make me upgrade.</p>
<p>Unfortunately, like most software frameworks, Hibernate Search introduced/forced some new dependencies on us. We had previously been using Seam 2.2.0 and Hibernate 3.3.0 (<em>both JPA1</em>), neither of which were compatible with Hibernate Search 3.2.0.</p>
<p>We&#8217;re using Maven, so I&#8217;ll quickly outline the dependency changes I had to make (<em>all dependences are available via the </em><a href="http://relation.to/Bloggers/JBossMavenRepositoryChanges"><em>JBoss Nexus Repository</em></a>):</p>
<blockquote><p><font size="2" face="Verdana">&lt;dependency&gt;       <br />&#160;&#160;&#160; &lt;groupId&gt;javax.persistence&lt;/groupId&gt;        <br />&#160;&#160;&#160; &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;        <br />&#160;&#160;&#160; &lt;!&#8211; bit of a hack to make sure we aren&#8217;t transitively pulling in the persistence api (should be referencing hibernate-jpa-2.0-api now) –-&gt;        <br />&#160;&#160;&#160; &lt;version&gt;explicitly-fail&lt;/version&gt;        <br />&lt;/dependency&gt;</font></p>
</blockquote>
<p>javax.persistence:persistence-api is the JPA1 API and is no longer relevant and should never be included as a dependency. The <em>explicitly-fail</em> version will trigger a build failure if it ever manages to sneak in.</p>
<blockquote><p><font size="2" face="Verdana">&lt;dependency&gt;       <br /> &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;        <br /> &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;        <br /> &lt;version&gt;1.0.0.Final&lt;/version&gt;        <br />&lt;/dependency&gt;</font>      </p>
</blockquote>
<p>org.hibernate.javax.persistence:hibernate-jpa-2.0-api is the new JPA2 API published by Hibernate.&#160; </p>
<p>All previous hibernate dependencies had to be upgraded to <strong>3.5.2.Final</strong>, and Hibernate Search bumped up to<strong> 3.2.0.Final</strong>.</p>
<p>If you&#8217;re using Seam, you&#8217;ll also need to upgrade it to <strong>2.2.1.CR1</strong>.&#160; Note that this is not yet a final release but is necessary in order to support JPA2.</p>
<p>Unfortunately, Seam <strong>2.2.1.CR1</strong> lacks a complete Hibernate Search integration.&#160; I could no longer able properly inject a FullTextEntityManager (<em>via @In</em>).</p>
<p>Instead I was forced to obtain a FullTextSession programmatically:</p>
<blockquote><p><font face="Verdana">private FullTextSession getFullTextSession()       <br />{        <br />&#160;&#160;&#160; Session session = (Session) entityManager.getDelegate();        <br />&#160;&#160;&#160; return Search.getFullTextSession&#160; (session.getSessionFactory().getCurrentSession());        <br />}</font></p>
</blockquote>
<p>Seam also enhanced it&#8217;s EntityManager so that it now returns a JDK proxy when getDelegate() is called.&#160; </p>
<p>That would be fine and dandy, but unfortunately the proxy does not implement org.hibernate.classic.Session, as required by the FullTextSession in Hibernate Search.&#160; </p>
<p>Session.getSessionFactory().getCurrentSession() will return an org.hibernate.classic.Session and does allow you to move forward.&#160; </p>
<p>A bit annoying and hopefully something that will get corrected in the near future.&#160; I’m hoping that either Hibernate Search will be upgraded to not require a classic session, or Seam will provide an EntityManager delegate implementing the classic session interface. Better yet, Seam should just provide a fully supported integration with Hibernate Search 3.2.0.   </p>
<p>Honestly, that was about it as far as the upgrade went.&#160; We were able to index using either the new MassIndexer API or the old suggested best practice from Hibernate Search 3.1.&#160; </p>
<p>It&#8217;s interesting to note that on my test system, the MassIndexer API was slower than the previous indexing code. The documentation does cover many different tuning possibilities so it’s entirely possible the situation could be improved.</p>
<p>Also, the MassIndexer API runs in a series of transactions and unless your timeout is set sufficiently high (<em>ie. higher than the default JBoss 5 minutes</em>), you will see transaction timeouts. </p>
<p>I didn&#8217;t attempt to work around this and opt&#8217;d to stick with existing indexing code that already runs in a separate Seam @Asynchronous method (<em>thus avoiding timeouts</em>).</p>
<p>Somewhat less than ideal, but if you&#8217;re keen on running Hibernate Search 3.2.0 w/ Seam in JBoss 4.2.3, it <strong>is possible<em> </em></strong>and not too much work.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2010/05/upgrading-to-hibernate-search-3-2-0-w-seam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maintaining OEM&#8217;d Source</title>
		<link>http://littlesquare.com/2009/09/maintaining-oemd-source/</link>
		<comments>http://littlesquare.com/2009/09/maintaining-oemd-source/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 06:42:29 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2009/09/07/maintaining-oemd-source/</guid>
		<description><![CDATA[Background The company I work for made the decision to OEM a product from a partner, rather than invest valuable development time to build something that has essentially been commoditized. Development resources are at a premium and we consciously don’t want to spend any more time on this code base than we have to, we’re [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background</strong></p>
<p>The company I work for made the decision to OEM a product from a partner, rather than invest valuable development time to build something that has essentially been commoditized.</p>
<p>Development resources are at a premium and we consciously don’t want to spend any more time on this code base than we have to, we’re <strong>much better</strong> at adding value in other areas.</p>
<p>&#160;</p>
<p>Not necessarily a bad or the wrong decision, we’ve just reached the point in time where we need to make functional changes to the OEM’d code base.&#160; </p>
<p>&#160;</p>
<p><strong>Due Diligence</strong></p>
<p>Obviously, before you entertain the outright purchase or license of a third party product/code base, there’s a few questions you ought to ask yourself:</p>
<p><em>- Is the technology stack compatible with our existing products?&#160; </em>(A member of the development staff should provide the answer)</p>
<p>-<em> Does the product do significantly less/more than we will ever need it to? </em>(The later is an important question, do you really want to maintain features that customers will never use? What’s the cost of re-implementing just the features the customer does need?)</p>
<p>- <em>What’s the support model look like? </em>(Who is fixing bugs, you or the source company? How are patches exchanged, or are they?)</p>
<p>&#160;</p>
<p><strong>Maintenance</strong></p>
<p>During the course of our due diligence, we did send a couple developers on site to become familiar with not only the code base but in particular the build process around it.</p>
<p>This did pay dividends as we were able to setup Bamboo builds capable of automatically creating installation packages and running unit tests.</p>
<p><em>Significant win in my books</em>.&#160; Test coverage may not be the greatest, but if you can build a complete candidate release in 7 minutes, manual testing/verification remains a possibility.</p>
<p>&#160;</p>
<p>That’s it for now.&#160; </p>
<p>I’ll admit that I was a skeptic when the idea of adopting a 3rd party code base was first brought up.&#160; Fortunately the changes we’ve been required to make thus far have been minor.&#160; Technology stack is slightly different and anecdotally bug fixes seem to be taking ~3x longer then they would on our primary product, I expect that ratio to more or less even out as we familiarize ourselves with the patterns and structure in the new code base.&#160; </p>
<p>The verdict&#8217;s still out on whether or not we’ll be able to add any new components of significant functionality while keeping things at all maintainable.</p>
<p>But of course that’s the challenge inherent with any software development activity!</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2009/09/maintaining-oemd-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DeveloperForce.com : Initial Thoughts and Experiences using the Platform</title>
		<link>http://littlesquare.com/2009/07/developerforce-com-initial-thoughts-and-experiences-using-the-platform/</link>
		<comments>http://littlesquare.com/2009/07/developerforce-com-initial-thoughts-and-experiences-using-the-platform/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 06:39:19 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2009/07/08/developerforce-com-initial-thoughts-and-experiences-using-the-platform/</guid>
		<description><![CDATA[The team and I have recently kicked off a rather ambitious project.&#160; In an attempt to help accelerate the early development activities, we’ve made a decision to build a series of one-off implementations using the DeveloperForce.com platform (salesforce.com sans the sales CRM portions). The objective is to learn enough about the platform during these initial [...]]]></description>
			<content:encoded><![CDATA[<p>The team and I have recently kicked off a rather ambitious <a href="http://www.genologics.com/translational-research">project</a>.&#160; In an attempt to help accelerate the early development activities, we’ve made a decision to build a series of one-off implementations using the <em>DeveloperForce.com</em> platform (<em>salesforce.com sans the sales CRM portions</em>).</p>
<p>The objective is to learn enough about the platform during these initial largely custom implementations, to be in a position to hopefully create and deliver a largely standalone solutions faster than we would using the typical Java technology stack.</p>
<p>The jury is still out, but what follows are some initial thoughts after working with the platform.&#160; The team in question are a group of 3 senior developers working collectively on an application deployed in a single Salesforce Organization.&#160; <em></em></p>
<p><em>Forgive my use or miss-use of Salesforce/DeveloperForce terminology.&#160; </em><em>It can get confusing at times <img src='http://littlesquare.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<p><strong></strong></p>
<p><strong>Version Control</strong></p>
<p>Like any good development shop, we store all code and build artifacts in source control.&#160; Subversion is our poison of choice.</p>
<p>Salesforce development is a bit different in that a lot of the configuration and development activities can occur in either the browser or their Eclipse-based IDE.&#160; </p>
<p>Our strategy for getting code and configurations under source control was to use Eclipse and regularly sync with our development organizations (<em>Salesforce jargon for a development space or area</em>).&#160; </p>
<p>Unbeknownst to us at the onset, there are certain configurations you can make using the browser that are not possible to make with the IDE.&#160; It’s important that these configurations (<em>user/queue creation, etc.</em>) are documented externally (<em>ie. in a spreadsheet</em>).</p>
<p>Code and configurations are moved between developers using Subversion and the Eclipse synchronization capabilities (or the Salesforce migration tool).&#160; By storing these artifacts in Subversion, we’re also able to do code reviews on them via Crucible.</p>
<p>Your mileage may vary with this approach, as we found the current Salesforce tooling to be quite poor at conflict resolution when it came to structural changes.&#160; Moreover, we frequently had to fall back to manually making changes via the web browser.&#160; <strong></strong></p>
<p><strong>Very annoying</strong>.&#160; </p>
<p>I think it’s safe to assume that despite all the redeeming qualities of the DeveloperForce platform, some significant gaps remain when it comes to the expectations of traditional software developers.&#160; By traditional, I mean those of us that are used to using source control, doing code reviews, etc.&#160; <strong>I guess Salesforce considers us a dying breed <img src='http://littlesquare.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>&#160;</p>
<p>Would I choose the platform to build a product I expected to maintain in the long-term and derive significant value from? <strong>No</strong>.&#160; </p>
<p>Would I use it in the short-term as a RAD environment to build a prototype? <strong>Possibly</strong>, but not without first considering some of the more traditional alternatives (<em>there are a number of schema-less data storage products available these days, combine that with a Grails, Seam, Rails or Django and you may very well be off to the races</em>).</p>
<p>&#160;</p>
<p>That’s enough for one night.&#160; I plan on doing a follow-up once the team has more experience maintaining and migrating code after it’s been deployed to DeveloperForce.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2009/07/developerforce-com-initial-thoughts-and-experiences-using-the-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate Scalability Talk</title>
		<link>http://littlesquare.com/2009/06/hibernate-scalability-talk/</link>
		<comments>http://littlesquare.com/2009/06/hibernate-scalability-talk/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 03:05:48 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[qcon hibernate]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2009/06/20/hibernate-scalability-talk/</guid>
		<description><![CDATA[Good talk from Emmanuel Bernard and Max Ross on the subject over at InfoQ. Both Hibernate Core and Shards are covered, as well as Hibernate Search. Particularly interesting for me was his overview of the different mechanisms by which you can support multiple customer schemas securely and with decent performance.&#160; The product I’m actively working [...]]]></description>
			<content:encoded><![CDATA[<p>Good <a href="http://www.infoq.com/presentations/Scaling-Hibernate-Emmanuel-Bernard-Max-Ross">talk</a> from Emmanuel Bernard and Max Ross on the subject over at InfoQ. Both Hibernate Core and Shards are covered, as well as Hibernate Search.</p>
<p>Particularly interesting for me was his overview of the different mechanisms by which you can support multiple customer schemas securely and with decent performance.&#160; The product I’m actively working on is likely headed in this direction, looks like Oracle VPD is Emmanuel’s preferred solution.&#160; A quick search has turned up an add-on for Postgres called <a href="http://veil.projects.postgresql.org/curdocs/index.html">Veil</a> which aims to provide row/column-level security similar to Oracle VPD.&#160; Good to at least have a choice, but I imagine that when push comes to shove, Oracle will win out.</p>
<p>Shards has always looked interesting, will be nice when it finally hits GA and supports the JPA API.&#160; Would make it slightly easier to incorporate and play around with.</p>
<p>Interesting thoughts on clustering Lucene/Hibernate Search.&#160; We’re currently running it asynchronously (<em>ie. @Asynchronous in Seam</em>) on a single node but will likely need to look at pushing it to a second box and trying to get indexes in near real time without noticeable degradation to the front-end.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2009/06/hibernate-scalability-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Framework misuses are still your bugs.</title>
		<link>http://littlesquare.com/2009/03/framework-misuses-are-still-your-bugs/</link>
		<comments>http://littlesquare.com/2009/03/framework-misuses-are-still-your-bugs/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 16:24:04 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2009/03/03/framework-misuses-are-still-your-bugs/</guid>
		<description><![CDATA[I spent a few hours tonight trying to diagnose a problem we were running into tonight with some web application code. That was on top of the better part of a day that was spent by another developer digging into the code. Development ain’t easy, and frameworks for all their glory strive to make the [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a few hours tonight trying to diagnose a problem we were running into tonight with some web application code.</p>
<p>That was on top of the better part of a day that was spent by another developer digging into the code.</p>
<p>Development ain’t easy, and frameworks for all their glory strive to make the easy stuff easier and the difficult stuff… well it’s still difficult.</p>
<p>Take Seam for example, a couple simple @In annotations here and there, and all of a sudden you have an application up and running.&#160; </p>
<p>But throw transactions and exceptions into the mix and the expected behaviour is up in the air.</p>
<p>Imagine the following scenario:</p>
<blockquote><p>Component A calls Component B.update() which in turn calls EntityManager.persist(someEntity).</p>
<p>someEntity fails a database constraint and an EntityAlreadyExists exception is propagated from Component B.update().&#160; </p>
</blockquote>
<p>Can Component A turn around and update someEntity and call Component B.update() again?</p>
<p>It depends.&#160; In Seam there is a RollbackInterceptor behind the scenes that will rollback any transaction crossing an injection boundary (<em>it’s slightly more complicated than that but we’ll leave that for another day</em>).&#160; </p>
<p>If Component A was a POJO Transactional Seam component, and Component B was a Seam EntityHome component, this wouldn’t work.&#160; In this sitation, Component B throwing an exception would actually rollback the transaction before control was returned to Component A.&#160; Component A could very well handle the exception but the underlying transaction would still be rolled back.</p>
<p>From the looks of the implementation, the EntityHome (<em>Component B</em>) is relying on the entity existing in its PersistenceContext when doing an update.&#160; You can update() multiple times as long as the transaction remains open and long-running.</p>
<p>Throw an exception into the mix and that transaction is likely to get rolled back by the RollbackInterceptor and the persistence context reset.</p>
<p>From that point on, calling Component B.update() (<em>equivalent to EntityHome.update()</em>) is going to report a success but do nothing but flush an empty persistence context.&#160; </p>
<p>&#160;</p>
<p>The short term fix was to have Component B.update() re-merge in <em>someEntity</em>.&#160; However, rather than perverting the framework, it likely makes sense to dig deeper into the implementations and merge Component A and Component B to prevent the RollbackInterceptor from firing and rolling back the transaction on an exception that is recoverable.</p>
<p>The things you learn!</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2009/03/framework-misuses-are-still-your-bugs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&quot;No matter how cool your interface is, less of it would be better.&quot;</title>
		<link>http://littlesquare.com/2009/02/no-matter-how-cool-your-interface-is-less-of-it-would-be-better/</link>
		<comments>http://littlesquare.com/2009/02/no-matter-how-cool-your-interface-is-less-of-it-would-be-better/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 08:02:22 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2009/02/18/no-matter-how-cool-your-interface-is-less-of-it-would-be-better/</guid>
		<description><![CDATA[Interesting little article over on InfoQ talking about Alan Cooper’s book About Face. &#160; Few key points: Design for Intermediates Users Use Tools that Help Beginners to Become Intermediates Less is More Design for the Probable, Provide for the Possible Eliminate Errors or Confirmation Dialogs &#160; There’s an interesting closing comment discussing the need (or [...]]]></description>
			<content:encoded><![CDATA[<p>Interesting little <a href="http://www.infoq.com/articles/UI-Principles-Naysawn-Naderi">article</a> over on InfoQ talking about <em>Alan Cooper</em>’s book <strong>About Face</strong>.</p>
<p>&#160;</p>
<p>Few key points:</p>
<ul>
<li>Design for Intermediates Users</li>
<li>Use Tools that Help Beginners to Become Intermediates</li>
<li>Less is More</li>
<li>Design for the Probable, Provide for the Possible</li>
<li>Eliminate Errors or Confirmation Dialogs</li>
</ul>
<p>&#160;</p>
<p>There’s an interesting closing comment discussing the need (<em>or lack there of</em>) for error or confirmation dialogs.&#160; </p>
<blockquote><p>“Cooper notes that while they [error dialogs] are used to signal that something went wrong with the code, the user tends to interpret them as “I’ve done something wrong.”&#160; When users are told that they are wrong repeatedly, they start to hate your product”</p>
</blockquote>
<p><font face="Trebuchet MS" color="#888888"></font>I suspect there’s some truth behind the statement, however all things being equal, if your product is blowing up, there’s a good chance that users aren’t going to be happy campers anyways.</p>
<p>That being said, I agree that showing an error dialog with some cryptic exception message only decipherable by the originating author, is probably not doing anyone a favor.&#160;&#160; </p>
<p>Using the Java IDE IntelliJ as an example, it’s quite rare for a user to get an actual error dialog.&#160; Instead, there’s a little status icon in the corner that will blink red whenever there’s a problem.&#160; Clicking it will provide additional details with the option of submitting it back as a bug report.&#160; </p>
<p>It’s important to remember who the user is, and considering the article’s focus on differentiating between beginner, intermediate and expert users, this <strong>status icon</strong> approach is probably best suited for intermediate/expert users, and not beginners.&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2009/02/no-matter-how-cool-your-interface-is-less-of-it-would-be-better/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good ANTLR Resource</title>
		<link>http://littlesquare.com/2008/09/good-antlr-resource/</link>
		<comments>http://littlesquare.com/2008/09/good-antlr-resource/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 06:02:06 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2008/09/12/good-antlr-resource/</guid>
		<description><![CDATA[I was playing around with ANTLR today and was at bit overwhelmed at both the detail and lack of detail in various documentation and resources I was able to find. Plenty of grammar examples kicking around but some more recent tutorials that used ANTLR v3 would have been helpful. The problem I&#8217;m trying to solve [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with ANTLR today and was at bit overwhelmed at both the detail and lack of detail in various documentation and resources I was able to find. Plenty of grammar examples kicking around but some more recent tutorials that used ANTLR v3 would have been helpful.</p>
<p>The problem I&#8217;m trying to solve is simple, define a grammar for a basic search language (<em>to potentially be extended over time</em>), parse it into an AST and manipulate appropriately.</p>
<p>After some initial frustration, I did make headway on parts 1 + 2 of the plan. We&#8217;ll see how the rest plays out next week.</p>
<p>For the benefit of others, if you&#8217;re looking to get started with ANTLR, here&#8217;s a useful introduction <a href="http://blog.centuryminds.com/2008/09/antlr-tutorial-dependency-injection-language/">blog post</a>. A quick search on dzone would have saved some trial and error.</p>
<p>For what it&#8217;s worth, getting ANTLR hooked into Maven is pretty simple and there&#8217;s decent documentation available for that. The IntelliJ plugin for ANTLRWorks is quite slick and includes a nice debugger.</p>
<p>I&#8217;m going to have to pickup <em>The Definitive ANTLR Reference</em> if this implementation pans out.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2008/09/good-antlr-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing with Unitils</title>
		<link>http://littlesquare.com/2008/08/testing-with-unitils/</link>
		<comments>http://littlesquare.com/2008/08/testing-with-unitils/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 17:49:36 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2008/08/30/testing-with-unitils/</guid>
		<description><![CDATA[I was doing some reading and came across Unitils (1.1 was just released). Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils builds further on existing libraries like DBUnit and EasyMock and integrates with JUnit and TestNG . Unitils provides general asserion utilities, support for database testing, support for [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some reading and came across <a href="http://www.unitils.org">Unitils</a> (1.1 was just <a href="http://www.theserverside.com/news/thread.tss?thread_id=50487">released</a>).</p>
<blockquote>
<p>Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils builds further on existing libraries like DBUnit and EasyMock and integrates with JUnit and TestNG .</p>
<p>Unitils provides general asserion utilities, support for database testing, support for testing with mock objects and offers integration with Spring , Hibernate and the Java Persistence API (JPA). It has been designed to offer these services to unit tests in a very configurable and loosely coupled way. As a result, services can be added and extended very easily.</p>
</blockquote>
<p>What particularly caught my attention was the support they&#8217;ve included for <em>transactional</em> test cases. By transactional, I mean test cases that will automatically cleanup after themselves. Simply include a @Transactional and you&#8217;re rocking.</p>
<p>In the past, we&#8217;ve rolled this capability ourselves with varying degrees of success. It&#8217;s easy to support rolling back of inserts but somewhat difficult to handle rolling back of deletes and other data mutations.</p>
<p>I&#8217;m just in the process of kicking off some new product development (<em>actually, we&#8217;re one week into it but who&#8217;s counting</em>) and general infrastructure (<em>testing included</em>) is something forefront on our minds.</p>
<p>For starters, we&#8217;ve got <em>Cobertura</em> and <em>Selenium</em> integrated into our build. General unit is covered with <em>TestNG</em> with Seam components integration tested using <em>SeamTest/Embedded JBoss</em>. Everything short of the <em>Selenium</em> tests are hitting freshly initialized in-memory databases.</p>
<p>It might be worth considering something like Unitils at this stage rather than building out our own tooling to accomplish much the same thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2008/08/testing-with-unitils/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seam + Groovy + Maven : Nice Simple Hibernate POJOs</title>
		<link>http://littlesquare.com/2008/07/seam-groovy-maven-nice-simple-hibernate-pojos/</link>
		<comments>http://littlesquare.com/2008/07/seam-groovy-maven-nice-simple-hibernate-pojos/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 17:52:32 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[General Discussions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2008/07/01/seam-groovy-maven-nice-simple-hibernate-pojos/</guid>
		<description><![CDATA[Being a long weekend, I had a couple hours yesterday to mess around with my Maven build in the hopes of integrating Groovy and ridding myself of a lot of Hibernate boilerplate (you know, all the annoying getters/setters). I&#8217;m currently working on a Seam-based prototype and Groovy is certainly applicable to aspects other than Hibernate [...]]]></description>
			<content:encoded><![CDATA[<p>Being a long weekend, I had a couple hours yesterday to mess around with my <em>Maven</em> build in the hopes of integrating <em>Groovy</em> and ridding myself of a lot of <em>Hibernate</em> boilerplate (<em>you know, all the annoying getters/setters</em>).</p>
<p>I&#8217;m currently working on a <em>Seam-based</em> prototype and <em>Groovy</em> is certainly applicable to aspects other than <em>Hibernate</em> but it was a good initial goal.</p>
<p><strong>Required POM Changes</strong></p>
<pre>
&lt;build&gt;
&lt;plugins&gt;
    &lt;plugin&gt;
        &lt;groupId&gt;org.codehaus.groovy.maven&lt;/groupId&gt;
        &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt;
        &lt;version&gt;1.0-rc-2&lt;/version&gt;
        &lt;executions&gt;
            &lt;execution&gt;
                &lt;goals&gt;
                    &lt;goal&gt;generateStubs&lt;/goal&gt;
                    &lt;goal&gt;compile&lt;/goal&gt;
                    &lt;goal&gt;generateTestStubs&lt;/goal&gt;
                    &lt;goal&gt;testCompile&lt;/goal&gt;
                &lt;/goals&gt;
            &lt;/execution&gt;
        &lt;/executions&gt;
    &lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
</pre>
<p><em><strong>The gmaven plugin is able to cross-compile Java and Groovy. The compilation phase will generate Java stubs corresponding to the groovy classes prior to compiling the actual Java classes. This allows for seamless dependencies to exist between Groovy and Java.</strong></em></p>
<p><em><strong>It&#8217;s important to note that your Groovy sources must (by default) be in a <span style="text-decoration: underline;">src/main/groovy</span> folder.</strong></em></p>
<pre>
&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.codehaus.groovy.maven.runtime&lt;/groupId&gt;
        &lt;artifactId&gt;gmaven-runtime-default&lt;/artifactId&gt;
        &lt;version&gt;1.0-rc-2&lt;/version&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
</pre>
<p><strong>Results</strong></p>
<p>Simple as that. <em>Unit tests passed!</em></p>
<p>I&#8217;m able to take a class that looked like:</p>
<pre>
@Entity
public class Annotation
{
    private Long id;
    private String name;

    private Specimen specimen;
    private Patient patient;

    /**
     * Getter for property 'id'.
     *
     * @return Value for property 'id'.
     */
    @Id @GeneratedValue
    public Long getId()
    {
        return id;
    }

    /**
     * Setter for property 'id'.
     *
     * @param id Value to set for property 'id'.
     */
    public void setId(Long id)
    {
        this.id = id;
    }
...
}
</pre>
<p>and make it look like:</p>
<pre>
@Entity
public class Annotation
{
    @Id @GeneratedValue
    Long id;

    @Length(max=50) @NotNull
    String name;

    @ManyToOne @JoinColumn(name = "specimen_id")
    Specimen specimen;

    @ManyToOne @JoinColumn(name = "patient_id")
    Patient patient;
}
</pre>
<p>Much simpler and without a lot of unnecessary boilerplate.</p>
<p><strong>Gotchas</strong></p>
<p>Just a couple of things to be aware of. Simple stuff really if you actually read documentation and know what you&#8217;re doing <img src='http://littlesquare.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Firstly, Groovy sources have to live in <em>src/main/groovy</em>.</p>
<p>Secondly, don&#8217;t add private modifiers to your attributes if you want the generated Groovy stubs to include getters/setters. This is probably more obvious if you&#8217;re creating your Groovy classes from scratch. I forgot to remove them when I was converting from a Java POJO and had a minor WTF moment.</p>
<p>Next step will be to see how much Groovy could potentially be leveraged for other aspects of the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2008/07/seam-groovy-maven-nice-simple-hibernate-pojos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipise Memory Analyzer (MAT)</title>
		<link>http://littlesquare.com/2008/06/eclipise-memory-analyzer-mat/</link>
		<comments>http://littlesquare.com/2008/06/eclipise-memory-analyzer-mat/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 00:10:26 +0000</pubDate>
		<dc:creator>ajordens</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[citations]]></category>

		<guid isPermaLink="false">http://littlesquare.com/2008/06/28/eclipise-memory-analyzer-mat/</guid>
		<description><![CDATA[I must say the Eclipse Memory Analyzer looks pretty slick. There is some pretty good material over on the developers blog. Lastly, there was a talk on it at JavaOne 2008 titled &#8216;Automated Heap Dump Analysis for Developers, Testers, and Support Employees&#8216; (multimedia recording). The Eclipse Memory Analyzer is a fast and feature-rich Java heap [...]]]></description>
			<content:encoded><![CDATA[<p>I must say the <a href="http://www.eclipse.org/mat/">Eclipse Memory Analyzer</a> looks pretty slick. There is some pretty good material over on the <a href="http://dev.eclipse.org/blogs/memoryanalyzer/">developers blog</a>. Lastly, there was a talk on it at JavaOne 2008 titled &#8216;<em>Automated Heap Dump Analysis for Developers, Testers, and Support Employees</em>&#8216; (<a href="http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5729&amp;yr=2008&amp;track=tools">multimedia recording</a>).</p>
<blockquote>
<p>The Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.</p>
<p>The Memory Analyzer was developed to analyze productive heap dumps with hundreds of millions of objects. Once the heap dump is parsed, you can re-open it instantly, immediately get the retained size of single objects and quickly approximate the retained size of a set of objects. The reference chain to the Garbage Collection Roots then details why the object is not garbage collected.</p>
<p>Using these features, a report automatically extracts leak suspects. It includes details about the objects accumulated, the path to the GC Roots, plus general information like system properties.</p>
</blockquote>
<p>The tool was actually contributed by SAP and is currently an incubation project over at Eclipse. It&#8217;s available as both an <em>eclipse feature</em> and a standalone <em><strong>eclipse RCP</strong></em> application.</p>
<p>Kudos to the team for taking the time to provide a standalone package!</p>
]]></content:encoded>
			<wfw:commentRss>http://littlesquare.com/2008/06/eclipise-memory-analyzer-mat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
