Note that by default, the library is built without line number information to save space in flash memory. For debugging purposes, you may find it useful to build it with line number information, which will put line number information in stack traces. To do this, do

ant library –DKEEPSYMBOLS=true

4. Deploy the new library suite to your Sun SPOTs

Use the command

ant flashlibrary

to flash the new library onto your Sun SPOTs. This command always flashes the library whose name is defined in .sunspot.properties, regardless of where it is executed.

5. Build and deploy applications that use the library suite as usual

Change directory to the addertest folder, and deploy and run the application as usual using the command

ant deploy run

Library manifest properties

Each library extension must contain a file named

resources/META-INF/MANIFEST.MF

within its root folder. The adderlib extension has such a file, whose content is

FavouriteSnake: Viper

This defines a property whose value will be available to all applications in a similar fashion to application-specific manifest properties. The addertest application demonstrates this by displaying the value of this property. The library suite is built to contain all the properties defined by the manifests of all its input jars. For more details on accessing these properties, see the section Manifest and resources.

Running startup code

Some library extensions require initialisation to be performed at startup (for example, to create daemon threads). To specify startup code that must be run, add one or more lines to the manifest properties of the library extension with the following format:

spot-startup-xxxx: my.fully.qualified.Classname

where xxxx is a string that is provided as the single argument to the static main() method of

Classname.

Startup code is run only in the master isolate. It is run after all normal spotlib initialisation is completed but before the OTACommandServer (if configured) is started and before the application is launched.

Modifying the system library code

It is also possible to modify the supplied library code if you wish. To do this, you should expand step 2 in the process outlined in the section Adding user code to the library suite as follows.

48

Page 48
Image 48
Sun Microsystems V2.0 manual Use the command