<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Passion Development &#187; java</title>
	<atom:link href="http://www.passiondevelopment.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.passiondevelopment.com</link>
	<description>Java Developers in Dublin Ireland &#124;  It&#039;s what we love</description>
	<lastBuildDate>Thu, 08 May 2008 15:00:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Java Programming for the Nintendo Wii</title>
		<link>http://www.passiondevelopment.com/2008/05/08/java-programming-for-the-nintendo-wii/</link>
		<comments>http://www.passiondevelopment.com/2008/05/08/java-programming-for-the-nintendo-wii/#comments</comments>
		<pubDate>Thu, 08 May 2008 15:00:23 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Wii]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2008/05/08/java-programming-for-the-nintendo-wii/</guid>
		<description><![CDATA[There is a great article over at Ajaxian on programming for the Nintendo Wii. I bought a Wii myself a few weeks back and have been having great fun with Tiger Woods golf. (It is actually my first game console) Up until down the idea of playing a game console alone did not appeal to [...]]]></description>
			<content:encoded><![CDATA[<p>There is <a href="http://ajaxian.com/archives/wii-darts-powering-ajax-applications-with-wii-controllers" target="_blank">a great article</a> over at <a href="http://ajaxian.com" target="_blank">Ajaxian</a> on programming for the Nintendo Wii.  I bought a Wii myself a few weeks back and have been having great fun with Tiger Woods golf.    (It is actually my first game console)  Up until down the idea of playing a game console alone did not appeal to me but the Nintendo Wii experience is amazing.</p>
<p>The Wii console connects to the controller or <a href="http://en.wikipedia.org/wiki/Wii_Remote" target="_blank">Wiimote</a> via bluethooth and uses an <a href="http://en.wikipedia.org/wiki/Accelerometer" target="_blank" title="Accelerometer">accelerometer</a> built into the wiimote to detect the  location of the wiimote  as well as it&#8217;s acceleration.   This leads to a really interactive experience for the user.</p>
<p>I have been amazed by responsiveness of the <a href="http://en.wikipedia.org/wiki/Wii_Remote" target="_blank">Wiimote</a> and now <a href="http://www.almaer.com/blog/" target="_blank" rel="me">Dion Almaer</a> and <a href="http://weblogs.java.net/blog/javaben/" target="_blank" rel="co-worker">Ben Galbraith</a> over at <a href="http://ajaxian.com" target="_blank">Ajaxian</a> have developed an Ajax app that uses <a href="http://code.google.com/p/wiiusej/" target="_blank">Wiiusej</a> to interact with the Wiimote.   The Wiiusej API is a java wrapper  for the C based <a href="http://www.wiiuse.net/" target="_blank">Wiiuse</a> library.</p>
<blockquote><p>We then wrote a Java class that acts as a state machine for what the remote is doing. It understands the movements, which buttons are pushed, how fast you are moving the device. With this data we could build a simple darts game. With the state machine Java code, and an Applet wrapper that exposed the information, we were ready to get to the Ajax side of the house.</p></blockquote>
<p>Checkout the video below of the guys in action:</p>
<p><object type="application/x-shockwave-flash" data="http://www.vimeo.com/moogaloop.swf?clip_id=968191&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" height="362" width="480"><br />
<a href="http://www.vimeo.com/968191?pg=embed&amp;sec=968191">Wii Darts in Ajax</a> from <a href="http://www.vimeo.com/dion?pg=embed&amp;sec=968191">Dion Almaer</a> on <a href="http://vimeo.com?pg=embed&amp;sec=968191">Vimeo</a>.</object></p>
<p><a href="http://ajaxian.com/archives/wii-darts-powering-ajax-applications-with-wii-controllers" target="_blank"> You can find the article here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2008/05/08/java-programming-for-the-nintendo-wii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great blog for Java Design Patterns</title>
		<link>http://www.passiondevelopment.com/2008/04/15/great-blog-for-java-design-patterns/</link>
		<comments>http://www.passiondevelopment.com/2008/04/15/great-blog-for-java-design-patterns/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 10:10:51 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[design patterns]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2008/04/15/great-blog-for-java-design-patterns/</guid>
		<description><![CDATA[I came across this great site via DZone. The site provides a great overview of the Gang of Four patterns as well as J2EE patterns with UML diagrams and sample code for each one. Here what the author, Andre Mare wants to get from the blog. Java Design Concepts will provide information on how to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.stephendowney.net/blog/wp-content/uploads/javaCodeSM.jpg" align="right" border="0" />I came across <a href="http://www.javadesign.info/" target="_blank">this great site</a> via <a href="http://java.dzone.com/news/design-pattern-builder-pattern" target="_blank">DZone.</a>  The site provides a great overview of the Gang of Four patterns as well as J2EE patterns with UML diagrams and sample code for each one.   Here what the author, Andre Mare wants to get from the blog.</p>
<blockquote>
<p align="left"> Java Design Concepts will provide information on how to design, implement and deploy system in a high availability enterprise environment. The design concepts include design patterns, and Object Oriented Programming (OO). Java technologies include J2EE, EJB, JAF, JMS, JSP, JSTL, JDBC etc..</p>
</blockquote>
<p align="left">As the site is still in development some of the J2EE patterns are not complete yet but this is definitely one for your RSS reader.</p>
<p align="left"><a href="http://www.javadesign.info" target="_blank">Check out the site here.</a>..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2008/04/15/great-blog-for-java-design-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ever want to run your web application on Google&#8217;s infrastructure?</title>
		<link>http://www.passiondevelopment.com/2008/04/08/ever-want-to-run-your-web-application-on-googles-infrastructure/</link>
		<comments>http://www.passiondevelopment.com/2008/04/08/ever-want-to-run-your-web-application-on-googles-infrastructure/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 18:38:23 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2008/04/08/ever-want-to-run-your-web-application-on-googles-infrastructure/</guid>
		<description><![CDATA[Well now you can&#8230;. Google just launched a preview of their app enigne. You can read all about it here. With Google App Engine, developers can write web applications based on the same building blocks that Google uses, like GFS and Bigtable. Google App Engine packages those building blocks and provides access to scalable infrastructure [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://code.google.com/appengine/images/appengine_lowres.jpg" align="right" height="79" width="100" />Well now you can&#8230;.</p>
<p>Google just launched a preview of their app enigne.  You can read all about it <a href="http://googleblog.blogspot.com/2008/04/developers-start-your-engines.html" target="_blank">here</a>.</p>
<blockquote><p>With Google App Engine, developers can write web applications based on the same building blocks that Google uses, like <a href="http://labs.google.com/papers/gfs.html">GFS</a> and <a href="http://labs.google.com/papers/bigtable.html">Bigtable</a>. Google App Engine packages those building blocks and provides access to scalable infrastructure that we hope will make it easier for developers to scale their applications automatically as they grow. This means they can spend less time dealing with system administration and maintenance, and more time building and improving their applications. (There&#8217;s <a href="http://googleappengine.blogspot.com/2008/04/introducing-google-app-engine-our-new.html">more detail</a> on the new App Engine Blog.)</p></blockquote>
<p>I tried to <a href="http://appengine.google.com/" target="_blank">sign up</a> but it looks like the first 10,000 have already applied.  You can still download the API from <a href="http://code.google.com/appengine/downloads.html" target="_blank">here</a> in the mean time if you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2008/04/08/ever-want-to-run-your-web-application-on-googles-infrastructure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Need an end to end web solution using the latest Frameworks?</title>
		<link>http://www.passiondevelopment.com/2008/03/07/need-an-end-to-end-web-solution-using-the-latest-frameworks/</link>
		<comments>http://www.passiondevelopment.com/2008/03/07/need-an-end-to-end-web-solution-using-the-latest-frameworks/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 19:37:27 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2008/03/07/need-an-end-to-end-web-solution-using-the-latest-frameworks/</guid>
		<description><![CDATA[&#8230;then check out iWebMVC. I came across this framework during the week via Ajaxian. It provides an end to end solution with all of the plumbing in place for DWR, Dojo, Spring and Hibernate/JPA. This is a great place to start for someone that wants to get up and running fast with inner plumbing in [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.stephendowney.net/blog/wp-content/uploads/javaCodeSM.jpg" align="right" border="0" />&#8230;then check out <a href="http://code.google.com/u/jose.noheda/" target="_blank">iWebMVC</a>.</p>
<p>I came across this framework during the week via <a href="http://ajaxian.com/archives/iwebmvc-dwr-dojo-spring-and-hibernatejpa" target="_blank">Ajaxian.</a> It provides an end to end solution with all of the plumbing in place for <a href="http://getahead.org/dwr" target="_blank">DWR</a>, <a href="http://dojotoolkit.org/" target="_blank">Dojo</a>, <a href="http://www.springframework.org/" target="_blank">Spring</a> and <a href="http://www.hibernate.org/" target="_blank">Hibernate</a>/JPA.  This is a great place to start for someone that wants to get up and running fast with inner plumbing in place for these frameworks. Here is what the developer Jose Noheda said he was looking for from the project:</p>
<blockquote><p>Nonetheless, in my mind what I really needed was a platform that:</p>
<ul>
<li><strong>Is based on Java</strong><br />
Although supporting Grooy / JRuby is a plus</li>
<li><strong>Helps me to kick start a project</strong><br />
But simplifying the process by giving me the best (and this can be tricky) set of frameworks for each task</li>
<li><strong>Integrates both server and client sides</strong><br />
And it&#8217;s lightweight, robust and extensible. Read <em>enterprise quality</em>.</li>
<li><strong>Supports all the common tasks a web app has to handle</strong><br />
I include here: User Management, CRUD operations, i18n support (both framework &amp; data), AJAX and astounding visuals</li>
</ul>
</blockquote>
<p>The project is only at the preview stage so it does come with caveats.  When you start up the app you get a sample app showing some of the Dojo widgets in action as well as some screens demonstrating basic CRUD operations.</p>
<p>If you want find out more you can download the project <a href="http://code.google.com/u/jose.noheda/" target="_blank">from here</a> or check out Jose&#8217;s blog <a href="http://internna.blogspot.com/search/label/IWebMvc" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2008/03/07/need-an-end-to-end-web-solution-using-the-latest-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Code Style and some Handy Plugins for Eclipse</title>
		<link>http://www.passiondevelopment.com/2007/01/12/java-code-style-and-some-handy-plugins-for-eclipse/</link>
		<comments>http://www.passiondevelopment.com/2007/01/12/java-code-style-and-some-handy-plugins-for-eclipse/#comments</comments>
		<pubDate>Fri, 12 Jan 2007 10:29:47 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[CPD]]></category>
		<category><![CDATA[CheckStyle]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[JDepend]]></category>
		<category><![CDATA[Metrics]]></category>
		<category><![CDATA[coding conventions]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2007/01/12/java-code-style-and-some-handy-plugins-for-eclipse/</guid>
		<description><![CDATA[Here are some handy plugins for Eclipse that I came across via an IBM Developerworks article by Paul Duvall. CheckStyle: For coding standardsPMD&#39;s CPD: Enables discovering code duplicationCoverlipse: Measures code coverageJDepend: Provides dependency analysisEclipse Metrics plugin: Effectively spots complexity I have used the Checkstyle plugin for a few years now and found it extremely useful.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some handy plugins for <a href="http://www.eclipse.org/" target="_blank">Eclipse </a>that I came across via an <a href="http://www-128.ibm.com/developerworks/" target="_blank">IBM Developerworks</a> <a href="http://www-128.ibm.com/developerworks/java/library/j-ap01117/index.html?ca=drs-" target="_blank">article </a>by <a href="http://www-128.ibm.com/developerworks/java/library/j-ap01117/index.html?ca=drs-#author" target="_blank">Paul Duvall</a>. </p>
<blockquote><p><a href="http://eclipse-cs.sourceforge.net/" target="_blank">CheckStyle</a>: For coding standards<br /><a href="http://pmd.sourceforge.net/" target="_blank">PMD&#39;s CPD</a>: Enables discovering code duplication<br /><a href="http://coverlipse.sourceforge.net/index.php" target="_blank">Coverlipse</a>: Measures code coverage<br /><a href="http://www.clarkware.com/software/JDepend.html" target="_blank">JDepend</a>: Provides dependency analysis<br /><a href="http://metrics.sourceforge.net/" target="_blank">Eclipse Metrics plugin</a>: Effectively spots complexity</p></blockquote>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6681085387246782";
//stephendowney_java_embeded
google_ad_slot = "4220870787";
google_ad_width = 300;
google_ad_height = 250;
//--></script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>I have used the Checkstyle plugin for a few years now and found it extremely useful.&nbsp; In a nutshell, checkstyle will check your code against coding standards and issue a warning if you code something that is not in the correct format. &nbsp; This has always been a real bone of contention with fellow developers.&nbsp; One developer I worked with in the past felt that everyone should be free to code in whatever style they prefer.&nbsp; I would not agree with this at all.&nbsp; It can lead to code that is very hard to maintain and read. &nbsp; </p>
<p>With a plugin like Checkstyle you don&#39;t need &quot;<a href="http://catb.org/jargon/html/C/code-police.html" target="_blank">Code Police</a>&quot; checking the code and informing people that they are using the wrong style.&nbsp; If you want to push it one step further you can set up your automatic build (We used <a href="http://cruisecontrol.sourceforge.net/" target="_blank">Cruisecontrol</a> in the past) to mark a build as broken when it comes across a Checkstyle error.  This ensures that a code base is readable and maintainable.&nbsp;&nbsp; Here is an example of bad coding style: </p>
<blockquote><p>if (testBoolean) myNum++;</p></blockquote>
<p>Many developers leave out the parenthesis as the compiler will not complain, this can often lead to confusion when you expect a line below to run when the statement is true but of course it won&#39;t because the <em>myNum++ </em>is going to run. The correct way to write this would be as follows:<br />
<blockquote>if (testBoolean)<br /> {<br />&nbsp; myNum++;<br /> }</p></blockquote>
<p>A new developer that comes across this code will know exactly what statement is run when the <em>if statement</em> is true. It is also possible to change the change the Checkstyle configuration for situations where a company has their own coding convention.</p>
<p>&nbsp;I have not used the other plugins yet but have a look at the <a href="http://www-128.ibm.com/developerworks/java/library/j-ap01117/index.html?ca=drs-" target="_blank">article</a> for how to install them.&nbsp; I am interested to see how good the code duplication plugin is.&nbsp;&nbsp; I hate when I come across &quot;Cut and paste&quot; coding because someone is too lazy to abstract the functionality into a base class. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2007/01/12/java-code-style-and-some-handy-plugins-for-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX process definition on Client Side</title>
		<link>http://www.passiondevelopment.com/2006/12/19/ajax-process-definition-on-client-side/</link>
		<comments>http://www.passiondevelopment.com/2006/12/19/ajax-process-definition-on-client-side/#comments</comments>
		<pubDate>Tue, 19 Dec 2006 11:53:11 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[J-SOFA]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2006/12/19/ajax-process-definition-on-client-side/</guid>
		<description><![CDATA[I came across an interesting article by Masayuki Otoshi via Java World that discusses how to execute process definitions on the client side rather than the server side.&#160; This can come into play when making AJAX calls.&#160; As AJAX is Asynchronous, it is not possible to predict the order that your callback methods will be [...]]]></description>
			<content:encoded><![CDATA[<p>I came across an interesting <a href="http://www.javaworld.com/javaworld/jw-12-2006/jw-1217-jsofa.html" target="_blank">article</a> by Masayuki Otoshi via <a href="http://www.javaworld.com" target="_blank">Java World</a> that discusses how to execute process definitions on the client side rather than the server side.&nbsp; This can come into play when making AJAX calls.&nbsp; As AJAX is Asynchronous, it is not possible to predict the order that your callback methods will be called in.&nbsp;&nbsp;Masayuki uses <a href="http://www5f.biglobe.ne.jp/~webtest/jsofa/" target="_blank">J-SOFA</a> (Java/JavaScript Services Orchestration for Actions) to overcome this.</p>
<p>I haven&#39;t come across J-SOFA before but it looks like it might be worth looking at for situations where the order of callback methods is important. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2006/12/19/ajax-process-definition-on-client-side/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BPEL, Java Developers take note&#8230;.</title>
		<link>http://www.passiondevelopment.com/2006/07/10/bepl-java-developers-take-note/</link>
		<comments>http://www.passiondevelopment.com/2006/07/10/bepl-java-developers-take-note/#comments</comments>
		<pubDate>Mon, 10 Jul 2006 08:00:13 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[BPEL]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2006/07/10/bepl-java-developers-take-note/</guid>
		<description><![CDATA[I came across this interesting article by Matjaz B. Juric on how to integrate BPEL(Business Process Execution Language) into an SOA environment. Juric discusses the core concepts involved with BPEL and why BPEL is so important.&#160; He uses a business travel system as an example. &#160;Juric concludes by stating: We have seen that BPEL is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.stephendowney.net/blog/wp-content/uploads/javaCodeSite.jpg" border="0" width="164" height="115" align="right" />I came across this <a href="http://www.javaworld.com/javaworld/jw-07-2006/jw-0710-bpel_p.html" target="_blank" title=" BPEL: Service composition for SOA">interesting article</a> by Matjaz B. Juric on how to integrate BPEL(Business Process Execution Language) into an SOA environment. <br />Juric discusses the core concepts involved with BPEL and why BPEL is so important.&nbsp; He uses a business travel system as an example.</p>
<p>&nbsp;Juric concludes by stating: </p>
<blockquote><p>We have seen that BPEL is one of the most important cornerstones of SOA. It differs from common programming languages, such as Java, and is relatively easy to learn and use. Because BPEL has been designed specifically for definition of business processes, it provides good support for various specifics of business processes, such as support for long running transactions, compensation, event management, correlation, etc. BPEL is well suited for use with the Java EE platform, and many BPEL servers build on top of it. Java developers, particularly those who are involved in the development of enterprise applications and SOA, should therefore take a closer look at BPEL and start using the benefits it provides.</p></blockquote>
<p>I have not used BPEL in any of the projects that I have been involved with but it certainly looks like something that should be seriously considered. </p>
<p>Does anybody have any Caveats from their experiences of using BPEL?&nbsp; If so please leave a comment as I would be interested to hear any real world experiences.&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2006/07/10/bepl-java-developers-take-note/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java and USB devices</title>
		<link>http://www.passiondevelopment.com/2006/07/06/java-and-usb-devices/</link>
		<comments>http://www.passiondevelopment.com/2006/07/06/java-and-usb-devices/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 12:18:43 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2006/07/06/java-and-usb-devices/</guid>
		<description><![CDATA[Here is an interesting artice from Jeff Friesen discussing how to interact with a USB device using java:&#160; Java and USB by Jeff Friesen &#8212; Want to use a USB device in Java? Some with native abstractions, like mass-storage drives, work as you&#39;d expect, but many devices like webcams and game controllers are simply invisible [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an interesting artice from <em><a href="http://today.java.net/pub/au/174" target="_blank" title="Jeff Friesen">Jeff Friesen</a></em> discussing how to interact with a USB device using java:&nbsp;</p>
<blockquote><p><a href="http://today.java.net/pub/a/today/2006/07/06/java-and-usb.html" target="_blank">Java and USB</a> by Jeff Friesen &#8212; Want to use a USB device in Java? Some with native abstractions, like mass-storage drives, work as you&#39;d expect, but many devices like webcams and game controllers are simply invisible to the Java programmer. Jeff Friesen looks at two APIs that expose USB devices to Java, then shows how to build a Java USB implementation of your own.</p>
</blockquote>
<p>Currently, Java does not officially support USB but Jeff discusses how you can use thirdparty APIs as well as his own API.&nbsp; Readers may also be interested in the <a href="http://jcp.org/en/jsr/detail?id=82" target="_blank" title="Bluetooth JSR">Bluetooth JSR</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2006/07/06/java-and-usb-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflection Tip &#8211; Dynamically calling methods</title>
		<link>http://www.passiondevelopment.com/2006/04/04/reflection-tip-dynamically-calling-methods/</link>
		<comments>http://www.passiondevelopment.com/2006/04/04/reflection-tip-dynamically-calling-methods/#comments</comments>
		<pubDate>Tue, 04 Apr 2006 22:32:51 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[Reflection]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2006/04/04/reflection-tip-dynamically-calling-methods/</guid>
		<description><![CDATA[There are often times when you need to call a method but you do not know the name of the method until runtime.&#160; I came across this issue during my Thesis.&#160;&#160;&#160; Our problem was as follows: How do we dynamically map between an object type and a method in the sub class of PublishableServer that [...]]]></description>
			<content:encoded><![CDATA[<p>There are often times when you need to call a method but you do not know the name of the method until runtime.&nbsp; I came across this issue during my <a href="http://www.stephendowney.net/blog/research/" title="Published Data Protocol">Thesis</a>.&nbsp;&nbsp;&nbsp; Our problem was as follows: <br /><em><br />How do we dynamically map between an object type and a method in the sub class of PublishableServer that processes that type?</em> </p>
<p>Here is some background to the problem: <br />PublishableServer&nbsp;is an abstract class that can connects to our distributed system and receives requests for lists of PublishedData objects.&nbsp;A subclasses of PublishableServer&nbsp;must implement methods to process various PublishedData objects it receives. </p>
<div align="center" style="text-align: center"><img src="http://www.stephendowney.net/blog/wp-includes/images/research/Central-JDBCServerSm.jpg" border="0" alt="The Central Server Connecting to a JDBC sub server" title="The Central Server Connecting to a JDBC sub server" width="214" height="226" /></div>
<p>If we look at the JDBCServer illustrated above.&nbsp; This class must implement methods to search for PublishedData objects&nbsp;in the database that it is connected to.&nbsp; Each method must map between attributes of the <em>PublishedData</em> object and the columns in the database.&nbsp;&nbsp; As the <em>getPublishedList(PublishedData publishedData)</em> method of <em>PublishableServer</em>&nbsp;is called we must map this <em>publishedData</em> object to the correct method in the sub class.&nbsp;&nbsp; </p>
<p>One option could be to declare the methods as abstract in the PublishableServer class and then use the <em>instanceof</em> operator to select the correct method. </p>
<blockquote><p>&nbsp;&nbsp;&nbsp; public ArrayList getPublishedList(PublishedData publishedData)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (publishedData instanceof Student)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return getPublishedList((Student) publishedData);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if (publishedData instanceof Course)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return getPublishedList((Course) publishedData);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new ArrayList(0);<br />&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public abstract ArrayList getPublishedList(Course publishedCourse);<br />&nbsp;&nbsp;&nbsp; public abstract ArrayList getPublishedList(Student publishedStudent);</p>
</blockquote>
<p>The issue with using this approach is that we&nbsp;need to update the <em>PublishableServer</em> class every time a new type of <em>PublishedData</em> is added to the framework. All <em>PublishableServer</em> implementations would also have to implement all the search methods, even if they did not want to.</p>
<p>The solution to this issue is to use Reflection to dynamically call the methods in the sub class.&nbsp; To allow this, the methods in the subclass must have a known name.&nbsp; We prepend &quot;getPublished&quot; to the name of the <em>PublishedData</em> class that was passed to the&nbsp; <em>getPublishedList()</em> method.&nbsp; So all we need to do is get the name of the class that has been passed, append that to &quot;getPublished&quot; and we have the name of the method that implements that search.&nbsp; The publishedData object implements a mehtod called <em>getClassName()</em> that will return the name of a class without the package name.&nbsp; To create a method to search for <em>Student</em> objects we simple implement the following method in the <em>JDBCServer</em> class that extends <em>PublishableServer</em>.</p>
<blockquote><p>public ArrayList getPublishedStudent(PublishedData publishedData)</p></blockquote>
<p>The body of this method should implement a search for <em>Student</em> objects in the servers persistent store using the properties of the <em>Student</em> object passed to narrow the search results.</p>
<p>So how do we call this method once we have its name?</p>
<p>The <em>getClass()</em> method that all java objects inherit will return the runtime class of the current object.&nbsp; In our case when we call this method inside the <em>PublishableServer</em> class we will get the runtime class that extended our <em>PublishableServer</em> class. <br />The <em>Class</em> object contains a method called <em>getMethod()</em> which takes the name of the method and an array of Class objects which represents the list of parameters for the method.&nbsp; If the method does not exist a <em>NoSuchMethodException</em>&nbsp;is thrown.&nbsp; If this is thrown in our server we simple return an empty <em>ArrayList</em> as this server does implement that search.</p>
<p>If the method does exist then we call <em>invoke()</em> passing the current object and PublishedData parameter.&nbsp; This will dynamically call our method and return an <em>Object</em> class.&nbsp; We must cast this to an <em>ArrayList</em> and return it.&nbsp; The implementation of this can be seen below.</p>
<blockquote><p>&nbsp;&nbsp;&nbsp; public ArrayList getPublishedList(PublishedData publishedData)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ArrayList result = new ArrayList(0);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String className = publishedData.getClassName();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String methodName = &quot;getPublished&quot; + className;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class[] argTypes = new Class[]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { PublishedData.class };<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object[] args = new Object[]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { publishedData };<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method m = this.getClass().getMethod(methodName, argTypes);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = (ArrayList) m.invoke(this, args);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (NoSuchMethodException noSuchMethod)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;ERROR: &quot; + serverName<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + &quot; does not support searches of type: &quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + publishedData.getClass().getName());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;ERROR:&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ this.getClass().getName()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &quot; needs to implement the follwing method to preform search:&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;public ArrayList &quot; + methodName<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + &quot;(PublishedData publishedData){&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;&nbsp; ArrayList result = new ArrayList();&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;&nbsp; //Preform Search&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;&nbsp; return result;&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(&quot;}&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (IllegalAccessException illegalAccess)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(serverName + &quot; Does not support searches of type&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + publishedData.getClass().getName(), illegalAccess);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (InvocationTargetException invocTarget)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(serverName + &quot; Does not support searches of type&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + publishedData.getClass().getName(), invocTarget);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception general)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.error(serverName + &quot; Does not support searches of type&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + publishedData.getClass().getName(), general);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2006/04/04/reflection-tip-dynamically-calling-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX and JSF Visual editor</title>
		<link>http://www.passiondevelopment.com/2006/03/22/ajax-and-jsf-visual-editor/</link>
		<comments>http://www.passiondevelopment.com/2006/03/22/ajax-and-jsf-visual-editor/#comments</comments>
		<pubDate>Wed, 22 Mar 2006 11:18:48 +0000</pubDate>
		<dc:creator>Stephen Downey</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.passiondevelopment.com/2006/03/22/ajax-and-jsf-visual-editor/</guid>
		<description><![CDATA[Exadel have just released a JSF editor with AJAX support. JSF, a Web component framework, is the only standard Java Web framework,” said Richard Monson-Haefel, senior analyst for Burton Group. “AJAX, which makes Web sites more responsive, is enjoying an avalanche of grass roots support because of its portability and seamless integration with HTML. Together, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.exadel.com/web/portal/press_20060320" target="_blank">Exadel</a> have just released a JSF editor with AJAX support.</p>
<blockquote><p>
JSF, a Web component framework, is the only standard Java Web framework,” said Richard Monson-Haefel, senior analyst for Burton Group. “AJAX, which makes Web sites more responsive, is enjoying an avalanche of grass roots support because of its portability and seamless integration with HTML. Together, JSF and AJAX offer the benefits of standardization with a rich internet experience; a combination that will be attractive to many organizations</p></blockquote>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6681085387246782";
//stephendowney_java_embeded
google_ad_slot = "4220870787";
google_ad_width = 300;
google_ad_height = 250;
//--></script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>Unfortunately, it is a bit pricey at $799 per annual subscription license. I am going to download the trial at the weekend and have a look. I have been using the exadel Studio for eclipse and found the it very good.  (Thanks Colin for the recommendation on this one.)  I had been looking for a good JSP visual editor plugin for eclipse for quiet a while and this seems to be one of the better ones.</p>
<p>On a different note, I have decided to change my hosting service to <a href="http://www.interadvantage.com/" target="_blank">InterAdvantage</a>.  I have got a pretty good package and will be transferring over this blog to <a href="http://wordpress.com/" target="_blank">WordPress</a> as soon as the domain transfer goes through. I will post all new RSS feeds here before the change over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.passiondevelopment.com/2006/03/22/ajax-and-jsf-visual-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

