How Do I build the sample applications

Complete sources of Dekoh applications DekohPhotos , DekohMusic , DekohBooks , DekohCalendar is available for download.

Each of these applications harness the Dekoh platform API to deliver unique desktop applications that lets users manage their personal digital content like photos, music, reading lists and so on. Browsing through the source code is a good way to learn how you can leverage Dekoh platform API in your application.

Prerequisites to building sample applications

  • Dekoh installation on your computer.
  • Installation of Java build tool ANT . Version 1.6.2.
  • Java development kit (version 1.5 or higher)

Executing the Build

  • Download and extract contents from the source zip file to a directory. Lets call this directory, working_dir
  • Open the Command Prompt (shell) and change the directory to working_dir. You will see a build.xml file in the working_dir. You can now see what are the available targets in this build file.
$ ant -projecthelp
Buildfile: build.xml

Main targets:

compile.books     Compile and build WAR of Dekoh Books Application
compile.calendar  Compile and build WAR of Dekoh Calendar Application
compile.music     Compile and build WAR of Dekoh Music Application
compile.picApp    Compile and build WAR of Dekoh Photos Application
compile.samples   Compile and Build WAR files of all sample applications
Default target: compile.samples
  • Run ant. The default target will build WAR files for Dekoh Photos, Dekoh Music, Dekoh Books and Dekoh Calendar. The built WAR files will be stored in dist directory.
  • To build WAR files of any specific application, execute the above documented targets. For example, executing ant compile.books will result in WAR file dekohbooks.war

How to deploy the built WAR on Dekoh

  • Start Dekoh in interactive mode (with a shell). To do this, run the dekoh_shell.bat/.sh script in C:/Dekoh on Windows and in /home/${user.name}/Dekoh on Unix machines.
Tip: If you see the following error when attempting to start dekoh shell, Dekoh Server may already be running in the background on your computer. In such a case, go to the Dekoh Desktop page by double clicking on the Dekoh Tray icon and selecting "Shutdown". This stops Dekoh running in the background. Now go back to the command prompt and execute <pre>dekoh_shell.bat/dekoh_shell.sh</pre> to restart Dekoh in interactive mode.
$ ./dekoh_shell.sh
Exception in thread "main" java.lang.IllegalStateException: Somebody else already holds the lock on C:\Dekoh\server\nodes\default\config\server.lock. The server is probably already started.
        at com.pramati.das.core.Bootstrapper.acquireLock(Bootstrapper.java:106)
        at com.pramati.das.core.Bootstrapper.start(Bootstrapper.java:85)
        at com.pramati.das.core.Bootstrapper.main(Bootstrapper.java:146)
        at com.pramati.das.core.Delegator.main(Delegator.java:43)
  • When you run the script dekoh_shell.bat/.sh, Dekoh starts and displays a prompt LWT>. This indicates that Dekoh startup is complete and is ready.
  • There are a number of commands that can be run at this prompt. Typing help will list these commands.
LWT> help
--------------------------------------------------------------------------------
The Following Commands are available :
  *) deploy - To deploy an Application
  *) undeploy - To undeploy an Application
  *) prepare - To prepare an Application
  *) start - To start a stopped Application
  *) stop - To stop a started Application
  *) status - to show webContainer status
  *) list - to get list of deployed applications
  *) shutdown - to shutdown the server
--------------------------------------------------------------------------------
  • To deploy the build WAR, usethe deploy command. For example, when you deploy C:\working_dir\dist\dekohbooks.war, the output looks like:
LWT> deploy C:\working_dir\dist\dekohbooks.war
2:33:40 PM-   Deploying application [C:\working_dir\dist\dekohbooks.war]
[TopLink Info]: 2007.09.13 02:33:41.363--ServerSession(1766076)--TopLink, version: Oracle TopLink Essentials - 2.0 (Build b58a-rc2 (08/09/2007))
[TopLink Info]: 2007.09.13 02:33:41.445--ServerSession(1766076)--file:/C:/Dekoh/server/nodes/default/archives/public_html/books/WEB-INF/classes/-books-dio-persistence-unit login successful
No Trace props by name [dekohBooksTrace.props] found in classpath, did not load trace:
2:33:41 PM-   Application started sucessfully with
               contextroot [books] on host [default]
2:33:41 PM-   Application [C:\working_dir\dist\dekohbooks.war]
               deployed successfully

        Application [C:\working_dir\dist\dekohbooks.war] with contextRoot [books] on VHost [default] deployed Successfully
  • As the last sentence in the output indicates dekohbooks.war is now deployed at context root books on Dekoh.
  • Double click on the Dekoh tray icon to open Dekoh Desktop in the browser. Change the address location to point to context root books.
  • Congratulations! You should now see the home page for Dekoh Books application which was just built and deployed.

See Also

How To Precompile JSP Files