1 /**
2 *
3 */
4 package org.sourceforge.jemm.database;
5
6 import java.util.Iterator;
7 import java.util.Set;
8
9 import org.sourceforge.jemm.database.components.types.StoredAtomicIntObject;
10 import org.sourceforge.jemm.database.components.types.StoredListObject;
11 import org.sourceforge.jemm.database.components.types.StoredMapObject;
12 import org.sourceforge.jemm.database.components.types.StoredObject;
13 import org.sourceforge.jemm.database.components.types.StoredSetObject;
14 import org.sourceforge.jemm.database.components.types.StoredUserObject;
15 import org.sourceforge.jemm.types.ID;
16
17 /**
18 * Interface to reduce direct coupling between ObjectHandlers and their users.
19 *
20 * @author Rory Graves
21 */
22 public interface ObjectAccessor {
23 StoredObject getObject(ID objectId);
24 StoredUserObject getUserObject(ID objectId);
25
26 /**
27 * Returns the stored jemm list object referred to by 'id'
28 * @param id The id of the set to retrieve.
29 * @throws IllegalArgumentException If 'id' is null or is not JLIST type id.
30 * @throws IllegalStateException If the object is not in the database (an internal error), or the type
31 * of the retrieved object is not a stored jemm list.
32 */
33 StoredListObject getListObject(ID objectId);
34
35 /**
36 * Returns the stored jemm set object referred to by 'id'
37 * @param id The id of the set to retrieve.
38 * @throws IllegalArgumentException If 'id' is null or is not JSET type id.
39 * @throws IllegalStateException If the object is not in the database (an internal error), or the type
40 * of the retrieved object is not a stored jemm set.
41 */
42 StoredSetObject getSetObject(ID id);
43 /**
44 * Returns the stored jemm map object referred to by 'id'
45 * @param id The id of the map to retrieve.
46 * @throws IllegalArgumentException If 'id' is null or is not JSET type id.
47 * @throws IllegalStateException If the object is not in the database (an internal error), or the type
48 * of the retrieved object is not a stored jemm map.
49 */
50 StoredMapObject getMapObject(ID id);
51
52 boolean checkExists(ID objectId);
53
54 void release(StoredObject object);
55
56 /**
57 * Returns an iterator over the currently active ID set
58 * @return An iterator over valid IDs
59 */
60 Iterator<ID> idIterator();
61
62 void removeObject(ID id);
63
64 Set<ID> getObjectChildren(ID id);
65
66 ID createObject(ClientId clientId,ClassId classId);
67 }