A bootstrapper takes care of loading up the Naked Objects framework and application, initialising it, and running it. When it starts up it reads in a list of components and attempts to load in each one. Any component that can be loaded is then available to be used and can then be specified on the command line if required. Requesting a component that cannot be loaded will result in an error. To resolve such an error simply ensure that the component's Jar file is available on the class path. All the components supplied with the framework are listed in the file installer-registry.properties which is part of the runtime-4.0.jar file.
During start-up Naked Objects loads in a number of configuration files. The main file, nakedobjects.properties, is always loaded and must be present for the framework to start up. For each of the various types of persistor and viewer, there is a separate configuration file. For example, for the following command line parameters
-v dnd -r xml
specifies that the viewer is to be the drag and drop (dnd) interface, and the persistor is to be the 'xml object store'. As well as loading those components, the framework will look for configuration files named viewer.properties, viewer_dnd.properties, persistor.xml and persistor_xml.properties and will load them if found.
The bootstrapper is the class org.nakedobjects.runtime.NakedObjects and takes the following options on the command line. (Note that in each case there is an abbreviated, and a full, version of the option).
There is also an alternative bootstrapper, org.nakedobjects.webserver.WebServer.
-c <config file> --config <config file>
Loads in the specified configuration file, in addition to nakedobjects.properties and the properties files relating to the installed component.
-s --nosplash
Prevents the splash screen from being displayed during start up.
-h --help
Prints out the options that are available. This is dynamic so that only the components that can be used are listed.
The amount of logging detail can be controlled from the command line. If no flag is specified only warnings and errors are output. All logging level relate to the Log4J levels, which is the logging mechanism used by Naked Objects.
-quiet
Quiet reduces logging to show errors only.
-verbose
Increases logging to show information about the system as it runs.
-debug
Increases logging to show all logged entries. At this level so much is logged that it will likely slow down the system if used when outputting log details to the console or other slow devices.
-t <mode> --type <mode>
The framework is started up in one of several different deployment modes, as listed below:
exploration - Exploration mode is for developers to explore and test their code. The framework always uses an in-memory persistor and runs the fixtures at startup to ensure a known state every time the system is started. The user is not prompted to log in, but is automatically logged in as user 'exploration'. The logged in user can be changed on the fly using an option with the user interface; this simply changes the user and does not require an explicit login action. Also, exploration methods defined in the DOM are also available to the user to do things that a user would not normally be allowed to do. These are used expressly for testing the system. Please note it is an error to specify a persistor type in exploration mode.
prototype - Prototype mode is for demonstrating the system in realistic fashion. The user is always prompted to log in at start up, and can log out and log in again without losing the state of the objects. This allows a user to demonstrate exactly how a system would work.
single-user - Single user mode runs the system for a single user with object persistence.
client - Client mode provides multiple users access to a server. With this mode selected the connection option must also be specified.
server-exploration - Server mode, but all clients will automatically be logged in as the 'exploration' user (or as LoginFixture is present).
server-prototype - Server mode, but if a LoginFixture is present then all clients will automatically be logged in as this user.
server - Server mode runs Naked Objects as a server for multiple clients. With this mode selected the connection option must also be specified.
If no mode is specified, the framework will start up in prototype mode.
-D property=value
Using this flag we can pass in properties from the command line that would otherwise need to specified in a configuration file. This is normally used to override a property, or to temporarily specify one.
-p <password> --password <password>
Ignored if type is prototype or not used with the user option below.
Uses the specified password when logging the user in with the username specified with --user.
-r <persistor> --persistor <persistor>
Ignored if type is client.
The persistor option allows you to choose how the objects created by the system will be persisted so they are still available the next time you run the system. The following options are available with the current distribution, and if none is specified then the in-memory persistor will be used for exploration mode and xml persistor will be used for other non-client modes by default.
in-memory - A simple non-persisting mechanism that will only hold the persisted object while the virtual machine is running. This is used for testing and demonstrating.
xml - A simple file based mechanism that encodes each object's data in an XML file. Alongside the data files for the objects are instance lists listing all the files for each type of object.
<class name> - By specifying a class name the boot loader will load up that class as the persistor.
-x <connector> --connector <connector>
Ignored if mode is not a client. If the type is a client then a connection mechanism can be specified. Connector mechanisms available are:-
encoding-sockets - Uses the encoding mechanism (of value types) to serialize/deserialize objects, over TCP/IP sockets.
encoding-http - Uses the encoding mechanism (of value types) to serialize/deserialize objects, over HTTP.
serializing-sockets - Uses Java serialization (of value types) to serialize/deserialize objects, over TCP/IP sockets.
xstream-sockets - Uses the Xstream library to serialize/deserialize objects to/from XML for simple stream communications, over TCP/IP sockets.
-u <user name> --user <user name>
Ignored if type is prototype.
Uses the specified name when logging the user in. If the password is also specified (see above) then an attempt to log in using the supplied user name and password is made; authentication failure at this point will exit the program.
-v <viewer> --viewer <viewer>
The viewer option allows you to choose the user interface that is used to access your Naked Objects application. The following options are available with the current distribution, and if none is specified then the drag and drop view will be used by default.
dnd - Drag and Drop viewer
html - Web browser viewer - accessed via standard web browser such as FireFox, Internet Explorer or Opera
encoding-sockets - Uses the encoding mechanism (of value types) to serialize/deserialize objects, over TCP/IP sockets.
encoding-http - Uses the encoding mechanism (of value types) to serialize/deserialize objects, over HTTP.
serializing-sockets - Uses Java serialization (of value types) to serialize/deserialize objects, over TCP/IP sockets.
xstream-sockets - Uses the Xstream library to serialize/deserialize objects to/from XML for simple stream communications, over TCP/IP sockets.
<class name> - By specifying a class name the boot loader will load up that class as the viewer