org.objectweb.fractal.gui.repository.lib
Class XMLFileStorage

java.lang.Object
  extended byorg.objectweb.fractal.gui.repository.lib.XMLFileStorage
All Implemented Interfaces:
Storage

public class XMLFileStorage
extends java.lang.Object
implements Storage

Basic implementation of Storage interface, based on a single XML file. More precsiely, each storage is a single XML file, and each (name, value) pair is represented by an XML element of these files (the name is given by the 'name' attribute of an XML element).


Constructor Summary
XMLFileStorage()
           
 
Method Summary
 void close()
          Closes the currently opened storage.
 java.lang.Object load(java.lang.String name)
          Loads the object whose name is given, from the currently opened storage.
 void open(java.lang.String storage)
          Opens the storage whose name is given.
 void store(java.lang.String name, java.lang.Object value)
          Stores the given object under the given name in the currently opened storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFileStorage

public XMLFileStorage()
Method Detail

open

public void open(java.lang.String storage)
          throws java.lang.Exception
Description copied from interface: Storage
Opens the storage whose name is given.

Specified by:
open in interface Storage
Parameters:
storage - name of the storage to be opened
Throws:
java.lang.Exception - if the storage cannot be opened.

load

public java.lang.Object load(java.lang.String name)
                      throws java.lang.Exception
Description copied from interface: Storage
Loads the object whose name is given, from the currently opened storage.

Specified by:
load in interface Storage
Parameters:
name - the name of the object to be loaded.
Returns:
the object whose name is given.
Throws:
java.lang.Exception - if the given object cannot be loaded.

store

public void store(java.lang.String name,
                  java.lang.Object value)
           throws java.lang.Exception
Description copied from interface: Storage
Stores the given object under the given name in the currently opened storage.

Specified by:
store in interface Storage
Parameters:
name - the name of the object to be stored.
value - the value of the object to be stored.
Throws:
java.lang.Exception - if the object cannot be stored.

close

public void close()
           throws java.lang.Exception
Description copied from interface: Storage
Closes the currently opened storage.

Specified by:
close in interface Storage
Throws:
java.lang.Exception - if the currently opened storage cannot be closed.