1
2
3
4
5
6 package yawn.io;
7
8 /***
9 * A storage of instances of <code>IPersistent</code> sub-classes.
10 *
11 * <p>$Id: IStorage.java,v 1.5 2005/05/09 11:04:55 supermarti Exp $</p>
12 *
13 * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara </a>
14 * @version $Revision: 1.5 $
15 */
16
17 public interface IStorage {
18
19 /***
20 * Inserts an instance of a <code>IPersistent</code> implementor in the
21 * underlying storage.
22 *
23 * @param object
24 * The <code>IPersistent</code> implementor instance to store.
25 */
26 public void insert(Object object, String key) throws StorageException, DuplicateKeyException;
27
28 public String generateKey(Object object);
29
30 public void update(Object object, String key) throws KeyNotPresentException, StorageException;
31
32 /***
33 * Retrieves the <code>IPersistent</code> implementor instance that
34 * matches the provided <b>id</b>.
35 *
36 * @param key
37 * The provided <b>key</b>.
38 * @return The <code>IPersistent</code> implementor instance that matches
39 * the provided id, or <b>null</b> if not matching instance is
40 * found.
41 */
42 public Object get(String key) throws StorageException, KeyNotPresentException;
43
44 /***
45 * Retrieves all the instances of <code>IPersistent</code> implementors
46 * present in the underlying storage.
47 *
48 * @return All the retrieved instances.
49 */
50 public Object[] getAll() throws StorageException;
51
52 public void flush();
53 }