KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > repository > api > Storage


1 /***
2  * FractalGUI: a graphical tool to edit Fractal component configurations.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: fractal@objectweb.org
20  *
21  * Authors: Eric Bruneton, Patrice Fauvel
22  */

23
24 package org.objectweb.fractal.gui.repository.api;
25
26 /**
27  * A generic storage manager. A storage can be a single file, and set of files
28  * organized in a several directories, a data base, etc. A storage must be
29  * opened before one can read or write values in it. It must be closed after
30  * use. Each storage contains a set of (name, value) pairs.
31  */

32
33 public interface Storage {
34
35   /**
36    * Opens the storage whose name is given.
37    *
38    * @param storage name of the storage to be opened
39    * @param create <tt>true</tt> to create a new storage, or to override an
40    * existing one, or <tt>false</tt> to open an existing storage.
41    * @throws Exception if the storage cannot be opened.
42    */

43
44   void open (String JavaDoc storage) throws Exception JavaDoc;
45
46   /**
47    * Loads the object whose name is given, from the currently opened storage.
48    *
49    * @param name the name of the object to be loaded.
50    * @return the object whose name is given.
51    * @throws Exception if the given object cannot be loaded.
52    */

53
54   Object JavaDoc load (String JavaDoc name) throws Exception JavaDoc;
55
56   /**
57    * Stores the given object under the given name in the currently opened
58    * storage.
59    *
60    * @param name the name of the object to be stored.
61    * @param value the value of the object to be stored.
62    * @throws Exception if the object cannot be stored.
63    */

64
65   void store (String JavaDoc name, Object JavaDoc value) throws Exception JavaDoc;
66
67   /**
68    * Closes the currently opened storage.
69    *
70    * @throws Exception if the currently opened storage cannot be closed.
71    */

72
73   void close () throws Exception JavaDoc;
74 }
75
Popular Tags