org.objectweb.fractal.gui.repository.api
Interface Storage

All Known Implementing Classes:
XMLFileStorage

public interface Storage

A generic storage manager. A storage can be a single file, and set of files organized in a several directories, a data base, etc. A storage must be opened before one can read or write values in it. It must be closed after use. Each storage contains a set of (name, value) pairs.


Method Summary
 void close()
          Closes the currently opened storage.
 Object load(String name)
          Loads the object whose name is given, from the currently opened storage.
 void open(String storage, boolean create)
          Opens the storage whose name is given.
 void store(String name, Object value)
          Stores the given object under the given name in the currently opened storage.
 

Method Detail

open

public void open(String storage,
                 boolean create)
          throws Exception
Opens the storage whose name is given.

Parameters:
storage - name of the storage to be opened
create - true to create a new storage, or to override an existing one, or false to open an existing storage.
Throws:
Exception - if the storage cannot be opened.

load

public Object load(String name)
            throws Exception
Loads the object whose name is given, from the currently opened storage.

Parameters:
name - the name of the object to be loaded.
Returns:
the object whose name is given.
Throws:
Exception - if the given object cannot be loaded.

store

public void store(String name,
                  Object value)
           throws Exception
Stores the given object under the given name in the currently opened storage.

Parameters:
name - the name of the object to be stored.
value - the value of the object to be stored.
Throws:
Exception - if the object cannot be stored.

close

public void close()
           throws Exception
Closes the currently opened storage.

Throws:
Exception - if the currently opened storage cannot be closed.