<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Effective Development Notes</title>
	
	<link>http://www.carlobonamico.com/blog</link>
	<description>From a passionate developers working on...</description>
	<lastBuildDate>Fri, 23 Sep 2011 08:40:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/carlobonamico" /><feedburner:info uri="carlobonamico" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Moved to Linode.com</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/rK6zxrK1fis/</link>
		<comments>http://www.carlobonamico.com/blog/?p=71#comments</comments>
		<pubDate>Fri, 23 Sep 2011 08:40:40 +0000</pubDate>
		<dc:creator>Carlo Bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=71</guid>
		<description><![CDATA[Just a quick update to check that everything is working after moving to linode.com.]]></description>
			<content:encoded><![CDATA[<p>Just a quick update to check that everything is working after moving to <a href="http://linode.com" target="_blank">linode.com</a>.</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/rK6zxrK1fis" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=71</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=71</feedburner:origLink></item>
		<item>
		<title>Is my Web Application secure? OWASP Top Ten and Beyond (from Codemotion 2011)</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/IX7MhLXFNs8/</link>
		<comments>http://www.carlobonamico.com/blog/?p=66#comments</comments>
		<pubDate>Mon, 21 Mar 2011 08:25:42 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[codemotion]]></category>
		<category><![CDATA[ESAPI]]></category>
		<category><![CDATA[juggenova]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Spring Security]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[web application security]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=64</guid>
		<description><![CDATA[Java &#38; .NET always featured stronger security and reliability with respect to the common vulnerabilities (think of Buffer Overflows, etc&#8230; ) of the C/C++ world. However, the power and also complexity increase of Rich Internet Applications (DHTML, JS, AJAX&#8230;) paves &#8230; <a href="http://www.carlobonamico.com/blog/?p=66">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Java &amp; .NET always featured stronger security and reliability with respect to the common vulnerabilities (think of Buffer Overflows, etc&#8230; ) of the C/C++ world.</p>
<p>However, the power and also complexity increase of Rich Internet Applications (DHTML, JS, AJAX&#8230;) paves the way to new attack forms, from SQL Injection to Cross-Site Scripting and Request Forgery. In my talk at the <a href="http://www.codemotion.it" target="_blank">2011 Codemotion</a> in Rome I discussed the main issues and principles in securing a modern Web Application, with specific reference to the <a href="http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project" target="_blank">OWASP Top Ten security risks for 2010</a>.</p>
<div style="width:425px"><strong><a title="Is my Web Application secure? OWASP Top Ten Security Risks and Beyond..." href="http://www.slideshare.net/carlo.bonamico/is-my-web-application-secure-owasp-top-ten-security-risks-and-beyond">Is my Web Application secure? OWASP Top Ten Security Risks and Beyond&#8230;</a></strong> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="id" value="__sse7307739" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=bonamico-owasp-topten-2011-110318103015-phpapp01&amp;stripped_title=is-my-web-application-secure-owasp-top-ten-security-risks-and-beyond&amp;userName=carlo.bonamico" /><embed id="__sse7307739" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=bonamico-owasp-topten-2011-110318103015-phpapp01&amp;stripped_title=is-my-web-application-secure-owasp-top-ten-security-risks-and-beyond&amp;userName=carlo.bonamico" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div id="__ss_7307739" style="width:425px">
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/carlo.bonamico">carlo.bonamico</a></div>
</div>
<p>Have a look at all the other presentations on <a href="http://www.codemotion.it/programma-talks" target="_blank">Codemotion&#8217;s website</a>.</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/IX7MhLXFNs8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=66</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=66</feedburner:origLink></item>
		<item>
		<title>JVM Management &amp; Monitoring Power Tools: what is my JVM doing?</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/iOtKCfD5MY4/</link>
		<comments>http://www.carlobonamico.com/blog/?p=65#comments</comments>
		<pubDate>Sat, 30 Jan 2010 14:05:25 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[btrace]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaday]]></category>
		<category><![CDATA[javaday 2010]]></category>
		<category><![CDATA[jconsole]]></category>
		<category><![CDATA[jps]]></category>
		<category><![CDATA[jstat]]></category>
		<category><![CDATA[jvisualvm]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[visualvm]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=63</guid>
		<description><![CDATA[Unfortunately I was unable to present myself at the Javaday Rome 2010 because of a flu which kept me at home&#8230; and first of all many thanks to Fabrizio and Ugo for presenting on my behalf. Here you are my &#8230; <a href="http://www.carlobonamico.com/blog/?p=65">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Unfortunately I was unable to present myself at the <a href="http://roma.javaday.it">Javaday Rome 2010</a> because of a flu which kept me at home&#8230; and first of all many thanks to <a href="http://www.java.net/blogs/fabriziogiudici/">Fabrizio</a> and Ugo for presenting on my behalf.</p>
<p>Here you are my slides on how to monitor and analyze JVM behavior with a number of tools which are hidden in plain sight inside the JDK, so useful and at the same time quite unknown to many developers.</p>
<p>We are so used to Java that we often forget what&#8217;s required behind the scenes to give us robustness, security, platform independence, performance, rich APIs and commercial/open source ecosystem.</p>
<p>But it is interesting (and sometimes necessary) to get a deeper look at what&#8217;s happening behind the scenes&#8230; The JVM gives us powerful tools to monitor, debug, tune &#038; troubleshoot its internal mechanisms, including the Garbage Collector and dynamic Just in Time compiler.</p>
<div style="width:425px;text-align:left" id="__ss_3031113"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/carlo.bonamico/javaday2010-jvm-power-tools-what-is-my-jvm-doing" title="Javaday2010 - Jvm Power Tools - What is my JVM doing?">Javaday2010 &#8211; Jvm Power Tools &#8211; What is my JVM doing?</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javaday2010-carlobonamico-jvmpowertools-100130074643-phpapp01&#038;stripped_title=javaday2010-jvm-power-tools-what-is-my-jvm-doing" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javaday2010-carlobonamico-jvmpowertools-100130074643-phpapp01&#038;stripped_title=javaday2010-jvm-power-tools-what-is-my-jvm-doing" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/carlo.bonamico">carlo.bonamico</a>.</div>
</div>
<p>As usual, a huge thank you to Mara Marzocchi and the entire JUG Roma team for organizing such a not-to-be missed and lively event.</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/iOtKCfD5MY4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=65</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=65</feedburner:origLink></item>
		<item>
		<title>What is my JVM doing? management and monitoring with JDK power tools</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/wlNl3spHcRw/</link>
		<comments>http://www.carlobonamico.com/blog/?p=64#comments</comments>
		<pubDate>Sat, 16 Jan 2010 22:00:17 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaday]]></category>
		<category><![CDATA[javaday2010]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[jstat]]></category>
		<category><![CDATA[juggenova]]></category>
		<category><![CDATA[jvisualvm]]></category>
		<category><![CDATA[visualvm]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=62</guid>
		<description><![CDATA[I am happy to announce that I will be speaking at the Javaday Rome 2010, the main Italian event for and by the Java community. An event not to be missed! My talk will focus on the use of many &#8230; <a href="http://www.carlobonamico.com/blog/?p=64">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am happy to announce that I will be speaking at the <a href="http://www.carlobonamico.com">Javaday Rome 2010</a>, the main Italian event for and by the Java community. An event not to be missed!</p>
<p>My talk will focus on the use of many power tools that are part of JDK since version 1.5, but are at the same time unknown to many developers; specifically, I will discuss how to</p>
<ul>
<li>find active JVMs with jps</li>
<li>anaylze memory consumption and garbage collection behavior with jstat</li>
<li>get an overview of VM activities with jconsole</li>
<li>analyze in depth VM behavior with VisualVM, both in the case of local and remote Virtual Machines</li>
<li>analizzare i bottleneck prestazionali con i profiler di VisualVM</li>
<li>detect threading issues with the Thread Dump Analyzer</li>
<li>find causes of OutOfMemory errors and PermGen errors</li>
<li>detect memory leaks</li>
<li>trace and debug running applications in production with btrace</li>
</ul>
<p>If you want to meet me at the event, drop by at my company (<a href="http://www.nispro.it">NIS</a>) booth in the exhibition hall.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm3.static.flickr.com/2785/4272667352_85a72e006a_o.jpg" alt="Speaking at Javaday 2010" /></p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/wlNl3spHcRw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=64</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=64</feedburner:origLink></item>
		<item>
		<title>Slides for the Maven2 in the real world talk @ Javaday 2009</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/qOMs7l6iaUs/</link>
		<comments>http://www.carlobonamico.com/blog/?p=59#comments</comments>
		<pubDate>Tue, 27 Jan 2009 12:25:08 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[effective development]]></category>
		<category><![CDATA[javaday]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[maven2]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=59</guid>
		<description><![CDATA[I am back from the Javaday 2009 in Rome, which was definitely THE Java event of the year for Italy&#8230; Congratulations to Mara and the JUG Roma team for creating an interesting, lively, and incredibly well-organized event. I had the &#8230; <a href="http://www.carlobonamico.com/blog/?p=59">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div>I am back from the <a href="http://roma.javaday.it/javaday2009">Javaday 2009</a> in Rome, which was definitely THE Java event of the year for Italy&#8230; Congratulations to Mara and the JUG Roma team for creating an interesting, lively, and incredibly well-organized event. I had the pleasure of attending several interesting presentations (slides for all talks will be published on the <a href="http://roma.javaday.it/javaday2009">Javaday 2009</a> website in the next few days), and moreover to meet in person a number of contacts in the community.</p>
<p>Here you are my presentation on how to effectively use Maven2 on large projects. Hope you enjoy it! Please do not hesitate to contact me (details are on last slide) for any question.</p>
</div>
<div style="width:425px;text-align:left"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Maven 2 in the real world" href="http://www.slideshare.net/carlo.bonamico/maven-2-in-the-real-world-presentation?type=powerpoint">Maven 2 in the real world</a><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=javaday2009carlobonamicomaven203-1232952925826657-2&amp;rel=0&amp;stripped_title=maven-2-in-the-real-world-presentation" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://static.slideshare.net/swf/ssplayer2.swf?doc=javaday2009carlobonamicomaven203-1232952925826657-2&amp;rel=0&amp;stripped_title=maven-2-in-the-real-world-presentation" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div id="__ss_952797" style="width:425px;text-align:left">
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/maven2">maven2</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/maven">maven</a>)</div>
</div>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/qOMs7l6iaUs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=59</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=59</feedburner:origLink></item>
		<item>
		<title>Runtime profiling and monitoring Java apps with btrace</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/8x99NhK1jVg/</link>
		<comments>http://www.carlobonamico.com/blog/?p=58#comments</comments>
		<pubDate>Wed, 28 May 2008 06:40:44 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[btrace]]></category>
		<category><![CDATA[instrumentation]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[profiling]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/?p=58</guid>
		<description><![CDATA[A the latest Genova JUG meeting last week there was much discussion about performance tuning and optimization, particularly of web applications. My mention of the recently released BTrace profiling tool was met with significant interested and I was asked to &#8230; <a href="http://www.carlobonamico.com/blog/?p=58">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A the latest <a href="http://juggenova.net" target="_blank">Genova JUG</a> meeting last week there was much discussion about performance tuning and optimization, particularly of web applications. My mention of the recently released <a href="https://btrace.dev.java.net/" target="_blank">BTrace</a> profiling tool was met with significant interested and I was asked to provide more details and references&#8230;</p>
<p><a href="https://btrace.dev.java.net/" target="_blank">BTrace</a> (where the &#8216;B&#8217; stands for <em>bytecode</em>) is an open source tool hosted on java.net, where you can find extensive <a href="https://btrace.dev.java.net/source/browse/btrace/docs/usersguide.html?rev=1.3" target="_blank">documentation and samples</a>. It is conceptually similar to the much-talked-about <a href="http://opensolaris.org/os/community/dtrace/" target="_blank">Solaris DTrace</a> platform, but can be used on any Java platform/app.</p>
<p>The main BTrace concept is that of dynamically connecting to a running Java application (or server) to attach short &#8220;scripts&#8221; which log a range of events and infos such as</p>
<ul>
<li>method calls;</li>
<li>execution times;</li>
<li>constructor invocation;</li>
<li>available memory;</li>
</ul>
<p>Script execution is tied to several situations</p>
<ul>
<li>reaching a specific line number;</li>
<li>invoking a given method;</li>
<li>returning from a method;</li>
<li>invoking system calls (e.g. <em>exit</em>);</li>
<li>recurring timer (period execution at fixed intervals);</li>
<li>and <a href="https://btrace.dev.java.net/source/browse/btrace/docs/usersguide.html?rev=1.3" target="_blank">many more</a>&#8230;</li>
</ul>
<p>In a way, BTrace scripts are very similar to AOP&#8217;s aspects, but can be attached to any existing Java code (or better, bytecode) at runtime and without any configuration or modification at development time.</p>
<p>The scripts are simply Java classes which take advantage of methods from the btrace API, and are configured by using simple but powerful annotations. Here you are an <em>hello world</em> script which traces session creation in <em>hibernate</em>:</p>
<pre><code>// import BTrace annotations
import <strong>com.sun.btrace.annotations.*;</strong>
// import logging methods
import <strong>static com.sun.btrace.BTraceUtils.*;</strong>

<strong>@BTrace</strong>
public class HelloWorldTrace {

// probe the openSession() method of Hibernate SessionFactory
<strong>@OnMethod</strong>(
clazz="org.hibernate.SessionFactory",
method="openSession"
)
public static void onOpenSessionTrace() {
// you can only log using the stati println method from BTraceUtils
println("Hibernate: opening a new session...");
}
}
</code></pre>
<p>Btrace scripts are attached to the running process using the JVM&#8217;s <a href="http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html" target="_blank">instrumentation interface</a>.</p>
<p>If you are using JDK 1.6, you can attach to any running jvm by simply specifying its pid obtained through the new <a href="http://java.sun.com/javase/6/docs/technotes/tools/share/jps.html" target="_blank">jps</a> command:</p>
<pre><a name="examples"><strong>jps</strong>

18037 Demo.JAR
19032 jps
19025 tomcat

<strong>btrace 19025 HelloWorldTrace </strong>

<code>Hibernate: opening a new session...</code>
<code>Hibernate: opening a new session...</code>
</a></pre>
<p>The last command is simply an utility batch file which actually compiles and attaches the script.: On the other hand, on previous JDKs it is necessary to enable tracing in a similar way to how you enable remote debugging.</p>
<p>As an example of BTrace power and ease of use, the following script from <a href="https://btrace.dev.java.net/source/browse/btrace/samples/WebServiceTracker.java?rev=1.2&amp;view=markup" target="_blank">BTrace samples</a> intercepts all calls to methods in classes which are annotated with @WebService (e.g. all JAX-WS web service classes) and logs theri execution times:</p>
<pre>@BTrace public class WebServiceTracker {
// store webservice entry time in this thread local
@TLS private static long startTime;

@OnMethod(
clazz="@javax.jws.WebService",
method="@javax.jws.WebMethod"
)
public static void onWebserviceEntry() {
print("entering webservice ");
println(strcat(strcat(name(probeClass()), "."), probeMethod()));
startTime = timeMillis();
}

@OnMethod(
clazz="@javax.jws.WebService",
method="@javax.jws.WebMethod",
location=@Location(Kind.RETURN)
)
public static void onWebserviceReturn() {
println(strcat("Time taken (msec) ", str(timeMillis() - startTime)));
println("==========================");
}

}</pre>
<p>Note the use of BTrace built-in <em>strcat </em>function, which is needed to avoid the overhead of string concatenation. Obviously, the script code must be as lightweight as possible to avoid influencing tracing results with its own execution times, and thus the BTrace API provides efficient implementations of basic logging tasks.</p>
<p>Stay tuned for more tracing examples&#8230;</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/8x99NhK1jVg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=58</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=58</feedburner:origLink></item>
		<item>
		<title>Java IDE day 2008: big success in Genova!</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/Rr93DJC-8gM/</link>
		<comments>http://www.carlobonamico.com/blog/?p=57#comments</comments>
		<pubDate>Wed, 12 Mar 2008 08:18:48 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[carlo bonamico]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[ideday]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jdeveloper]]></category>
		<category><![CDATA[jug]]></category>
		<category><![CDATA[juggenova]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/2008/03/12/java-ide-day-2008-big-success-in-genova/</guid>
		<description><![CDATA[Just a quick post while we recover from the organization effort&#8230; I will write a more detailed report as soon as possible. The IDE day was a success, with a participation level that definitely went beyond our best expectations, both &#8230; <a href="http://www.carlobonamico.com/blog/?p=57">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a quick post while we recover from the organization effort&#8230; I will write a more detailed report as soon as possible. The IDE day was a success, with a participation level that definitely went beyond our best expectations, both in terms of attendance (about 130 people!) and in term of audience interaction (the speakers were overwhelmed with questions!).</p>
<p>Presentation slides will be loaded on the <a href="http://www.ideday.org">http://www.ideday.org</a> website in the next few days.</p>
<p>In the meantime I publish this picture of the speakers with the organizing group for Genova, which give me the opportunity to say a huge THANK YOU to everyone who made this event possible.</p>
<p>[photopress:IMG_7888.jpg,thumb,centered]</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/Rr93DJC-8gM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=57</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=57</feedburner:origLink></item>
		<item>
		<title>Java IDE day 2008 is coming!</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/IssZ4t3fLqk/</link>
		<comments>http://www.carlobonamico.com/blog/?p=56#comments</comments>
		<pubDate>Wed, 13 Feb 2008 22:38:59 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java ideday juggenova jug jugroma netbeans eclipse idea]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/2008/02/14/java-ide-day-2008-is-coming/</guid>
		<description><![CDATA[Thanks to a fruitful collaboration between the Genova Java User Group and Rome Java User Group the first Italian Java IDE day is a reality&#8230; If you are interested in Java development (but not just java, as these IDEs interestingly &#8230; <a href="http://www.carlobonamico.com/blog/?p=56">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Thanks to a fruitful collaboration between the <a href="http://www.juggenova.net" target="_blank">Genova Java User Group</a> and <a href="http://www.jugroma.it" target="_blank">Rome Java User Group</a> the first Italian Java IDE day is a reality&#8230;</p>
<p>If you are interested in Java development (but not just java, as these IDEs interestingly support a range of languages) you can&#8217;t miss the event that will take place</p>
<ul>
<li>monday 10 march 2008 in Genova</li>
<li>wednesday 12 march 2008 in Rome</li>
</ul>
<p>where  international experts including Roman Strobl (Sun), Paolo Ramasso (Oracle) and Vaclav Pech (Jetbrains) will discuss the most advanced features of Java IDEs and their future evolution.</p>
<p>The event is free and open to all! for more information (and to register) visit <a href="http://www.ideday.org">http://www.ideday.org</a></p>
<p>See you there!</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/IssZ4t3fLqk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=56</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=56</feedburner:origLink></item>
		<item>
		<title>How to programmatically define Spring beans</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/qI8czqBV_3Y/</link>
		<comments>http://www.carlobonamico.com/blog/?p=55#comments</comments>
		<pubDate>Tue, 22 Jan 2008 16:20:42 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java spring howto eng beans]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/2008/01/22/how-to-dynamicallyprogrammatically-define-spring-beans/</guid>
		<description><![CDATA[The Spring framework is well know both for its powerful architecture and its often barely tolerated XML configuration syntax.So there are cases where you would like to take advantage of Spring features (Dependency Injection, scope management, AOP, Transaction Management) in &#8230; <a href="http://www.carlobonamico.com/blog/?p=55">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.springframework.org" target="_blank">Spring</a> framework is well know both for its powerful architecture and its often barely tolerated XML configuration syntax.So there are cases where you would like to take advantage of Spring features (Dependency Injection, scope management, AOP, Transaction Management) in a set of beans without having to declare all of them in XML. This is particularly the case where you need to define a non-trivial number of similar beans (e.g. DAOs, backing beans in a JSF application, etc.).</p>
<p>In practice, we want to be able to write something like</p>
<pre language="XML">
ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
SampleService s = (SampleService) context.getBean("sampleService");</pre>
<p>(or the equivalent code in a webapp or servlet with a <em>WebApplicationContext</em>) so that s get initialized by Spring in the right scope <strong>without actually declaring <em>sampleService </em>in <em>application.xml</em></strong>.</p>
<p>Thanks to Spring modularity, there are several ways of achieving this:</p>
<ul>
<li>define the bean through <em>annotations</em>;</li>
<li>define a custom <em>BeanDefinitionReader</em> that reads from a property/configuration file instead of XML;</li>
<li>define the bean <em>programmatically</em>.</li>
</ul>
<p>I will now describe how to do it with the third approach. With most kinds of ApplicationContexts, it is possible to use the <a href="http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/beans/factory/support/BeanDefinitionRegistry.html" target="_blank"><em>BeanDefinitionRegistry</em> </a>interface to dynamically and programmatically declare beans:</p>
<pre language="Java">
BeanDefinition definition = new RootBeanDefinition(SampleService.class);
//optionally configure all bean properties, like scope, prototype/singleton, etc
context.registerBeanDefinition("sampleService", definition);</pre>
<p>This allows you to manually add a bean definition to the context.</p>
<p>In order to fully automatize the configuration, we can define a <a href="http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/beans/factory/config/BeanFactoryPostProcessor.html" target="_blank">BeanFactoryPostProcessor</a> that is automatically invoked after the standard xml file is read, being thus able to automatically add more bean definitions. The bean definitions can be for instance created by scanning classes for custom annotations, scanning custom configuration files, or any other custom criteria.</p>
<p>The following example will create a bean for each <em>*.service</em> file in the <em>config</em> directory</p>
<pre>import java.io.IOException;</pre>
<pre>import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ResourceLoaderAware;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.ResourceLoader;</pre>
<pre>public class AutoBeanDeclarer implements BeanFactoryPostProcessor, ApplicationContextAware
 {
      private ApplicationContext mainContext;</pre>
<pre>public void postProcessBeanFactory(ConfigurableListableBeanFactory context)
        throws BeansException</pre>
<pre>{</pre>
<pre>BeanDefinitionRegistry registry = ((BeanDefinitionRegistry)context);</pre>
<pre>Resource[] fileList = null;

 fileList = mainContext.getResources("config/*.service");</pre>
<pre>for (Resource file : fileList)</pre>
<pre>{</pre>
<pre>System.out.println("File found: "+file.getFilename());</pre>
<pre>BeanDefinition definition = new RootBeanDefinition(SampleServiceImpl.class);</pre>
<pre>registry.registerBeanDefinition(file.getFilename(), definition);</pre>
<pre>}</pre>
<pre>public void setApplicationContext(ApplicationContext mainContext)
 {
      this.mainContext = mainContext;</pre>
<pre>}</pre>
<pre>}</pre>
<p>The BeanFactoryPostProcessor can then be simply added to the main <em>application.xml</em>:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</pre>
<pre>&lt;beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:aop="http://www.springframework.org/schema/aop"
 xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

http://www.springframework.org/schema/aop

 http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"&gt;</pre>
<pre>&lt;!-- note: no definition of SampleService  --&gt;</pre>
<pre>&lt;bean id="autoConfigurer" class="AutoBeanDeclarer"/&gt;</pre>
<pre>&lt;/beans&gt;</pre>
<p>Spring will then automatically activate the <em>PostProcessor </em>after reading all configuration files.</p>
<p>A possible use in a web application could be that of automatically defining a bean for each html page/component. More examples will appear in future posts&#8230;</p>
<p>Thank you for your time! I hope you enjoyed this post. You can find more materials on Spring on the <a href="http://www.juggenova.net" target="_blank">JUG Genova</a> website.</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/qI8czqBV_3Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=55</feedburner:origLink></item>
		<item>
		<title>Slides from the JUG Meeting and next Meeting (22/01/2008)</title>
		<link>http://feedproxy.google.com/~r/carlobonamico/~3/UPuhjL5bBJI/</link>
		<comments>http://www.carlobonamico.com/blog/?p=53#comments</comments>
		<pubDate>Fri, 23 Nov 2007 10:53:35 +0000</pubDate>
		<dc:creator>bonamico</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jug]]></category>
		<category><![CDATA[juggenova]]></category>

		<guid isPermaLink="false">http://www.carlobonamico.com/blog/2007/11/23/slides-from-the-jug-meeting-and-next-meeting-22012008/</guid>
		<description><![CDATA[The last meeting of the Genova JUG was a very interesting event&#8230; you can have a look at the presentations on Model Driven Engineering in Portofino and Nasa World Wind with Java on the JUG Website. The next meeting will &#8230; <a href="http://www.carlobonamico.com/blog/?p=53">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The last meeting of the Genova JUG was a very interesting event&#8230; you can have a look at the presentations on Model Driven Engineering in <a href="http://www.manydesigns.net" target="_blank">Portofino</a> and <a href="http://worldwind.arc.nasa.gov" target="_blank">Nasa World Wind</a> with Java on the <a href="http://www.juggenova.net" target="_blank">JUG Website</a>.</p>
<p>The <a href="http://www.jugevents.org/jugevents/event/show.html?id=907" target="_blank">next meeting</a> will take place on the 22th January 2008 at DIST.  More details will be announced soon&#8230;</p>
<img src="http://feeds.feedburner.com/~r/carlobonamico/~4/UPuhjL5bBJI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.carlobonamico.com/blog/?feed=rss2&amp;p=53</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.carlobonamico.com/blog/?p=53</feedburner:origLink></item>
	</channel>
</rss>

