Users guide
Architecture
Demo applications
Plugins
Porting Guide
Development Roles
Introduction
Administrator
Deployer
Assembler
Block Developer
Project Info
License
Mailing lists
IRC
Source repositories
Issue tracking
Blog entries
Team
|
|||||
|
|
|||||
Users guideArchitecture Development RolesIntroduction Project InfoLicense |
Demo applications
IntroductionThis document aims to provide developers new to Loom with a few simple examples to help them getting started. Instructions for installing Loom can be found in the Install document. Loom comes with two small demo applications, HelloWorld and Distributed. The demos are packaged as SAR files. A SAR file is an archive for Loom applications which conveniently holds all the libraries and deployment information for the the given application. If you are familiar with J2EE EAR and WAR files you'll find them very similar. BinariesIn binary releases the demos are included in the demo/ directory. To install them you just need to copy the .sar files to the apps/ directory and start loom. Building from sourceTo build everything from source you need to follow these steps:
The resulting artifacts are ready SAR files, one for each demo. They are copied to the distribution/deploy/demos directory. All that is needed is for the SAR files to be dropped in the apps/ directory of a Loom distribution, plus a start/restart of Loom by executing the preferred script in the bin/ directory. HelloWorld demoLoom would not be a serious application if it did not have a HellWorld demo! It will allow you to verify that you've successfully built or installed Loom. Fire up Loom by executing the run script in the bin/ directory. This will execute in the foreground so you can see the messages written to System.out. Next point your favorite web browser to http://localhost:8999. If "localhost" isn't recognized by your system, replace it with "127.0.0.1". If all goes well, you will see something like the following: Hello World! Requests so far = 1 you are 127.0.0.1 at 127.0.0.1 This shows that Loom has unpacked and launched the server application contained within the demo-helloworld.sar file. To stop Loom simply use CTRL-C on the console window. You can stop and start as many times as you need.
Distributed demoThis demo application demonstrates that it is possible to make a server application that is dual mode. Dual mode here is the ability for the server application to run inside Loom and also stand-alone from the command line. The only difference is that the app needs to be zipped into two forms - the sar file for Loom and a jar file for standalone. The build artifacts produced by this demo are
To run the Server app inside Loom drop the demo-distributed-server.sar in the Loom distribution apps directory (as done above), and restart Loom: Server started on port 1234
To run the Server app in standalone mode: java -jar demo-distributed-server-x.y.jar
Loom Demo listening on port 7654
Ctrl-C to exit
Finally use the client application to poke the server: java -jar demo-distributed-client-x.y.jar localhost 7654 HelloLonerWorld java -jar demo-distributed-client-x.y.jar localhost 1234 HelloLoomWorld You should see the messages appear in the console windows in which the two servers are running. |
||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||