Next Previous Up Contents
Next: GUI Support
Up: Storage Policies
Previous: Available Policies

### 4.2 Default Policy

Any time a storage policy is required and has not been specified explicitly, STIL will get one by calling the static method

        StoragePolicy.getDefaultPolicy()

(application code should follow the same procedure). You can modify the value returned by this method in two ways: you can use the `StoragePolicy.setDefaultPolicy()` static method, or set the system property `startable.storage` (this string is available as the constant `PREF_PROPERTY`).

The permissible values for `startable.storage` are currently as follows:

memory
  Use the `PREFER_MEMORY` policy
disk
  Use the `PREFER_DISK` policy
sideways
  Use the `SIDEWAYS` policy
discard
  Use the `DISCARD` policy

Any other value is examined to see if it is the name of a loadable class which is a subclass of `StoragePolicy` and has a no-arg constructor. If it is, an instance of this class is constructed and installed as the default.

This means that without any code modification you can alter how applications cache their table data by setting a system property at runtime. The file `.starjava.properties` in the user's home directory is examined during static initialization of `StoragePolicy` for property assignments, so adding the line

        startable.storage=disk

in that file will have the same effect as specifying

        -Dstartable.storage=disk

on the java command line.

If it has not been set otherwise, the 'default' default storage policy is `ADAPTIVE`.

Next Previous Up Contents
Next: GUI Support
Up: Storage Policies
Previous: Available Policies

STIL - Starlink Tables Infrastructure Library
Starlink User Note252
STIL web page: http://www.starlink.ac.uk/stil/
Author email: m.b.taylor@bristol.ac.uk