<?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>let x=x &#187; infrastructure and frameworks</title>
	<atom:link href="http://www.crazymcphee.net/x/category/tech/architecture/infrastructure-and-frameworks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Tue, 13 Jul 2010 21:56:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The Ordeal of Installing Oracle Service Bus on a Windows-based developer workstation</title>
		<link>http://www.crazymcphee.net/x/2010/07/12/the-ordeal-of-installing-oracle-service-bus-on-a-windows-based-developer-workstation/</link>
		<comments>http://www.crazymcphee.net/x/2010/07/12/the-ordeal-of-installing-oracle-service-bus-on-a-windows-based-developer-workstation/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:30:12 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[esb]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[osb]]></category>
		<category><![CDATA[poorly attempted humour]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[weblogic]]></category>
		<category><![CDATA[wizards considered harmful]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=570</guid>
		<description><![CDATA[This is a genuine installation procedure which I wrote, but you might want to read it for its other values. Overview OSB installation in a development environment consists of a completely separate Weblogic instance and yet another &#8216;special installation&#8217; of Eclipse. You can&#8217;t use existing Eclipse installations. Nor is it recommend to use one of [...]]]></description>
			<content:encoded><![CDATA[<p>This is a genuine installation procedure which I wrote, but you might want to read it for its other values.</p>
<h2>Overview</h2>
<p>OSB installation in a development environment consists of a completely separate Weblogic instance and yet another &#8216;special installation&#8217; of Eclipse. You can&#8217;t use existing Eclipse installations. Nor is it recommend to use one of the five other existing Weblogic instances that Oracle products thoughtfully demand their own copy thereof (SOA Suite, I am looking at you).</p>
<h2>Installation process</h2>
<p>This is the procedure for installing OSB development environment.</p>
<p>As network firewall policy prevents the downloading of files, you will need to use installation media located within &lt;companyname&gt; network. Take the files conveniently stored on network server &lt;location redacted&gt; and copy them into a directory on your local computer. This directory is hereafter referred to as &#8216;installation files directory&#8217; below.</p>
<h3>Install Weblogic</h3>
<ol>
<li>Go to the installation files directory.</li>
<li>Run the executable file wls1033_oepe111150_win32.exe</li>
<li>This action launches the Oracle Installer for the Weblogic instance. It takes some time to run so contemplate the meaning of your life for a few minutes while it does. Maybe get a cup of tea. Stretch your legs. Think about lunch or your next holiday. File a support request for more memory. You should get at least 8GB.</li>
<li>Okay that&#8217;s it, you&#8217;ll finally see the Oracle Weblogic 10.3.3.0 installer. Think about the fact that Oracle sees fit to put &#8220;instructions&#8221; on the first screen telling you what the &#8220;Next&#8221; button does. This is advanced JEE server technology you&#8217;re installing, and potentially, Oracle think you don&#8217;t know what the &#8220;Next&#8221; button does. Maybe this reflects the level of experience inside Oracle, or perhaps it is indicative of the depth of respect in which Oracle holds their customers.</li>
<li>Press the &#8220;Next&#8221; button. The next screen you will see  is very important. If you fsck it up you&#8217;ll have to uninstall and start over. It does not have any instructions, but that&#8217;s OK, we&#8217;ve done it here in this wiki page for you. Pay attention.</li>
<li><strong>DO. NOT. ACCEPT. THE. DEFAULT.</strong> Especially if you installed SOA Suite or some other Oracle product before you installed this one. Double especially if you still want that product to work.</li>
<li>SELECT &#8220;Create a new Middleware Home&#8221; (THIS IS VERY IMPORTANT)</li>
<li>TYPE a name of an Appropriate Directory. I used &#8220;C:\Oracle\OSB_Middleware&#8221;</li>
<li>PRESS The &#8220;Next&#8221; button. Use the &#8220;Back&#8221; button if you need to see the instructions about how to use the &#8220;Next&#8221; button that Oracle conveniently provided for you on the first Screen. No, don&#8217;t do that. If you do that you&#8217;ll probably have to do this proceedure again and it will just make this entire experience last longer than it needs to. This is not a recommended practice.</li>
<li>The next screen demands that you give Oracle your Email Address to get &#8220;security updates&#8221;. It also wants a thing called your &#8220;My Oracle Support Password&#8221; (I suspect this is what might have been known as Oracle TechNet). As we both know, the best possible security measure is not to give out your password to strange programs that demand it.</li>
<li>As I planned on giving them my &lt;workcompany&gt; email, and as my Technet sub doesn&#8217;t use that Email address, I also unchecked the &#8220;I wish to receive security updated via My Oracle Support&#8221; check box.</li>
<li>Are you Sure? YES I&#8217;M VERY SURE. I would like to be &#8220;ignorant of security updates&#8221; and also Oracle spam. Ignorance is Bliss.</li>
<li>Look at that, I can&#8217;t give them my email address after all, what they really meant was &#8220;type your Oracle Support user id&#8221;. Press &#8220;Next&#8221;.</li>
<li>Now you have to choose whether you want a &#8220;Typical&#8221; installation or a &#8220;Custom&#8221; one. I chose &#8220;Typical&#8221;, which, being an Oracle installation, I expect to require an 8-core 64GB RAM 2TB SAN SSD -based supercomputer with a external 4-way Oracle RAC for configuration (&#8220;infrastructure&#8221;) DB in order to have enough grunt to service about 3 requests a minute. Press &#8220;Next&#8221;.</li>
<li>There&#8217;s a lot of choices here about the various subdirectories under the Middleware Home Directory that you created further back. I recommend accepting the defaults, but you can probably cause yourself countless of fun trolling on the My Oracle Support forums as you get ever-more-desparate for a solution to a very obscure problem that the phone support have no idea about and that was likely caused by you mucking about these defaults, causing the support personel to simply recommend you to reinstall the product, if you really feel the need to change them here.</li>
<li>If you can remember the instruction about the use of the &#8220;Next&#8221; button at step 4, then Press &#8220;Next&#8221;.</li>
<li>Now you can choose whether you want to put the shortcuts for &#8220;All users&#8221; or just you (&#8220;Local user&#8221;). If you are the BOFH I recommend &#8220;All Users&#8221;. As this is the default, we can all safely assume that the BOFH works for Oracle and is now responsible for designing their installation processes. Accept the default, and press &#8220;Next&#8221;.</li>
<li>The next screen is a summary of what you&#8217;ll be installing. You can also select each item and see a summary of what it does. Ponder the mystery of Oracle, and press &#8220;Next&#8221;.</li>
<li>Keep pondering that mystery while Oracle Weblogic Server 11g Release 1 (10.3.3.0) is installed. It takes a little bit of time. While it does that, you might to book that Holiday, get another cup of tea, or chase up that support request for the additional RAM you&#8217;ll be soon needing.</li>
<li>Congratulations! Installation is complete.</li>
<li>I opted to leave the &#8220;Run Quickstart&#8221; option checked.</li>
<li>Press &#8220;Done&#8221;. There are no onscreen instructions for this button.</li>
<li>Quickstart will run. It&#8217;s just a link farm.</li>
</ol>
<h3>Install Oracle Enterprise Pack for Eclipse (OEPE aka &#8220;Special Eclipse&#8221;)</h3>
<ol>
<li>Go to the installation files directory</li>
<li>Extract the file oepe-galileo-all-in-one-11.1.1.5.0.201003170852-win32.zip &#8230; I used 7zip and made sure to put it into a subdirectory of the installation files directory.</li>
<li>It&#8217;s kind of pretty big, takes a cople of minutes.</li>
<li>Just like a regular version of Eclipse, once this is unzipped, it&#8217;s installed. However it&#8217;s not a regular version of Eclipse. It is a &#8220;special&#8221; Eclipse that went to &#8220;special&#8221; school.</li>
<li>Although this directory can <em>probably</em> live anywhere, it&#8217;s a good idea to copy this directory into the new Oracle Middleware Home that you created when you installed Weblogic. Look I really have no idea why this is the case, however, it&#8217;s not good to anger the Oracle by using you regular development directories. ORACLE_HOME sweet ORACLE_HOME it is then.</li>
</ol>
<h3>Install OSB and OSB Dev Tools</h3>
<ol>
<li>Go to the installation files directory.</li>
<li>Extract the file ofm_osb_generic_11.1.1.3.0_disk1_1of1.zip &#8230; again I used 7zip and made sure to put it into a directory underneath the installation files directory.</li>
<li>Enter this directory. Enter the directory &#8220;osb&#8221; that will be created underneath it. Note that even though the file said &#8220;disk1_1of1&#8243; in the file name that underneath here there&#8217;s two directories, Disk1 and Disk2.</li>
<li>Go into the directory &#8220;Disk1&#8243;</li>
<li>Run the executable file &#8220;setup.exe&#8221;</li>
<li>A DOS window opens which asks you for the location of a JRE in order to use Oracle Universal Installer. Probably. Exactly why the Weblogic installer didn&#8217;t need to know where the JDK was, I do not know. Probably it used a sensible installer rather then the Oracle Universal Installer. I don&#8217;t ever think I&#8217;ve ever seen an machine with two Oracle installations on it that didn&#8217;t also have two or more installations of the Oracle Universal Installer also installed on it. Its name perhaps means that it installs itself universally, rather than it is a product which has a universal use for installing other software. Ponder the mystery of the Oracle.</li>
<li>A JRE will be located in the original Oracle Middleware Home that you created when you installed Weblogic. In fact there&#8217;s at least two (Sun JDK and JRockit). Use the Sun JDK. For example, my value for the JDK was &#8220;C:\Oracle\OSB_Middleware\jdk160_18&#8243;. Press Enter.</li>
<li>Now the Universal Installer will actually attempt to install something. It says &#8220;You are about to install the Oracle Service Bus (OSB) and may install the Oracle Service Bus IDE and Oracle Service Bus Examples (OSBE). Before proceeding, make sure that you have installed and configured Oracle WebLogic Server 11g. If you want to design OSB applications in Eclipse, make sure Oracle Enterprise Package for Eclipse (OEPE) is installed.&#8221; Which is all true if you&#8217;ve been following this guide.</li>
<li>Press &#8220;Next&#8221;. There&#8217;s no instructions in this program for the use of the &#8220;Next&#8221; button. Someone ought to file a change request for that.</li>
<li>Now you can choose whether you want a &#8220;Typical&#8221; installation or a &#8220;Custom&#8221; one. Typically, choose &#8220;Typical&#8221;.</li>
<li>Press &#8220;Next&#8221;. I tried looking for online help here about the use of the &#8220;Next&#8221; button but I did not find anything.</li>
<li>It does a prerequisite check. It should pass, and if it doesn&#8217;t, you are probably screwed. If it does, you will be able to Press &#8220;Next&#8221;</li>
<li>At this next screen <strong>DO NOT ACCEPT THE DEFAULTS</strong>.</li>
<li>Choose the Oracle Middleware Home that you installed the Weblogic into at the first part of this installation procedure. E.g. I chose &#8220;C:\Oracle\OSB_Middleware&#8221;.</li>
<li>Once you do the previous step, ff you followed the instructions for the Special Eclipse (OEPE), it will have found it automatically. If not, choose the location where you installed the Special Eclipse (OEPE Location). For example, my value was &#8220;C:\Oracle\OSB_Middleware\oepe-galileo-all-in-one-11.1.1.5.0.201003170852-win32&#8243;</li>
<li>Press &#8220;Next&#8221;. Did you know that the Oracle at Delphi was a priestess called the &#8216;Pythoness&#8217; who answered your question using gibberish verse. A Male Attendant of the Pythoness interpreted her raving mad gibberings and told you what they meant. For a fee. Does this sound familiar?</li>
<li>Review the installation details. When you are sure they are correct, press &#8220;Install&#8221;.</li>
<li>OSB will now install. It takes a little time so run those errands, go to lunch, get a coffee, dream of the Holiday you just Booked. I&#8217;d tell you to install the new 8GB of memory that you ordered before which surely has arrived by now, but that would mean turning your computer off. Best to wait until it&#8217;s finished then.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2010/07/12/the-ordeal-of-installing-oracle-service-bus-on-a-windows-based-developer-workstation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically loading Spring contexts from the classpath at runtime</title>
		<link>http://www.crazymcphee.net/x/2010/04/29/dynamically-loading-spring-contexts-from-the-classpath-at-runtime/</link>
		<comments>http://www.crazymcphee.net/x/2010/04/29/dynamically-loading-spring-contexts-from-the-classpath-at-runtime/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 06:45:11 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[applicationcontext]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[PathMatchingResourcePatternResolver]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=540</guid>
		<description><![CDATA[Using these three Spring features will enable us to be able to place a JAR file containing an interface implementation, and a Spring context XML file matching a particular pattern, into the classpath of our WAR, and on restart, we can dynamically pick up the newly inserted features into our application installation.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just going to document a way I&#8217;ve found to use Spring ApplicationContext to dynamically load other context XML configurations that it find in the classpath. We have a requirement to do this coming up on a product we&#8217;re building. Let me describe the sort of problem we are trying to solve (with many specifics omitted or glossed over):</p>
<blockquote><p>There is a web service inside a component, let&#8217;s call that component a &#8216;Node&#8217;, that receives something like (but not identical to!) an Event on its interface. Inside the Event is some data that the Node does not particularly care about (and actually has no access to &#8211; it&#8217;s just a <em>byte[]</em> as far as the Node can tell). However, the Node contains a Registry which enables components, lets call them Event Handlers, to register themselves with the Node, as available to process certain Events (i.e. decode that <em>byte[]</em> and do something with it) according to criteria which the EventHandler injects into the Node&#8217;s Registry.  EventHandler is an interface with a handful of simple methods related to handling the Event, and also registration with the Registry.</p>
<p>So, the process flow looks something like this: The Node first records the reception of the Event at the interface in a log. Then it tells the Registry about the Event, and the Registry produces the EventHandler(s) it needs to use.  The Registry gives the Node back the instances of the EventHandler interface. The Node then hands off the Event to the EventHandler, which does whatever it does unbeknownst to the Node, and returns a fairly simple EventResponse object. The Node records the EventResponse object in its log (i.e. a database) and returns it as the response to the web service call.</p>
<p>Consider the Node service method as looking something like this (you&#8217;ll have to excuse the Java 1.4-ness of this code, the WordPress code highlighting plugin apparently hates Java 5) :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">List</span> receive<span style="color: #009900;">&#40;</span><span style="color: #003399;">Event</span> event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">List</span> responses <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>EventHandler handler <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">registry</span>.<span style="color: #006633;">lookup</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">getMetadata</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      Response response <span style="color: #339933;">=</span> handler.<span style="color: #006633;">handle</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      saveResponse<span style="color: #009900;">&#40;</span>response, event, handler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      responses.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> responses<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>To enable the wiring, the Registry has a method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000066; font-weight: bold;">void</span> register<span style="color: #009900;">&#40;</span>EventMetadata metadata, EventHandler handler<span style="color: #009900;">&#41;</span></pre></div></div>

<p>and among other methods the EventHandler interface defines:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000066; font-weight: bold;">void</span> setRegistry<span style="color: #009900;">&#40;</span><span style="color: #003399;">Registry</span> registry<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Currently the WAR file imports the Node.JAR and a group of EventHandler.JAR files which are specific implementations for handling different kinds of Events. We configure it in Spring currently so that the specific EventHandler is injected with the Registry object (from the Node.JAR). The EventHandler implementation then registers itself with the Registry in a call-back operation, telling it what sort of Events it will handle<em>.</em></p></blockquote>
<p><span style="text-decoration: underline;">This all works just fine at the moment</span>. The <span style="text-decoration: underline;">problem</span> with what we have is that it is all currently statically compiled into the WAR file.The WAR file specifies a Spring application context XML file which in turn loads the Spring configuration for the Node and Registry component, and every Spring application context for each Handler JAR included inside the WAR file&#8217;s <em>WEB-INF/lib</em> directory.</p>
<p>Now, we now don&#8217;t want every deployed instance of every Node to handle every possible Event. Currently we&#8217;ve got a small <em>.properties</em> file that actually tells another Spring component which EventHandlers are be to be instantiated or not. This is working fine when we only desire some Nodes to handle maybe one or two of a larger group of related Events. That is, where we currently don&#8217;t mind that the WAR file is identical in every respect on every Node &#8212; it&#8217;s just that each node contains a <em>.properties</em> file in its classpath that tells it which EventHandlers it is allowed to load and use (and therefore what Events it is capable of receiving, bearing in mind that when I say &#8216;Events&#8217; there is really only one concrete type of Event, I mean the encrypted data which is held <span style="text-decoration: underline;">within</span> the Event which is actually consumed by the Handler).</p>
<p>However, we are now in a situation where we want to use this same architecture for a completely different group of Events. We definitely don&#8217;t want to have to compile and assemble a new WAR file for different Nodes based on the Event cluster. We want to deploy a standardized <em>Node.WAR</em> which has available on its classpath a dynamic set of <em>XxxEventHandler.JAR</em> which can dynamically register themselves with the Node&#8217;s registry. There may be also a requirement for some related custom extension points in the future.</p>
<p>Initially we considered OSGi as the technology to enable this. After some discussion yesterday with people who know better about OSGi, this approach was rejected as impractical for the moment. Therefore last night I set out tooling about with the Spring 2.5.6 ApplicationContext and its related objects to see what could be done to enable dynamically-loaded JAR files within a parent Spring application context. Here is what I&#8217;ve discovered we can do, with only some small restrictions on developers writing the individual EventHandler implementations.</p>
<p>The first issue is, we need to locate a set of Spring application context XML file which should be on the classpath but not yet instantiated into any live Spring context.</p>
<p>Assuming we&#8217;re in a bean that&#8217;s <em>ContextAware</em> or otherwise has access to the Spring application context which is loading it, after the parent context has loaded and initialized (there are method hooks for this sort of thing) we can use the <em>org.springframework.core.io.support.PathMatchingResourcePatternResolver</em> class to search the classpath for a resource:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  PathMatchingResourcePatternResolver pmrl <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PathMatchingResourcePatternResolver<span style="color: #009900;">&#40;</span>context.<span style="color: #006633;">getClassLoader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Resource<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> resources <span style="color: #339933;">=</span> pmrl.<span style="color: #006633;">getResources</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">&quot;classpath*:/net/crazymcphee/dynamiccontext/*/Crazy*DynamicContext.xml&quot;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Looking at the Spring 2.5.6 source code we found that the String passed to the <em>getResources()</em> method isn&#8217;t a proper regular expression, which is a pity. So you can&#8217;t do something like look for <em>**/Crazy*DynamicContext.xml</em> and expect to match a file <em>Crazy*DynamicContext.xml</em> in any package. Also we found that it had to prefixed with that <em>classpath*:</em> &#8230; yes, the asterix, literally &#8230; else it wouldn&#8217;t search the classpath, as opposed to the file path. So we&#8217;re restricted in the above example to a file called <em>Crazy&lt;something&gt;DynamicContext.xml </em>in a package exactly one deep from <em>net.crazymcphee.dynamiccontext</em> &#8230; e.g. <em>net.crazymcphee.dynamiccontext.package.CrazyMcpheeDynamicPackage.xml</em> matches but <em>net.crazymcphee.dynamiccontext.package.sub.CrazySubDynamicPackage.xml </em>and <em>net.crazymcphee.dynamiccontext.CrazySuperDynamicPackage.xml </em>do not. Therefore we will have a restriction on what package the dynamic context can be in and what it&#8217;s name will be. I don&#8217;t think that&#8217;s too onerous on our developers &#8211; we just have to pick a sensible standard.</p>
<p>The next part of the problem is that we have to load the &#8216;Resource&#8217; thus found into a Spring context. This is pretty easy:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Resource r <span style="color: #339933;">:</span> resources<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   GenericApplicationContext createdContext <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GenericApplicationContext<span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   XmlBeanDefinitionReader reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XmlBeanDefinitionReader<span style="color: #009900;">&#40;</span>createdContext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> reader.<span style="color: #006633;">loadBeanDefinitions</span><span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span></pre></div></div>

<p>The<em> int i</em> will be set to the number of beans found in the <em>createdContext</em>. The <em>createdContext</em> will have the original <em>context</em> as its parent context, so it can gain access to any beans defined there (and also, although we are yet to test this (!), it should also be intercepted by the AOP-based transaction interceptors in the parent, and so forth).</p>
<p>The only other part of the puzzle may be to query the <em>createdContext</em> to see if it has any target beans within it, luckily for us an ApplicationContext has a method <em>getBeansOfType(Class clazz)</em> which will load all the beans of a particular type:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Resource r <span style="color: #339933;">:</span> resources<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    GenericApplicationContext createdContext <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GenericApplicationContext<span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    XmlBeanDefinitionReader reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XmlBeanDefinitionReader<span style="color: #009900;">&#40;</span>createdContext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> reader.<span style="color: #006633;">loadBeanDefinitions</span><span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">Map</span> map <span style="color: #339933;">=</span> createdContext.<span style="color: #006633;">getBeansOfType</span><span style="color: #009900;">&#40;</span>EventHandler.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> o <span style="color: #339933;">:</span> map.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      EventHandler handler <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EventHandler<span style="color: #009900;">&#41;</span> createdContext.<span style="color: #006633;">getBean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> o<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// do some programmatic manipulation with the EventHandler that we found here</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Using these three Spring features will enable us to be able to place a JAR file containing an interface implementation, and a Spring context XML file matching a particular pattern, into the classpath of our WAR, and on restart, we can dynamically pick up the newly inserted features into our application installation. I&#8217;ll report back when we get an actual production prototype together that can do this. Hopefully it will be OK to put the code in the blog too (if we make it generic enough).</p>
<p>If you have any further ideas or refinements to this idea, please leave them in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2010/04/29/dynamically-loading-spring-contexts-from-the-classpath-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glassfish is doomed in the &#8216;department&#8217;</title>
		<link>http://www.crazymcphee.net/x/2010/02/04/glassfish-is-doomed-in-the-department/</link>
		<comments>http://www.crazymcphee.net/x/2010/02/04/glassfish-is-doomed-in-the-department/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 10:25:18 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[weblogic]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=508</guid>
		<description><![CDATA[There&#8217;s been lots of discussion the past six months about the fate of MySQL under the ownership of Oracle. Now that the purchase of Sun is complete, I&#8217;m much more concerned about the fate of the excellent JEE platform Glassfish. For example some people think that superior technology will prove to Oracle that Glassfish is [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been lots of discussion the past six months about the fate of MySQL under the ownership of Oracle. Now that the purchase of Sun is complete, I&#8217;m much more concerned about the fate of the excellent JEE platform <a href="http://glassfish.dev.java.net/">Glassfish</a>. For example some people think that superior technology will prove to Oracle that Glassfish is worth pursuing (see the <a href="http://java.dzone.com/news/oh-yes-sun-not-set-yet">comments on this dZone thread about Kenai.com</a>).</p>
<p>The problem for Glassfish, as <a href="http://www.theserverside.com/news/thread.tss?thread_id=59317">the  second sentence of this ServerSide article states</a> (see it straight from Oracle&#8217;s mouth <a href="http://blogs.sun.com/arungupta/entry/glassfish_strategy_by_oracle_sun">here</a>, and see also <a href="http://www.infoworld.com/d/open-source/oracle-reveals-strategy-glassfish-mysql-openoffice-and-solaris-914">here</a>) is that Oracle  view it as being used for &#8220;non-mission critical department apps&#8221;. Glassfish&#8217;s superior technology (or otherwise) just doesn&#8217;t come into it. It&#8217;s not a factor (as it rarely every is).</p>
<p>Not so long ago Oracle spent a <em>big</em> wad of money acquiring an app server (Weblogic) and then a stack of <em>more</em> money porting all its other products into it and branding the resulting <span style="text-decoration: line-through;">mess</span> platform &#8220;Oracle Fusion Middleware 11g&#8221;. Now not only do they have their <em>third</em> app server (OC4J/OAS, Weblogic and Glassfish), but the Sun product suite includes products that compete with various Fusion Middleware 11g products (portals, ESBs, and so on).   So on one hand you&#8217;ve got a &#8220;departmental&#8221; application server, which you can either licence for free by downloading the open-source version, or buy support for the fancier &#8216;Enterprise&#8217; version, and on the other, an expensive, full-stack-integrated (all the way to the IDE), fully-branded <em>strategic platform</em> that Oracle just invested a vast amount of money into, and have been pushing like crazy onto customers the past six months. And it is the same sales team that will sell both this licensed &#8220;departmental&#8221; Glassfish. Therefore if you say the magic words like &#8220;need a cluster&#8221; or maybe &#8220;we might build a portal&#8221;, or &#8220;we are considering adopting a service-orientated architecture&#8221;, lo and behold you&#8217;ll find the molto-dinero &#8220;Fusion Middleware&#8221; based solution installed all over your sorry arse quicker than you can say &#8220;<em>can you please explain this per-core with special CPU-architecture-loading-factor licencing schema to me once again and why is it a different price if I upgrade my hardware without adding any additional cores???</em>&#8220;.</p>
<p>Let&#8217;s dissect those &#8220;key points&#8221; of Oracle&#8217;s strategy announcement:</p>
<blockquote>
<table cellpadding="10">
<tr>
<th width="50%">
Key Point
</th>
<th width="50%">
What they meant to say
</th>
</tr>
<tr>
</tr>
<tr valign="top">
<td>GlassFish continues as the Java EE reference implementation and as an open source project.</td>
<td>
We see it as the way to dominate the direction of Java EE for at least two years, but for Larry&#8217;s sake don&#8217;t try to use it <em>in production</em>.
</td>
</tr>
<tr valign="top">
<td>Oracle&#8217;s strategic application server, Oracle WebLogic Server, together with GlassFish, provide world class Java EE infrastructure.</td>
<td>
Oracle&#8217;s strategic application server, Oracle WebLogic Server something something something provide world-class something something infrastructure.
</td>
</tr>
<tr valign="top">
<td>GlassFish Enterprise Server and WebLogic Server expected to share core components.</td>
<td>
We are the Borg. Resistance is futile. You will be assimilated.
</td>
</tr>
<tr valign="top">
<td>Oracle plans to add GlassFish Enterprise Server all WebLogic offerings.</td>
<td>
Hey, look at this cute free &#8220;reference implementation&#8221; thingy that comes free with Weblogic! You could use that to run your departmental Wiki instead of having to pay us another fortune for more Weblogic licences. Did you say &#8220;WIKI&#8221;? Did we tell you all about the great wiki-like Enterprise 2.0 features available in the Oracle Fusion Middleware 11g offering? How many test environments did you say you needed licences for?
</td>
</tr>
<tr valign="top">
<td>GlassFish Web Stack maintained for existing customers.</td>
<td>
Not available for sale.
</td>
</tr>
<tr valign="top">
<td>GlassFish Message Queue remains as the GlassFish messaging infrastructure.</td>
<td>
We&#8217;re not expecting to sell any licences of this. Just use Oracle Fusion Middleware&#8217;s SOA Suite 11g already. We&#8217;re fairly sure that&#8217;s got a message queue in it.
</td>
</tr>
<tr valign="top">
<td>Oracle plans to license GlassFish Enterprise Server and Java System Web Server with all WebLogic Server offerings.</td>
<td>
See above.
</td>
</tr>
<tr valign="top">
<td>GlassFish also available as standalone offering.</td>
<td>
Are you sure you didn&#8217;t mean to say &#8220;Weblogic&#8221;? No? Can you call back next Thursday at 2pm and ask for Fred? We&#8217;re reasonably certain he might know something about that Glassthingy.
</td>
</tr>
<tr valign="top">
<td>GlassFish will continue to be supported and maintained for an extended time period for customers current on support.</td>
<td>
Well, the lawyers said we had to. We know how to do this. Ask any 10g customer.
</td>
</tr>
<tr valign="top">
<td>GlassFish open source projects thrive</td>
<td>
As long as we will let them.</td>
</tr>
</table>
</blockquote>
<p>I know I&#8217;m a completely cynical bastard about these things, but I will wager within a few months that even if you deliberately ask for Glassfish Enterprise <em>directly</em> that you&#8217;ll have to fight off the Weblogic borg absolutely <em>tooth and nail to the last man</em> as they repeatedly try to board your IT department brandishing their integrated-wizard-driven <em>Red Stack</em>. I predict that, basically, after a year of not even <em>trying</em> to sell any Glassfish licences &#8211; because if you ask for any of the features that are in the licenced version and not the open-source one, you&#8217;ll be pushed to Weblogic (and anyway, at ten times the price they&#8217;ll prefer to sell you Weblogic as a default position, after all &#8220;Glassfish comes free with Weblogic&#8221;) &#8211; Oracle will announce, &#8220;there&#8217;s no sales in it&#8221;, then probably ditch the licenced Glassfish version completely, leaving only the open source version. Finally sometime after that they&#8217;ll cut the open source funding off and it will have to limp along without hardly any of the resources it formerly had. Maybe they&#8217;ll donate it to the ghetto of an Apache incubator project where it can die unnoticed a couple of years after that.  It&#8217;s a pity because IMHO Glassfish is ten thousand times a better app server than anything Oracle ever produced, or even bought before this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2010/02/04/glassfish-is-doomed-in-the-department/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>ORM-is-Dead meme</title>
		<link>http://www.crazymcphee.net/x/2009/10/19/orm-is-dead-meme/</link>
		<comments>http://www.crazymcphee.net/x/2009/10/19/orm-is-dead-meme/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 07:31:32 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dao]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[persistence]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=488</guid>
		<description><![CDATA[I agree with Stephan, and  Aldo; ORMs increasingly get in the way. Collection mapping is one of those &#8220;hello world&#8221; problems. (The &#8220;hello world&#8221; example in the doco looks totally trivial and completely ideal [which is the problem], but suck-in-the-galaxy-greet-it-and-then-map-all-the-stars problem, which is more like what your real app looks like, is far less than [...]]]></description>
			<content:encoded><![CDATA[<p>I agree with <a href="http://codemonkeyism.com/orms/">Stephan</a>, and  <a href="http://www.hatfulofhollow.com/posts/code/farewell-to-orms.html">Aldo</a>; ORMs increasingly get in the way.</p>
<p>Collection mapping is one of those &#8220;hello world&#8221; problems. (The &#8220;hello world&#8221; example in the doco looks totally trivial and completely ideal [which is the problem], but suck-in-the-galaxy-greet-it-and-then-map-all-the-stars problem, which is more like what your real app looks like, is far less than trivial and not so easily achieved with the demonstrated toolkit). In my experience, collection mapping is the cause of all sorts of pain and performance perfidy.</p>
<p>Here&#8217;s a further situation where I find that they <em>really</em> get in the way. Consider integration with existing systems that use highly-normalised database schemas (designed by advanced SQL programmers who know what they are doing in that language).</p>
<p>This is not an uncommon scenario &#8211; we have this system &#8216;A&#8217; which (let&#8217;s say) has all our customer shipping, product, warehousing data in it. We don&#8217;t want to replace it. But we need to extend it so that e.g. available to web systems. Or maybe it needs to be integrated into the big fancy off-the-shelf CRM we&#8217;re installing. Something like that. We need to build some sort of service layer around this system &#8216;A&#8217; so that other systems can access its data and/or functions. It&#8217;s common to think that an ORM around that big complex database schema is going to help, but in my experience, it doesn&#8217;t for many of the reasons Stephan and Aldo list. That sort of highly-normal database schema in my experiences completely kills ORM object representations stone cold. You end up with so many LazyInitialisationExceptions and various other problems it sucks productivity out the developers and performance out of the system.</p>
<p>Also, I get a bit annoyed about ORM abstractions leaking into the web tier, this is especially prevalent with using annotations rather than ORM mapping files.</p>
<p>Different sorts of approaches are sometimes needed to be applied with careful thought in that scenario. Perhaps you need to model the &#8220;intermediate&#8221; domain you need directly, and then use, for example, simple DAO layers which operate directly on the domain you&#8217;ve defined. These DAO layers then might call functions (stored procs) in the database that do the problematic mapping in an efficent relational language (after all it&#8217;s the direct representation of the target data format).</p>
<p>I&#8217;m not saying that you have to do the above in every case, or that an ORM is always wrong, but anyway the point is, ORM isn&#8217;t a magic bullet like any other technology you have to consider carefully. Your application doesn&#8217;t always need one by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/10/19/orm-is-dead-meme/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Out of the box experience</title>
		<link>http://www.crazymcphee.net/x/2009/10/06/out-of-the-box-experience/</link>
		<comments>http://www.crazymcphee.net/x/2009/10/06/out-of-the-box-experience/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 03:44:47 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[profession]]></category>
		<category><![CDATA[wizards considered harmful]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=483</guid>
		<description><![CDATA[Every now and again we get some customers who expect that they can get a custom website, portal, or services integration done by looking at a vendor&#8217;s &#8220;out of the box&#8221; experience. This can be very frustrating for us, as we need to get into their heads that no platform will delivery any website, portal, [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and again we get some customers who expect that they can get a custom website, portal, or services integration done by looking at a vendor&#8217;s &#8220;out of the box&#8221; experience. This can be very frustrating for us, as we need to get into their heads that no platform will delivery any website, portal, or integration &#8220;out of the box&#8221;. I classify this as a species of magical thinking.  This sort of thinking is so persuasive among many IT systems users that they will spend $500,000 on the infrastructure and $50,000 on the development effort. They are often shocked to discover that to get all the features they demand &#8211; even when those features can be delivered trivially from the chosen platform, costs time (and therefore money) often to the equivalent value of the software licensing. The &#8220;out of the box&#8221; approach can deliver excellent results in terms of a single-point-system, let&#8217;s say a CRM (e.g. sign up for a Salesforce account) but they don&#8217;t see to integrate that CRM into their custom warehousing system (for example) and linking all of that into a comprehensive product website involves completely customised software development. Every website, portal or integration scenario is custom &#8211; always. Unless it is somehow the case that you don&#8217;t mind that your website is the default &#8220;Welcome to Apache Tomcat&#8221; page.</p>
<p>In recent times I&#8217;ve seen this often enough that I think it&#8217;s really a failing of the IT industry in general, and we need to educate business IT users about the various scenarios and categories of software.</p>
<p>The simplest analogy I can think of is to say the website or portal is the letter, and the platform is the word processor.  Regardless if you use Word, Wordperfect, Pages 09, your email program or just plain old &#8216;notepad.exe&#8217;, at the end of the day the time to write the letter is pretty much the same effort and therefore the task is basically identical. If you said &#8220;I want you to help me to write a letter to my member of parliament&#8221;, should  I ask you whether you&#8217;re using the new letter wizard in Word? Have you seen this great &#8220;clippy&#8221; feature? Have you considered the new upgrade to Office 2007? Tell you to buy a Mac? Or would I be better off asking who is your member of parliament and what&#8217;s the matter about? When we get these sorts of naive clients we need to concentrate their minds on what their actual problem is and the best way we can solve it, when they&#8217;ve got their head in the sand thinking about that great drag-and-drop wizard feature the vendor showed them they totally thinking about the completely wrong thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/10/06/out-of-the-box-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Oracle XE on Mac OSX using virtualised JeOS</title>
		<link>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/</link>
		<comments>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 06:30:20 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[oracle-xe]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=462</guid>
		<description><![CDATA[So Oracle in its wisdom doesn&#8217;t have Mac OSX version of its free database. This is of course really annoying to Mac users who need to develop systems that use Oracle databases &#8211; Oracle XE is a great little database especially for development environments. Recently I found myself in a situation where I would be [...]]]></description>
			<content:encoded><![CDATA[<p>So Oracle in its wisdom doesn&#8217;t have Mac OSX version of its free database. This is of course really annoying to Mac users who need to develop systems that use Oracle databases &#8211; Oracle XE is a great little database especially for development environments. Recently I found myself in a situation where I would be needing to bind a Hibernate object to a PL/SQL function in the target Oracle database rather than a table or view per se. As the function call is database specific, when developing the application I needed to use an Oracle database and could use e.g. HSQL or MySql as a substitute Oracle DB for development purposes. Oracle XE is a great way out here because it fully supports PL/SQL packages and functions and procedures.</p>
<p>I was off the client site so I couldn&#8217;t rely on a fast connection to their development databases. I just wrote a dummy function that was called the same as the real function with the same input and output parameters and instead of the complex function body it just wrapped a simple mock table of test data. Problem solved, Oracle XE to the rescue. But first you have get Oracle XE running on your Mac, this is what the rest of this article is about, because you can&#8217;t just download an Oracle XE edition for the Macintosh.</p>
<h3>Virtualisation is great &#8211; use a Linux VM</h3>
<p>However modern Virtualisation is your saviour. Put simply, you can use a virtualisation tool like Parallels, or my choice, VMWare Fusion, to run a virtualised version of Linux that contains the Oracle XE instance.</p>
<p>Because VMs can waste a bit of your local resources, luckily there is a specialised version of Ubuntu designed for running as a virtualised machine of this type. Its called JeOS (pron. <em>Juice</em>, apparently). It doesn&#8217;t have an X-window environment, just the shell, so it&#8217;s pretty lightweight and can run, with Oracle XE, in less than 512MB of memory. Perfect for getting a copy of Oracle XE onto your Macbook Pro.</p>
<p>It will however, eat up a couple of gigabytes of disk space, up to the maximum limit you choose for your disk size in the VMWare configuration. However it will only use the current amount of disk needed, as VMWare will expand the size of the image as needed (I&#8217;ll just assume that Parallels does something similar).</p>
<h3>Setting it up &#8211; basic instructions</h3>
<p><a href="http://tedwise.com/2008/10/03/running-oracle-for-development-on-the-mac/">This page here</a> &#8211; has a great set of instructions for getting JeOS installed and configured with Oracle XE on it. Follow the instructions there <em>exactly</em> &#8211; but only to the point where you install and configure Oracle XE &#8211; don&#8217;t go further than that.</p>
<p>Make sure you configure plenty of swap space as outlined in the instructions.</p>
<blockquote>
<h3>Setting it up on standard Ubuntu/Debian</h3>
<p>If you are running a full Ubuntu or other Debian based instance, the instructions are somewhat simpler. Install it as per normal in your VM. But make sure your swap space is twice the memory you have assigned to the VM! Oracle XE demands things to be like that.</p>
<p>Add</p>
<pre>deb http://oss.oracle.com/debian unstable main non-free</pre>
<p>to /etc/apt/sources.list and then:</p>
<pre>$ wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install oracle-xe</pre>
<p>These instructions were cribbed from <a href="http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html">here</a>.</p></blockquote>
<h3>After installing and configuring Oracle XE</h3>
<p>After you run the XE configuration (&#8216;$&#8217; represents the Unix shell prompt and should not be typed);</p>
<pre>$ sudo /etc/init.d/oracle-xe configure</pre>
<p>If you&#8217;re running on JeOS don&#8217;t yet make the machine &#8220;headless&#8221;! Or you might find there are issues with the &#8220;Apex&#8221; application. The problem is that the Apex application, which is a useful web-based administration program for Oracle XE (especially for developers who don&#8217;t want to be forced to use sqlplus for all their database administration), will only allow connections from localhost &#8211; and you don&#8217;t have X-window, or a browser, to access it (I don&#8217;t know if lynx will work with Apex and I wasn&#8217;t going to try).</p>
<h3>Get SSH installed</h3>
<p>First get SSH installed in JeOS so you can get to the command prompt remotely:</p>
<pre>$ sudo apt-get install ssh</pre>
<h3>Find out the VM&#8217;s IP address</h3>
<p>Now, if you type <em>ifconfig</em> (<em>/sbin/ifconfig</em> if that&#8217;s not found on your path) you will be able to determine the IP address of your VM running on your Macintosh. At this point you can connect to the VM using ssh from a Macintosh terminal window:</p>
<pre>$ ssh username@ip_address</pre>
<p>Actually, at this point you can go ahead and make the machine headless, if you want. I would recommend not to do that until you&#8217;re sure of everything you&#8217;ve configured.</p>
<h3>Configure environment to run sqlplus</h3>
<p>After you&#8217;ve logged back into the running Linux VM using ssh from the Mac Terminal, the next thing is you&#8217;ve got to get sqlplus access working to the XE instance you installed. Funnily enough, although the .deb file that is installed off the Oracle site creates an oracle user, it doesn&#8217;t in any way set that user up so you can use the command line tools. SO you can&#8217;t just su &#8211; oracle and get a functional environment.</p>
<p>Anyway, you will need to do two things to your environment; add the <em>ORACLE_HOME</em> environment variable and set up your <em>PATH</em> so it can find <em>sqlplus</em>.</p>
<pre>$ export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
$ export PATH=${PATH}:${ORACLE_HOME}/bin</pre>
<p>You should add these two lines to your <em>.profile</em> or <em>.bash_profile</em> file &#8211; probably best for the &#8216;oracle&#8217; user that the installation will have created. But you can actually set this up for any regular user that you configure in this VM. You can also just type them at the command line to get them in your current environment, if you have to.</p>
<h3>Configure Apex to accept non-localhost connections</h3>
<p>The web-based administration software for XE, called &#8220;APEX&#8221;, only binds to <em>localhost</em>. This is a big hassle if your VM copy of Linux (like JeOS) doesn&#8217;t have a GUI, because you don&#8217;t have a browser (lynx/links excluded, I did not try those!).  However, you can make Apex bind to the &#8220;external&#8221; IP address for your VM, but you&#8217;ll need to use <em>sqlplus</em>.</p>
<p>To run <em>sqlplus</em>, do the following:</p>
<pre>$ sqlplus system@XE
  Enter password:</pre>
<p>Enter the password you specified at the &#8216;oracle-xe configure&#8217; step above.</p>
<p>At the SQL prompt, enter the following command:</p>
<pre>SQL&gt; EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);</pre>
<p>Now you&#8217;ll have to stop and start Oracle to make the configuration active:</p>
<pre>$ sudo /etc/init.d/oracle-xe restart</pre>
<p>After which, if you type</p>
<pre>$ netstat -tna</pre>
<p>You should find a line</p>
<pre>tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN</pre>
<p>This indicates a process is listening to the port 8080 on all IP addresses for connections coming from any other IP address. Assuming you specified port 8080 at the &#8216;oracle-xe configure&#8217; step. Sometimes I use 8888 especially if I have a Tomcat instance in the same VM, as Tomcat will also like to run on 8080 and I&#8217;d prefer it if it did.</p>
<h3>Test and use Apex</h3>
<p>Test this connection in your browser, in my case, the address was 10.1.2.17, but you will have to substitute your own VM&#8217;s IP address &#8211; <em>http://10.1.2.17:8080/apex</em>. I like to make an /etc/hosts entry that points to this address as &#8216;oracleXE&#8217;. That way I can use a symbolic name in my jdbc connection strings and actually switch which instance of XE I am using depending which VM I&#8217;ve fired up without editing the jdbc configuration of the application under development &#8211; I just change the /etc/hosts entry instead.</p>
<p>Anyway once you connect to apex you can login using the user name and password you set up during your XE install and configuration process (same as you used for <em>sqlplus</em>). The users will be sys and system, you can use them to create new users to contain your databases for development.</p>
<p>The same IP address as above will be used to connect to your Oracle database from the programs you are developing. The default port should be 1521 and the SID should be XE.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tapestry 5 web framework</title>
		<link>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/</link>
		<comments>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 12:09:18 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tapestry]]></category>
		<category><![CDATA[tapestry5]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web framework]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=443</guid>
		<description><![CDATA[Lately I&#8217;ve been writing a Tapestry 5 based web application. I&#8217;ve used it before for a smaller application but this is the first time I&#8217;ve used it on a larger project. In a number of ways it is a very powerful framework to write web applications. The basics of Tapestry is that it is a [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been writing a <a href="http://tapestry.apache.org/tapestry5/" target="_blank">Tapestry 5</a> based web application. I&#8217;ve used it before for a smaller application but this is the first time I&#8217;ve used it on a larger project. In a number of ways it is a very powerful framework to write web applications.</p>
<p>The basics of Tapestry is that it is a component-based web framework. Just about everything, including web pages, are components. Components may contain other components. The way it works is very simple and quite elegant, once you get used to it and weaned off the big-XML-file style of configuring a web application.</p>
<p>When you start, you have two main Java packages that are created for you (if you use the maven archetype, otherwise you will create these packages yourself). If your package root is say &#8220;net.crazymcphee.webapp&#8221;, then your two packages are &#8220;net.crazymcphee.webapp.pages&#8221; and &#8220;net.crazymcphee.webapp.components&#8221;. To configure a Tapestry 5 project with maven <a href="http://tapestry.apache.org/tapestry5/quickstart/">use this command</a> and answer the prompts:</p>
<pre>mvn archetype:generate \</pre>
<pre>    -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository</pre>
<p>Don&#8217;t use the one in the <a href="http://tapestry.apache.org/tapestry5/tutorial1/first.html">tutorial</a> as it will not work! This is an excellent illustration of the first and most serious problem that Tapestry 5 has: the documentation not only has massive lacunas, it is also sometimes wrong and not updated.</p>
<p>Now, any class that you create in the &#8220;pages&#8221; package will automatically become a page in your application. But these classes need not be very complex at all. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.crazymcphee.webapp.pages</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collections</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.annotations.Persist</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.annotations.Property</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.ioc.annotations.Inject</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.crazymcphee.webapp.model.Person</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.crazymcphee.webapp.services.PersonService</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Persons <span style="color: #009900;">&#123;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">private</span> PersonService personService<span style="color: #339933;">;</span>
    @Property
    @Persist
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">List</span> persons<span style="color: #339933;">;</span>
    @Property
    @Persist
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> searchTerm<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">Object</span> onSubmitFromSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> personService.<span style="color: #006633;">findPersons</span><span style="color: #009900;">&#40;</span>searchTerm<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">Object</span> onSubmitFromClear<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> <span style="color: #003399;">Collections</span>.<span style="color: #006633;">EMPTY_LIST</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can see that this class doesn&#8217;t extend any infrastructure classes and has quite a simple structure. This is a fully functional page with two actions &#8211; one populates a list, the other clears it.</p>
<p>Now, to explain just a little here; PersonService is injected by Tapestry, but you need to configure in your AppModule which implementation you want to use. You can also use it with Spring as your IOC container but the one that comes with Tapestry is perfectly good enough for most applications.</p>
<p>The List, persons, and the searchTerm parameters are marked as @Property (so we don&#8217;t need to add getters and setters) and also @Persist so that the variables are preserved from request to request.</p>
<p>The methods &#8220;onSubmitFromSearch&#8221; and &#8220;onSubmitFromClear&#8221; are using a convention &#8211; &#8220;onSubmit&#8221; will also work, but assuming (as is true in this case) that we may have multiple forms on the one page, each method will only be fired from the &#8220;search&#8221; form in one instance, and the &#8220;clear&#8221; form in the other. These names are not special, it&#8217;s just (as you&#8217;ll see below) the forms will have these two names. They could be &#8220;Bill&#8221; and &#8220;Ben&#8221; in which case the methods would be &#8220;onSubmitFromBill&#8221; and &#8220;onSubmitFromBen&#8221;.</p>
<p>You will also note that these methods return the same page instance, which tells Tapestry to re-render the same page, but if you wanted to forward onto another page, you would add a instance variable, mark it with an @InjectPage annotation, and return that instance variable (after initialising it in your &#8220;onSubmit&#8221; method) instead of just returning &#8220;this&#8221;.</p>
<p>This page Persons, is available at {application-context-path}/persons. But there is one other part of the puzzle &#8211; the actual view. As mentioned, Tapestry uses convention over configuration and in this case, the convention is that the Page markup must be named the same: Persons.tml. Here is the matching tml file for the class above;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">html</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:type</span><span style="color: #000000;">=</span>&#8220;layout&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">title</span><span style="color: #000000;">=</span>&#8220;Peoples I Might Know&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #7f007f;"><span style="color: #000000;"> </span>t:sidebarTitle<span style="color: #000000;">=</span><span style="color: #2a00ff;">&#8220;Current Time&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #7f007f;">xmlns:t</span><span style="color: #000000;">=</span>&#8220;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #7f007f;">xmlns:p</span><span style="color: #000000;">=</span>&#8220;tapestry:parameter&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f5fbf;">&lt;!&#8211; Most of the page content, including &lt;head&gt;, &lt;body&gt;, etc. tags, comes from Layout.tml &#8211;&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:form</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;search&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:textfield</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;searchTerm&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">validate</span><span style="color: #000000;">=</span>&#8220;required&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">size</span><span style="color: #000000;">=</span>&#8220;20&#8243;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:submit</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;searchPeople&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">value</span><span style="color: #000000;">=</span>&#8220;search&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>t:form<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:grid</span><span style="color: #000000;"> </span><span style="color: #7f007f;">source</span><span style="color: #000000;">=</span>&#8220;persons&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:form</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;clear&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:submit</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;clearPeople&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">value</span><span style="color: #000000;">=</span>&#8220;clear&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>t:form<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>html<span style="color: #008080;">&gt;</span></p>
<p>Yes, it&#8217;s that bloody simple. The first form fires the &#8220;onSubmitFromSearch&#8221; method (with a little bit of validation, done in javascript) and the second method clears the list. In-between, there is this <span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:grid</span><span style="color: #000000;"> </span><span style="color: #7f007f;">source</span><span style="color: #000000;">=</span>&#8220;persons&#8221;<span style="color: #008080;">/&gt; <span style="color: #000000;">business, which, if the &#8216;persons&#8217; variable in the page class is populated, will show a list of its contents! </span></span></p>
<p>To test our app, we can use the command-line &#8216;mvn clean jetty:run&#8217;. When Jetty has run up, then we can point our browser at the web app: http://localhost:8080/sample-webapp/Persons, and with any luck we will see the following:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-1.png"><img style="border: 0px initial initial;" title="Initial View" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-1-300x171.png" alt="Initial View" width="300" height="171" /></a></p>
<p>Now, by default, Tapestry creates the web app to use the template design as shown above. Of course, you can make it look completely some other way &#8211; or even use a totally different template if you want. The page template is just a component that&#8217;s included.</p>
<p>So if you enter in a search term and click the search button, you&#8217;d expect to see a result like this:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-2.png"><img class="alignnone size-medium wp-image-452" title="Search Result" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-2-300x174.png" alt="Search Result" width="300" height="174" /></a></p>
<p>As you can see, the list is automatically populated with the details returned from the service method (in this particular instance, this are just a canned response, but normally of course they&#8217;d be the result of a database or a web service call of some type).</p>
<p>When you click the clear button, the list is cleared as you&#8217;d expect:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-3.png"><img class="alignnone size-medium wp-image-453" title="Clear button result" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-3-300x175.png" alt="Clear button result" width="300" height="175" /></a></p>
<p>Now, here&#8217;s a really powerful feature I find in Tapestry. Let&#8217;s say our automated acceptance tests assert that when the &#8216;Clear&#8217; button is pressed, the Search box as well as the persons list is cleared. What Tapestry allows us to to do, is keep Jetty running, edit the files in the IDE, and re-run the tests against the running app without restarting! We edit our method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">Object</span> onSubmitFromClear<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> <span style="color: #003399;">Collections</span>.<span style="color: #006633;">EMPTY_LIST</span><span style="color: #339933;">;</span>
        searchTerm<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>In this case I&#8217;ve also added a bit of space around the clear button in the template as well:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-4.png"><img class="alignnone size-medium wp-image-454" title="Picture 4" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-4-300x175.png" alt="Picture 4" width="300" height="175" /></a></p>
<p>And now our failing test will pass.</p>
<p>Editing files like this in the running web app only works for Pages and I think Components. If I had to change the service or model classes I&#8217;d have to restart, but &#8220;mvn jetty:run&#8221; isn&#8217;t very a heavyweight process.</p>
<p>As I said above, Tapestry&#8217;s not perfect: it&#8217;s major flaw is the poor documentation. Convention-over-configuration is easy to grok &#8211; if you know the convention. If you don&#8217;t and the documentation doesn&#8217;t tell you, and you can&#8217;t find a sample of what you need, it can be very frustrating. There is an excellent user list though.</p>
<p>Its other major flaw may be the stability of the API. Tapestry 5 is different (and incompatible) from Tapestry 4 is different from Tapestry 3. But so far I&#8217;ve used it on a couple of projects and I&#8217;m really enjoying it. I really hate the oodles of XML boilerplate and massive amounts of configuration found in Spring and I find myself somewhat reluctant to use it unless I really have to. Tapestry solves for me a range of different problems and mostly it presents a very elegant way to create a componentised web application. You might like to give it a try.</p>
<p>Attached is the sample code used above. It took me about 10 minutes to write (far shorter than it took me to write this blog entry!) - <a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/sample-webapp.tar.gz">sample-webapp.tar bundle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Agile is dead</title>
		<link>http://www.crazymcphee.net/x/2009/06/23/agile-is-dead/</link>
		<comments>http://www.crazymcphee.net/x/2009/06/23/agile-is-dead/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 05:49:44 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[professional practice]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[profession]]></category>
		<category><![CDATA[vendors]]></category>
		<category><![CDATA[wizards considered harmful]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=400</guid>
		<description><![CDATA[I know that&#8217;s a pretty bold statement but here&#8217;s why. This morning I went to a vendor&#8217;s presentation morning, it was the usual game of buzzword bingo from the very first slide on. All the usual enterprise2.0, social-networking, portal-compliant, content-management, vertically-integrated, SOA-BPM-UCM-JEE-ESB-WS-BPEL platform-framework-enabling scalability-enhancing fun-lovin&#8217; don&#8217;t write code but manage-the-enterprise-blog-wiki-twitter-facebook-youtube shopping cart drag-n-drop non-content that [...]]]></description>
			<content:encoded><![CDATA[<p>I know that&#8217;s a pretty bold statement but here&#8217;s why. This morning I went to a vendor&#8217;s presentation morning, it was the usual game of <em>buzzword bingo</em> from the very first slide on. All the usual enterprise2.0, social-networking, portal-compliant, content-management, vertically-integrated, SOA-BPM-UCM-JEE-ESB-WS-BPEL platform-framework-enabling scalability-enhancing fun-lovin&#8217; <em>don&#8217;t write code</em> but manage-the-enterprise-blog-wiki-twitter-facebook-youtube shopping cart drag-n-drop <em>non-content</em> that we have all come to expect from the big vendors was fully in attendance.</p>
<p>But the real kicker was a presentation on <em>Agile Integration</em>, by one of the vendor&#8217;s partners (and in the interests of disclosure, a competitor to my own employer). A few slides in and there&#8217;s the inevitable &#8220;what is agile&#8221; slide with a standard dictionary definition and some lip-service to previous history. Now the thing here of course, is that the word <em>Agile</em> in software development parlance is by now a well-entrenched piece of <em>jargon</em> &#8211; it has a specific meaning to most people that is fairly precise and different to just the garden-variety common English usage. This is the purpose of jargon in a discipline: to be precise in communication. And the <a href="http://agilemanifesto.org/" target="_blank">agile manifesto</a>, nearly 10 years old, just means in effect, if you&#8217;re in the software development game you just can&#8217;t redefine the term to mean something else.</p>
<p>Except of course, you <em>can</em>, if you do, and you&#8217;re <em>big</em> enough and enough people listen to your incredibly mangled marketoid-speak. <em>But implementing a SOA solution is not Agile</em>, no matter how many times you make an incredibly weak case that it is or how many times you repeat any other platform-orientated mantra. Yes, you read it right, according to the vendor&#8217;s partner at least, <em>SOA is Agile</em>.</p>
<p>This banality made me so angry, it was very lucky that straight after there was the morning coffee break because I was seething and it took all my self-discipline not to launch into an attack during the questions (easy picking, because there were no other questions asked!). I had to vent at my poor colleagues in the break.</p>
<p>Anyway, on my admittedly pessimistic reading it means that <em>Agile Is Dead</em>, as pretty soon we are going to find clients telling people, &#8220;Yeah we do agile, we bought the million-dollar SOA package off that vendor&#8221;, and then they&#8217;ll be saying the reason their integration projects are still failing is because they haven&#8217;t installed the very latest patchset, or upgraded to all-new <em>LEANsuite 17.4.15.8 release B</em> with the optional drag-n-drop Super-Agility add-in for Portals, Release 16f (the &#8220;f&#8221; is for &#8220;fail&#8221;).</p>
<p>At sushi train lunch afterwards, we made the observation that pretty much the vendor wants to be <em>all the food groups all at once</em>. Kind of like this bit of gluggy sushi I mistakenly lifted off the train:</p>
<div id="attachment_404" class="wp-caption alignnone" style="width: 310px"><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/06/img_0080.jpg"><img class="size-medium wp-image-404" title="bad sushi" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/06/img_0080-300x225.jpg" alt="All the food groups. Nasty." width="300" height="225" /></a><p class="wp-caption-text">All the food groups. Nasty.</p></div>
<p>Now I&#8217;m not saying that you can&#8217;t do &#8220;SOA&#8221; with an agile process, if that&#8217;s your preferred architectural style, then if you are committed you can certainly develop it in an Agile fashion. You can&#8217;t afford however, to confuse the two things. If you do, that picture above is  what your enterprise will look like too if you mistake the <em>buzzword bingo</em> offered by vendors for actual <em>insight into agile development process</em>. Talk to an expert instead.</p>
<p>Sorry to be so negative, the whole morning pretty much sapped my will to live.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/06/23/agile-is-dead/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Google Wave is coming &#8230;</title>
		<link>http://www.crazymcphee.net/x/2009/05/30/google-wave-is-coming/</link>
		<comments>http://www.crazymcphee.net/x/2009/05/30/google-wave-is-coming/#comments</comments>
		<pubDate>Sat, 30 May 2009 05:45:40 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=377</guid>
		<description><![CDATA[I don&#8217;t normally just blog technologies, but this is so incredible you have to see it, if you haven&#8217;t already. If you want to see the future of both email and social networks, check out Google Wave. It&#8217;s described as: &#8230; a product that helps users communicate and collaborate on the web. A &#8220;wave&#8221; is [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t normally just blog technologies, but this is so incredible you have to see it, if you haven&#8217;t already. If you want to see the future of both email and social networks, check out <a href="http://wave.google.com/">Google Wave</a>. It&#8217;s <a href="http://code.google.com/apis/wave/">described</a> as:</p>
<blockquote><p>&#8230; a product that helps users communicate and collaborate on the web.  A &#8220;wave&#8221; is equal parts conversation and document, where users can almost  instantly communicate and work together with richly formatted text, photos, videos,  maps, and more. Google Wave is also a platform with a rich set of open APIs that allow  developers to embed waves in other web services and to build extensions that work  inside waves.</p></blockquote>
<p>In the video from Google IO that I embed below, it&#8217;s described as &#8216;email if it would have been invented now&#8217; instead of 50 years ago. It&#8217;s hard to put the experience into words: it&#8217;s like threaded email, a bulletin board or forum, and social networking sites like Facebook or Twitter. Although it is only in developer preview, there are several APIs and an open-source protocol to facilitate Wave servers and clients not necessarily run by Google itself.</p>
<p>The only downside: Google is concentrating on adding sandbox accounts to the developer preview mostly for the people who were lucky enough to be at Google IO, which is a pity. Apart from the general site and the Google Code site linked above, there is also a <a href="http://googlewavedev.blogspot.com/2009/05/introducing-google-wave-apis-what-can.html">blog</a> and a <a href="http://twitter.com/Wave_Google">twitter</a> account (not sure if this last one is official but it looks like it is, not other dodgy links or anything). <strong>Update</strong>: also here&#8217;s the <a href="http://www.waveprotocol.org/draft-protocol-spec">draft protocol specification</a>, the <a href="http://groups.google.com/group/wave-protocol">protocol mailing list</a> and the <a href="http://groups.google.com/group/google-wave-api">API mailing list</a>.</p>
<p>Anyway I think it&#8217;s a big, big, huge, game-changer in all sorts of internet and web-enabled interface areas (not just email + bbs + social media, it does things like wiki, version control, document production, bug tracking, concurrent editing, etc). Maybe even remote pair programming with real-time collaboration. It&#8217;s the sort of thing that could kill <em>MS Office</em>, not just email or social networks.. It&#8217;s also been built with Google Web Toolkit and runs on devices like the iPhone <em>through the browser</em>. No iPhone app necessary.</p>
<p>Video embedded below; it&#8217;s very long (1hr 20min) but worth it.</p>
<p><object width="560" height="340" data="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/05/30/google-wave-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;One throat to choke&#8217;</title>
		<link>http://www.crazymcphee.net/x/2009/05/26/one-throat-to-choke/</link>
		<comments>http://www.crazymcphee.net/x/2009/05/26/one-throat-to-choke/#comments</comments>
		<pubDate>Tue, 26 May 2009 12:18:20 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[professional practice]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=371</guid>
		<description><![CDATA[Many developers will have heard this term used as a justification for buying all, or most, of an organization&#8217;s IT infrastructure from a single vendor. And it is, like most of these idiotic aphorisms bandied around IT management, a complete crock of excrement. It&#8217;s the sort of thing that salesmen must tell credulous IT management [...]]]></description>
			<content:encoded><![CDATA[<p>Many developers will have heard this term used as a justification for buying all, or most, of an organization&#8217;s IT infrastructure from a single vendor. And it is, like most of these idiotic aphorisms bandied around IT management, a complete crock of excrement. It&#8217;s the sort of thing that salesmen must tell credulous IT management right after the second bottle of Grange Hermitage at the pre-sales, post-golfing, dinner and drinks.</p>
<p>I&#8217;m working currently for a client, building a portal which will serve tens of thousands of users. In order to deliver reasonable functionality, we have to integrate to about a half-dozen other critical systems. Email servers (two different types/styles). Calendars (three different sources of calendar information). ERP systems containing customised enterprise information, HR and payroll, content management, identity management, and a couple of specialised web apps. This is supposedly held together with a single-sign-on system. The Portal, SSO, and ERP system all come from the one vendor, I won&#8217;t say which one, but it&#8217;s a big, major vendor. One Throat To Choke, they say. Well I call <em>bulldust</em>.</p>
<p>The thing is, the only throat&#8217;s that&#8217;s got any damage on it is the poor client&#8217;s, who has managed to have it&#8217;s own throat cut wide open and lies bleeding money on the pavement.</p>
<p>The really big gotcha, the huge hole in the way things get pitched to clients from vendors with the &#8220;we&#8217;ll take the blame&#8221; line, is the downright lies that get told to the client about the ease of integration. The portal technology we have, simply cannot propagate identity information across to the ERP&#8217;s web services (it&#8217;s even more fundamental than that, really). The whole part of this shooting match all comes from the same vendor &#8211; portal, ERP and authentication mechanisms. There is a slide in existence in a powerpoint that I&#8217;ve seen which claims this integration is trivial. I&#8217;ve seen a document from the vendor that claims this is possible, and gives a detailed procedure. But when you try it, it doesn&#8217;t work.</p>
<p>Worse, after you struggle with this integration for several days, and log a support call to the vendor (who by now, having banked the cheque, has disappeared from the site completely). Well, that&#8217;s a whole new kettle of fish trying to tell each and every newly minted support technician who deal with your support requests just what is meant by WSRP (you can substitute your own appropriate acronym which is central to your particular technology if you like), or even, the logical sequence of what you&#8217;re trying to do, which things are of significance, the repeated asking for the same basic irrelevant information over and over, the failure to understand what the question is, <em>ad nauseum</em>. Oh, then and only then do the special &#8220;support notes&#8221; come out, the ones which which warn against the particular configuration of products that the client has been sold, when the sales slides, and available documentation, and the sales pitch, told exactly the opposite as to what you get after you actually try it and experience the massive whoosh of fail that gushes out the products concerned. I&#8217;m just lucky that mostly, it&#8217;s not me who is having to deal with this particular problem. I grieve for my colleague though. We&#8217;ve lost days and days on what is a completely critical integration. Sold on a <em>lie</em> by people who don&#8217;t even know what it is they are selling. Where&#8217;s the blame, where&#8217;s the throat being choked? The vendor won&#8217;t take reponsibility for their own damn product suite&#8217;s lack of interoperability!</p>
<p>Just the other day on a different and unrelated support call for a different problem I had to explain how to read a stack-trace, twice, to the support personel involved. Although we cleared the support problem ourselves, that is we found a tedious work-around that at least got us back on the path of writing code, we want an explanation as to what the product is actually doing, so we&#8217;ve left the job open. But in that case, the support feedback has been dead a week with no follow up on the matter with the job still critical, unresolved and outstanding, as far as the vendor should be concerned (because we told them so).  Hello? &lt;cue cavenous reverb effect&gt;. &lt;tumbleweeds&gt;.</p>
<p>The hilarious thing is, the funky little systems the client has already installed, with competent programmers in the client&#8217;s own employ looking after the other end, look like a joy to integrate against: trivial, almost. Developer on site.</p>
<p>I can&#8217;t believe in this day and age these big vendors sell <em>anything</em> to anyone. Hasn&#8217;t everyone been burnt like this one too many times? I&#8217;ve dealt with other similar big vendors in the past. They are all the same basically. Snake oil salemen selling an oily tar-pit of overcomplexification as if it were the <em>acqua vitae</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/05/26/one-throat-to-choke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
