<?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>byte bohemian &#187; Java</title>
	<atom:link href="http://nicl.net/category/technology/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicl.net</link>
	<description></description>
	<lastBuildDate>Sat, 15 May 2010 20:51:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Contemporary Software Development: Building</title>
		<link>http://nicl.net/2010/05/contemporary-software-development-building/</link>
		<comments>http://nicl.net/2010/05/contemporary-software-development-building/#comments</comments>
		<pubDate>Sat, 15 May 2010 20:51:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Agile software development]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Buildr]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=68</guid>
		<description><![CDATA[The subject of my first post of the series "Contemporary Software Development" will be building. How to build your software project is a decision which is made quite early when you start developing.
Unfortunately in a lot of projects this very important topic does not get the appreciation it deserves. On one hand side it's a [...]]]></description>
			<content:encoded><![CDATA[<p>The subject of my first post of the series "Contemporary Software Development" will be building. How to build your software project is a decision which is made quite early when you start developing.</p>
<p>Unfortunately in a lot of projects this very important topic does not get the appreciation it deserves. On one hand side it's a very sad story of suffering and endurance. On the other hand side we are talking about a lot of wasted money.<span id="more-68"></span>In my career as software engineer I experienced some different approaches to the project setup and the build process.</p>
<p>It started with something like <code>find . -name '*.java' | xargs javac</code>, which worked quite well for the first weeks of my professional career. But with a couple of software developer working on a project <em>you want something more standardized.</em></p>
<p>So we went on with <code>make</code><a href="http://www.gnu.org/software/make/">(*)</a>. I guess most of the software engineers will know this build tool which still is a standard tool in the Unix/Linux world. <code>make</code> is a very powerful tools but has its peculiarities also. The <code>make</code> grammar is very delicate when it comes to white spaces. I quess quite a few people sat over a broken <code>make</code> build when a <code>TAB</code> char wasted your build script.</p>
<p>In the Java world <a href="http://ant.apache.org/">Apache Ant</a> was the successor to <code>make</code> in my career. The problem with <code>make</code> and the Java world is, that make is not really platform independent. There are <code>make</code> ports for Microsoft Windows but (at least when I made the jump from <code>make</code> to Ant) it does not work very well. So if you have a heterogeneous environment e.g. you develop on Microsoft Windows and you deploy into a Linux based cloud, <em>you want your build to to be platform independent.</em></p>
<p>A nice story about platform independence. I did some consulting in a project for the Deutsche Bank Italy and a very large (and expensive) consulting company provided the BEA Weblogic build and setup. I am not 100% sure but I guess it was an <a href="http://ant.apache.org/">Apache Ant</a> based build. One major issue was the application server integration integration. To solve it, the complete project was placed and build in the application server which was committed in to the CVS source control management system. The delivery artifact was - of course - delivered without the application server. But this leads to another wish I have when I am using a build. <em>You want the build to credit the current  environment.</em> If you are building for your local development environment you may have different requirements concerning the built artifact as when you are creating an artifact that will be deployed on staging or productive environment.</p>
<p>Back on memory lane: <a href="http://ant.apache.org/">Apache Ant</a> worked pretty well for some years and a couple of projects. But one thing that started to annoy me. Every project was using a slightly build setup so in the daily business there were always searching for artifacts or checking library versions.</p>
<p>Some former colleagues introduced me to <a href="http://maven.apache.org/">Apache Maven</a>. I started with <a href="http://maven.apache.org/maven-1.x/index.html">Maven 1</a> which is a quite interesting mixture of <a href="http://ant.apache.org/">Ant</a> with a framework that offered the possibility to manipulate the Ant build file during the runtime. But <a href="http://maven.apache.org/">Apache Maven</a> had some features which I hat to get used to.<br />
An example is the rigid directory structure defined in a Maven build: Why do I have to follow them? I want my special directory names! But nowadays I love this structure which is equal in every project. You find your files so fast now and even in foreign project. That's another thing that you want: <em>You want your builds to follow standards, so you can get familiar with the project in very short time.</em> If you are working in the software business a couple of years, may have already realized that you will see very much projects during a professional career and standard projects and processes will make your life much more easy.</p>
<p>Let's talk about some goodies now which modern build system offer. I will use <a href="http://maven.apache.org/">Apache Maven</a> as example but other systems like <a href="http://rake.rubyforge.org/">rake</a> or <a hef="http://buildr.apache.org/">buildr</a> offer similar functions.</p>
<p>One thing I love/hate is dependency management. When I started with make or ant, we where committing all libraries into our CVS. Which worked quite well, in most cases you could check our the project, performed the initial build and started to work. But there where lots of minor but very nasty problems. Starting from which library version is really used to incompatibilities of the build tool version. </p>
<p>With the <a href="http://maven.apache.org/">Apache Maven</a> dependency resolution mechanism a new area begun. If you are having one independent project the mechanism is pretty easy to use. You define the libraries you want to use in your <code>pom.xml</code> and maven takes care of the rest. Okay if you want to use libraries which are not in the maven central repository it's a little more complicated <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>If you are having a multi module/project environment things will get messy pretty easy, but: They would also if you don't use the dependency management mechanism. You ask why? When you don't use this mechanism you'll normally have a huge monolithic project in your SCM system which will get even more difficult to manage or build. So you <em>want to have a transparent dependency management in your build system</em>. With <a href="http://ant.apache.org/ivy/">Ivy</a> for example you'll have an add-on which offers the possibility to have an dependency management when you are using <a href="http://ant.apache.org/">Ant</a>.</p>
<p>Another goodie is release management. It's very handy if you start a build to create your release artifact and your tag (or something similar) in the SCM system of your choice. <em>You want your release process embedded in your build system, so you can perform the build when you are creating your release.</em></p>
<p>Another important topic is testing. You <em>really want your build tool to support your testing facilities.</em> At least when you create your release or deployment artifact you want your build to automatically run your test suite.</p>
<p>I have only one topic left in this post, that is IDE support. Unfortunately most modern IDE like <a href="http://www.eclipse.org/">Eclipe</a>, <a href="http://netbeans.org/">Netbeans</a> or <a href="http://www.jetbrains.com/idea/">Intellij IDEA</a> offer a IDE specific build. This this very comfortable if you have a small project and what to deal only with your IDE. But you'll grow really beyond this (my experience). But integration into other build tools is sometimes really poor. So you have to check how you can bridge the gap between your IDE and the build tool. E.g. the maven directory structure troubles some IDE<br />
standard configurations. Fortunatly more and more projects provide solutions for this.</p>
<p>So let's have a quick resume. This is what you should want in your build system:</p>
<ul>
<li>standardized process</li>
<li>platform indipendence (if your need it)</li>
<li>credit current environment</li>
<li>standardized structures</li>
<li>dependency management</li>
<li>embeddable release process (including SCM support)</li>
<li>support of your test tools</li>
<li>IDE support</li>
</ul>
<p>I think this list is not too lang and offers some major improvements for your daily work. So if your build process is missing some items from this list, you maybe should think about your build process. And remember: Your development resources are far to valuable to be wasted in an inefficient build process <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2010/05/contemporary-software-development-building/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Virtual Pages with Tapestry 5</title>
		<link>http://nicl.net/2010/03/virtual-pages-with-tapestry-5/</link>
		<comments>http://nicl.net/2010/03/virtual-pages-with-tapestry-5/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 15:13:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tapestry]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=62</guid>
		<description><![CDATA[Some of you may know Apache Tapestry 5 already. It's a very great framework for building web applications. In my opinion you'll won't find a framework this mature and production ready very easy. Tapestry 5 covers a wide variety of topics related to the creation of state-of-the-art web applications. So it's no surprise that Howard [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you may know <a href="http://tapestry.apache.org/tapestry5/">Apache Tapestry 5</a> already. It's a very great framework for building web applications. In my opinion you'll won't find a framework this mature and production ready very easy. Tapestry 5 covers a wide variety of topics related to the creation of state-of-the-art web applications. So it's no surprise that <a href="http://tapestryjava.blogspot.com/">Howard Lewis Ship</a> the creator/founder of the Tapestry Project joined the ranks of the <a href="http://tapestryjava.blogspot.com/2010/03/java-champion.html>"Java Champions</a>. So congratulations from here <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>But back on topic: One fundamental rule of the Tapestry 5 framework is, that each page has a corresponding class which contains all (java-) logic for this page. This mechanism works sole with convention over configuration and there is no exception to this rule. At least in standard Tapestry 5 ...<span id="more-62"></span>In the company I used to work we depended on Tapestry pretty heavy. We had created a couple very good solutions using this framework but we also had some challenges to meet. I guess they are pretty common to web based companies.</p>
<ul>
<li>We had to use a CMS system (<a href="http://www.magnolia-cms.com/home.html">Magnolia CMS</a> in this case) to enable the marketing and non-techical guys to maintain all the content they are creating.</li>
<li>We had to maintain a couple of so called landing pages. I guess most of the web guys know and hate them <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  These pages are just an empty shell containing nothing more than some sightly different logos and graphics of partner companies. The also provide a nice URL in most cases like: <code>http://www.mycomany.com/tv</code>, <code>/mobile</code> or <code>/unameit</code>. Unfortunately some of these landing pages hade some minor dynamical stuff on it. </li>
<li>Most of this landing pages require that you are storing some (voucher) code into your application to modifier your check-out process a little bit.</li>
</ul>
<p>So, now you have a couple of pages, of which you don't know when they appear - and you really don't want to know, because coordinating the timing with the marketing guys is always a mess <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  -, with very similar structure and functionality. As a matter of fact this case should be a text book example for component reuse. but this is a case where Tapestry 5 and the convention-over-configuration thing works against us.</p>
<p>So what do you have to do in classic Tapestry 5? Jepp you allready guessed it, you have to create a page class for each of this landing pages. Okay thanks to inheritance this class will be de-facto empty. But it is annoying to create this class. You'll have to create a version of your web application, do a QA cycle (if you want to play it right), make a deployment. So you have a lots of communication with a bunch of other departments. In a world with perfect processes you might to accept this, but I guess most of the guys out there know the situation where a junior business consultant guy stands right at your desk telling you of the nation wide TV campaign that launches tomorrow and that needs this new landing page. Maybe some of you already tried to say the 'n*' word <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>A early solution was to introduce some Meta templates in out CMS. They were some simple HTML comments which where evaluated by a service in our web application and re-assembled via simple Tapestry pages and components. This worked quite well but brought us a bunch of issues - like template caching, dynamic contents in templates, etc. -  which are already solved in Tapestry. The solution was also pretty limited in when dynamical and statical parts should be joined together. So I took some time to evaluate a different approach:</p>
<p><i>My first question was:</i> Is it possible to make tapestry work with pages that do not have a class as backup?</p>
<p>I never tried this, because I figured out, that I actually didn't want to do this, and as a matter of fact, it makes the whole exercise a lot easier. What I did was to make Tapestry use a default class for pages tapestry does not know. I call this pages <i>virtual</i> pages. I'll guess you always have some minor data shared between all virtual pages, so you create on page class that Tapestry may use to serve <i>virtual</i> pages.</p>
<p>So how you serve <i>virtual</i> pages with Tapestry 5.1? I was surprised who simple it was (after some month of the wrong track). So this is, how <i>virtual</i> pages may work:</p>
<ol>
<li><b>Check if the page exists</b><br />A good place to do this is the <code>ComponentClassResolver</code> with its <code>isPageName(..)</code> method. I created a <a href="http://github.com/niclasmeier/tapestry-virtual-pages/blob/master/src/main/java/net/nicl/virtualpages/services/DecoratedComponentClassResolver.java">special implementation</a> of the  <code>ComponentClassResolver</code> which decorates the Tapestry original.</li>
<li><b>Mark the request</b><br />Mark the request as request to a virtual page. I used a <a href="http://github.com/niclasmeier/tapestry-virtual-pages/blob/master/src/main/java/net/nicl/virtualpages/services/VirtualPageData.java">dedicated service</a> with thread scope for this. You also may compute and store some data in this service.</li>
<li><b>Alter page class loading</b><br />Adapt the loading of the component classes to load (and attach) the default class to the page. <a href="http://github.com/niclasmeier/tapestry-virtual-pages/blob/master/src/main/java/net/nicl/virtualpages/services/DecoratedComponentInstantiatorSource.java">Another decorated service</a> does the work here too.</li>
</ol>
<p>And voila you can deliver content for pages with no backing class, astonishing isn't it? You may look at the <a href="http://github.com/niclasmeier/tapestry-virtual-pages">small prototype/example project at github</a> and you'll realize how simple the solution is. The prototype is a slightly modified Tapestry 5 archetype project which will serve the URL <code>http://localhost:8080/About</code> as virtual page.</p>
<p>So far, so good! But now some last words if this is a good solution at all. First I want to mention that we had an integration ready for the architecture we used, but it went - for several reasons, most non-technical - never productive.</p>
<p>Let's talk about some oddities first:</p>
<ul>
<li>The URLs to address the pages do not fully comply the Tapestry behaviour. In Tapstry it does not matter if you request <code>/About</code> or <code>/about</code>, but the prototype only supports a simple template resolution.</li>
<li>Some Tapestry components/mechanisms won't work properly. Tapestry uses classes to compute links to pages. Always when this mechanism is used, you'll may get problems. Components like <code>&lt;t:pagelink ...&gt;</code> may not work properly because you do not have a class. Keep this in mind.</li>
<li>Unexpected Runtime and memory behaviour. Tapestry is a very stable and production ready framework. But we are misusing it a little bit. Keep a close eye on memory consumption because every HTML page will now be a tapestry template and will be cached in the memory of your virtual machine. Some of some infrastructure components are also optimized for a (relatively) small amount of page instances.</li>
</ul>
<p><i>Why do I want to use Tapstry this way?</i> The first advantage is the simple creation of new pages. You'll create the <code>.tml</code> file and you are done. We used it with a CMS in the background and with some specialized CMS templates the marketing guys where able to create a bunch of landing pages without troubling an IT guy. In addition to the standard page we used some components which contained the major functions of the pages. So we were able to create instance of this virtual pages which behaved sightly different because we passed some parameters using the <code>TML</code> of the virtual page.</p>
<p><i>Why does not offer Tapestry this mechanism?</i> First: It's a prototype! If you take a closer look you will se how limited it is. This topic as hole comes across the tapestry mailing list regularly and there are lots of pro's and con's. I don't want to discuss any of them in this blog post. But I agree with the Tapestry guys not to introduce it into the core framework.</p>
<p>At the time I was evaluating this prototype I had some very good reasons to do so and only a few are mentioned here. But if you have a big amount of content it is seldom a good idea to generate templates which are interpreted by a dynamic framework. No matter if you use JSP, Tapestry or even PHP.</p>
<p>I hope you'll enjoyed reading this blog post. I learned much about Tapestry 5 preparing it and evaluating my idea. If you have questions of any kind feel free to contact me <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2010/03/virtual-pages-with-tapestry-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a domain specific  language with XML-Schema and JAX-B</title>
		<link>http://nicl.net/2010/01/creating-a-domain-specific-language-with-xml-schema-and-jax-b/</link>
		<comments>http://nicl.net/2010/01/creating-a-domain-specific-language-with-xml-schema-and-jax-b/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 11:32:30 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Domain Specific Languages]]></category>
		<category><![CDATA[JAX-B]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Magnolia CMS]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=56</guid>
		<description><![CDATA[Here at scoyo we use the Magnolia CMS to manage our website content. It's a quite nice tool based on the Content Repository API for Java (JCR) (JSR-170). In this blog post I want to tell you a little more about a small domain specific language, which I created to manage the migration of content [...]]]></description>
			<content:encoded><![CDATA[<p>Here at <a href="http://www.scoyo.de">scoyo</a> we use the <a href="http://www.magnolia-cms.com">Magnolia CMS</a> to manage our website content. It's a quite nice tool based on the <a href="http://en.wikipedia.org/wiki/Content_repository_API_for_Java">Content Repository API for Java (JCR)</a> (<a href="http://jcp.org/en/jsr/detail?id=170">JSR-170</a>). In this blog post I want to tell you a little more about a small domain specific language, which I created to manage the migration of content and configuration of our <a href="http://www.magnolia-cms.com">Magnolia CMS</a> installation, using XML-Schema, JAX-B and the facilities of the CMS.</p>
<p><span id="more-56"></span>To introduce you a little more into the domain. When using a CMS with some other software components you'll have a situation very similar like having a database. You have content which other (non-tech type) people manage and if you change your application sometimes you'll have to change the content - or worse the structure of the content - too. In the database world there is a <a href="http://www.amazon.com/Refactoring-Databases-Evolutionary-Database-Design/dp/0321293533/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1262857005&#038;sr=8-1">very nice book regarding the refactoring of databases</a>.</p>
<p>As a solution to this issue the magnolia CMS offer some API related to the <code> info.magnolia.module.ModuleVersionHandler</code>. This API's offers the possibility to define <code>info.magnolia.module.delta.Task</code>s which may be related to specific module version. So the CMS may discover on startup time which <code>Task</code>s to execute when migrating e.g. from module version 1.4.2 to 1.4.6. This is very nice because you can load partial XML content dumps or move some content (or configuration) nodes around. </p>
<p>Unfortunately you'll have to do this while program the update procedure in Java in your <code>ModuleVersionHandler</code>. To close this gap we introduced an own domain specific language using XML. I refer to this as DSL because it evolved to be much more like a simple XML config file, I'll hope you'll get the point later on. The inspiration gave a <a href="http://www.menzel.com/">freelance contractor</a> with very deep <a href="http://www.magnolia-cms.com">magnolia</a> know-how. So here is how I did it:</p>
<p>First of all the <code>ModuleVersionHandler</code> has to deliver all the information defined in the XML file, so you'll have to override it. So we subclassed the <code>info.magnolia.module.DefaultModuleVersionHandler</code> to override methods like <code>getExtraInstallTasks(...)</code>. This new version handler is responsible for reading the XML file, and converting it into the objects that magnolia handles.</p>
<p>Next step was to define a XML format. It should be an expressive format, nice to read and easy to understand. So waived of standard formats or facilities like the <a href="http://www.springframework.com/">Springframework</a> which also offers facilities to assemble object graphs from XML files. The format we choose looks like:</p>
<pre>
&lt;updates&gt;
	&lt;version number="1.5.0"&gt;
		&lt;description&gt;Changed implementation of header selection&lt;/description&gt;
		&lt;updates&gt;
			&lt;load file="config.modules.scoyo.dialogs.pageProperties.xml"/&gt;
			&lt;if-exists repository="WEBSITE" node="/en"&gt;&lt;then&gt;
				&lt;set-property node="/de" repository="WEBSITE" property="reportSuiteIdLive"&gt;&lt;value&gt;test_en&lt;/value&gt;&lt;/set-property&gt;&lt;/then&gt;
			&lt;/if-exists&gt;

 		&lt;/updates&gt;
	&lt;/version&gt;
&lt;/updates&gt;
</pre>
<p>which is quite nice to read and you'll have your documentation in the right place. In order to automatically process it using JAX-B you'll have to define a <a href="http://www.w3.org/XML/Schema">XML-Schema</a> which will be used to generate your Java bindings. Besides this it's always good to have a XML-Schema, I'll give you some further examples later <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Our schema looks like this (at least in eclipe)<br />
<img src="http://nicl.net/wp-content/uploads/2010/01/Eclipse.png" alt="Eclipse.png" border="0" width="588" height="575" /></p>
<p>We defined some elements (as seen on the left hand side). Each of this elements contains some attributes (or inner elements) which are passed to the magnolia <code>Task</code>s. The clou of this XML-Schema is the <code>Task</code> type and the <code>&lt;task /&gt;</code> element. The <code>&lt;task /&gt;</code> element is an element, which all elements defining a specific task (e.g. <code>&lt;load /&gt;</code>) must have as substitution group. Doing this allows on every place where a <code>&lt;task /&gt;</code> may be placed in XML another element of this substitution group may be placed too. In fact you'll never use <code>&lt;task /&gt;</code> but always use a specific element like <code>&lt;load /&gt;</code>. The <code>Task</code> XML type covers the XML type part of the <code>&lt;task /&gt;</code> element, when generating the XML bindings the <code>Task</code> XML type will be translated into an abstract super class for all specific types like the <code>Load</code> XML type, which defines the structure of the <code>&lt;load /&gt;</code> element.</p>
<p>To generate the XML binding classes from the XML-Schema we use the <a href="http://maven.apache.org/">Apache Maven 2</a> plugin from <a href="http://mojo.codehaus.org/">the Codehaus mojos</a>. You may configure it like this:</p>
<pre>
&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
    &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.2&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
        	&lt;id&gt;bootstrap&lt;/id&gt;
        	&lt;phase&gt;generate-sources&lt;/phase&gt;
            &lt;configuration&gt;
            	&lt;schemaFiles&gt;bootstrap_1_2.xsd&lt;/schemaFiles&gt;
                &lt;packageName&gt;...&lt;/packageName&gt;
            &lt;/configuration&gt;
            &lt;goals&gt;
                &lt;goal&gt;xjc&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
    &lt;configuration&gt;
    	&lt;verbose&gt;true&lt;/verbose&gt;
        &lt;outputDirectory&gt;${project.build.directory}/generated-sources/java&lt;/outputDirectory&gt;
        &lt;clearOutputDir&gt;false&lt;/clearOutputDir&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
<p>The JAX-B bindings will produce nice annotated java beans which you can use in the further work. Another nice side effect of using JAX-B is, that it's blazing fast compared to use DOM or XPath processing of your XML files. Another nice effect of having an XML-Schema.</p>
<p>So, after defining the XML-Schema and generating the JAX-B binding the next thing to do is to unmarshal the data from the XML file (or <code>InputStream</code>) which is not more than 20 lines of standard java code. Then you have an object graph representing the XML and the only thing left is to create the objects you (or the Magnolia CMS) need from this object graph. This should be an accomplishable task for a serious developer <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I choose to create a generic mapper interface like</p>
<pre>
interface TaskHandler<t extends com...xml.Task> {
	info.magnolia.module.delta.Task create(T xmlTask);
}
</t></pre>
<p>and use a <code>java.util.Map</code> to determine the right <code>TaskHandler</code> instance for a XML task bean instance and voila I had all the <code>info.magnolia.module.delta.Task</code> instances which where defined in XML. Some glue code which does some sorting and other stuff completed my <code>ModuleVersionHandler</code>. A <code>TaskHandler</code> implementation could look like this:</p>
<pre>
dictionary.put(Load.class, new TaskHandler<load>(Load.class) {
    @Override
    public Task create(Load xmlTask) {
        String name = name(xmlTask, String.format("Load file '%s'.", xmlTask.getFile()));
        String description = description(xmlTask, String.format("Load file '%s' for XML import.", xmlTask.getFile()));
        String resource = String.format("/mgnl-bootstrap/%1$s/%2$s", moduleName, xmlTask.getFile());
        return new BootstrapSingleResource(name, description, resource,
                javax.jcr.ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
    }
});
</load></pre>
<p>I used an anonymous inner class an add the instance directly to the dictionary mapping all JAX-B types to the <code>TaskHandler</code>. The task handler itself uses the getter from the XML bean to create a new instance of the <code>BootstrapSingleResource</code> task. You will mention that the name of the element (<code>&lt;load /&gt;</code>) is more readable. One of the benefits using a specialized domain specific XML file.</p>
<p>I promised to give some more advantages of having an XML-Schema. Another Advantage is that you may validate the XML (quite boring) and when you deploy the XML to a public location (e.g. a web server) you will get auto completion in Eclipse. Which is very nice!</p>
<p>So my resume: Sometimes it's more than only nice to have a solution specific to the problem domain. With very little effort you are able to create this solution using XML-Schema and JAX-B technology stack. The result in this case was a well documented XML format which can handle various content migration scenarios. With some further levels of indirections (which were very simple) I was able to introduce programming language constructs like conditions (e.g. the <code>&lt;if-exists repository="WEBSITE" node="/en" /&gt;</code> element). I guess it's okay to call it a language now, isn't it?</p>
<p>There are many situation where standard soultions like the <a href="http://www.springframework.com/">Springframework</a> (or the <a href="http://en.wikipedia.org/wiki/SOAP">SOAP</a> message XML format) are the best choice to quickly assemble an object graph, but when the XML (or the content in general) is object to changes made by humans it's always worth to consider a more human readable variant.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2010/01/creating-a-domain-specific-language-with-xml-schema-and-jax-b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating dynamic PDF, or another reason to like Apache Tapestry</title>
		<link>http://nicl.net/2009/08/creating-dynamic-pdf-or-another-reason-to-like-apache-tapestry/</link>
		<comments>http://nicl.net/2009/08/creating-dynamic-pdf-or-another-reason-to-like-apache-tapestry/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 20:40:29 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Tapestry]]></category>
		<category><![CDATA[The Flying Saucer Project]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=45</guid>
		<description><![CDATA[I am using Apache Tapestry 5 on my job since February of this year. Today was another of these days when I am pretty sure why it is a good idea to use this framework.
Last week we started the new sprint for the scoyo feature release which will be release on end of September. A [...]]]></description>
			<content:encoded><![CDATA[<p>I am using <a href="http://tapestry.apache.org/">Apache Tapestry 5</a> on my job since February of this year. Today was another of these days when I am pretty sure why it is a good idea to use this framework.<br />
<span id="more-45"></span>Last week we started the new sprint for the <a href="http://www-de.scoyo.com">scoyo</a> feature release which will be release on end of September. A website feature may require the dynamic creation of PDF files so I evaluated the possibilities of the <a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer Project"</a>, a XML/XHTML/CSS 2.1 rendering engine.</p>
<p>I already made some experiences with the <a href="https://xhtmlrenderer.dev.java.net/">Flying Saucer</a> on another job and it is still a very nice framework for PDF creation. For me, a major advantage of <a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer"</a> over other PDF creation frameworks, like XSLT and <a href="http://xmlgraphics.apache.org/fop/">FOP</a>, in the Web world is the homogenous technology mix.</p>
<p><a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer Project"</a> create PDF from XML/XHTML pages using CSS style sheets. All technologies known to the web designer that gives your web site this pretty look. I guess it's okay when you say, that XSLT and <a href="http://xmlgraphics.apache.org/fop/">FOP</a> is the more powerful technology mix, but styling pages on this technology mix is not a simple task to do.</p>
<p>So back to the initial topic: A basic ingredient which is needed to create PDFs with the <a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer Project"</a> is some XHTML. In our project at <a href="http://www-de.scoyo.com">scoyo</a> we wanted to use <a href="http://tapestry.apache.org/">Apache Tapestry</a> to create this XHTML.</p>
<p>After taking a closer look to the <a href="http://tapestry.apache.org/">Apache Tapestry</a> rendering pipeline I found out, that the <code>PageResponseRenderer</code> is the perfect place to hook up the PDF creation into the rendering process. On the one hand the <code>PageResponseRenderer</code> uses a <code>MarkupWriter</code> to create the (X)HTML content from the current <code>Page</code> instance. On the other hand the <code>PageResponseRenderer</code> is responsible for writing the generated content into the server response.</p>
<p>Using the <a href="http://tapestry.apache.org/">Apache Tapestry</a> own IoC mechanism it's quite an easy task to decorate the <a href="http://tapestry.apache.org/">Tapestry</a>  <code>PageResponseRenderer</code> implementation. It's a beautiful mechanism when you understood how it works. Okay I guess using the 5.1 version of tapestry it would be better to advice the <code>renderPageResponse(...)</code> method, but I had not enough time to get familiar with it yet.</p>
<p>One real big plus on <a href="http://tapestry.apache.org/">Apache Tapestry</a> is the implementation. Every function is well encapsulated into separate services. And the service implementing classes are very short and almost always on consistent level of abstraction. So you easily understand how a service works and you are able to copy and extend the service functions. So I extended <code>PageResponseRenderer</code> to determine if a page creates XHTML output which should be transformed to PDF. If no PDF should be created my <code>PageResponseRenderer</code> simply delegates to the original Tapestry instance.</p>
<p>When the page wants to create PDF my <code>PageResponseRenderer</code> buffers the created content and redirects it into the <code>ITextRenderer</code> of the a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer". Okay this sounds more nice, than it actually is. The content is stored into a <code>ByteArrayOutputStream</code> and re-parsed by the standard JDK XML parser for further processing by the <code>ITextRenderer</code>. But I guess the we will live with the performance impact until it gets a real issue.</p>
<p>So long explanation short story. The whole thing worked out great! It took me like two to three hours to implement a first prototype. In out web application. This also includes the embedding of custom fonts into the PDF and a nice discovery of pages to render into PDF, via custom annotations using the component model meta-data facilities and a <code>ClassTransformationWorker</code>.</p>
<p>Web development can be so easy when you are using <a href="http://tapestry.apache.org/">Apache Tapestry</a>. On an earlier project we used a similar architacture with JSP and the <a href="https://xhtmlrenderer.dev.java.net/">"The Flying Saucer"</a>. I guess it took us ten times the effort to establish an equal infrastructure using JSF and the Java Servlet API ...</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/08/creating-dynamic-pdf-or-another-reason-to-like-apache-tapestry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New jaev Release</title>
		<link>http://nicl.net/2009/07/new-jaev-release/</link>
		<comments>http://nicl.net/2009/07/new-jaev-release/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 18:42:16 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tapestry]]></category>
		<category><![CDATA[google wave]]></category>
		<category><![CDATA[jaev]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=41</guid>
		<description><![CDATA[Today I made a new release of the jaev Framework for "advanced" e-mail validation. After being in productive use for quite some month now it was about time to offer a bugfix release. Some issues with domains containing no MX but an A DNS record where resolved. E-mail belonging to this kind of domains will [...]]]></description>
			<content:encoded><![CDATA[<p>Today I made a new release of the <a href="http://jaev.googlecode.com">jaev Framework</a> for "advanced" e-mail validation. After being in productive use for quite some month now it was about time to offer a bugfix release. Some issues with domains containing no MX but an A DNS record where resolved. E-mail belonging to this kind of domains will now be accepted. An issue with a file handle leak due to unclosed UDP connections during the DNS lookup was also fixed.</p>
<p>Due to the generosity of Google I got a nice <a href="http://wave.google.com/">Google wave</a> test account. Now I am looking desperately to some spare time to evaluate the integration of <a href="http://jaev.googlecode.com">jaev</a> to the <a href="http://wave.google.com/">wave</a>. One idea is to expand the validation to wave addresses via the <a href="http://www.waveprotocol.org/">wave protocol</a>. Maybe an online validation as wave bot is another exciting idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/07/new-jaev-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jaev 1.0 released</title>
		<link>http://nicl.net/2009/05/jaev-10-released/</link>
		<comments>http://nicl.net/2009/05/jaev-10-released/#comments</comments>
		<pubDate>Sat, 30 May 2009 10:31:11 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tapestry]]></category>
		<category><![CDATA[jaev]]></category>

		<guid isPermaLink="false">http://87.106.3.237/?p=35</guid>
		<description><![CDATA[After some weeks the third release candidate of the jaev was the final one yesterday.
The jaev framework is in productional use at least one installation and no major problems where filed so far. I'm keeping my fingers crossed  
I am working already on some new features:

Caching negative responses of mail serversWhen a mail server [...]]]></description>
			<content:encoded><![CDATA[<p>After some weeks the third release candidate of the <a href="http://code.google.com/p/jaev/">jaev</a> was the final one yesterday.</p>
<p>The <a href="http://code.google.com/p/jaev/">jaev</a> framework is in productional use at least one installation and no major problems where filed so far. I'm keeping my fingers crossed <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I am working already on some new features:</p>
<ul>
<li>Caching negative responses of mail servers<br />When a mail server refuses communication due to suspected spam, the result will be cached to reduce network traffic.</li>
<li>Suggest e-mail addresses<br />When the validation fails suggest a list e-mail addresses. This algorithm may use the previous request and a default list of domains to compute some suggestions.</li>
</ul>
<p>If you have any good ideas, file them on the <a href="http://code.google.com/p/jaev/issues/list">issue tracking system</a> or the <a href="http://groups.google.com/group/jaev-users/topics">google group</a>.</p>
<p>Maybe I am applying for a <a href="http://wave.google.com">google wave</a> developer sandbox access to provide a <a href="http://wave.google.com">google wave</a> robot for online e-mail suggestion. Bah, that sounds like some work <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/05/jaev-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mavenizing a Flex build</title>
		<link>http://nicl.net/2009/03/mavenizing-a-flex-build/</link>
		<comments>http://nicl.net/2009/03/mavenizing-a-flex-build/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 12:54:51 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex-mojo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://nicl.net/2009/03/21/mavenizing-a-flex-build/</guid>
		<description><![CDATA[In the last week the release 1.0 platform release of scoyo came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.
The platform build process is realized with Apache Maven, which is, in humble my opinion, [...]]]></description>
			<content:encoded><![CDATA[<p>In the last week the release 1.0 platform release of <a href"http://www.scoyo.de">scoyo</a> came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.</p>
<p>The platform build process is realized with <a href="http://maven.apache.org">Apache Maven</a>, which is, in humble my opinion, still the first choice for <a href="http://java.sun.com">Java</a> based software projects, but integrating other project types into maven is a kind of challenging due to the nature of Maven. You may summarize this in: If you do it the maven way it's very easy, if you don't it is up to you ...</p>
<p>Luckily there was already an existing build with <a href="http://ant.apache.org">Ant</a> and a dysfunctional Maven variant with the Maven <a href="http://code.google.com/p/flex-mojos/">Flex-mojos</a> plugin. So it stated  my journey to insanity an back ...<br />
<span id="more-22"></span><br />
In the last week the release 1.0 platform release of <a href"http://www.scoyo.de">scoyo</a> came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.</p>
<p>The platform build process is realized with <a href="http://maven.apache.org">Apache Maven</a>, which is, in humble my opinion, still the first choice for <a href="http://java.sun.com">Java</a> based software projects, but integrating other project types into maven is a kind of challenging due to the nature of Maven. You may summarize this in: If you do it the maven way it's very easy, if you don't it is up to you ...</p>
<p>Luckily there was already an existing build with <a href="http://ant.apache.org">Ant</a> and a dysfunctional Maven variant with the Maven <a href="http://code.google.com/p/flex-mojos/">Flex-mojos</a> plugin. So it stated  my journey to insanity an back.</p>
<p>My first attempts started  with reactivating the Flex-mojos maven build. I already had some experience with Flex-mojos when preparing the build for the <a href="http://jaev.googlecode.com">jaev</a> Flex example. This example Project for the <a href="http://jaev.googlecode.com">jaev</a> framework also uses the Flex-mojos maven plugin to create the example <code>.swf</code> and uses the infrastructure of maven to assemble the web application with the HTML and the <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/">BlazeDS</a> services. Took me some time and a quite nice <a href="http://sebastien-arbogast.com/2008/04/10/flex-spring-and-blazeds-the-full-stack/">tutorial</a> from <a href="http://sebastien-arbogast.com/">Sébastien Arbogast</a> but finally it worked!</p>
<p>So I thought I was prepared for the task and nothing could stop me. There is no law against being wrong, at least in Germany <code> <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </code>.</p>
<p>The main problems was finding all the required libraries in various maven repositories. Additionally there were some foul libraries. Some yahoo uploaded HTML files as <code>.pom</code> and <code>.jar</code> file in a repository. It took me quite a moment to realize this. Unfortunately the current <a href="http://www.adobe.com/products/flex/flexdownloads/">Flex SDK 3.3</a> was not available at all in any maven repository. At least I did not find any.</p>
<p>So after wasting some hours I changed the strategy: My new Idea was to call the Flex <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a> provided by <a href="http://www.adobe.com">Adobe</a> from the maven build using the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">maven-antrun-plugin</a>. The antrun-plugin is quite nice if you have to perform some tasks not covered by maven. So you can execute some <a href="http://ant.apache.org">Ant</a><a> tasks to enrich your build.</p>
<p>But things where going to be worse. A couple of very "unsatisfying" hours later I discovered a bug or incompatibility of the maven </a><a href="http://maven.apache.org/plugins/maven-antrun-plugin/">maven-antrun-plugin</a> and the Adobe <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a>. So it was time to rethink my strategy again. Should I switch back to the Flex-mojo approach? I went for a minor adjustment first: Instead of using the the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a> I went for the compilers (<code>mxmlc</code> for Flex applications and <code>compc</code> for Flex libraries) directly. Calling them with the Ant <a href="http://ant.apache.org/manual/CoreTasks/exec.html"><code>&lt;exec /&gt;</code></a> task, which executes a command on the command line. Then use the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">maven-assembly-plugin</a> to create a ZIP file of the compiled artifact and install/deploy it into the repository.</p>
<p>Let's sum this up:
<ol>
<li>start JVM and execute maven</li>
<li>execute the maven-antrun-plugin to execute ant tasks</li>
<li>use some Ant tasks to assemble the Flex build path (external and included libraries)</li>
<li>use the Ant <code>&lt;exec /&gt;</code> task to execute the flex compiler (let's share a secret: The Flex compilers are written in Java. Welcome back home <code> <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </code>)</li>
<li>use the maven-assembly-plugin</li>
<p> to create a ZIP file</p>
<li>install the ZIP file into the local repository</li>
<li>(optionally deploy the artifact into a remote repository)</li>
</ol>
<p>That does not sound like a simple build process. And let me amend something: If you a using shared libraries in the build (yepp we have a couple of them) you may add another step before invoking the maven-antrun plugin. You'll have to use the maven dependency plugin to copy and uncompress the libraries from the local (remote) repository to your build environment, so they can be accessed/found by the build. You'll imagine I was not satisfied at all with this build variant ...</p>
<p>Again my old friend came along, the question:"What to do?"</p>
<p>The Flex-mojo approach obliged my to upload the whole Flex SDK into our local <a href="http://archiva.apache.org/">archiva</a> installation which hosts out company maven repository. This includes the minimum 54 libraries supplied by the Flex SDK. Okay most of them are quite common, but when a new Flex SDK is released (which happens on a quite regular basis) you'll have to recheck all dependencies. No thanks ...<br />
The maven/Ant/Flex compiler variant emerged as juggernaut with bad performance and a loads of catches. No improvement at all ...</p>
<p>So I decided to take a closer look at the Flex-mojo plugin itself. Why do I need to have all this dependencies? The major advantages to the Flex-mojo plugin are the special packaging types <code>swf</code> and <code>swc</code> for Flash movies and libraries. Using this packaging types maven will use a special life cycle and offer the possibility to install/deploy the artifacts directly into the repository. To my relief only a <a href="http://svn.sonatype.org/flexmojos/trunk/flexmojos-maven-plugin/src/main/resources/META-INF/plexus/components.xml">quite simple XML file</a> (a plexus component definition) was necessary to achieve this.</p>
<p>So desperate as I was, I decided to write a maven plugin on my own. I must confess it was not my first time. I already wrote a simple maven plugin for the <a href="http://www.sinnerschrader.de">SinnerSchrader commerce framework</a>, a library developed by my former employer. I really do not like to reinvent software on my own. But I was curious and I want to give it a shot. My goal was to combine the two approaches I tried before and use the best of both. So the plugin should be able to manage the <code>swc</code> dependencies, the flex compiler configuration (via <code>-load-config</code>) and the direct deployment of <code>swc</code> and <code>swf</code> artifacts.</p>
<p>The approach was simple:
<ol>
<li>check the maven dependencies for libraries to reference or to include</li>
<li>check for a configured compiler configuration</li>
<li>create the compiler command line and all options like <code>-load-config</code>, <code>-compile.debug</code>, <code>-compiler.include-libraries</code> or <code>-compiler.external-library-path</code>, etc. </li>
<li>invoke the compiler via the<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html"><code>java.lang.ProcessBuilder</code></a></li>
<li>install the artifact into the local repository</li>
</ol>
<p>It took me not an hour to build a working proof of concept and only approx. four more hours to mavenize almost the entire build. This was really fun after two days of trying and failing. There are still some minor adjustments to make on monday, but I am really looking forward to finish the build. And if all works out as I want, there might be a 15-20% speed improvements for a complete build. But this also reduces the necessity to perform complete builds, because some shared libraries are rarely changing at all, so we can deploy them into our company maven repository.</p>
<p>As I went to bed last night, I was wondering why the Flex-mojo approach failed and the home-grown maven plugin approach succeeded. Under the shower this morning it was quite obvious to me. The Flex-mojo plugin stores the whole Flex SDK in maven repositories, so you don't even have to download the Flex SDK to compile your Flex application. My home-grown plugin needs the Flex SDK installed on the build computer and the <code>FLEX_HOME</code> environment variable set. But that is okay, because the <a href="http://maven.apache.org/plugins/maven-compiler-plugin/">maven-compiler-plugin</a> does the same. It does not work without the <code>JAVA_HOME</code> set and it does not try to deploy the Java SDK into maven repositories. Maybe the Flex-mojo guys will also realize the difference. It seems to be a quite nice piece of software but with too much unnecessary complexity and very "clustered" documentation.</p>
<p>After tying up this loose end me and a very experienced Flex development colleague already discovered some further TODOs relating to the maven and <a href="http://www.adobe.com/products/flex/features/flex_builder">Flex Builder</a> integration. There is still lots of work to do, so I am exited. My <a href="http://www.scoyo.de">new job</a> is different as I expected but a am very confident that it will offer some exiting further challenges for me ...</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/03/mavenizing-a-flex-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting closer to 1.0</title>
		<link>http://nicl.net/2009/03/getting-closer-to-10/</link>
		<comments>http://nicl.net/2009/03/getting-closer-to-10/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 18:00:33 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tapestry]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[jaev]]></category>

		<guid isPermaLink="false">http://nicl.net/2009/03/14/getting-closer-to-10/</guid>
		<description><![CDATA[This afternoon I spend some time to take the jaev Framework closer to the 1.0 final release.

This afternoon I spend some time to take the jaev Framework closer to the 1.0 final release.
The second release candidate was built this afternoon. It contains some fixes and some improvements suggested by PMD and Findbugs. Another major focus [...]]]></description>
			<content:encoded><![CDATA[<p>This afternoon I spend some time to take the <a href="http://jaev.googlecode.com">jaev</a> Framework closer to the 1.0 final release.<br />
<span id="more-21"></span><br />
This afternoon I spend some time to take the <a href="http://jaev.googlecode.com">jaev</a> Framework closer to the 1.0 final release.</p>
<p>The second release candidate was built this afternoon. It contains some fixes and some improvements suggested by <a href="http://pmd.sourceforge.net/">PMD</a> and <a href="http://findbugs.sourceforge.net">Findbugs</a>. Another major focus was to improve the performance of <a href="http://jaev.googlecode.com">jaev</a>. This was achieved in reducing the number DNS lookups by introducing a cache for DNS MX record resolution.</p>
<p>This may lead to another nifty feature in the next release candidate, final or 1.1 release. I am planning to introduce a domain suggest function. This may be achieved by using a fix/initial suggestion list and the queries against the DNS lookup cache. If everything works out well the i.e. the Tapestry 5 example may offer a suggest function for e-mail addresses.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/03/getting-closer-to-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rethinking logging</title>
		<link>http://nicl.net/2009/02/18/</link>
		<comments>http://nicl.net/2009/02/18/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 14:31:04 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://nicl.net/2009/02/15/18/</guid>
		<description><![CDATA[Recently I discovered something new about a thing I am using on an every day basis like most of the software engineers. It's about logging. You may ask: "What is so exiting about logging?"
In my opinion logging is one of the underestimated aspects of software development. Everyone uses it, but only very few are using [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I discovered something new about a thing I am using on an every day basis like most of the software engineers. It's about logging. You may ask: "What is so exiting about logging?"<br />
In my opinion logging is one of the underestimated aspects of software development. Everyone uses it, but only very few are using it right.<br />
Logging is the bridge between the development phase and the operational phase in the software life cycle. If you do it right it may provide valuable informations about the inner workings of an application.</p>
<p>I'am using <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> for quite a while. I am not sure when the framework was created by <a href="http://ceki.blogspot.com/">Ceki Gülcü</a>, but log4j was the straight edge for java logging in the recent years. Unfortunately it became very quite around the log4j project recently.</p>
<p><span id="more-20"></span></p>
<p>Recently I discovered something new about a thing I am using on an every day basis like most of the software engineers. It's about logging. You may ask: "What is so exiting about logging?"<br />
In my opinion logging is one of the underestimated aspects of software development. Everyone uses it, but only very few are using it right.<br />
Logging is the bridge between the development phase and the operational phase in the software life cycle. If you do it right it may provide valuable informations about the inner workings of an application.</p>
<p>I'am using <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> for quite a while. I am not sure when the framework was created by <a href="http://ceki.blogspot.com/">Ceki Gülcü</a>, but log4j was the straight edge for java logging for the recent years. Unfortunately it became very quite around the log4j project recently.</p>
<p>In <a href="http://jaev.googlecode.com/">my new open source project</a> I broke some new grounds. It started with the <a href="http://www.slf4j.org/">simple logging for java (slf4j)</a>, which I used for logging. The motivation was clear, I wanted to get rid of a dedicated logger implementation and offer the possibility to integrate the output of <a href="http://jaev.googlecode.com">jaev</a> logging into the application log files (streams).<br />
The <a href="http://www.slf4j.org">sl4j</a> is not the first "meta" logging library. The <a href="http://commons.apache.org/logging/">commons logging</a> framework was one of the first of these frameworks. At least it's the one I came across most. The <a href="http://www.slf4j.org">sl4j</a> framework is quite new. It offers a similar functionality like the <a href="http://commons.apache.org/logging/">commons logging</a> framework, but <a href="http://www.slf4j.org/">slf4j</a> uses a static binding against the executing logging framework. It also supports various logger implementations and offers bridges from i.e. the JUL (java.util.logging) logging into the <a href="http://www.slf4j.org">sl4j</a> world. So you can integrate all logging informations in the <a href="http://www.slf4j.org">sl4j</a> infrastructure.</p>
<p>This is quite handy if you are combining frameworks which rely on a specific logger implementation (i.e. <a href="https://facelets.dev.java.net/">facelets</a> which relies on JUL). When you use the JUL to slf4j bridge you may merge all logging streams and handle the events on you logger implementations. The <a href="http://www.slf4j.org/">slf4j</a> framework by the way was created by <a href="http://ceki.blogspot.com/">Ceki Gülcü</a>.</p>
<p>One other word to the logger implementation. Durning my first steps with <a href="http://www.slf4j.org/">slf4j</a> I used the <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> implementation. Which works pretty well. But in last weeks I stumbled about the <a href="http://logback.qos.ch/">logback</a> project, an offspring of <a href="http://ceki.blogspot.com/">Ceki Gülcü</a> too. The <a href="http://logback.qos.ch/">logback</a> project is a native implementation of the <a href="http://www.slf4j.org/">slf4j</a> API and it offers a state of the art logger implementation. If you are using <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> you feel familiar in no time. But it also offers quite some interesting new features and continues the evolution which stalled at the <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> project for quite some years. Here are some highlights:</p>
<ul>
<li>Configuration fully in XML via <code>logback.xml</code> and read automatically on logging initialisation.</li>
<li>Different configuration files for productive and test environment (<code>logback.xml</code> and <code>logback-test.xml</code>).</li>
<li>Configuration via JMX possible.</li>
<li>Quite handy reduction of the logger name length.</li>
<li>Provides position informations of the caller (class, line, method).</li>
<li>Shortened stack traces of exceptions</li>
</ul>
<p>It took not very long to convince me to switch my logging implementation from <a href="http://logging.apache.org/log4j/1.2/index.html">log4j</a> to <a href="http://logback.qos.ch/">logback</a> for the <a href="http://jaev.googlecode.com/">jaev</a> project.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/02/18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The name is jaev &#8230;</title>
		<link>http://nicl.net/2009/02/the-name-is-jaev/</link>
		<comments>http://nicl.net/2009/02/the-name-is-jaev/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 21:52:38 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tapestry]]></category>
		<category><![CDATA[jaev]]></category>

		<guid isPermaLink="false">http://nicl.net/2009/02/09/the-name-is-jaev/</guid>
		<description><![CDATA[The name of who/what is jaev? The jaev framework is my first open source project! Jepp, I joined the community and giving something back after years of using the frameworks of other people.
What does jaev do? The name jaev is the abbreviation for java (advanced) email validation. So the framework does validate e-mails. Sounds quite [...]]]></description>
			<content:encoded><![CDATA[<p>The name of who/what is jaev? The jaev framework is my first open source project! Jepp, I joined the community and giving something back after years of using the frameworks of other people.</p>
<p>What does jaev do? The name jaev is the abbreviation for <i>ja</i>va (<i>a</i>dvanced) <i>e</i>mail <i>v</i>alidation. So the framework does validate e-mails. Sounds quite boring, isn't it? Of course not!<br />
<span id="more-19"></span><br />
The name of who/what is <a href="http://code.google.com/p/jaev/">jaev</a>? The <a href="http://code.google.com/p/jaev/">jaev framework</a> is my first open source project! Jepp, I joined the community and giving something back after years of using the frameworks of other people.</p>
<p>What does jaev do? The name <a href="http://code.google.com/p/jaev/">jaev</a> is the abbreviation for <i>ja</i>va (<i>a</i>dvanced) <i>e</i>mail <i>v</i>alidation. So the framework does validate e-mails. Sounds quite boring, isn't it? Of course not! There are some quite good tools for e-mail validation like the one in the <a href="http://commons.apache.org/validator/">Apache commons validator</a> project (I <i>"borrowed"</i> some test cases there). But the e-mail validation in java was quite shallow. If you want to have a more advanced validation, i.e. of the domain, you'll had to do it yourself. The <a href="http://code.google.com/p/jaev/">jaev framework</a> tries to fill this gap.</p>
<p>It provides facilities to validate the syntax of an e-mail address with including addresses with names like <code>Niclas Meier &lt;niclas.meier@example.com&gt;</code>  (I confess the handling of comments in e-mail addresses has still some flaws, but it's not so important I guess). This is obligatory but the <a href="http://code.google.com/p/jaev/">jaev framework</a> offers quite more.</p>
<p>With the <a href="http://code.google.com/p/jaev/">jaev framework</a> you'll may check the domain of the e-mail address. The framework uses a local (or server) copy of the IANA top level domain database (<a href="http://data.iana.org/TLD/tlds-alpha-by-domain.txt">http://data.iana.org/TLD/tlds-alpha-by-domain.txt</a>) to validate the top level domain. If the top level domain is okay  the DNS database will be queries if the domain exists and has <code>MX</code> entries. If a domain has no <code>MX</code> entries you'll have to assume that you will could not relay an e-mail message to the e-mail address. The mail server uses the same mechanism.</p>
<p>A very important feature of the <a href="http://code.google.com/p/jaev/">jaev framework</a> is: You have the choice! You are receiving a <code>Result</code> object as outcome of the validation process. The <code>Result</code> contains a code, which specifies the details, and a validity level which specifies  the level of validity of an e-mail address. I.e. <code>SYNTAX</code> suggests that an e-mail address is syntactically valid but the domain and account may be invalid. The maximum validity is <code>ACCESSIBLE</code>. With <code>ACCESSIBLE</code> validity the <a href="http://code.google.com/p/jaev/">jaev framework</a> was able to verify the existence and accessibility of the e-mail address on the <a href="http://de.wikipedia.org/wiki/Mail_Transfer_Agent">MTA</a> of the e-mail domain.</p>
<p>This is the last big feature of the <a href="http://code.google.com/p/jaev/">jaev framework</a>. The framework can connect to the <a href="http://de.wikipedia.org/wiki/Mail_Transfer_Agent">MTA</a> specified in the MX entry of the domain and tries to send an e-mail to the e-mail address. If the mail transfer can be initiated the framework will abort the process, no mail will be send, but we can assure that the e-mail account exits.</p>
<p>Around the three step validation mechanism the framework offers quite simple and extendible construction and configuration mechanisms, examples for JSF, Tapestry 5 and Flex &amp; BlazeD and different acceptance strategies. Timeouts may be applied on different levels and operations, so you can assure that you'll get a <code>Result</code> in a defined amount of time.</p>
<p>I think this is quite a handy package. And I spent lots of my spare time the last four weeks to bring this to life. Maybe someone out there agrees with me and uses the framework in his application.</p>
<p>If you encounter some problems or you would like to contribute/request some features you may post them to the <a href="http://groups.google.com/group/jaev-users?pli=1">google group</a> or to the <a href="http://code.google.com/p/jaev/issues/list">issue management system</a>. Maybe there is someone out there who is firm in <a href="http://www.antlr.org/">ANTLR</a> which the jeav framework uses for e-mail parsing.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/02/the-name-is-jaev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
