Server doesn't have an up-to-date copy of the data
Server has an up-to-date copy
Data that can always be recreated
These states are read by the JNLP Client when it needs to clear the cache. The deletion order
is: temporary files first; then cached data; and, finally, items tagged as dirty .
A Persistence Utility Class
Another utility class provided with this topic, the PersistenceStorage class, is a wrapper of
the PersistenceService object, so that you don't have to deal with FileContents or all the
details typical of the new jnlp API. Instead, the interface of this utility class is very simple to
use, and there is no additional knowledge of the PersistenceService API required in order to
use it. Of course, if you need particular operations, you can always extract the wrapped
PersistenceService object and manage it as required. However, this class will help in the
majority of real cases.
It is useful for storing Java objects locally with a given key. It works much like a Hash table,
saving objects and retrieving them by means of a key (a string or a full URL). The key string is
used to create a URL based on the codebase value (see the getUrl() method at lines 102-111)
in Listing 11.5.
To save a serializable object, just use the following code:
to read the following value:
Object serializableObject = persistenceStorage1.read(“key”);
Then, cast the obtained object as needed.
L ISTING 11.5 The PersistenceStorage Utility Class
* Chapter 11 - utility wrapper for PersistenceService
* @author Mauro Marinilli
* @version 1.0