<?xml version="1.0" encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="https://raibledesigns.com/roller-ui/styles/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:app="http://www.w3.org/2007/app"
      xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">

    <title type="html">Search for [sidenote] in weblog rd</title>
    <subtitle type="html">Search results for [sidenote] within weblog Raible Designs</subtitle>
    <id>https://raibledesigns.com/rd/feed/entries/atom?q=sidenote&amp;cat=%2FJava</id>

    <link rel="self" type="application/atom+xml" 
        href="https://raibledesigns.com/rd/feed/entries/atom?q=sidenote&amp;cat=%2FJava" />

    <link rel="alternate" type="text/html" 
        href="https://raibledesigns.com/rd/search?q=sidenote&amp;cat=%2FJava" />

    <link rel="search" type="application/opensearchdescription+xml" 
        href="https://raibledesigns.com/roller-services/opensearch/rd" />
    <opensearch:Query role="request" searchTerms="sidenote" startPage="1" />

    <link rel="first" type="application/atom+xml" href="https://raibledesigns.com/rd/feed/entries/atom?q=sidenote&amp;cat=%2FJava" />
    <updated>2026-05-25T13:53:18-06:00</updated>
    <generator uri="http://roller.apache.org" version="5.0.3 (1388864191739:dave)">Apache Roller</generator>

        <entry>
        <id>https://raibledesigns.com/rd/entry/upgrading_grails_from_2_0</id>
        <title type="html">Upgrading Grails from 2.0 to 2.2</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/upgrading_grails_from_2_0"/>
        <published>2013-03-22T09:16:37-06:00</published>
        <updated>2014-05-08T19:47:19-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="grails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="devoxx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="smackdown" scheme="http://roller.apache.org/ns/tags/" />
        <category term="upgrade" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;a href=&quot;http://grails.org&quot;&gt;&lt;img src=&quot;//static.raibledesigns.com/repository/images/grails-logo-20130322.png&quot; alt=&quot;Grails&quot; width=&quot;166&quot; height=&quot;39&quot; class=&quot;picture&quot; style=&quot;border: 0&quot;/&gt;&lt;/a&gt;
In preparation for my &lt;a href=&quot;http://www.devoxx.com/display/FR13/Play+Framework+vs.+Grails+Smackdown&quot;&gt;Grails vs. Play Smackdown&lt;/a&gt; at &lt;a href=&quot;http://www.devoxx.com/display/FR13/Home&quot;&gt;Devoxx France&lt;/a&gt; next week, I recently upgraded my &lt;a href=&quot;https://github.com/jamesward/happytrails/tree/grails2&quot;&gt;Grails version&lt;/a&gt; of Happy Trails from Grails 2.0.3 to Grails 2.2.1. I ran into a few issues along the way and figured I&apos;d document them here to help others out.
&lt;/p&gt;
&lt;p id=&quot;source&quot;&gt;&lt;strong&gt;Fixing the source&lt;/strong&gt;&lt;br/&gt;The first issue I ran into was Spock and Groovy 2 incompatibilities. &lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;
| Resolving plugin JAR dependencies
| Error WARNING: Dependencies cannot be resolved for plugin [mail] due to error: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/mraible/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-1.8 is not compatible with Groovy 2.0.7. For more information, see http://versioninfo.spockframework.org
&lt;/pre&gt;
&lt;p&gt;I &lt;a href=&quot;http://stackoverflow.com/questions/15410368/upgrading-from-grails-2-0-3-to-2-2-1-server-access-error-connection-refused&quot;&gt;posted the problem to StackOverflow&lt;/a&gt; and got a response almost immediately. While &lt;a href=&quot;https://github.com/geb/geb-example-grails/pull/7/files&quot;&gt;this pull request&lt;/a&gt; helped me quite a bit, it was ultimately caused by my vision: I had two &quot;geb-spock&quot; dependencies listed in &lt;em&gt;BuildConfig.groovy&lt;/em&gt; with different groupIds.&lt;/p&gt;
&lt;p&gt;At this point, I also moved all my plugin dependencies from &lt;em&gt;application.properties&lt;/em&gt; to &lt;em&gt;BuildConfig.groovy&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The next problem I ran into was &lt;a href=&quot;http://stackoverflow.com/questions/15413701/upgrading-from-grails-2-0-3-to-2-2-1-tests-failing&quot;&gt;a unit test and functional tests failing&lt;/a&gt;. The unit testing issue was caused by my Direction model not being in the tests @Mock annotation. After I added it, validation kicked and I recognized my test was invalid. I added @Ignore and continued.&lt;/p&gt;
&lt;p&gt;The functional test seemed to be seemed to be caused by Geb and it trying to use the Chrome Driver. One of my tests didn&apos;t work with the default HtmlUnitDriver, so I used the ChromeDriver for the one test.&lt;/p&gt;
&lt;pre&gt;
| Running 11 spock tests... 6 of 11
| Failure:  signup as a new user(happytrails.AuthenticatedUserSpec)
|  org.openqa.selenium.WebDriverException: Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 45.66 seconds
Build info: version: &apos;2.27.0&apos;, revision: &apos;18259&apos;, time: &apos;2012-12-05 11:30:53&apos;
System info: os.name: &apos;Mac OS X&apos;, os.arch: &apos;x86_64&apos;, os.version: &apos;10.8.2&apos;, java.version: &apos;1.7.0_04&apos;
Driver info: org.openqa.selenium.chrome.ChromeDriver
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:111)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:115)
    at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:161)
    at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:107)
    at happytrails.AuthenticatedUserSpec.signup as a new user(AuthenticatedUserSpec.groovy:25)
&lt;/pre&gt;
&lt;p&gt;Even when running &quot;grails -Dgeb.env=chrome test-app&quot;, this still happened. This was caused by the fact that I had &lt;em&gt;GebConfig.groovy&lt;/em&gt; in test/functional/happytrails. Move it to test/functional solved the problem. I also discovered that I know longer needed Chrome to get this test to pass. Apparently, the &lt;a href=&quot;http://fbflex.wordpress.com/2013/03/18/how-to-configure-webdriver-in-grails-for-your-geb-tests/&quot;&gt;HtmlUnitDriver has issues with Grails 2.2&lt;/a&gt;, but it seems to work for me.&lt;/p&gt;
&lt;p&gt;After getting the Geb configuration fixed, I ran into a functional test failure:&lt;/p&gt;
&lt;pre&gt;
| Running 11 spock tests... 5 of 11
| Failure:  click signup link(happytrails.AuthenticatedUserSpec)
|  org.openqa.selenium.ElementNotVisibleException: Element must be displayed to click (WARNING: The server did not provide any stacktrace information)
&lt;/pre&gt;
&lt;p&gt;Even though I could see the &quot;signup&quot; link when I ran &quot;grails run-app&quot;, I could see that it didn&apos;t show up when running tests in Chrome. This turned out to be caused by an extraneous &lt;code&gt;&amp;lt;div class=&quot;nav-collapse&quot;&gt;&lt;/code&gt; I had in my main.gsp. Removing it solved the problem. It&apos;s strange that this never showed up with Grails 2.0. My only guess is that Geb someone didn&apos;t look at the visibility of the element.&lt;/p&gt;
&lt;p&gt;The last testing-related issue I ran into was a &lt;code&gt;InvalidElementStateException&lt;/code&gt;:
&lt;/p&gt;
&lt;pre&gt;
| Running 11 spock tests... 7 of 11
| Failure:  add new route to region(happytrails.AuthenticatedUserSpec)
|  org.openqa.selenium.InvalidElementStateException: Element must be user-editable in order to clear it. (WARNING: The server did not provide any stacktrace information)
&lt;/pre&gt;
&lt;p&gt;I was able to fix this by changing &lt;em&gt;AddRoutePage.groovy&lt;/em&gt; from:&lt;/p&gt;
&lt;pre class=&quot;brush: groovy&quot;&gt;
static content = {
    createButton(to: ShowRoutePage) { create() }
    name { value(&quot;Name&quot;) }
    distance { value(&quot;Distance&quot;) }
    location { value(&quot;Location&quot;) }
}
&lt;/pre&gt;
&lt;p&gt;To:&lt;/p&gt;
&lt;pre class=&quot;brush: groovy&quot;&gt;
static content = {
    createButton(to: ShowRoutePage) { create() }
    form { $(&quot;form&quot;) }
}
&lt;/pre&gt;
&lt;p&gt;And then referencing name, distance and location accordingly (form.name, etc.) in &lt;em&gt;AuthenticatedUserSpec.groovy&lt;/em&gt;.&lt;/p&gt;
&lt;p id=&quot;cloudbees&quot;&gt;&lt;strong&gt;CloudBees&lt;/strong&gt;&lt;br/&gt;
After I had everything working locally, I logged into Jenkins on &lt;a href=&quot;http://www.cloudbees.com/&quot;&gt;CloudBees&lt;/a&gt;. Since I hadn&apos;t used it in a while, I had to wait a bit while my Jenkins server was re-commissioned. Once it was up, I tried to select Grails 2.2.1 to build with, but found it wasn&apos;t available. After a &lt;a href=&quot;https://twitter.com/mraible/status/312636120112431104&quot;&gt;tweeting this&lt;/em&gt;, I learned about &lt;a href=&quot;http://grails.org/doc/2.1.0/ref/Command%20Line/wrapper.html&quot;&gt;Grails Wrapper&lt;/a&gt;, found that the latest Grails Jenkins plugin supported it and got everything working. I later discovered that CloudBees does support Grails 2.2.1, I just needed to setup another Grails installation to automatically download and install 2.2.1.&lt;/p&gt;
&lt;p id=&quot;heroku&quot;&gt;&lt;strong&gt;Heroku&lt;/strong&gt;&lt;br/&gt;
The last two issues I ran into were with Heroku. Since I was upgrading everything, I wanted Grails to build/run under Java 7 and use Servlet 3. I changed the appropriate properties in &lt;em&gt;BuildConfig.groovy&lt;/em&gt;, &lt;a href=&quot;https://devcenter.heroku.com/articles/add-java-version-to-an-existing-maven-app&quot;&gt;configured Heroku&lt;/a&gt; and deployed. No dice.&lt;/p&gt;
&lt;pre&gt;
Error Compilation error: startup failed:
Invalid commandline usage for javac.
javac: invalid source release: 1.7
Usage: javac &lt;options&gt; &lt;source files&gt;
use -help for a list of possible options
&lt;/pre&gt;
&lt;p&gt;Sidenote: I tried building with Java 8 on CloudBees, but discovered the searchable plugin doesn&apos;t support it.&lt;/p&gt;
&lt;pre&gt;
Compile error during compilation with javac.
/scratch/jenkins/workspace/Happy Trails - Grails 2/work/plugins/searchable-0.6.4/src/java/grails/plugin/searchable/internal/compass/index/DefaultUnindexMethod.java:94: error: reference to delete is ambiguous
                    session.delete(query);
                           ^
  both method delete(CompassQuery) in CompassOperations and method delete(CompassQuery) in CompassIndexSession match
&lt;/pre&gt;
&lt;p&gt;As far as Servlet 3, it was pretty obvious that the Jetty version Heroku uses for Grails doesn&apos;t support it. Therefore, I reverted back to Servlet 2.5.&lt;/p&gt;
&lt;pre&gt;
java.lang.NoClassDefFoundError: javax/servlet/AsyncContext
	at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
&lt;/pre&gt;
&lt;p&gt;I sent the Java 7 issue to Heroku Support a few days ago but haven&apos;t heard back yet.&lt;/p&gt;
&lt;p id=&quot;summary&quot;&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br/&gt;
While upgrading Grails from 2.0 to 2.2 wasn&apos;t as easy as expected, it is understandable. After all, Grails 2.2 ships with Groovy 2.0, which has a &lt;a href=&quot;http://www.infoq.com/articles/new-groovy-20&quot;&gt;bunch of new features&lt;/a&gt; itself. All the issues I ran into were fairly easy to solve, except for Java 7 on Heroku. But hey, what do you expect from a free hosting service?&lt;/p&gt;
&lt;p&gt;If you&apos;re at Devoxx France next week, I look forward to &lt;a href=&quot;http://www.devoxx.com/display/FR13/Play+Framework+vs.+Grails+Smackdown&quot;&gt;sharing our research&lt;/a&gt; on Grails 2.2.1 vs. Play 2.1.0. </content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/integration_testing_with_http_https</id>
        <title type="html">Integration Testing with HTTP, HTTPS and Maven</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/integration_testing_with_http_https"/>
        <published>2011-02-11T15:54:16-07:00</published>
        <updated>2012-11-11T02:00:40-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="cargo" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jetty" scheme="http://roller.apache.org/ns/tags/" />
        <category term="overstock.com" scheme="http://roller.apache.org/ns/tags/" />
        <category term="ssl" scheme="http://roller.apache.org/ns/tags/" />
        <category term="http" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tomcat" scheme="http://roller.apache.org/ns/tags/" />
        <category term="maven" scheme="http://roller.apache.org/ns/tags/" />
        <category term="https" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Earlier this week, I was tasked with getting automated integration tests working in my project at &lt;a href=&quot;http://overstock.com&quot;&gt;Overstock.com&lt;/a&gt;. By &lt;em&gt;automated&lt;/em&gt;, I mean that ability to run &quot;mvn install&quot; and have the following process cycled through: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start a container&lt;/li&gt;
&lt;li&gt;Deploy the application&lt;/li&gt;
&lt;li&gt;Run all integration tests&lt;/li&gt;
&lt;li&gt;Stop the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since it makes sense for integration tests to run in Maven&apos;s &lt;em&gt;integration-test&lt;/em&gt; phase, I first configured the maven-surefire-plugin to skip tests in the &lt;em&gt;test&lt;/em&gt; phase and execute them in the &lt;em&gt;integration-test&lt;/em&gt; phase. I used the &amp;lt;id&gt;&lt;strong&gt;default-&lt;/strong&gt;&lt;em&gt;phase&lt;/em&gt;&amp;lt;/id&gt; syntax to override the plugins&apos; usual behavior.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
  &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;default-test&amp;lt;/id&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;excludes&amp;gt;
          &amp;lt;exclude&amp;gt;**/*Test*.java&amp;lt;/exclude&amp;gt;
        &amp;lt;/excludes&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;default-integration-test&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;integration-test&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;test&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;includes&amp;gt;
          &amp;lt;include&amp;gt;**/*Test.java&amp;lt;/include&amp;gt;
        &amp;lt;/includes&amp;gt;
        &amp;lt;excludes&amp;gt;
          &amp;lt;exclude&amp;gt;none&amp;lt;/exclude&amp;gt;
          &amp;lt;exclude&amp;gt;**/TestCase.java&amp;lt;/exclude&amp;gt;
        &amp;lt;/excludes&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;After I had this working, I moved onto getting the container started and stopped properly. In the past, I&apos;ve &lt;a href=&quot;http://raibledesigns.com/rd/entry/integrating_selenium_with_maven_2&quot;&gt;done this&lt;/a&gt; using &lt;a href=&quot;http://cargo.codehaus.org&quot;&gt;Cargo&lt;/a&gt; and it&apos;s always worked well for me. Apart from the usual setup I use in AppFuse archetypes (&lt;a href=&quot;http://source.appfuse.org/browse/appfuse/trunk/archetypes/appfuse-basic-struts/src/pom.xml?r=HEAD#l496&quot;&gt;example pom.xml&lt;/a&gt;), I added a couple additional items:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added &amp;lt;timeout&gt;180000&amp;lt;/timeout&gt; so the container would wait up to 3 minutes for the WAR to deploy.&lt;/li&gt;
&lt;li&gt;In configuration/properties, specified &amp;lt;context.path&gt;ROOT&amp;lt;/context.path&gt; so the app would deploy at the / context path.&lt;/li&gt;
&lt;li&gt;In configuration/properties, specified &amp;lt;cargo.protocol&gt;https&amp;lt;/cargo.protocol&gt; since many existing unit tests made requests to secure resources.
&lt;/ul&gt;
&lt;p&gt;I started by using Cargo with Tomcat and had to &lt;a href=&quot;http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html&quot;&gt;create certificate keystore&lt;/a&gt; in order to get Tomcat to start with SSL enabled. After getting it to start, I found the tests failed with the following errors in the logs:
&lt;/p&gt;
&lt;pre&gt;
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: 
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1649)
&lt;/pre&gt;
&lt;p&gt;Co-workers told me this was easily solved by &lt;a href=&quot;http://blogs.sun.com/gc/entry/unable_to_find_valid_certification&quot;&gt;adding my &apos;untrusted&apos; cert to my JVM keystore&lt;/a&gt;. Once all this was working, I thought I was good to go, but found that some tests were still failing. The failures turned out to be because they were talking to http and https was the only protocol enabled. After doing some research, I discovered that Cargo &lt;a href=&quot;http://jira.codehaus.org/browse/CARGO-574&quot;&gt;doesn&apos;t support starting on both http and https ports&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So back to the drawing board I went. I ended up turning to the &lt;a href=&quot;http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin&quot;&gt;maven-jetty-plugin&lt;/a&gt; and the &lt;a href=&quot;http://mojo.codehaus.org/tomcat-maven-plugin/&quot;&gt;tomcat-maven-plugin&lt;/a&gt; to get the functionality I was looking for. I also automated the certificate keystore generation using the &lt;a href=&quot;http://mrhaki.blogspot.com/2009/05/configure-maven-jetty-plugin-for-ssl.html&quot;&gt;keytool-maven-plugin&lt;/a&gt;. Below is the extremely-verbose 95-line profiles section of my pom.xml that allows either container to be used.
&lt;/p&gt;
&lt;p style=&quot;margin-left: 20px&quot;&gt;&lt;em&gt;Sidenote: I wonder how this same setup would look using &lt;a href=&quot;http://www.gradle.org&quot;&gt;Gradle&lt;/a&gt;?&lt;/em&gt;
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;profiles&amp;gt;
  &amp;lt;profile&amp;gt;
    &amp;lt;id&amp;gt;jetty&amp;lt;/id&amp;gt;
    &amp;lt;activation&amp;gt;
      &amp;lt;activeByDefault&amp;gt;true&amp;lt;/activeByDefault&amp;gt;
    &amp;lt;/activation&amp;gt;
    &amp;lt;build&amp;gt;
      &amp;lt;plugins&amp;gt;
        &amp;lt;plugin&amp;gt;
          &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;
          &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;
          &amp;lt;version&amp;gt;6.1.26&amp;lt;/version&amp;gt;
          &amp;lt;configuration&amp;gt;
            &amp;lt;contextPath&amp;gt;/&amp;lt;/contextPath&amp;gt;
            &amp;lt;connectors&amp;gt;
              &amp;lt;connector implementation=&quot;org.mortbay.jetty.nio.SelectChannelConnector&quot;&amp;gt;
                &amp;lt;!-- forwarded == true interprets x-forwarded-* headers --&amp;gt;
                &amp;lt;!-- http://docs.codehaus.org/display/JETTY/Configuring+mod_proxy --&amp;gt;
                &amp;lt;forwarded&amp;gt;true&amp;lt;/forwarded&amp;gt;
                &amp;lt;port&amp;gt;8080&amp;lt;/port&amp;gt;
                &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;
              &amp;lt;/connector&amp;gt;
              &amp;lt;connector implementation=&quot;org.mortbay.jetty.security.SslSocketConnector&quot;&amp;gt;
                &amp;lt;forwarded&amp;gt;true&amp;lt;/forwarded&amp;gt;
                &amp;lt;port&amp;gt;8443&amp;lt;/port&amp;gt;
                &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;
                &amp;lt;keystore&amp;gt;${project.build.directory}/ssl.keystore&amp;lt;/keystore&amp;gt;
                &amp;lt;password&amp;gt;overstock&amp;lt;/password&amp;gt;
                &amp;lt;keyPassword&amp;gt;overstock&amp;lt;/keyPassword&amp;gt;
              &amp;lt;/connector&amp;gt;
            &amp;lt;/connectors&amp;gt;
            &amp;lt;stopKey&amp;gt;overstock&amp;lt;/stopKey&amp;gt;
            &amp;lt;stopPort&amp;gt;9999&amp;lt;/stopPort&amp;gt;
          &amp;lt;/configuration&amp;gt;
          &amp;lt;executions&amp;gt;
            &amp;lt;execution&amp;gt;
              &amp;lt;id&amp;gt;start-jetty&amp;lt;/id&amp;gt;
              &amp;lt;phase&amp;gt;pre-integration-test&amp;lt;/phase&amp;gt;
              &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;run-war&amp;lt;/goal&amp;gt;
              &amp;lt;/goals&amp;gt;
              &amp;lt;configuration&amp;gt;
                &amp;lt;daemon&amp;gt;true&amp;lt;/daemon&amp;gt;
              &amp;lt;/configuration&amp;gt;
            &amp;lt;/execution&amp;gt;
            &amp;lt;execution&amp;gt;
              &amp;lt;id&amp;gt;stop-jetty&amp;lt;/id&amp;gt;
              &amp;lt;phase&amp;gt;post-integration-test&amp;lt;/phase&amp;gt;
              &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;stop&amp;lt;/goal&amp;gt;
              &amp;lt;/goals&amp;gt;
            &amp;lt;/execution&amp;gt;
          &amp;lt;/executions&amp;gt;
        &amp;lt;/plugin&amp;gt;
      &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;
  &amp;lt;/profile&amp;gt;
  &amp;lt;profile&amp;gt;
    &amp;lt;id&amp;gt;tomcat&amp;lt;/id&amp;gt;
    &amp;lt;build&amp;gt;
      &amp;lt;plugins&amp;gt;
        &amp;lt;plugin&amp;gt;
          &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;
          &amp;lt;artifactId&amp;gt;tomcat-maven-plugin&amp;lt;/artifactId&amp;gt;
          &amp;lt;version&amp;gt;1.1&amp;lt;/version&amp;gt;
          &amp;lt;configuration&amp;gt;
            &amp;lt;addContextWarDependencies&amp;gt;true&amp;lt;/addContextWarDependencies&amp;gt;
            &amp;lt;fork&amp;gt;true&amp;lt;/fork&amp;gt;
            &amp;lt;path&amp;gt;/&amp;lt;/path&amp;gt;
            &amp;lt;port&amp;gt;8080&amp;lt;/port&amp;gt;
            &amp;lt;httpsPort&amp;gt;8443&amp;lt;/httpsPort&amp;gt;
            &amp;lt;keystoreFile&amp;gt;${project.build.directory}/ssl.keystore&amp;lt;/keystoreFile&amp;gt;
            &amp;lt;keystorePass&amp;gt;overstock&amp;lt;/keystorePass&amp;gt;
          &amp;lt;/configuration&amp;gt;
          &amp;lt;executions&amp;gt;
            &amp;lt;execution&amp;gt;
              &amp;lt;id&amp;gt;start-tomcat&amp;lt;/id&amp;gt;
              &amp;lt;phase&amp;gt;pre-integration-test&amp;lt;/phase&amp;gt;
              &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;run-war&amp;lt;/goal&amp;gt;
              &amp;lt;/goals&amp;gt;
            &amp;lt;/execution&amp;gt;
            &amp;lt;execution&amp;gt;
              &amp;lt;id&amp;gt;stop-tomcat&amp;lt;/id&amp;gt;
              &amp;lt;phase&amp;gt;post-integration-test&amp;lt;/phase&amp;gt;
              &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;shutdown&amp;lt;/goal&amp;gt;
              &amp;lt;/goals&amp;gt;
            &amp;lt;/execution&amp;gt;
          &amp;lt;/executions&amp;gt;
        &amp;lt;/plugin&amp;gt;
      &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;
  &amp;lt;/profile&amp;gt;
&amp;lt;/profiles&amp;gt;
&lt;/pre&gt;
&lt;p&gt;With this setup in place, I was able to automate running our integration tests by simply typing &quot;mvn install&quot; (for Jetty) or &quot;mvn install -Ptomcat&quot; (for Tomcat). For running in Hudson, it&apos;s possible I&apos;ll have to further enhance things to randomize the port and pass that into tests as a system property. The &lt;a href=&quot;http://mojo.codehaus.org/build-helper-maven-plugin/&quot;&gt;build-helper-maven-plugin&lt;/a&gt; and its &lt;em&gt;reserve-network-port&lt;/em&gt; goal is a nice way to do this. Note: if you want to run more than one instance of Tomcat at a time, you might have to randomize the ajp and rmi ports to avoid collisions.
&lt;/p&gt;
&lt;p&gt;The final thing I encountered was our app didn&apos;t shutdown gracefully. Luckily, this was fixed in a newer version of our core framework and upgrading fixed the problem. Here&apos;s the explanation from an architect on the core framework team.&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
The hanging problem was caused by the way the framework internally
aggregated statistics related to database connection usage and page
response times.  The aggregation runs on a separate thread but not as a
daemon thread.  Previously, the aggregation threads weren&apos;t being
terminated on shutdown so the JVM would hang waiting for them to finish.
In the new frameworks, the aggregation threads are terminated on shutdown.
&lt;/p&gt;
&lt;p&gt;Hopefully this post helps you test your secure and unsecure applications at the same time. At the same time, I&apos;m hoping it motivates the Cargo developers to add simultaneous http and https support. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;)&quot; title=&quot;;)&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; In the comments, Ron Piterman recommended I use the &lt;a href=&quot;http://maven.apache.org/plugins/maven-failsafe-plugin/&quot;&gt;Maven Failsafe Plugin&lt;/a&gt; because its designed to run integration tests while Surefire Plugin is for unit tests. I changed my configuration to the following and everything still passes. Thanks Ron!
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
  &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;2.7.2&amp;lt;/version&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;skipTests&amp;gt;true&amp;lt;/skipTests&amp;gt;
  &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;plugin&amp;gt;
  &amp;lt;artifactId&amp;gt;maven-failsafe-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;2.7.2&amp;lt;/version&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;includes&amp;gt;
      &amp;lt;include&amp;gt;**/*Test.java&amp;lt;/include&amp;gt;
    &amp;lt;/includes&amp;gt;
    &amp;lt;excludes&amp;gt;
      &amp;lt;exclude&amp;gt;**/TestCase.java&amp;lt;/exclude&amp;gt;
    &amp;lt;/excludes&amp;gt;
  &amp;lt;/configuration&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;integration-test&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;integration-test&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;integration-test&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;verify&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;verify&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;verify&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; In addition to application changes to solve hanging issues, I also had to change my Jetty Plugin configuration to use a different SSL connector implementation. This also required adding the jetty-sslengine dependency, which has been &lt;a href=&quot;http://stackoverflow.com/questions/2215550/mavens-jetty-plugin-ssl-configuration-issue&quot;&gt;renamed to jetty-ssl for Jetty 7&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;connector implementation=&quot;org.mortbay.jetty.security.SslSelectChannelConnector&quot;&amp;gt;
...
&amp;lt;dependencies&amp;gt;
  &amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jetty-sslengine&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;6.1.26&amp;lt;/version&amp;gt;
  &amp;lt;/dependency&amp;gt;
&amp;lt;/dependencies&amp;gt;
&lt;/pre&gt;&lt;p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/choosing_an_ajax_framework</id>
        <title type="html">Choosing an Ajax Framework</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/choosing_an_ajax_framework"/>
        <published>2009-01-08T21:36:22-07:00</published>
        <updated>2009-01-09T04:42:59-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="comparison" scheme="http://roller.apache.org/ns/tags/" />
        <category term="extjs" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gwt" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="dojo" scheme="http://roller.apache.org/ns/tags/" />
        <category term="ajax" scheme="http://roller.apache.org/ns/tags/" />
        <category term="yui" scheme="http://roller.apache.org/ns/tags/" />
        <category term="frameworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This past week, my colleagues and I have been researching Ajax Frameworks. We&apos;re working on a project that&apos;s following SOFEA-style architecture principles and we want the best framework for our needs. I&apos;m writing this post to see 1) if you, the community, agree with our selection process and 2) to learn about your experiences with the frameworks we&apos;re evaluating. Below is the process we&apos;re following to make our choice.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Choose a short list of frameworks to prototype with.&lt;/li&gt;
&lt;li&gt;Create an application prototype with each framework.&lt;/li&gt;
&lt;li&gt;Document findings and create a matrix with important criteria.&lt;/li&gt;
&lt;li&gt;Create presentation to summarize document.&lt;/li&gt;
&lt;li&gt;Deliver document, presentation (with demos) and recommendation.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For #1, we chose  &lt;a href=&quot;http://extjs.com/products/extjs/&quot;&gt;Ext JS&lt;/a&gt;, &lt;a href=&quot;http://dojotoolkit.org/&quot;&gt;Dojo&lt;/a&gt;, &lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;YUI&lt;/a&gt; and &lt;a href=&quot;http://code.google.com/intl/nl/webtoolkit/&quot;&gt;GWT&lt;/a&gt; because we feel these Ajax libraries offer the most UI widgets. We also considered Prototype/Scriptaculous, jQuery and MooTools, but decided against them because of their lack of UI widgets.&lt;/p&gt;
&lt;p&gt;For #2, we time-boxed ourselves to 3 days of development. In addition to basic functionality, we added several features (i.e. edit in place, drag and drop, calendar widgets, transitions, charts, grid) that might be used in the production application. We all were able to complete most of the functionality of the application. Of course, there&apos;s still some code cleanup as well as styling to make each app look good for the demo. The nice thing about doing this is we&apos;re able to look at each others code and see how the same thing is done in each framework. None of us are experts in any of the frameworks, so it&apos;s possible we could do things better. However, I think it&apos;s good we all started somewhat green because it shows what&apos;s possible for someone relatively new to the frameworks.&lt;/p&gt;
&lt;p&gt;For #3, we&apos;re creating a document with the following outline:&lt;/p&gt;
&lt;pre style=&quot;font-family: inherit; background: #CDFFCC; border: 1px solid #54FF52; width: 250px; padding-left: 20px&quot;&gt;
Introduction

Ajax Framework Candidates
(intro and explanation)

  Project Information
  (history)
  (license / cost)
  (number of committers)
  (support options)
  (mailing list traffic (nov/dec 2008))

Matrix and Notes

Conclusion
&lt;/pre&gt;
&lt;p&gt;For the Matrix referenced in the outline above, we&apos;re using a table with weights and ranks:&lt;/p&gt;

&lt;table class=&quot;comparison&quot; style=&quot;width: 500px&quot;&gt;
    &lt;thead&gt;
    &lt;tr&gt;
        &lt;th&gt;Weight&lt;/th&gt;
        &lt;th&gt;Criteria&lt;/th&gt;
        &lt;th&gt;Dojo&lt;/th&gt;
        &lt;th&gt;YUI&lt;/th&gt;
        &lt;th&gt;GWT&lt;/th&gt;
        &lt;th style=&quot;white-space: nowrap&quot;&gt;Ext JS&lt;/th&gt;
        &lt;th&gt;Notes&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
        &lt;td&gt;#&lt;/td&gt;
        &lt;td&gt;Important Criteria for Customer&lt;/td&gt;
        &lt;td&gt;0..1&lt;/td&gt;
        &lt;td&gt;0..1&lt;/td&gt;
        &lt;td&gt;0..1&lt;/td&gt;
        &lt;td&gt;0..1&lt;/td&gt;
        &lt;td&gt;Notes about rankings&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Our strategy for filling in this matrix:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customer adjusts the weight for each criteria (removing/adding as needed) so all weights add up to 1.&lt;/li&gt;
&lt;li&gt;We rank each framework with 0, .5 or 1 where 0 = doesn&apos;t satisfy criteria, .5 = partially satisfies, 1 = satisfies.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The list of criteria provided to us by our client is as follows (in no particular order).&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Quality of Documentation/Tutorials/Self Help&lt;/li&gt;
&lt;li&gt;Browser support (most important browsers/versions based on web stats)&lt;/li&gt;
&lt;li&gt;Testability (esp. Selenium compatibility)&lt;/li&gt;
&lt;li&gt;Licensing&lt;/li&gt;
&lt;li&gt;Project health/adoption&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;li&gt;Scalability&lt;/li&gt;
&lt;li&gt;Flexibility/extensibility&lt;/li&gt;
&lt;li&gt;Productivity (app dev, web dev)&lt;/li&gt;
&lt;li&gt;Richness of widget/component library&lt;/li&gt;
&lt;li&gt;Charting capability&lt;/li&gt;
&lt;li&gt;Ability to create new widgets&lt;/li&gt;
&lt;li&gt;Match to existing Java team skill-set&lt;/li&gt;
&lt;li&gt;Ease of deployment (on Ops, QA, Users)&lt;/li&gt;
&lt;li&gt;Degree of risk generally&lt;/li&gt;
&lt;li&gt;Ability to integrate with existing site (which includes Prototype)&lt;/li&gt;
&lt;li&gt;Easy to style with CSS&lt;/li&gt;
&lt;li&gt;Validation (esp. marking form elements invalid)&lt;/li&gt;
&lt;li&gt;Component Theme-ing/Decoration&lt;/li&gt;
&lt;li&gt;CDN Availability (i.e. Google&apos;s Ajax Libraries API or Ext CDN)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What do you think? How could this process be improved? Of course, if you have framework answers (0, .5 or 1) for our matrix, we&apos;d love to hear your opinions.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework</id>
        <title type="html">Choosing a JVM Web Framework</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework"/>
        <published>2007-08-07T10:10:05-06:00</published>
        <updated>2007-08-14T12:53:11-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">I plan on rewriting my &quot;Comparing Java Web Frameworks&quot; presentation for this year&apos;s &lt;a href=&quot;http://softwaresummit.com&quot;&gt;Colorado Software Summit&lt;/a&gt;. Rather than &quot;Comparing Java Web Frameworks&quot;, I&apos;m going to make it into more of a &quot;Choosing a JVM Web Framework&quot; presentation. I think this opens it up to more possibilities such as Grails, JRuby on Rails, Flex and GWT. 
&lt;/p&gt;
&lt;p&gt;
One of the things I hope to talk about is choosing the right tool for the job. I think there&apos;s 3 types of web applications you can develop:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Consumer-facing, high-traffic, stateless applications&lt;/li&gt;
&lt;li&gt;Internal, more desktop-like applications that are stateful&lt;/li&gt;
&lt;li&gt;Media-rich applications that require a RIA framework like Flex&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Once you&apos;ve decided on which of these you&apos;re developing, it&apos;s much easier to narrow down the choices:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Struts 2, Spring MVC, Stripes&lt;/li&gt;
&lt;li&gt;JSF, Tapestry, Wicket&lt;/li&gt;
&lt;li&gt;GWT, Flex, OpenLaszlo&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;
I&apos;m not sure if GWT fits in the RIA category. I&apos;m not sure where Rails or Grails fit either. They more closely resemble category #1 than any other, yet there&apos;s a lot of speculation about their scalability. I think if that perception can be changed, they&apos;ll fit into the first category quite well. However, I don&apos;t think they compete with component-based or RIA because they don&apos;t hold state or offer rich-media capabilities. 
&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; I find the scalability debate quite interesting. There&apos;s a fair amount of propaganda in Javaland that scalability can be achieved with appservers and clustering tools like Terracotta. If this is true, I&apos;ve yet to read good solid proof of it. Most of the &quot;how to scale&quot; information out there suggests &quot;share nothing&quot; architectures that shard data and applications across several servers. Of course, there&apos;s scalability and then there&apos;s massive scalability. Can appservers and clustering solve massive scalability like Google and Amazon require?&lt;/p&gt;
&lt;p&gt;
The 2nd and 3rd categories have someone of a blurry line, so I&apos;m hoping to figure out how to clarify that. There&apos;s also a lot of other factors that will go into choosing a web framework. What if you&apos;re simply trying to replace a home-grown framework with an open-source one? If you want to keep your backend and all its logic, does it make sense to use something like Seam, Grails, JRuby on Rails or even AppFuse? Probably not - all their wizbang features and CRUD generation doesn&apos;t mean much if all you&apos;re using is the web framework. Also, if your application requires support for non-JavaScript browsers (for 508 compliance), then GWT and JSF can be easily eliminated. I know that there are many claims that JSF doesn&apos;t require JavaScript, but I&apos;ve yet to see a real-world application developed with JSF that &lt;em&gt;expects&lt;/em&gt; JavaScript to be turned off. Progressive enhancement is a requirement by many of my clients these days. 
&lt;/p&gt;
&lt;p&gt;What&apos;s your opinion? How can we make it easier for developers and companies to choose a web framework? Is categorizing application types a good technique?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_spring_osgi_with_adrian</id>
        <title type="html">[TSE] Spring-OSGI with Adrian Colyer</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_spring_osgi_with_adrian"/>
        <published>2006-12-09T14:29:58-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">One of the first questions people ask about OSGi is &quot;what the heck is it?&quot;&lt;br/&gt;&lt;br/&gt;
Most people don&apos;t even know what it is. OSGi stands for &lt;b&gt;O&lt;/b&gt;pen &lt;b&gt;S&lt;/b&gt;ervices &lt;b&gt;G&lt;/b&gt;ateway &lt;b&gt;i&lt;/b&gt;nitiative. From the very beginning, it was designed to be lightweight and dynamic. This is the major difference between it and other containers.  It&apos;s always been designed to have things added and removed.  Now it&apos;s tagline is: &quot;The Dynamic Module System for Java&quot;.
&lt;br/&gt;&lt;br/&gt;
It&apos;s designed to allow you to partition a system into a number of modules (a.k.a. bundles).  There&apos;s strict visibility rules (similar to protected and private).  There&apos;s a resolution process (dependencies are satisfied) and it understands versioning.
&lt;br/&gt;&lt;br/&gt;
It&apos;s dynamic! Modules can be installed, started, stopped, uninstalled and updated - all at runtime.</summary>
        <content type="html">Adrian has &lt;i&gt;CTO&lt;/i&gt; as his title on his slides.  Wasn&apos;t he hired as &quot;Chief Scientist&quot; &lt;a href=&quot;http://www.aspectprogrammer.org/blogs/adrian/2005/09/joining_interfa.html&quot;&gt;originally&lt;/a&gt;? I wonder why his title changed?  Maybe having the CTO title is a better way of getting more cash when the buyout happens?  What buyout you ask?  I don&apos;t know, but I can&apos;t help but think that Interface21 is on the radar of major organizations like Oracle and BEA.  While it might suck for those guys to answer to a larger organization, it would be nice to see Rod, Juergen, et. al. benefit ($$) from all their hard work.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Agenda&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot; style=&quot;margin-top: 0&quot;&gt;
&lt;li&gt;What is OSGi?&lt;/li&gt;
&lt;li&gt;What problems does it help us to solve?&lt;/li&gt;
&lt;li&gt;How does it work?&lt;/li&gt;
&lt;li&gt;Where does Spring fit in?&lt;/li&gt;
&lt;li&gt;Spring-OSGi&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
One of the first questions people ask about OSGi is &quot;what the heck is it?&quot;
&lt;/p&gt;
&lt;blockquote&gt;&lt;em&gt;
 The 2nd question is &quot;what&apos;s with the lowercase i?&quot; Seriously - does anyone know?&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;
Most people don&apos;t even know what it is. OSGi stands for &lt;b&gt;O&lt;/b&gt;pen &lt;b&gt;S&lt;/b&gt;ervices &lt;b&gt;G&lt;/b&gt;ateway &lt;b&gt;i&lt;/b&gt;nitiative. From the very beginning, it was designed to be lightweight and dynamic. This is the major difference between it and other containers.  It&apos;s always been designed to have things added and removed.  Now it&apos;s tagline is: &quot;The Dynamic Module System for Java&quot;.
&lt;br/&gt;&lt;br/&gt;
It&apos;s designed to allow you to partition a system into a number of modules (a.k.a. bundles).  There&apos;s strict visibility rules (similar to protected and private).  There&apos;s a resolution process (dependencies are satisfied) and it understands versioning.
&lt;br/&gt;&lt;br/&gt;
It&apos;s dynamic! Modules can be installed, started, stopped, uninstalled and updated - all at runtime.
&lt;br/&gt;&lt;br/&gt;
It&apos;s even service oriented (no wonder IBM loves it). Bundles can &lt;i&gt;publish&lt;/i&gt; services (dynamically).  The Service Registry allows other bundles to &lt;i&gt;find&lt;/i&gt; services and &lt;i&gt;bind&lt;/i&gt; to them.  Services come and go at runtime, all taken care of for you.
&lt;br/&gt;&lt;br/&gt;
Where does OSGi come from?  It&apos;s backed by the &lt;a href=&quot;http://www.osgi.org&quot;&gt;OSGi Alliance&lt;/a&gt;. Unfortunately, this site makes it difficult to figure out exactly what OSGi is.  The founders of OSGi understood it needed to be lightweight and dynamic from day one.  It started in 1999, and was originally focues on embedded Java nd networked devices.  In 2003 it was exteneded to support to mobile devices.  In 2004, it had significant ope source community opttion with Eclipse.  In 2006 and 2007, it&apos;s moving into server-side Java.
&lt;br/&gt;&lt;br/&gt;
Who&apos;s doing OSGi containers?&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Open-source implementations: Equinox, Felix (Apache), Knopflerfish&lt;/li&gt;
&lt;li&gt;Significant Enterprise usage: Eclipse, IBM (WebSphere, Lotus), JOnAS, interest from BEA and Oracle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;So what?&lt;/strong&gt; What problems does OSGi solve?
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;Visibility&lt;/b&gt;
By default, a bundle is a black box.  It&apos;s completely protected and you can&apos;t see inside it, not even with reflection or any other classloading trickery. Only exported packages are visible outside of the exporting bundle. This stops unintended coupling between modules, enables independent development, faster development cycles and security.
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;Operational Control&lt;/b&gt;&lt;br/&gt;
An OSGi container allows you to see all modules and their status - using the OSGi console or JMX.  You can get information on wiring, install new bundles, activate bundles (and publish services), deactivate bundles (and unregister services), refresh bundles, stop bundles and uninstall bundles.  The beauty?  You can do all of this &lt;i&gt;without stopping or restarting the application!&lt;/i&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;What is an OSGi bundle?&lt;/b&gt;&lt;br/&gt;
It&apos;s just a jar file.  There&apos;s no complicated tools or sophisticated packaging required.  All you need is a symbolic name in your META-INF/MANIFEST.MF file.  For example:
&lt;/p&gt;
&lt;pre&gt;
Bundle-SymbolicName: org.swf.beans
&lt;/pre&gt;
&lt;p&gt;There are a number of other attributes you can specify, but the SymbolicName is the only &lt;i&gt;required&lt;/i&gt; one. 
&lt;br/&gt;&lt;br/&gt;
There&apos;s a Maven OSGi Plugin.  The major change from a regular JAR project is &amp;lt;packaging&amp;gt;jar&amp;lt;/packaging&gt; -&gt; &amp;lt;packaging&gt;&lt;b&gt;osgi-bundle&lt;/b&gt;&amp;lt;/packaging&gt;.
&lt;/p&gt;
&lt;blockquote&gt;
Sidenote: You have to love how Maven is so Google un-friendly.  &lt;a href=&quot;http://www.google.com/search?q=Maven+OSGi+Plugin&quot;&gt;Searching for Maven OSGi Plugin&lt;/a&gt; doesn&apos;t seem to provide a definitive answer to the Maven plugin that Adrian is talking about.  I&apos;m guessing Maven has OSGi support natively?
&lt;/blockquote&gt;
&lt;p&gt;
Eclipse has fantastic tooling support for OSGi via &quot;plug-ins&quot;.  You can create a new &quot;plug-in project&quot; and use Eclipse to create/edit your OSGi manifest.  Eclipse calls bundles &quot;plug-ins&quot; - so creating a plug-in project is the same thing as creating a new bundle.
&lt;br/&gt;&lt;br/&gt;
Export-Package is a header (a.k.a. manifest entry) used to export types for other bundles to use.  If it&apos;s not exported, it&apos;s not visible. For example:
&lt;/p&gt;
&lt;pre&gt;
Export-Package: org.xyz.m1.service, 
                org.xyz.m2.service, 
                org.xyz.m3.service
&lt;/pre&gt;
&lt;p&gt;
You can also specify a version by adding a semicolon after the package and specifying &quot;version=#&quot;.  For example:
&lt;/p&gt;
&lt;pre&gt;
Export-Package: org.xyz.m1.service; version=1.0, 
                org.xyz.m2.service; version=1.0, 
                org.xyz.m3.service; version=1.0
&lt;/pre&gt;
&lt;p&gt;
In addition to specifying specific versions, there&apos;s syntax to control a specific versions.  For the examples above, OSGi will actually get any version 1.0 and above.  
&lt;br/&gt;&lt;br/&gt;
For the next 10 minutes, Adrian talked about how class-loading and resolution works.  He also pointed out how to bootstrap a bundle (using the BundleActivator interface) and the basics of the Service Registry. The BundleContext allows you to get and remove services.
&lt;br/&gt;&lt;br/&gt;
What about JSR 277 (Java Module System)? It&apos;s a very crude version of OSGi with its &quot;RequireBundle&quot; mechanism.  The key problem is the lack of dynamics (loading/unloading of modules). Peter Kriens (of the OSGi Alliance) shares his thoughts on this in his &lt;a href=&quot;http://www.osgi.org/blog/2006/10/jsr-277-review.html&quot;&gt;JSR 277 Review&lt;/a&gt;. JSR 291 (Dynamic Component Support for Java SE) may kill 277 because it relies on OSGi. Its goal:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Establish a JCP specification for a dynamic component 
framework supporting existing Java SE environments based 
on the OSGi dynamic component model specifications. &quot; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #333&quot;&gt;What about Spring?&lt;/strong&gt;
&lt;br/&gt;
OSGi offers an excellent foundation for building enterprise applications.  How can you exploit the power and sophistication of OSGi w/o adding complexity?  How can you split your application into a number of OSGi bundles? Between bundles, you need an easy way to expose bundles as services and wire service references b/w them.  What about testing?  How can you test bundles w/o running them inside an OSGi container?
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.springframework.org/osgi&quot;&gt;Spring-OSGi&lt;/a&gt; hopes to allow you to build on OSGi, but deploy in Tomcat, WebSphere, WebLogic or any other application server.  Basically, it gives you an &quot;OSGi powered Web Application&quot;.
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color: #666&quot;&gt;Project Goals:&lt;/b&gt; Bring the benefits of OSGi to enterprise applications and use Spring to configure modules/bundles. In addition, make it easy to code your applications w/o depending on OSGi APIs and make it easy to unit and integration test.
&lt;br/&gt;&lt;br/&gt;

&lt;b style=&quot;color: #666&quot;&gt;Project Collaborators&lt;/b&gt;: Adrian is the lead, and there&apos;s active committers from BEA and Oracle. Input to the project&apos;s specification has been gathered from OSGi Alliance (technical director and CTO), BEA, Oracle, IBM, Eclipse Equinox, Felix and many individuals.
&lt;br/&gt;&lt;br/&gt;
Spring modules (spring-core, spring-beans, spring-aop) will be shipped as OSGi bundles in Spring 2.1.  All the necessary import and export package headers will be pre-defined.  This will enable an OSGi application to import and use Spring packages and services.
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://static.springframework.org/maven2/spring-osgi/apidocs/org/springframework/osgi/context/support/OsgiBundleXmlApplicationContext.html&quot;&gt;OsgiBundleXmlApplicationContext&lt;/a&gt; is a Spring application context based on an OSGi bundle.  It uses the bundle context and classloader to load resources and implements Spring&apos;s resource abstraction for OSGi. There is a &quot;bundle:&quot; prefix for specifying an explicit path.
&lt;br/&gt;&lt;br/&gt;
To do integration testing with Spring-OSGi, you can extend &lt;a href=&quot;http://static.springframework.org/maven2/spring-osgi/apidocs/org/springframework/osgi/test/ConfigurableBundleCreatorTests.html&quot;&gt;ConfigurableBundleCreatorTests&lt;/a&gt;.  This automatically creates an OSGi bundle containing the tests on the fly.  This class handles starting an OSGi container, installs all bundles and runs tests inside OSGi.  Currently, it supports Equinox, Felix and Knopflerfish.  If you&apos;re using Maven, it&apos;s simple to switch containers with profiles (i.e. -Pfelix).  Adrian did a demo in Eclipse.  I didn&apos;t seem the OSGi container starting (or him specify which one to use) but the test seemed to finish rather quickly.
&lt;br/&gt;&lt;br/&gt;
To interact with OSGi, there are a number of conveniences that Spring-OSGi provides: BundleContextAware, &amp;lt;osgi:property-placeholder&gt;, &amp;lt;osgi:bundle&amp;gt; (starts other bundles), &amp;lt;osgi:virtual-bundle&gt; (bundle created on the fly).
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color: #666&quot;&gt;OSGi-based web applications&lt;/b&gt;
&lt;br/&gt;
It&apos;s entirely possible to run an OSGi container embedded in another container. Remember it&apos;s lightweight enough to run in a phone! Even &lt;i&gt;OSGi in OSGi&lt;/i&gt; is supported.
&lt;br/&gt;&lt;br/&gt;
Equinox is the only OSGi container that currently supports web applications.  It uses a &quot;bridge servlet&quot; that acts as a front controller and dispatches servlet requests to bundles. To package your application as and deploy it to Equinox, you basically have to create a WAR with the bridge servlet as the only entry in web.xml and the only JAR in WEB-INF/lib is servletbridge.jar.  Everything else is packaged under /WEB-INF/eclipse.  Here&apos;s what that looks like:
&lt;/p&gt;
&lt;pre&gt;
WEB-INF 
    web.xml  
    lib/servletbridge.jar 
    eclipse 
        launch.ini 
        configuration/config.ini 
        features 
        plugins 
            &amp;lt;your-bundles&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
Adrian did a demo showing a simple &quot;Hello World&quot; example deployed into an OSGi container.  The output from the demo in the browser wasn&apos;t much.  However, he showed how you could use an OSGi Console to interact (start/stop/refresh) all the different bundles.  The fact that you can do this all at runtime has some pretty interesting implications. 
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color:#333&quot;&gt;My Thoughts&lt;/strong&gt;&lt;br/&gt;
The demo makes Servlet/EJB containers look somewhat primitive. Will OSGi containers be the next generation of application servers? It seems somewhat likely, but as Adrian said, most of this stuff is on the bleeding edge (or even &quot;razors edge&quot; to quote Adrian). My guess is OSGi will be a very interesting space in 2007.  However, I don&apos;t see myself deploying WARs to OSGi containers anytime soon. Maybe in 2008.
&lt;br/&gt;&lt;br/&gt;
Can OSGi power a web application&apos;s plugin architecture?  It doesn&apos;t seem like it. The web application would have to be deployed in an OSGi container to make this possible.  Either that, or the web application would have to be an OSGi container itself.

</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/rails_is_8_times_slower</id>
        <title type="html">Rails is 8 times slower than Spring+Hibernate</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/rails_is_8_times_slower"/>
        <published>2005-02-28T06:25:27-07:00</published>
        <updated>2012-11-11T01:44:05-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">Might as well start off this week by getting people&apos;s blood boiling. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt; According to a comment on &lt;a href=&quot;http://www.almaer.com/blog/archives/000735.html&quot;&gt;Dion&apos;s blog&lt;/a&gt;:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Having done extensive performance (scalability means different things to different people) testing on both Rails and a comparable Spring/Hibernate/JSP2 webapp (no one seems have have done any sort of benchmarking on Rails, or they simply don&apos;t care, I don&apos;t really know, but since benchmarking is what I do... &lt;img src=&quot;https://raibledesigns.com/images/smileys/smile.gif&quot; class=&quot;smiley&quot; alt=&quot;:-)&quot; title=&quot;:-)&quot; /&gt;) I can say that Apache2/FastCGI/Rails is about... 8x slower than the comparable Tomcat/Spring/Hibernate/JSP2 solution. And that is with caching turned on in Rails (using Rails 0.9.5...)
&lt;br /&gt;&lt;br /&gt;
Quite frankly, 62 req/s on a Dual Opteron with 4GB of RAM rendering a simple view with no DB access is too... damn slow.
&lt;/p&gt;
&lt;p&gt;Personally, I still think Rails looks like a great (and easy) way to develop webapps.  I just wonder if there&apos;s some truth to the &quot;can&apos;t scale&quot; argument.  I guess the best way to find out is for me to develop an application like &lt;a href=&quot;http://raibledesigns.com/appfuse&quot;&gt;AppFuse&lt;/a&gt; with Rails, and then hammer it (and AppFuse) with JMeter to see what kind of results I get.
&lt;br /&gt;&lt;br /&gt;
On a sidenote, I wonder when Rails will hit the illustrious version 1.0?  They &lt;a href=&quot;http://weblog.rubyonrails.com/archives/2005/02/24/rails-0100-routing-web-services-components-oracle/&quot;&gt;released 0.1&lt;/a&gt; last week - which is a bad version number for marketing.  If it&apos;s as mature as folks claim, why not make the next release 1.0?  That version number alone will likely allow developers to use it more in big companies.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/djug_the_google_guys</id>
        <title type="html">[DJUG] The Google Guys</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/djug_the_google_guys"/>
        <published>2004-08-12T01:01:48-06:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">I&apos;m sitting at the Denver JUG
meeting and &lt;a href=&quot;http://java.sun.com/features/2003/05/bloch_qa.html&quot;&gt;Joshua Bloch&lt;/a&gt;
and &lt;a href=&quot;http://www.gafter.com/~neal/&quot;&gt;Neal Gafter&lt;/a&gt; just finished a talk on &quot;Java
Puzzlers&quot;.  I didn&apos;t show up until halfway through - but it was still a
great half hour.  They had a bunch of slides with problems that had
seemingly easy answers.  They&apos;d both have a good dialog about their
proposed answers - and then asked the crowd what they thought.  The
problems were mostly due to dumb (but real world mistakes) - the kind of
thing you&apos;d slap your fellow programmer for writing.  These guys are
definitely fun to listen to - next up is Tiger and what&apos;s new in 1.5 (I
thought it was 5.0?). Boy, it&apos;s a full room tonight - I&apos;d bet there&apos;s 
around 120-150 people here.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Taming the Tiger&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
Major theme of &quot;JDK 5&quot; is ease of development with features like generics, for-each loop, 
autoboxing/unboxing, enums, varargs, static imports and annotations.
It&apos;s designed to make programs clearer, shorter and safer by providing linguistic support for commong idioms. Sidenote:
Joshua said that Neal wrote the compiler - and they&apos;ve basically made it more rigorous so it writes
the boilerplate code for you.  New features do no sacrifice compatibility or
compromise the spirit of the language.  Neal has been using these features for a couple of years now and
he says he&apos;s really enjoyed them.
&lt;br /&gt;&lt;br /&gt;
Goal of this talk is to make it easy for us to understand JDK 5 so we can start using it in our development.  Let&apos;s look at the different features of 5.0.&lt;br /&gt;&lt;br /&gt;
&lt;strong&gt;Generics, For-Each and Autoboxing/unboxing&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
Generics allow you to specify the element type of collection.  Rather than specifying a List - you specify 
it&apos;s contents - i.e. String. It&apos;s basically stronger typing with less typing which enforces the specification 
at compile time. For example, the following code using the new for-each syntax to iterate through a list of TimerTasks
in a collection.  Notice the lack of casting and easy-to-read loop syntax.&lt;/p&gt;&lt;pre&gt;
void cancellAll(Collection&amp;lt;TimerTask&amp;gt; c) {
    for (TimerTask task : c) {
        task.cancel();
    }
}
&lt;/pre&gt;&lt;p&gt;
Bytecode is the same as it is in 1.4 - 5.0 merely converts the code for you.  One question that these guys
have heard a lot is &lt;strong&gt;why &quot;:&quot; rather than &quot;in&quot;&lt;/strong&gt;.  &lt;span style=&quot;text-decoration: line-through&quot;&gt;The answer is twofold - because &quot;in&quot; is already
a keyword (for example, System.in) and they didn&apos;t want to introduce a new keyword.&lt;/span&gt; Because &apos;in&apos; is an identifier that is already in widespread use, and thus they could not make it a keyword without serious impact. Only new
keyword in JDK 5 is enum.
&lt;br /&gt;&lt;br /&gt;
The Collection Interface has been &lt;em&gt;Generified&lt;/em&gt;.  All existing code should still work, but you
can also use the new stuff if you like.  I haven&apos;t listened much to what&apos;s new in 5.0 - but this is
wicked cool.  You might say it sucks because now you end up with strongly typed stuff, but at least
you won&apos;t have any more ClassCastExceptions.
&lt;/p&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;autoboxing: automatic conversion from int to Integer (or from double to Double, etc.)&lt;/li&gt;&lt;li&gt;unboxing: automatic conversion from Integer to int&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
For example, you can now easily do the following:
&lt;/p&gt;&lt;pre&gt;
Integer i = new Integer(5);
Map map = new HashMap();
map.put(&quot;result&quot;, i+1);
&lt;/pre&gt;&lt;p&gt;
Notice that the Integer type is converted to an int for the addition, and then back to an Integer when it gets
put into the Map.  Cool, huh?
&lt;br /&gt;&lt;br /&gt;
JDK 5 also simplifies reflection. Class &lt;code&gt;Class&lt;/code&gt; has been generified - 
Class literal &lt;code&gt;Foo.class&lt;/code&gt; is of type Class&amp;lt;Foo&amp;gt;.  This enables compile-time 
type-safe reflection w/o casting.  The following used to return an Object and required casting.
&lt;/p&gt;&lt;pre&gt;
Foo foo = Foo.class.newInstance();
&lt;/pre&gt;&lt;p&gt;This enables strongly typed static factories.  &lt;em&gt;I wonder if this can be
used with Spring so you don&apos;t have to cast a bean when grabbing it from the ApplicationContext?&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When should you use Generics?&lt;/strong&gt;  Any time you can - unless you need to run on a pre-5.0 VM.  The extra
effor in generifying code is worth it - especially b/c of increased clarity and type safety.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When to use for-each loop?&lt;/strong&gt;  Any time you can b/c it really beautifies code and makes it much
easier to write.  It&apos;s probably the smallest new feature in 5.0, but likely to be a favorite. 
You can&apos;t use for-each for these cases:
&lt;/p&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;Removing elements as you traverse a collection (b/c there&apos;s no iterator)&lt;/li&gt;&lt;li&gt;Modifying the current slot in an array or list (b/c the index is hidden)&lt;/li&gt;&lt;li&gt;Iterating over multiple collections or arrays&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
The lack of an index seems to rub the crowd wrong.  Joshua and Neal&apos;s response is they tried to
design something &lt;em&gt;very&lt;/em&gt; simple that would capture 80% of usage.  If you need an index, just use
the old for loop - it ain&apos;t that hard; we&apos;ve been doing it for years!
&lt;br /&gt;&lt;br /&gt;
If you want to use for-each in your APIs - i.e. if you&apos;re writing a framework, a class should implement
the new Iterable class.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;When should you use autoboxing?&lt;/strong&gt;  When there is an impedance mismatch b/w reference types 
and primitives.  Not
appropriate for scientific computing.  An Integer is not a substitute for an int.  It simply hides
the distinction between wrappers and primitives.  A null unboxes by returning a NullPointerException.
They did consider setting it to the primitive&apos;s default, but the community voted 50-1 to for NPE.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Enums&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
JDK 5 includes linguistic support for enumerated types.  Advanced OO features include the ability to 
add methods and fields to enums.  Much clearer, safer, more powerful than existing alternatives (i.e. int enums).&lt;/p&gt;&lt;pre&gt;
enum Season { WINTER, SPRING, SUMMER, FALL }
&lt;/pre&gt;&lt;p class=&quot;quote&quot;&gt;
I just noticed that it&apos;s boiling in here - A/C must be out again in the auditorium.  It&apos;s 8:20 right
now, I hope this is over soon, I can feel sweat beading on my forehead.
&lt;/p&gt;&lt;p&gt;
Enums are Comparable and Serializable.  Enum constants should be named similar to constants.  Enums are basically
a new type of class.  As far as I can tell, I have no use for Enums in my code.  There&apos;s lots of gasps
from the crowd as Joshua is describing the features of Enums (i.e. constant-specific methods).  Sure
it looks cool, but I still don&apos;t think I have a use for it.  Maybe framework developers will find this
useful.  BTW, there&apos;s two high-performance collection classes: EnumSet (bit-vector) and EnumMap (array).
EnumSet replaces traditional bit-flags: i.e. EnumSet.of(Style.BOLD, Style.ITALIC).
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;
When should you use Enums?&lt;/strong&gt;&lt;/p&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;
Natural enumerated types: days of week, phases of moon, seasons&lt;/li&gt;&lt;li&gt;
Other sets where you knkow all possible values: choices on menus, rounding modes, command line flags&lt;/li&gt;&lt;li&gt;
As a replacement for flags (EnumSet)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Quote of the night:&lt;/strong&gt; &quot;It&apos;s extraordinarily rare that you&apos;ll need to cast when programming with JDK 5&quot;.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Varargs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
A method that takes an arbitrary number of values requires you to create an array.  Varargs automates
and hides the process.  James Gosling contributed the ... syntax.  Varargs always has to be the last
parameter. &lt;code&gt;MessageFormat.format&lt;/code&gt; has been retrofitted with varargs in JDK 5:
&lt;/p&gt;&lt;pre&gt;
public static String format(String pattern, Object... arguments);

String result = MessageFormat.format(&quot;At {1,time} on {1,date}, there was {2} on planet &quot;
                                     + &quot;{0,number,integer}.&quot;, 7, new Date(),
                                     &quot;a disturbance in the Force&quot;);

&lt;/pre&gt;&lt;p&gt;
Reflection is now much easier with Varargs - so you can call &lt;code&gt;c.getMethod(&quot;test&quot;).invoke(c.newInstance())&lt;/code&gt;
instead of &lt;code&gt;c.getMethod(&quot;test&quot;, new Object[0]).invoke(c.newInstance(), new Object[0]))&lt;/code&gt;.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;
When should you use Varargs?&lt;/strong&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;
If you&apos;re designing your own APIs - use it sparingly.  &lt;/li&gt;&lt;li&gt;
Only when the benefit is compelling.  Don&apos;t
overload a varargs method.&lt;/li&gt;&lt;li&gt;
In clients, when the API supports them: reflection, message formatting, printf&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Static Imports&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
Clients must qualify static members with class name (Math.PI).
To avoid this, some programmers put constants in an interface and implement it.  BAD - &quot;Constant Interface Antipattern&quot;.
They&apos;ve made this mistake in the JDK - java.util.jar has this pattern. Static import allows unqualified access to 
static member w/o extending a type.  All static fields, methods, etc. will be available for your
class using static imports. For example:
&lt;/p&gt;&lt;pre&gt;
import static java.lang.Math.*;
r = cos(PI * theta);&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;
When should you use Static Imports?&lt;/strong&gt;&lt;/p&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;Very sparingly - overuse makes programs unreadable.  &lt;/li&gt;&lt;li&gt;Only use it when tempted to abuse inheritence.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Metadata&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
Decorates programs with additional information.  Annotations don&apos;t directly affect program semantics.  They *can*
affect treatment by tools and libraries.  Can be read from: source, class files, or reflectively. Ad hoc examples: 
transient, @deprecated.  Tiger provides a general purpose metadata facility.
&lt;br /&gt;&lt;br /&gt;
Why Metadata?
&lt;/p&gt;&lt;ul class=&quot;glassList&quot;&gt;&lt;li&gt;Many APIs require a fair amount of boilerplate - i.e. JAX-RPC.&lt;/li&gt;&lt;li&gt;Many APIs require &quot;side files&quot; to be maintained. Examples: BeanInfo class, deployment descriptor.&lt;/li&gt;&lt;li&gt;Many APIs use naming patterns, i.e. JUnit.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
Metadata encourages a declarative programming style - tell a computer &lt;em&gt;what&lt;/em&gt; to do, now &lt;em&gt;how&lt;/em&gt; to do it.
Annotation Type Declarations are similar to interface declarations.
Special kinds of annotations include &lt;em&gt;Marker&lt;/em&gt; annotations and &lt;em&gt;Single-element&lt;/em&gt; annotations. 
The main reason for annotations is for tools providers.
&lt;br /&gt;&lt;br /&gt;
Neal thought that JDK 5 Beta 3 or Release Candidate was available at &lt;a href=&quot;http://java.sun.com/j2se/1.5.0&quot;&gt;
http://java.sun.com/j2se/1.5.0&lt;/a&gt;, but it looks like Beta 2 is the latest release.  The fact that he said that implies that a new release should be available shortly.  Neal
also mentioned that JDK 5 (final) would be shipping soon.
&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Random fact:&lt;/strong&gt;
Google uses a lot of Java - entire Ads front-end is done in Java.
&lt;br /&gt;&lt;br /&gt;
This was a great talk about all the new features of JDK 5 - I can&apos;t wait to start using them.  It might be awhile before
I can convert AppFuse to JSP 2.0 and JDK 5, but it&apos;ll be a good day when I can write my apps using these technologies.  Tonight was the best overview of JDK 5 that I&apos;ve seen so far - in print or person.
&lt;br /&gt;&lt;br /&gt;
&lt;strong&gt;Update:&lt;/strong&gt; Presentations PDFs have been published: &lt;a href=&quot;http://www.denverjug.org/meetings/files/200408_Puzzles.pdf&quot;&gt;Programming Puzzles&lt;/a&gt; and &lt;a href=&quot;http://www.denverjug.org/meetings/files/200408_Tiger.pdf&quot;&gt;Taming the Tiger&lt;/a&gt;.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/make_your_junit_tests_run</id>
        <title type="html">Make your JUnit Tests run faster when using Spring</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/make_your_junit_tests_run"/>
        <published>2004-04-08T01:22:14-06:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">&lt;em&gt;&lt;a href=&quot;http://jroller.com/page/raible&quot;&gt;JRoller&lt;/a&gt; is down, and has been down for an hour or so - so I&apos;ve decided to post this Spring Live entry here.&lt;/em&gt;
&lt;br /&gt;&lt;br /&gt;
I discovered an interesting thing today about Spring and my JUnit tests.  I noticed  that the VelocityEngine I was setting on my 
PositionManager was getting initialized once for each test* method in my Test.  This means that 
since my PositionManagerTest has 10 test methods - it would load the context 10 times.
&lt;br /&gt;&lt;br /&gt;
Loading the context so many times was because the following code was in my Test&apos;s parent&apos;s 
constructor:
&lt;/p&gt;
&lt;pre&gt;    ctx = new ClassPathXmlApplicationContext(&quot;/applicationContext.xml&quot;);&lt;/pre&gt;
&lt;p&gt;I suppose I expected any constructor-iniatialized variables to be initialized &lt;em&gt;once and only 
once&lt;/em&gt;.  So I figured out a solution to make my JUnit tests run faster.  By making the &lt;code&gt;ctx&lt;/code&gt; variable static, and loading the file in the member variables definition, I 
greatly reduced the amount of time needed to run tests.  Below is the new code I&apos;m using:&lt;/p&gt;
&lt;pre&gt;    protected static ApplicationContext ctx = 
    	new ClassPathXmlApplicationContext(&quot;/applicationContext.xml&quot;);&lt;/pre&gt;
&lt;p&gt;By doing this, the ApplicationContext is only set once, and my tests run much faster.  Here&apos;s 
some performance comparisons from &lt;a href=&quot;http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsResume&quot;&gt;Struts Resume&lt;/a&gt;:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;Average time to run &quot;ant test-dao&quot;: 36 seconds&lt;br /&gt;
Average time to run &quot;ant test-dao&quot; after this change: &lt;strong&gt;26 seconds&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A 10 second improvement - that&apos;s &lt;em&gt;crazy talk&lt;/em&gt; dontcha think?!  I&apos;ve tried it on single tests, as well as suites - and it seems to improve performance by approximately 30% across the board. 
&lt;br /&gt;&lt;br /&gt;
Because of this experience, I have to recommend that when you write JUnit tests that use Spring - &lt;strong&gt;you should initialize your ApplicationContext in a static member variable&lt;/strong&gt;.  It seems to be the best performing and logical choice.  Of course, if I&apos;m off my rocker - please let me know.
&lt;br /&gt;&lt;br /&gt;
&lt;em&gt;On a sidenote, it would be cool if Roller allowed me to turn off comments for a single post.  I like how &lt;a href=&quot;http://www.simongbrown.com&quot;&gt;Simon&lt;/a&gt; posts stuff on java.net and then aggregates it to his personal weblog.&lt;/em&gt;</content>
    </entry>
</feed>

