Running Naked Objects in a multi-user environment is as simple as
starting the server program and then running some clients. As the clients
will commonly be run on separate machines they need to told where to find
the server. They also need to be told which naked object classes to make
available to the user.
Running the server
The framework's org.nakedobjects.ObjectServer class is
used to run the framework as a server and is started using the following
command:
java -cp nakedobjects.jar:log4j.jar:<object class path>
org.nakedobjects.ObjectServer
(This command should all be on a single line.)
Log4J is a logging framework from Apache, which is used for logging
the running of the framework. The Log4J jar-file, the framework itself,
and the directory containing the naked object classes, must all be
specified in the command's classpath unless they are already specified in
the system's CLASSPATH variable. In addition a copy of
server.properties must be in the working directory, i.e. the
directory where the above command is run. This file can be found in the
conf directory in the Naked Objects distribution.
Aassuming the original
server.properties configuration file was copied across,
as the server starts it will install the
default object store, a basic network service, and a graphical console
for monitoring and controlling the server. All of these aspects of the
server can be changedComplete configuration details are included in
the Naked Objects distribution.. The following console screen
will be shown allowing you to monitor the clients and to shutdown the
server:
Running the client
Before running the client you must specify where the server is to be
found, and tell the client which classes to make available to the user.
This is done by editing the client's configuration file,
client.properties. This file should copied to the working
directory from the conf directory in the Naked Objects
distribution. The line:
nakedobjects.socketed-proxy.address=localhost
should be changed, replacing localhost with
the server's IP address or host name. For example, on our local server
the line becomes:
nakedobjects.socketed-proxy.address=192.168.1.8
The naked object classes to be made available to the user are
specified by appending the fully-qualified class names, separated by
semicolons, to the line:
nakedobjects.classes=
For example, to configure the client to use the classes developed
for the ECS application the following would be seen in the
configuration file. (The backslashes at the end of each line
indicate that the property is continued onto the next line.)
nakedobjects.classes=\
org.nakedobjects.example.booking.Customer;\
org.nakedobjects.example.booking.Booking;\
org.nakedobjects.example.booking.Location;\
org.nakedobjects.example.booking.Telephone;\
org.nakedobjects.example.booking.CreditCard;\
org.nakedobjects.example.booking.City
Before running the client the images directory, and its
contents, should be copied into the working directory. The required
class files should also be copied across and placed in the working
directory (ideally in a specific subdirectory).
The framework's org.nakedobjects.Client class is used
to run the framework as a client application. The class path is set up
in the same way as the server so that the framework, Log4J and the naked
object classes can be found:
java -cp nakedobjects.jar:log4j.jar:<object class path>
org.nakedobjects.Client
(This command should all be on a single line.)
The application will appear as below.
|