<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Eskatos's thoughts on JEE development</title>
	<atom:link href="http://eskatos.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://eskatos.wordpress.com</link>
	<description>Oooops</description>
	<pubDate>Tue, 05 Aug 2008 16:47:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A maven plugin to repackage your java archives : jaroverlay-maven-plugin</title>
		<link>http://eskatos.wordpress.com/2008/08/03/jaroverlay-maven-plugin/</link>
		<comments>http://eskatos.wordpress.com/2008/08/03/jaroverlay-maven-plugin/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 16:32:32 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[jaroverlay-maven-plugin]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=37</guid>
		<description><![CDATA[In the Java EE 5 Tutorial &#8220;Development Roles&#8221; chapter we can see the following three roles, from the code to the deployment :

Application Component Provider: &#8220;The application component provider is the company or person who creates web components, enterprise beans, applets, or application clients for use in Java EE applications.&#8221;
Application Assembler: &#8220;The application assembler is [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In the <a href="http://java.sun.com/javaee/5/docs/tutorial/doc/index.html">Java EE 5 Tutorial</a> &#8220;<a href="http://java.sun.com/javaee/5/docs/tutorial/doc/bnaca.html">Development Roles</a>&#8221; chapter we can see the following three roles, from the code to the deployment :</p>
<ul>
<li><strong>Application Component Provider:</strong> &#8220;The application component provider is the company or person who creates web components, enterprise beans, applets, or application clients for use in Java EE applications.&#8221;</li>
<li><strong>Application Assembler:</strong> &#8220;The application assembler is the company or person who receives application modules from component providers and assembles them into a Java EE application EAR file.&#8221;</li>
<li><strong>Application Deployer and Administrator:</strong> &#8220;The application deployer and administrator is the company or person who configures and deploys the Java EE application &#8230;&#8221;</li>
</ul>
<p>This page says that this is the Application Assembler job to configure the deployment descriptor before packaging the EAR.</p>
<p>Beside that, artifact produced by mavenized enterprise projects are EARs, already packaged. Plus, it often is the developer (or Application Component Provider) that write the packaging configuration.</p>
<p>Next comes the &#8220;configuration for deployment&#8221; time. Here, if deployment dependant configuration is in deployment descriptors you would have to unpack the EAR and possibly nested java archives (WARs and/or JARs) to get a hand on all deployment descriptors.</p>
<p>This task can be quite cumbersome and time consuming (really dumb too).<span id="more-37"></span></p>
<p>I&#8217;ve read about people using maven profiles to build several EARs with different configuration but this means that the different configurations are hosted in the development project and so are released at the same time. I needed a way to have the development project contains only development and testing configuration and have deployment specific configurations hosted in a separate project that have its own release lifecycle.</p>
<p>I wrote jaroverlay-maven-plugin to address this need. It&#8217;s another simple maven plugin that can take an existing maven artifact and apply an overlay to it. Here is an example configuration that add/remove/replace files inside an EAR and it&#8217;s nested java archives :<br />
<code><br />
&nbsp;&lt;build&gt;<br />
&nbsp;&nbsp;&lt;plugins&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;plugin&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.n0pe.mojo&lt;/groupId&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;jaroverlay-maven-plugin&lt;/artifactId&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;executions&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;execution&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id&gt;ear&lt;/id&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goals&gt;&lt;goal&gt;jaroverlay&lt;/goal&gt;&lt;/goals&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;phase&gt;package&lt;/phase&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;configuration&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;overlay&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;source&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.n0pe.mojo.examples&lt;/groupId&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;ear-example&lt;/artifactId&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;type&gt;ear&lt;/type&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/source&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;classifier&gt;custom-packaging&lt;/classifier&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;puts&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;put&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from&gt;src/main/resources/test.txt&lt;/from&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to&gt;war-example-0.1-SNAPSHOT.war|WEB-INF/test.txt&lt;/to&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/put&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;put&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;from&gt;src/main/resources/test.txt&lt;/from&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;to&gt;ejb-example-0.1-SNAPSHOT.jar|META-INF/test/txt&lt;/to&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/put&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/puts&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;removes&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;remove&gt;war-example-0.1-SNAPSHOT.war|index.jsp&lt;/remove&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;remove&gt;war-example-0.1-SNAPSHOT.war|WEB-INF/lib/commons-lang-2.3.jar|META-INF/NOTICE.txt&lt;/remove&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/removes&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/overlay&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/configuration&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/execution&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/executions&gt;<br />
&nbsp;&nbsp;&lt;/plugin&gt;<br />
&nbsp;&lt;/plugins&gt;<br />
&lt;/build&gt;<br />
</code></p>
<p>When writing a path to a file contained by a nested archive, use a pipe (&#8221;|&#8221;) to inform the plugin that it has to navigate inside a nested archive.</p>
<p>I did not released the 0.1 as the current code is more a proof of concept than anything. It is working well for file operations. I need to clean the code up and add support for directories operations and the 0.1 will be out.</p>
<p>The project is hosted at google code : http://code.google.com/p/jaroverlay-maven-plugin/</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=37&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/08/03/jaroverlay-maven-plugin/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>asadmin-maven-plugin-0.2 released</title>
		<link>http://eskatos.wordpress.com/2008/07/20/asadmin-maven-plugin-02-released/</link>
		<comments>http://eskatos.wordpress.com/2008/07/20/asadmin-maven-plugin-02-released/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 15:45:57 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[asadmin-maven-plugin]]></category>

		<category><![CDATA[glassfish]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=34</guid>
		<description><![CDATA[I released the second version of asadmin-maven-plugin today.
It added the following features :

Issue#1: support for maven projects with &#8220;ejb&#8221; packaging
support for (un)deploying to remote glassfish instance (thanks to Larry Sanderson that provided the patch)

The following issues were fixed :

Issue#2: asadmin is not found when only glassfishHome is specified and glassfishHome/bin not in PATH (thanks to [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I released the second version of <a href="http://code.google.com/p/asadmin-maven-plugin/">asadmin-maven-plugin</a> today.</p>
<p>It added the following features :</p>
<ul>
<li><a href="http://code.google.com/p/asadmin-maven-plugin/issues/detail?id=1">Issue#1</a>: support for maven projects with &#8220;ejb&#8221; packaging</li>
<li>support for (un)deploying to remote glassfish instance (thanks to Larry Sanderson that provided the patch)</li>
</ul>
<p>The following issues were fixed :</p>
<ul>
<li><a href="http://code.google.com/p/asadmin-maven-plugin/issues/detail?id=2">Issue#2</a>: asadmin is not found when only glassfishHome is specified and glassfishHome/bin not in PATH (thanks to <a href="http://code.google.com/u/streifi/">streifi</a> that provided a patch)</li>
<li><a href="http://code.google.com/p/asadmin-maven-plugin/issues/detail?id=3">Issue#3</a>: asadmin:start-domain hangs on windows (thanks again to streifi)</li>
</ul>
<p>Go to the<a href="http://code.google.com/p/asadmin-maven-plugin/"> project&#8217;s page</a> for more information.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=34&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/07/20/asadmin-maven-plugin-02-released/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>Customer i18n overlays with GWT</title>
		<link>http://eskatos.wordpress.com/2008/07/19/customer-i18n-overlays-with-gwt/</link>
		<comments>http://eskatos.wordpress.com/2008/07/19/customer-i18n-overlays-with-gwt/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 16:38:05 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[HOWTOs]]></category>

		<category><![CDATA[gwt]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=22</guid>
		<description><![CDATA[I&#8217;m building a web backoffice for an IT product with GWT for several month now. I had to internationalize all the UI. GWT provides several mechanisms for i18n. I use Constants and Messages because I love the compile time check and the fact that deferred binding permutations provide a download as small as possible to [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m building a web backoffice for an IT product with <a href="http://code.google.com/webtoolkit/">GWT</a> for several month now. I had to internationalize all the UI. GWT provides <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Internationalization.html">several mechanisms for i18n</a>. I use <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/gwt/i18n/client/Constants.html">Constants</a> and <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/gwt/i18n/client/Messages.html">Messages</a> because I love the compile time check and the fact that deferred binding permutations provide a download as small as possible to the users.</p>
<p>All this worked well until we wanted to provide customers the ability to change how things are named in our product. In the UI layer of course !</p>
<p>Like said above, GWT is using deferred binding to provide a Constant/Message implementation per locale. I extended this mechanism to provide a Constant/message implementation per locale and a given GWT property.</p>
<p>Enough talk, lets see how this is done.<br />
<span id="more-22"></span></p>
<h2>Classic i18n</h2>
<p>Here we will use the Constants approach, this is working with Messages too. For the purpose of this example we will use only one message &#8220;businessKey&#8221; that is called &#8220;Business Key&#8221; in our product but that some customers will like to name &#8220;DaGlobalUniquePersonnalIdentifierToRuleThemAll&#8221; or anything else they want.</p>
<p>Following the GWT documentation about static string internationalization, create an interface that extends Constants :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;public interface MyI18N extends Constants {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String businessKey();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String anotherMessage();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
</code></p>
<p>In the same package, provide a properties file for each locale you want to support :</p>
<p><strong>MyI18N.properties :</strong><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;businessKey=Business Key<br />
&nbsp;&nbsp;&nbsp;&nbsp;anotherMessage=Another message</code></p>
<p><strong>MyI18N_fr.properties :</strong><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;businessKey=Identifiant<br />
&nbsp;&nbsp;&nbsp;&nbsp;anotherMessage=Un autre message</code></p>
<p>All this is not enough to get i18n to work with GWT, you have to modify your gwt.xml file. Read the <a href="http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Internationalization.html">documentation</a> for more information.</p>
<h2>The first i18n overlay</h2>
<p>Now we want to add an i18n overlay to change how &#8220;businessKey&#8221; is named for only one customer.</p>
<p>Create an interface that extends the previous MyI18N interface :<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;public interface MyCustomI18N extends MyI18N {}</code></p>
<p>This interface can be empty as we only want to provide customized existing messages. Now create a properties file for each locale you want to support :</p>
<p><strong>MyCustomI18N.properties :</strong><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;businessKey=DaGlobalUniquePersonnalIdentifierToRuleThemAll</code></p>
<p><strong>MyCustomI18N_fr.properties :</strong><br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;businessKey=IdentifiantGlobalUniquePersonnelPourLesControlerTous</code></p>
<p>Here we declare only the message(s) we want to overwrite in this i18n overlay.</p>
<h2>Adding a GWT property</h2>
<p>We now need a gwt property that will trigger the use of an i18n overlay. We will name it &#8220;flavour&#8221;. For this you have to modify you host page and you gwt.xml file.</p>
<p>We will have two possible value for this property : &#8220;default&#8221; and &#8220;customer1&#8243;.</p>
<p>Add the flavour property in a meta tag inside your host page :<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta name="gwt:property" content="<strong>flavour=customer1</strong>&#8221; /&gt;</code></p>
<p>Now you know that with some server side code you can change this property in your host page depending on various configuration details. It&#8217;s up to you.</p>
<p>Finally, add theses lines in your GWT module gwt.xml file :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;define-property name=&#8221;flavour&#8221; values=&#8221;<strong>default,customer1</strong>&#8221; /&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;property-provider name=&#8221;flavour&#8221;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;![CDATA[<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var flavour = __gwt_getMetaProperty("flavour");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (flavour == null){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flavour = "default";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return flavour;<br />
&nbsp;&nbsp;&nbsp;&nbsp;]]&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property-provider&gt;<br />
</code></p>
<p>This snippet will allow us to use this property&#8217;s value for deferred binding.</p>
<h2>Writing an i18n factory</h2>
<p>Next, we need a way to defer to runtime the choice between My18N and MyCustom18N constants. We need to add a permutation layer on top of the GWT built-in locale permutation. We will do this with a simple factory.</p>
<p>First, write the MyI18NFactory interface :<br />
<code>&nbsp;&nbsp;&nbsp;&nbsp;public interface MyI18NFactory {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyI18N getMyI18N();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></p>
<p>Next, write the default implementation, aka MyDefaultI18NFactory :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;public class MyDefaultI18NFactory implements MyI18NFactory {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private static final MyI18N i18n = (MyI18N) GWT.create(<strong>MyI18N.class</strong>);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public MyI18N getMyI18N() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i18n;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
</code></p>
<p>And the implementation for customer1, aka MyCustomerOneI18NFactory :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;public class MyCustomerOneI18NFactory implements MyI18NFactory {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private static final MyI18N i18n = (MyI18N) GWT.create(<strong>MyCustomI18N.class</strong>);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public MyI18N getMyI18N() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return i18n;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
</code></p>
<p>The only difference is the targeted i18n implementation.</p>
<h2>Deferred binding</h2>
<p>The final step is to add deferred binding for our MyI18NFactory implementations so that depending on the &#8220;flavour&#8221; property, GWT will instanciate MyDefaultI18NFactory or MyCustomerOneI18NFactory.</p>
<p>Simply add the following to your GWT module gwt.xml file :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;replace-with class=&#8221;<strong>my.MyDefaultI18NFactory</strong>&#8220;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;when-type-is class=&#8221;my.MyI18NFactory&#8221;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;when-property-is name=&#8221;flavour&#8221; value=&#8221;<strong>default</strong>&#8220;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/replace-with&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;replace-with class=&#8221;<strong>my.MyCustomerOneI18NFactory</strong>&#8220;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;when-type-is class=&#8221;my.MyI18NFactory&#8221;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;when-property-is name=&#8221;flavour&#8221; value=&#8221;<strong>customer1</strong>&#8220;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/replace-with&gt;<br />
</code></p>
<h2>Usage</h2>
<p>To get the right i18n Constants implementation in your code you now can use the following statement :<br />
<code><br />
&nbsp;&nbsp;&nbsp;&nbsp;((MyI18NFactory) GWT.create(MyI18NFactory.class)).getMyI18N().businessKey();<br />
</code></p>
<p>Of course you would like to cache the MyI18N instance as instanciation is an expensive task.</p>
<p>I don&#8217;t know if this is the simplest or the beautifulest way to do this. If someone has a better pattern I&#8217;ll be glad to learn ! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=22&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/07/19/customer-i18n-overlays-with-gwt/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven plugins for Glassfish ecosystem</title>
		<link>http://eskatos.wordpress.com/2008/03/28/maven-plugins-for-glassfish-ecosystem/</link>
		<comments>http://eskatos.wordpress.com/2008/03/28/maven-plugins-for-glassfish-ecosystem/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 22:31:49 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[asadmin-maven-plugin]]></category>

		<category><![CDATA[glassfish]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jee]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=21</guid>
		<description><![CDATA[This post is only a snapshot of what is available at the time of writing to use Glassfish from maven., seen from the perspective of a simple maven plugin developer (simple plugin or simple developer ?).
Before beginning asadmin-maven-plugin, I searched and tried several ways to use Glassfish from maven. Main use case is simply deployment [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This post is only a snapshot of what is available at the time of writing to use <a href="https://glassfish.dev.java.net//">Glassfish</a> from <a href="http://maven.apache.org/">maven.</a>, seen from the perspective of a simple maven plugin developer (simple plugin or simple developer ?).</p>
<p>Before beginning <a href="http://code.google.com/p/asadmin-maven-plugin/">asadmin-maven-plugin</a>, I searched and tried several ways to use Glassfish from maven. Main use case is simply deployment and undeployment of applications.</p>
<p>There are two ways to do this &#8220;programmatically&#8221; :</p>
<ul>
<li>using the <a href="http://docs.sun.com/app/docs/doc/819-3671/gcode?a=view">asadmin</a> command, Glassfish specific,</li>
<li>and using the <a href="http://jcp.org/en/jsr/detail?id=88">JSR-88</a> api, app-server agnostic</li>
</ul>
<p><span id="more-21"></span></p>
<p>Here are all the glassfish maven plugins I&#8217;ve found :</p>
<ul>
<li><a href="http://cargo.codehaus.org/Maven2+plugin">cargo-maven2-plugin</a> on <a href="http://codehaus.org/">http://codehaus.org/</a>
<p>The Cargo maven plugin project will provide the JSR-88 way <a href="http://cargo.codehaus.org/Roadmap">soon or later</a>.</p>
<p>
</li>
<li><a href="http://code.google.com/p/glassfish-maven-plugin/">glassfish-maven-plugin</a> on <a href="http://code.google.com">http://code.google.com</a>
<p>I couldn&#8217;t make this one work, source code available in the subversion repository has not moved since december, 2007. This plugin use the same approach as asadmin-maven-plugin : using the asadmin command</p>
<p>
</li>
<li><a href="https://glassfish-maven-plugin.dev.java.net/">glassfish-maven-plugin</a> on <a href="http://java.net">http://java.net</a>
<p>No source code, no files released yet.</p>
<p>
</li>
<li><a href="https://maven-glassfish-plugin.dev.java.net/">maven-glassfish-plugin</a> on <a href="http://java.net">http://java.net</a> again
<p>No source code, no files released yet.</p>
<p>
</li>
<li><a href="http://clownfish.sourceforge.net/">clownfish-maven-plugin</a> on <a href="http://sourceforge.net">http://sourceforge.net</a>
<p>Appears to use the JSR-88 Glassfish implementation. I did not try this one yet.</p>
<p>
</li>
</ul>
<p>Appart from this, the <a href="http://mojo.codehaus.org/exec-maven-plugin/">exec-maven-plugin</a> allows to execute external commands and some posts on the net provide examples of using this plugin to invoke the asadmin command from a maven pom. Some others posts talks about using ant tasks inside maven pom to invoke asadmin.</p>
<p>In fact asadmin-maven-plugin is based on what Wouter van Reeven explain in a post called <a href="http://technology.amis.nl/blog/?p=2495">Deploying to GlassFish using Maven2</a> on the <a href="http://technology.amis.nl/blog/">AMIS Technology Blog</a>. I was using the exec-maven-plugin the way it&#8217;s explained there in my projects when I realized how much xml I had to copy/paste around.</p>
<p>At the end of the day, asadmin-maven-plugin is just a convenience maven plugin to execute the asadmin glassfish command leveraging the &#8220;<a href="http://en.wikipedia.org/wiki/Convention_over_Configuration">convention over configuration</a>&#8221; concept that maven teached to me.</p>
<p>In conclusion, I hope that the support for JSR-88 will soon be available in Cargo as we, developers, mostly need the cargo&#8217;s integration api usable from unit tests. On the other side, I hope that beside the immediate need of a working solution I&#8217;ll have time to maintain and continue asadmin-maven-plugin development.</p>
<p>Next time I&#8217;ll publish some documentation about asadmin-maven-plugin configuration.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=21&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/03/28/maven-plugins-for-glassfish-ecosystem/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>A repository for asadmin-maven-plugin</title>
		<link>http://eskatos.wordpress.com/2008/03/26/a-repository-for-asadmin-maven-plugin/</link>
		<comments>http://eskatos.wordpress.com/2008/03/26/a-repository-for-asadmin-maven-plugin/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 22:30:22 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[asadmin-maven-plugin]]></category>

		<category><![CDATA[glassfish]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jee]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=20</guid>
		<description><![CDATA[To ease the use of asadmin-maven-plugin I have set up a public repository that you can add to your maven settings / poms / proxies for maven to be able to download the plugin automagically.
The repositories are :

Releases Repository : http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases - contains nothing ATM
Snapshots Repository : http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots - contains the 0.1-SNAPSHOT

Here is the xml [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>To ease the use of <a href="http://code.google.com/p/asadmin-maven-plugin/">asadmin-maven-plugin</a> I have set up a public repository that you can add to your maven settings / poms / proxies for maven to be able to download the plugin automagically.</p>
<p>The repositories are :</p>
<ul>
<li>Releases Repository : <a href="http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases">http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases</a> - contains nothing ATM</li>
<li>Snapshots Repository : <a href="http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots">http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots</a> - contains the 0.1-SNAPSHOT</li>
</ul>
<p>Here is the xml snippet you could add to your pom.xml file :</p>
<pre>
    &lt;pluginRepositories&gt;
        &lt;pluginRepository&gt;
            &lt;id&gt;asadmin-maven-plugin-releases-repository&lt;/id&gt;
            &lt;name&gt;asadmin-maven-plugin-releases-repository&lt;/name&gt;
            &lt;url&gt;http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases&lt;/url&gt;
            &lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;
            &lt;snapshots&gt;&lt;enabled&gt;false&lt;/enabled&gt;&lt;/snapshots&gt;
        &lt;/pluginRepository&gt;
        &lt;pluginRepository&gt;
            &lt;id&gt;asadmin-maven-plugin-snapshots-repository&lt;/id&gt;
            &lt;name&gt;asadmin-maven-plugin-snapshots-repository&lt;/name&gt;
            &lt;url&gt;http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots&lt;/url&gt;
            &lt;releases&gt;&lt;enabled&gt;false&lt;/enabled&gt;&lt;/releases&gt;
            &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
        &lt;/pluginRepository&gt;
    &lt;/pluginRepositories&gt;
</pre>
<p>Plus, if you browse the source tree you&#8217;ll find two exemple projects, a WAR and an EAR, that use this plugin.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=20&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/03/26/a-repository-for-asadmin-maven-plugin/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>A simple maven plugin for Glassfish: asadmin-maven-plugin</title>
		<link>http://eskatos.wordpress.com/2008/03/24/a-simple-maven-plugin-for-glassfish-asadmin-maven-plugin/</link>
		<comments>http://eskatos.wordpress.com/2008/03/24/a-simple-maven-plugin-for-glassfish-asadmin-maven-plugin/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 14:30:54 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[asadmin-maven-plugin]]></category>

		<category><![CDATA[glassfish]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=19</guid>
		<description><![CDATA[To seamlessly use Glassfish from maven projects, JSR-88 seems to be answer. The cargo maven plugin has JSR-88 support planned but this will take time.
I published some days ago a maven plugin that simply wraps the asadmin command and aims to provide maven integration for starting, stopping glassfish and deploying and undeploying applications and modules.
Go [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>To seamlessly use <a title="glassfish" href="https://glassfish.dev.java.net//">Glassfish</a> from <a href="http://maven.apache.org/" title="maven">maven</a> projects, <a title="jsr-88" href="http://jcp.org/en/jsr/detail?id=88">JSR-88</a> seems to be answer. The <a href="http://cargo.codehaus.org/Maven2+plugin">cargo</a> maven plugin has JSR-88 support <a href="http://cargo.codehaus.org/Roadmap" title="cargo roadmap">planned</a> but this will take time.</p>
<p>I published some days ago a maven plugin that simply wraps the <a href="http://docs.sun.com/app/docs/doc/819-3671/gcode?a=view" title="the asadmin utility command">asadmin</a> command and aims to provide maven integration for starting, stopping glassfish and deploying and undeploying applications and modules.</p>
<p>Go to the Google Code page of <a title="asadmin-maven-plugin" href="http://code.google.com/p/asadmin-maven-plugin/">asadmin-maven-plugin</a> to download a preview version named asadmin-maven-plugin-0.1-SNAPSHOT : <a href="http://code.google.com/p/asadmin-maven-plugin/" title="asadmin-maven-plugin">http://code.google.com/p/asadmin-maven-plugin/</a></p>
<p>The api is designed for easy extensibility so feel free to submit contributions !<br />
<span id="more-19"></span><br />
Install the jar provided in the download section in your local repository and add this to your pom :</p>
<pre>
&lt;build&gt;
    &lt;plugin&gt;
        &lt;groupId&gt;org.n0pe.mojo&lt;/groupId&gt;
        &lt;artifactId&gt;asadmin-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
    &lt;/plugin&gt;
&lt;/build&gt;
</pre>
<p>Check that either AS_HOME or GLASSFISH_HOME environment variables are set to your SJAS/Glassfish installation folder.</p>
<p>You can now use the following commands :</p>
<ul>
<li>mvn asadmin:start-database</li>
<li>mvn asadmin:start-domain</li>
<li>mvn asadmin:deploy</li>
<li>mvn asadmin:undeploy</li>
<li>mvn asadmin:stop-domain</li>
<li>mvn asadmin:stop-database</li>
</ul>
<p>By default the asadmin-maven-plugin use the following settings :</p>
<ul>
<li>user: admin</li>
<li>password-file: ~/.asadmintruststore</li>
<li>admin-host: localhost</li>
<li>admin-port: 4848</li>
<li>domain: domain1</li>
</ul>
<p>You can override all theses settings in the plugin configuration section in your pom.xml. Full documentation will soon be provided but if you have a maven aware editor, you will get completion on available options.</p>
<p>By default again, the deploy and undeploy mojos use the archive (jar/war/ear) produced by your maven project and deploy it using your project&#8217;s artifactId as module name.</p>
<p>The next step is to provide user and developer documentation.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=19&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/03/24/a-simple-maven-plugin-for-glassfish-asadmin-maven-plugin/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>A simple^W dumb Map wrapper to use with JAXB</title>
		<link>http://eskatos.wordpress.com/2008/03/14/a-simple-map-wrapper-to-use-with-jaxb/</link>
		<comments>http://eskatos.wordpress.com/2008/03/14/a-simple-map-wrapper-to-use-with-jaxb/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 20:50:57 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[HOWTOs]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jax-ws]]></category>

		<category><![CDATA[jaxb]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=18</guid>
		<description><![CDATA[I sometimes need to use java.util.Map objects in WebServices. As I&#8217;m building all my WebServices with the JAX-WS RI (using the Metro bundle). The block responsible for XML (un)marshalling of POJO, named JAXB, does not allows to directly use Maps as a soap operation parameter. For this purpose I&#8217;ve written the following simple class that [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I sometimes need to use <a href="http://java.sun.com/javase/6/docs/api/java/util/Map.html">java.util.<b>Map</b></a> objects in WebServices. As I&#8217;m building all my WebServices with the <a href="https://jax-ws.dev.java.net/">JAX-WS RI</a> (using the <a href="https://metro.dev.java.net/">Metro</a> bundle). The block responsible for XML (un)marshalling of POJO, named <a href="https://jaxb.dev.java.net/"><b>JAXB</b></a>, does not allows to directly use Maps as a soap operation parameter. For this purpose I&#8217;ve written the following simple class that allows me to wrap Maps in a POJO that <b>JAXB</b> is able to (un)marshall :</p>
<pre>
public class JAXBMapWrapper&lt;KT, VT&gt; {

    private <b>Map</b>&lt;KT, VT&gt; wrappedMap;

    public JAXBMapWrapper() {
        wrappedMap = new HashMap&lt;KT, VT&gt;();
    }

    public <b>Map</b>&lt;KT, VT&gt; getWrappedMap() {
        return wrappedMap;
    }

    public void setWrappedMap(final <b>Map</b>&lt;KT, VT&gt; givenMap) {
        wrappedMap = givenMap;
    }

}
</pre>
<p>ATTENTION : I posted this some days ago and removed the post after understanding that this is simpler on the service side but that the client side gets cumbersome generated classes.. but google cache indexed the post in less than half a day.</p>
<p>Just don&#8217;t use this ! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> If you need to transmit Maps over JAX-WS webservices, do it the XmlAdapter way as advertised in the official <a href="https://jaxb.dev.java.net/guide/Mapping_your_favorite_class.html">Unofficial JAXB Guide</a> instead.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=18&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/03/14/a-simple-map-wrapper-to-use-with-jaxb/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>Could it be dared to say that java is overdesigned ?</title>
		<link>http://eskatos.wordpress.com/2008/03/08/could-it-be-dared-to-say-that-java-is-overdesigned/</link>
		<comments>http://eskatos.wordpress.com/2008/03/08/could-it-be-dared-to-say-that-java-is-overdesigned/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 00:46:34 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[Various Links]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/?p=16</guid>
		<description><![CDATA[Java 7 is coming. And it&#8217;s an awesome project ! Now that java is distributed under the GPL, developers can believe that the JSR way of doing things will be more and more pragmatic.
The title of this post is a little bit coarse but this is the feeling java gives to developpers who &#8220;learn and [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="https://jdk7.dev.java.net/">Java 7</a> is coming. And it&#8217;s an awesome project ! Now that java is distributed under the GPL, developers can believe that the JSR way of doing things will be more and more pragmatic.</p>
<p>The title of this post is a little bit coarse but this is the feeling java gives to developpers who &#8220;<a href="http://java.sun.com/new2java/javamap/Java_Technology_Concept_Map.pdf">learn and use java  to create  and run programs  that make devices and internet useful for people</a>&#8220;.</p>
<p>I just read some articles about jdk7 changes that I want to share :</p>
<p>About the new framework  for fork-join style parallel decomposition and the ParallelArray class in java.util.concurrent :</p>
<ul>
<li><a href="http://www.ibm.com/developerworks/java/library/j-jtp11137.html">Stick a fork in it - Part One</a></li>
<li><a href="http://www.ibm.com/developerworks/java/library/j-jtp03048.html">Stick a fork in it - Part Two</a></li>
</ul>
<p>About the first attempt to give packages and visibility modifiers a lift :</p>
<ul>
<li><a href="http://today.java.net/pub/a/today/2008/03/06/jsr-294-superpackages.html">JSR-294 Superpackages</a></li>
</ul>
<p>The first ones are really exciting ! The one about the superpackages scares me a little. I know it&#8217;s the first &#8220;public&#8221; communication about it but I sincerely hope that the final solution will be presented with successfull examples of complex implementations, ie. will be pragmatic.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=16&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2008/03/08/could-it-be-dared-to-say-that-java-is-overdesigned/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>JAXB Custom Binding for Joda-Time</title>
		<link>http://eskatos.wordpress.com/2007/11/24/jaxb-custom-binding-for-joda-time/</link>
		<comments>http://eskatos.wordpress.com/2007/11/24/jaxb-custom-binding-for-joda-time/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 14:16:12 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jax-ws]]></category>

		<category><![CDATA[jaxb]]></category>

		<category><![CDATA[jee]]></category>

		<category><![CDATA[metro]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/2007/11/24/jaxb-custom-binding-for-joda-time/</guid>
		<description><![CDATA[I&#8217;m extensively using Joda-Time for handling time in my Java development, client or server side. Joda-Time is the codebase of the coming RI implementation of  JSR-310 that will hopefully ship in Java 7.
I often need to work with dates in web services implementations, here is the JAXB custom binding lines I use to un/marshall [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m extensively using <a href="http://joda-time.sourceforge.net/">Joda-Time</a> for handling time in my Java development, client or server side. Joda-Time is the codebase of the coming <a href="https://jsr-310.dev.java.net/">RI implementation</a> of  <a href="http://jcp.org/en/jsr/detail?id=310">JSR-310</a> that will hopefully ship in Java 7.</p>
<p>I often need to work with dates in web services implementations, here is the <a href="http://jcp.org/en/jsr/detail?id=222">JAXB</a> custom binding lines I use to un/marshall JodaTime types to standard xs:date and xs:dateTime XML Schema types.</p>
<p>Note : I&#8217;m using the <a href="https://jaxb.dev.java.net/">RI implementation of JAXB</a> spec bundled in <a href="https://metro.dev.java.net/">Metro</a>.<br />
<span id="more-15"></span><br />
<strong>DateTimeXmlAdapter that convert Joda-Time types to standard java types</strong></p>
<pre>
import java.util.Date;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.joda.time.DateTime;

@XmlTransient
public class DateTimeXmlAdapter extends XmlAdapter {

    @Override
    public DateTime unmarshal(Date date) throws Exception {
        return new DateTime(date.getTime());
    }

    @Override
    public Date marshal(DateTime dateTime) throws Exception {
        return new Date(dateTime.getMillis());
    }

}
</pre>
<p><strong>JAXB Custom binder for binding xs:date to java.util.Date.</strong></p>
<p>In the documentation, an example JAXB customization file that use this binder.</p>
<pre>
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.xml.bind.DatatypeConverter;

/**
 * &#60;?xml version="1.0" encoding="UTF-8"?&#62;
 * &#60;bindings xmlns="http://java.sun.com/xml/ns/jaxb"
 *           version="2.0"
 *           xmlns:xs="http://www.w3.org/2001/XMLSchema"&#62;
 *     &#60;globalBindings&#62;
 *         &#60;javaType name="java.util.Date" xmlType="xs:date"
 *                   parseMethod="org.your.package.name.XSDateCustomBinder.parseDate"
 *                   printMethod="org.your.package.name.XSDateCustomBinder.printDate"
 *         /&#62;
 *     &#60;/globalBindings&#62;
 * &#60;/bindings&#62;
 */
public class XSDateCustomBinder {

    public static Date parseDate(String s) {
        return DatatypeConverter.parseDate(s).getTime();
    }

    public static String printDate(Date dt) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(dt);
        return DatatypeConverter.printDate(cal);
    }

}
</pre>
<p><strong>JAXB Custom binder for binding xs:dateTime to java.util.Date.</strong></p>
<p>In the documentation, an example JAXB customization file that use this binder.</p>
<pre>
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.xml.bind.DatatypeConverter;

/**
 * &#60;?xml version="1.0" encoding="UTF-8"?&#62;
 * &#60;bindings xmlns="http://java.sun.com/xml/ns/jaxb"
 *           version="2.0"
 *           xmlns:xs="http://www.w3.org/2001/XMLSchema"&#62;
 *     &#60;globalBindings&#62;
 *         &#60;javaType name="java.util.Date" xmlType="xs:dateTime"
 *                   parseMethod="org.your.package.name.XSDateTimeCustomBinder.parseDateTime"
 *                   printMethod="org.your.package.name.XSDateTimeCustomBinder.printDateTime"
 *         /&#62;
 *     &#60;/globalBindings&#62;
 * &#60;/bindings&#62;
 */
public class XSDateTimeCustomBinder {

    public static Date parseDateTime(String s) {
        return DatatypeConverter.parseDate(s).getTime();
    }

    public static String printDateTime(Date dt) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(dt);
        return DatatypeConverter.printDate(cal);
    }

}
</pre>
<p>I hope this may help you.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=15&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2007/11/24/jaxb-custom-binding-for-joda-time/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
		<item>
		<title>Classpath tools : jcfind and JWhich</title>
		<link>http://eskatos.wordpress.com/2007/10/20/classpath-tools-jcfind-and-jwhich/</link>
		<comments>http://eskatos.wordpress.com/2007/10/20/classpath-tools-jcfind-and-jwhich/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 11:17:55 +0000</pubDate>
		<dc:creator>eskatos</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[classpath]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://eskatos.wordpress.com/2007/10/20/classpath-tools-jcfind-and-jwhich/</guid>
		<description><![CDATA[Deep understanding of Java classpath is something that is too often neglected. I won&#8217;t write an article about classpath, internet is full of readings about it :

 How Classes are Found at java.sun.com
 Classpath (Java) page from Wikipedia
 Classpath entry in the Java Glossary
 Java Tip 105: Mastering the classpath with JWhich

Here come JWhich and [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Deep understanding of Java classpath is something that is too often neglected. I won&#8217;t write an article about classpath, internet is full of readings about it :</p>
<ul>
<li> <a href="http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html">How Classes are Found </a>at <a href="http://java.sun.com/">java.sun.com</a></li>
<li> <a href="http://en.wikipedia.org/wiki/Classpath_(Java)">Classpath (Java)</a> page from <a href="http://wikipedia.org/">Wikipedia</a></li>
<li> <a href="http://mindprod.com/jgloss/classpath.html">Classpath</a> entry in the <a href="http://mindprod.com/jgloss/">Java Glossary</a></li>
<li> <a href="http://www.javaworld.com/javaworld/javatips/jw-javatip105.html">Java Tip 105: Mastering the classpath with JWhich</a></li>
</ul>
<p>Here come <a href="https://which4j.dev.java.net/releasenotes.html">JWhich</a> and <a href="http://javaclassfind.wiki.sourceforge.net/">jcfind</a>. Both are classpath reflection tools.</p>
<p>JWhich provides a command line interface and a Java api where jcfind only has command line interface and is written in python.</p>
<p>I prefer to use jcfind from the command line because it&#8217;s really faster than Which4j and the command line is more practical. In Java software, I use the JWhich API that is really easy to use. The big drawback of using Which4j from command line is that you must provide a full class name, using it&#8217;s API you can search for a class simple name.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/eskatos.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/eskatos.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/eskatos.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/eskatos.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/eskatos.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/eskatos.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/eskatos.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/eskatos.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/eskatos.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/eskatos.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/eskatos.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/eskatos.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=eskatos.wordpress.com&blog=1874426&post=11&subd=eskatos&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://eskatos.wordpress.com/2007/10/20/classpath-tools-jcfind-and-jwhich/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/eskatos-128.jpg" medium="image">
			<media:title type="html">eskatos</media:title>
		</media:content>
	</item>
	</channel>
</rss>