Golden Buddha

In my previous article, Achieving Nirvana on Mac OS X, I set up a Nirvana server on port 8887 and imported a realm for the TradeSpace demo. The TradeSpace demo instructions had impudently asked me to run two .BAT scripts, setup.bat and startall.bat, and when we left off, I performed manually the equivalent operations for the former. Today I will tackle the latter which, according to the instructions, will create and populate the demonstration news and rates channels in our Nirvana realm.

The script contains only two simple lines to run two other scripts, startnews.bat and startrates.bat, and thankfully these secondary scripts are short and sweet. Inspecting them, .BAT-style rem comments redacted:

#startnews.bat
set CLASSPATH=%CLASSPATH%;..\classes
java -cp "%CLASSPATH%;..\classes" -DRNAME=nhps://showcase.my-channels.com:443 -DRNAME2=nsp://localhost:9000 -DCHANNAME=/showcase/consolidatedrss com.pcbsys.demos.feedsimulators.NewsFeeder

#startrates.bat
set CLASSPATH=%CLASSPATH%;..\classes
java -cp "%CLASSPATH%;..\classes" -DRNAME=nsp://localhost:9000 -DRNAME2=nsp://localhost:9000 -DCHANNAME=/showcase/stockindices com.pcbsys.demos.feedsimulators.Stockindices

It is clear I must run two Java programs. Unfortunately, my herculean efforts to run them from the terminal end as assorted failures, from Java classpath issues to brutal Mac OS X crashes (see Figure 1).

Instead, I launch Eclipse, create a Java project, and add the Java source from the TradeSpace demo package (in my case, ~/Sites/nirvana/demo/src/java/tradespace). I also add three entries to the build path:

  • External Class Folder – /Applications/Nirvana_5.1.6710/classes
  • External JAR – {NIRVANA_HOME}/lib/nClient.jar
  • External JAR – {NIRVANA_HOME}/lib/swing-layout-1.0.jar

Now I create two launch configurations:

Main Class: com.pcbsys.demos.feedsimulators.NewsFeeder

VM Arguments:
-DRNAME=nhps://showcase.my-channels.com:443
-DRNAME2=nsp://localhost:9000
-DCHANNAME=/showcase/consolidatedrss

Main Class: com.pcbsys.demos.feedsimulators.Stockindices

VM Arguments:
-DRNAME=nsp://localhost:9000
-DRNAME2=nsp://localhost:9000
-DCHANNAME=/showcase/stockindices

I launch both configurations in debug mode. Inspecting the Nirvana Enterprise Manager, I can see activity in the Event History chart and the Event Status table. I navigate to http://localhost:8887/ in a browser once again and click on the Flex link under the Web Client Demos section. The Flex client starts up and loads the news and rates data (see Figure 2). Voilà.

Mac OS X Crash Screen

Figure 1: Mac OS X Epic Fail


TradeSpace Web Client Demo in Flex

Figure 2: TradeSpace Web Client Demo in Flex

 
"Giant Buddha" on Lantau Island, Hong Kong

Here at Lab49 we develop right on technology’s bleeding edge. Innovation requires investigation, and so in its wisdom the Lab encourages a culture of research. Our own Matt Davey championed an internal venture, now involving a small team of 49ers, to demonstrate a new risk management architecture. While the project at its core focuses on back-end technologies such as data stores, for this article I will discuss mostly middleware.

Early on (and prior to my involvement) the team planned to create a straightforward Microsoft Silverlight front-end that connected to Nirvana middleware. We have since added a twist: the team will build two front-ends in parallel, one in Silverlight and one in Adobe Flex. Given the political intesity surrounding RIA technologies, I have no doubt this will be an interesting experiment. With luck it will also be informative beyond the usual Flex versus Silverlight religiosity, as we will be able to judge how easily each platform integrates with a proven middleware product in Nirvana. Of course, to begin I must install Nirvana Enterprise on my trusty MacBook Pro.

The shop behind Nirvana, my-Channels, provides a free developer edition. Generally I work on a Mac, so I grabbed the Mac OS X package. They also provide official installation instructions, but unfortunately the curtains do not match the carpet, as it were. There are instructions for Win32, Linux/Solaris and Generic Unix, but there is not a word about OS X. A reasonable man might assume Generic Unix is the appropriate replacement, but he would be wrong. The good news is that when I download and unzip nirvana_osx_novm.zip, out pops a proper OS X application install.app. I launch the installer and go with the defaults most of the way. I do choose a custom data directory, ~/Documents/nirvana_data. Installation proceeds without trouble, using the default /Applications/Nirvana_5.1.6710, henceforth called {NIRVANA_HOME}, for the Nirvana application folder.

Moving on, I download the TradeSpace demo package tradespace_demos.zip, which is free on the my-Channels downloads page. The demo instructions recommend unzipping to the Nirvana application folder, but instead I choose ~/Sites/nirvana/demo. Following the Environment Configuration section of the demo instructions, I update ~/Sites/nirvana/demo/cfg/demo.xml.

  • Update value of property BasePath to ~/Sites/nirvana/demo/www.
  • Update value of property port to 8887. This number is somewhat arbitrary, though I recommend avoiding the default 80.

Now I am able to launch the Nirvana server. In the Finder, I navigate to {NIRVANA_HOME}/server/nirvana and double-click the Start Nirvana Realm Server alias. A Terminal window opens and launches the Nirvana server, which in turn prints some server and environment details to the console. The server lives. The next section of the instructions, Interface, Plugin and Channel Setup, suggests I open an item from my Windows Start menu and then execute a pair of .BAT scripts. This is clearly impossible on OS X, and the instructions offer no alternative. I am on my own.

I open the first script, setup.bat, in a text editor and see a single command, nimportrealm ..\cfg\demo.xml -all. This implies the next step is to import the demo realm, and fortunately I can do this by GUI. I navigate to {NIRVANA_HOME}/Administration/nirvana/ and double-click the Nirvana Enterprise Manager. I find my default realm nirvana under the Realms node and right-click to bring up the context menu, selecting Import Realm from XML. I find the demo.xml file from earlier and click Import All. After I click OK, a directory showcase with four channels appears beneath my realm nirvana. To confirm the server is operational, I head to http://localhost:8887/ in a browser, and sure enough, a welcome page congratulates me.

For my encore, I will take care of the second .BAT script, startall.bat, and at last connect a Flex client to Nirvana.

[Update 13-April-2010] Continue with the follow up article, Achieving Nirvana with Flex.

 
Union Jack

It has been eleven days since the Heathrow immigration officer stamped my work visa, thus affirming my expropriated Englishness. For the annals, the food here is better than reputation and, tracking over the past decade, is improving steadily. Of course while the arc of history may bend towards refinement, Britain’s culinary graces have a ways to go still. Not a fortnight in and I might well kill a man to steal his bottle of Tapatío.

Meanwhile, I am striding through Week II at Lab49. My demonstrably smart London colleagues have welcomed me into the fold but nevertheless share a consternation that I would leave San Francisco to join them. This confusion (and shock, is it?) prevails among Londoners at large, who are strikingly pessimistic about their charming metropolis and cannot grasp Johnnys-come-lately. One amiable Scot here at the Lab (we will call her Agnes) adores America and has a particular fascination with my City by the Bay. Now, Agnes loves her native Scotland and lobbies heavily on behalf of Tunnock’s Teacakes. (Verdict: delicious but painfully sweet.) She is neither cultural turncoat nor dewy-eyed Americaphile. All the same, when we struck up conversation about her last trip to San Francisco, she revealed unusual yearnings for the Red, White & Blue.

To be sure, both Britons and Americans rigorously enjoy dissecting the peculiarities of cross-pond customs and regional dialects. (Pick up some dish soap at the chemist, please.) However Agnes took us beyond typical small talk by describing her first trip to Walmart. Sure, at Walmart you can buy a shotgun, tractor and cantaloupe under the same roof, but that’s not what enchanted our Scot. Walmart, her walls dripping with Post-its and Sharpies of every conceivable color and size, fulfilled an as yet unknown stationery fetish deep within Agnes. Where a UK shop carries standard Sharpies in black, red, and blue, Walmart in her glory offers Sharpies long and short, thin and thick, retractable and chiseled, twin-tipped and laundry-safe…and in a rainbow of colors, plus metallic. Agnes has a fever, and the only prescription is more Sharpie.

© 2011 Daniel Cohen Suffusion theme by Sayontan Sinha