Apr 132010
 
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

  One Response to “Achieving Nirvana with Flex”

Sorry, the comment form is closed at this time.