The getting started section aims to get you using Naked Object in just a few minutes. This part helps you get it installed and run a demo. The next part looks at building and modifying some example applications, and final part take in-depth look at how a Naked Object is coded.
Before we launch into using Naked Objects you need to have the Naked Objects binary distribution installed. This is covered in this section if you have not already installed it. There are other ways of building and running Naked Objects, but these are covered in later in the documentation in the main installation section.
To build and run Naked Objects applications for this tutorial you need Java version 1.5 or above, and Ant 1.7 installed on your machine. These can be downloaded from http://java.sun.com/ and http://ant.apache.org/ respectively.
The latest version of the Naked Objects framework can be downloaded from the downloads page of the Naked Objects Sourceforge project as shown below. For this tutorial you should download the binary release (suffixed with -for-ant) for immediate use. (There are three other versions available, suffixed -for-maven, -source, and -libs-only-with-dependencies. You can ignore these for now.
Extract the downloaded file's content into a suitable directory (a root directory is created upon extraction so there is no need to create a directory in which to install everything). As an example here is the compressed tar file being extracted
$ tar xzf nakedobjects-4.0-for-ant.tar.gz
Once expanded you should have the following directories and files:-
/nakedobjects-4.0
/demos
/docs
/examples
/lib
LICENSE.TXT
/resources
Change into the Naked Objects directory before continuing the tutorial
$ cd nakedobjects-4.0
The Naked Objects distribution comes with a demonstration application for expenses processing i.e. for creating, submitting and approving expense claims. The application has only limited functionality - a real expenses processing application would require many more features - but what it has is realistic in terms of implementation.
There are two ways in which you can run the demonstration: as a standalone executable, or building it and running it from within a development environment. This chapter covers the former approach and looks at how a Naked Objects application is used, while the next chapter looks at building and modifying the example allowing you to browse and modify the source code.
The files for running the demo can be found in the demo/expenses directory, while the source code and build files are in the examples/expenses directory.
The executable version of the Expenses demo application exists within the demos directory of the Naked Objects distribution.
Run the batch file ExpensesDND.bat file either by double-clicking on the icon (in Windows) or using the following commands on the command line. In Windows the commands are
> cd demos\expenses > ExpensesDND.bat
while on the Mac or when using Unix/Linux they are:
$ cd demos/expenses $ ./ExpensesDND.sh
After seeing the Naked Objects splash screen, you'll be presented with a Login screen:
Log in as 'sven' and a password of 'pass'. The application will then open like this:
When an application is started an application window is opened and the user's services are displayed on the left hand side. These icons typically give the user access to the domain objects held and used by the system, and provide a way for you to create new instances. Any other object that subsequently appears on the screen represents one of those domain objects.
The service and objects can be manipulated as follows:
TODO add examples interactions for the demo
To run the expenses demo with the HTML user interface, run the batch file ExpensesHTML.bat either by double-clicking on the icon (in Windows) or using the following commands on the command line. In Windows the commands are:
> cd demos\expenses > ExpensesHTML.bat
while on the Mac, or when using Unix/Linux, they are:
$ cd demos/expenses $ ./ExpensesHTML.sh
Allowing a few seconds for the application to start up, you then need to launch a browser and point it to http://localhost:8080/logon.app and you'll be presented with a Login screen.
Log in as 'sven' and a password of 'pass'. This will direct you to the start page of the application, a welcome page is displayed and links to the application services are shown across the top. In the same ways as for DND these links give the user access to the objects held and used by the system and provide a way to create new objects. Any other object that subsequently appears on the screen represents one of those objects.
For example if the Expense Claims link has been clicked on in the screen above and now shows the available service actions on the left hand side of the screen. Clicking on the first action brings up My Claims as shown below.
TODO add examples interactions for the demo