<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>K3andme</title>
	<atom:link href="http://k3andme.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://k3andme.wordpress.com</link>
	<description>Java, Maven, NetBeans et al</description>
	<lastBuildDate>Wed, 26 Nov 2008 21:21:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='k3andme.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>K3andme</title>
		<link>http://k3andme.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://k3andme.wordpress.com/osd.xml" title="K3andme" />
	<atom:link rel='hub' href='http://k3andme.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Spring &#8211; Quartz scheduler setup</title>
		<link>http://k3andme.wordpress.com/2008/11/25/spring-quartz-scheduler-setup/</link>
		<comments>http://k3andme.wordpress.com/2008/11/25/spring-quartz-scheduler-setup/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:55:55 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[quartz]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=28</guid>
		<description><![CDATA[The Spring Application Framework ships with helper classes to make configuring OpenSymphony&#8217;s quartz scheduler a breeze. The scheduler allows (amongst other things) cron style triggers. At the time of writing, the latest version of Quartz is 1.6.3, but I&#8217;ll be using 1.6.0 as this is the latest version in the Maven central repos. First, download [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=28&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.springframework.org/">Spring Application Framework</a> ships with helper classes to make configuring <a href="http://www.opensymphony.com/quartz/">OpenSymphony&#8217;s quartz</a> scheduler a breeze. The scheduler allows (amongst other things) cron style triggers. At the time of writing, the latest version of Quartz is 1.6.3, but I&#8217;ll be using 1.6.0 as this is the latest version in the <a href="http://maven.apache.org/">Maven</a> central repos.</p>
<p>First, download the version you wish to use and add as a dependency to your project. In <a href="http://maven.apache.org/">Maven</a>&#8216;s case, add this to the pom.xml:</p>
<pre>&lt;dependency&gt;
  &lt;groupId&gt;opensymphony&lt;/groupId&gt;
  &lt;artifactId&gt;quartz&lt;/artifactId&gt;
  &lt;version&gt;1.6.0&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>Now, create your task which extends org.springframework.scheduling.quartz.QuartzJobBean and implement public void executeInternal(JobExecutionContext context) throws JobExecutionException. You can inject any necessary beans too (myService in this example).</p>
<pre>import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class myTask extends QuartzJobBean {
  private MyService myService;

  public void setMyService(MyService myService) {
    this.myService = myService;
  }

  public void executeInternal(JobExecutionContext context) throws JobExecutionException {
 <em>   Actual Business Logic
  </em>}
}</pre>
<p>Create a schedulingContext-timer.xml to keep the scheudling configuration seperate and place in the WEB-INF folder of your <a href="http://www.springframework.org/">Spring</a> webapp. These settings could also go in the applicationContext.xml if you prefer but I like to keep the configuration seperate.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"&gt;
&lt;beans&gt;
  &lt;!-- Job details --&gt;
  &lt;bean id="myTask" class="org.springframework.scheduling.quartz.JobDetailBean"&gt;
    &lt;property name="jobClass" value="com.mycompany.project.scheduling.MyTask"/&gt;
    &lt;property name="jobDataAsMap"&gt;
      &lt;map&gt;
        &lt;entry key="myService" value-ref="myServiceBean"/&gt;
      &lt;/map&gt;
    &lt;/property&gt;
  &lt;/bean&gt;

   &lt;!-- Cron --&gt;
  &lt;bean id="myTaskCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"&gt;
    &lt;property name="jobDetail" ref="myTask"/&gt;
    &lt;property name="cronExpression" value="0 0/5 * * * ?"/&gt;
  &lt;/bean&gt;

   &lt;!-- Kicker --&gt;
  &lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
    &lt;property name="triggers"&gt;
      &lt;list&gt;
        &lt;ref bean="myTaskCronTrigger"/&gt;
      &lt;/list&gt;
    &lt;/property&gt;
  &lt;/bean&gt;
&lt;/beans&gt;</pre>
<p>A couple of notes:</p>
<ul>
<li>&#8220;Job details&#8221; is where you inject any required beans</li>
<li>This example uses a CronTriggerBean as this provides functionality otherwise not present in a simple Timer. In the example, the trigger is set to run every 5 minutes starting on the hour. For a full list of possible cron settings, click <a href="http://quartz.sourceforge.net/javadoc/org/quartz/CronTrigger.html">here</a>.</li>
<li>Available triggers are CronTrigger, SimpleTrigger and UICronTrigger. See <a href="http://quartz.sourceforge.net/javadoc/org/quartz/Trigger.html">here</a>.</li>
<li>The &#8220;Kicker&#8221; is required to actually make use of the triggers you&#8217;ve set up</li>
<li>If you&#8217;ve used a separate context, remember to add its name to the web.xml under contextConfigLocation</li>
</ul>
<p>And that&#8217;s all&#8230; your webapp now has full Cron capabilities! Enjoy <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=28&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/11/25/spring-quartz-scheduler-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven and log4j</title>
		<link>http://k3andme.wordpress.com/2008/11/07/maven-and-log4j/</link>
		<comments>http://k3andme.wordpress.com/2008/11/07/maven-and-log4j/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 15:23:19 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=25</guid>
		<description><![CDATA[I noticed a newer version of log4j (1.2.15) and figured I&#8217;d upgrade in our maven projects. My advice is to avoid it&#8230; some unnecessary dependencies are forced so you end up with lots of extra jars. Hope they fix it soon.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=25&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I noticed a newer version of <a href="http://logging.apache.org/log4j/1.2/download.html">log4j (1.2.15)</a> and figured I&#8217;d upgrade in our <a href="http://maven.apache.org/">maven</a> projects.</p>
<p>My advice is to <strong>avoid</strong> it&#8230; some unnecessary dependencies are forced so you end up with lots of extra jars. Hope they fix it soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=25&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/11/07/maven-and-log4j/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>Copylibs and copylibstask.jar NetBeans 6.5RC1</title>
		<link>http://k3andme.wordpress.com/2008/11/04/copylibs-and-copylibstaskjar-netbeans-65rc1/</link>
		<comments>http://k3andme.wordpress.com/2008/11/04/copylibs-and-copylibstaskjar-netbeans-65rc1/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 11:54:20 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[6.5rc1]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=20</guid>
		<description><![CDATA[Just a quick one. I currently have several projects which all rely on 1 project as a global library so the same jar versions are used across the board. This was working fine until 6.5RC1 came along. NetBeans would seemingly randomly create a CopyLibs folder with a copylibtask.jar within my library project. Not accidentally committing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=20&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just a quick one. I currently have several projects which all rely on 1 project as a global library so the same jar versions are used across the board.</p>
<p>This was working fine until <a href="http://download.netbeans.org/netbeans/6.5/rc/">6.5RC1</a> came along. <a href="http://www.netbeans.org/">NetBeans</a> would seemingly randomly create a CopyLibs folder with a copylibtask.jar within my library project. Not accidentally committing this to SVN has been a pain.</p>
<p>Seems it&#8217;s all down to using the embedded <a href="http://ant.apache.org/">ant</a>. Since I&#8217;ve changed this to use the external <a href="http://ant.apache.org/">ant</a>, the problem has disappeared (so far! &#8211; will update this if it reoccurs).</p>
<p>Fix:</p>
<p>Tools -&gt; Options -&gt; Miscellaneous -&gt; Ant -&gt; Change Ant Home to point to an external ant (preferably 1.7.1)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=20&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/11/04/copylibs-and-copylibstaskjar-netbeans-65rc1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>Converting Ant to Maven in NetBeans</title>
		<link>http://k3andme.wordpress.com/2008/10/30/converting-ant-to-maven-in-netbeans/</link>
		<comments>http://k3andme.wordpress.com/2008/10/30/converting-ant-to-maven-in-netbeans/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 19:05:02 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=12</guid>
		<description><![CDATA[After a good couple of days spent converting ant projects over to maven, here is what I consider the easiest method. This is using NetBeans 6.5rc1 but probably works in 6.1. Here are the steps for converting an ant project to a maven project in NetBeans. This presumes your ~/.m2/settings.xml is already set up (not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=12&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After a good couple of days spent converting <a href="http://ant.apache.org/" target="_blank">ant</a> projects over to <a href="http://maven.apache.org/" target="_blank">maven</a>, here is what I consider the easiest method. This is using <a href="http://www.netbeans.org/">NetBeans</a> 6.5rc1 but probably works in 6.1.</p>
<p>Here are the steps for converting an ant project to a <a href="http://maven.apache.org/">maven</a> project in <a href="http://www.netbeans.org/">NetBeans</a>.<br />
This presumes your ~/.m2/settings.xml is already set up (not shown here for security purposes) and you have installed the <a href="http://www.netbeans.org/">Netbeans</a> <a href="http://maven.apache.org/">maven2</a> plugin:</p>
<p>1. Open ant project<br />
2. Create new maven project using the &#8220;<a href="http://maven.apache.org/">Maven</a> Quickstart Archetype&#8221;<br />
3. Properties -&gt; Sources -&gt; Change to 1.6<br />
4. pom.xml -&gt; Add distribution management</p>
<pre>&lt;distributionManagement&gt;
  &lt;repository&gt;
    &lt;id&gt;nexus&lt;/id&gt;
    &lt;name&gt;Internal Releases&lt;/name&gt;
    &lt;url&gt;<em>YourInternalReleaseURL</em>&lt;/url&gt;
  &lt;/repository&gt;
&lt;/distributionManagement&gt;</pre>
<p>5. Files tab -&gt; src/main -&gt; add folder &#8220;resources&#8221;. This will create an &#8220;Other Sources/resources&#8221; entry in the project view<br />
6. Delete existing source and test package stubs<br />
7. Copy java sources and test sources across from ant project<br />
8. Move all config xml files (such as applicationContext.xml) over to &#8220;Other Sources/resources&#8221;<br />
9. If you have any <a href="http://www.hibernate.org/">hibernate</a> .hbm.xml files, create a folder structure under &#8220;Other Sources/resources&#8221; identical to the package structure, and copy the files to there<br />
10. Resolve dependencies. The easiest way to do this is go through red-underlined classes, copy the missing required classname, right-click the libraries node and hit &#8220;Find Dependency&#8221;<br />
11. If a dependency is purely for a test class, add &#8220;&lt;scope&gt;test&lt;/scope&gt;&#8221; to reduce the resulting jar filesize<br />
12. mvn install or deploy</p>
<p>If the <a href="http://ant.apache.org/">ant</a> project exposes a WebService:<br />
1. Add the following plugin to the pom.xml:</p>
<pre>&lt;plugin&gt;
  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
  &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
    &lt;execution&gt;
      &lt;goals&gt;
        &lt;goal&gt;wsimport&lt;/goal&gt;
      &lt;/goals&gt;
      &lt;configuration&gt;
        &lt;wsdlUrls&gt;
          &lt;wsdlUrl&gt;<em>yourWSDLExposedUrl</em>&lt;/wsdlUrl&gt;
        &lt;/wsdlUrls&gt;
        &lt;packageName&gt;<em>yourWSClientPackageName</em>&lt;/packageName&gt;
        &lt;sourceDestDir&gt;${basedir}/src/main/java&lt;/sourceDestDir&gt;
      &lt;/configuration&gt;
    &lt;/execution&gt;
  &lt;/executions&gt;
&lt;/plugin&gt;</pre>
<p>2. Change the wsdl location and packageName as necessary. Without the sourceDestDir, the generated sources live under target/ and code completion won&#8217;t work. Setting the package name to the same package as the ws-client solves this. Compilation works either way.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=12&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/10/30/converting-ant-to-maven-in-netbeans/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>ehcache and spring</title>
		<link>http://k3andme.wordpress.com/2008/10/23/ehcache-and-spring/</link>
		<comments>http://k3andme.wordpress.com/2008/10/23/ehcache-and-spring/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 16:28:24 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ehcache]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=7</guid>
		<description><![CDATA[As used by Hibernate, ehcache is a great little caching implementation which ought to be part of every Java coders arsenal. Although its complexities may seem overwhelming, it&#8217;s very easy to use as a simple caching solution. In my situation, I needed to prevent db hits when validating codes (ie seeing if they already exist [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=7&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As used by <a href="http://www.hibernate.org/" target="_blank">Hibernate</a>, <a href="http://ehcache.sourceforge.net/" target="_blank">ehcache</a> is a great little caching implementation which ought to be part of every Java coders arsenal. Although its complexities may seem overwhelming, it&#8217;s very easy to use as a simple caching solution.</p>
<p>In my situation, I needed to prevent db hits when validating codes (ie seeing if they already exist in the db). This is how easy it is to set up.</p>
<p><strong>applicationContext.xml</strong>:</p>
<pre>&lt;bean id="myDao" class="myDaoImpl" init-method="setupCache"&gt;
  &lt;property name="cacheManager" ref="cacheManager"&gt;
&lt;/bean&gt;</pre>
<pre>&lt;bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"&gt;
  &lt;property name="configLocation" value="classpath:ehcache.xml" /&gt;
&lt;/bean&gt;</pre>
<p><strong>ehcache.xml</strong>:</p>
<pre>&lt;ehcache&gt;
  &lt;diskStore path="java.io.tmpdir"/&gt;
  &lt;cache name="myCacheName"
    maxElementsInMemory="1000"
    eternal="true"
    overflowToDisk="false"/&gt;
  &lt;defaultCache
    maxElementsInMemory="300"
    maxElementsOnDisk="1000"
    eternal="false"
    timeToIdleSeconds="120"
    timeToLiveSeconds="120"
    overflowToDisk="true"/&gt;
&lt;/ehcache&gt;</pre>
<p><strong>myDaoImpl.java</strong>:</p>
<pre>import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class {
  private CacheManager cacheManager;
  private Cache myCache = null;

  public void setCacheManager(CacheManager cacheManager) {
    this.cacheManager = cacheManager;
  }

  private void setupCache() {
    String cacheName = "myCacheName";
    logger.debug("Fetching cache [" + cacheName + "]");
    myCache = cacheManager.getCache(cacheName);
  }
}</pre>
<p><strong>ehcache.xml</strong> needs to be put alongside <strong>applicationContext.xml</strong> (especially in the case of jar packaging). If you&#8217;re packaging a war, you can place it anywhere on the classpath and don&#8217;t need to specify the configLocation (it&#8217;s the default config name).</p>
<p>To use the cache, do something like this:</p>
<pre>Element cachedObject = myCache.get(key);
if (cachedObject != null) {
  return cachedObject;
} else {
  <em>fetch object from db
</em>  // add to cache<em>
</em>  myCache.put(new Element(key, object))
  return object;
}

And that's it!</pre>
<p>Now you&#8217;ll only hit the db when needed. Of course, it&#8217;s worth <a href="http://ehcache.sourceforge.net/" target="_blank">reading the reference material</a> to see the many ways you can configure the cache. My example is purely for a 1000 object permanent memory cache, but TTL and overflow-to-disk (for example) is just as easy to set up.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=7&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/10/23/ehcache-and-spring/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven dependency graph in NetBeans</title>
		<link>http://k3andme.wordpress.com/2008/10/23/maven-dependency-graph-in-netbeans/</link>
		<comments>http://k3andme.wordpress.com/2008/10/23/maven-dependency-graph-in-netbeans/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 15:57:14 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=5</guid>
		<description><![CDATA[Earlier today, we noticed one the maven war files was being bundled with the geronimo-spec-javamail.jar. Unfortunately, the other projects use the standard java mail.jar. The presence of 2 seperate mail jars under the same tomcat instance has been causing us mime-type conflicts. Hot-deploying worked though so we figured it was something to do with bundled [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=5&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Earlier today, we noticed one the <a href="http://maven.apache.org/" target="_blank">maven</a> war files was being bundled with the geronimo-spec-javamail.jar. Unfortunately, the other projects use the standard java mail.jar. The presence of 2 seperate mail jars under the same tomcat instance has been causing us mime-type conflicts.</p>
<p>Hot-deploying worked though so we figured it was something to do with bundled jars.</p>
<p>In NetBeans, the geronimo jar appeared greyed out in the list of libraries, indicating a transitive dependency. How to work out which jar is at the root of this dependency?</p>
<ol>
<li>Tools -&gt; Plugins -&gt; Install &#8220;Maven Dependency Graphs&#8221;</li>
<li>Return to project</li>
<li>Right-click the Libraries node and select &#8220;Show Library Dependency Graph&#8221;</li>
<li>Here, just type in the jar you want to trace and it reduces the graph to just a single tree</li>
</ol>
<p>The plugin is still in beta, but it saved me lots of time so I would recommend it.</p>
<p>Update:</p>
<p>Unfortunately, this plugin was available in 6.5Beta but not in 6.5RC1. Hopefully it&#8217;ll make a comeback soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=5&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/10/23/maven-dependency-graph-in-netbeans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
		<item>
		<title>Threads</title>
		<link>http://k3andme.wordpress.com/2008/10/23/threads/</link>
		<comments>http://k3andme.wordpress.com/2008/10/23/threads/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 15:34:15 +0000</pubDate>
		<dc:creator>k3andme</dc:creator>
				<category><![CDATA[Poetry]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://k3andme.wordpress.com/?p=3</guid>
		<description><![CDATA[And first, a little something: As one of you And one of me Two threads so bare, you&#8217;d hardly see. &#8211; Two steps entwine, two ryhmes sublime As yours are mine, your eyes divine &#8211; Friends, I&#8217;m sure, of which I&#8217;m certain Cannot draw the final curtain<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=3&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>And first, a little something:</p>
<div class="post-body entry-content">As one of you<br />
And one of me</p>
<p>Two threads so bare, you&#8217;d hardly see.</p>
<p>&#8211;</p>
<p>Two steps entwine, two ryhmes sublime<br />
As yours are mine, your eyes divine</p>
<p>&#8211;</p>
<p>Friends, I&#8217;m sure, of which I&#8217;m certain<br />
Cannot draw the final curtain</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k3andme.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k3andme.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k3andme.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=k3andme.wordpress.com&amp;blog=5273037&amp;post=3&amp;subd=k3andme&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://k3andme.wordpress.com/2008/10/23/threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c0543dd2391cafdecd5c8b5a2d63b051?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">k3andme</media:title>
		</media:content>
	</item>
	</channel>
</rss>
