1 /*
2 * Created on 6 Nov 2007
3 *
4 */
5 package org.sourceforge.jemm;
6
7 /**
8 * Main interface into the JEMM storage mechanism providing access to the root object.
9 *
10 * @author Rory Graves
11 * @author Paul Keeble
12 */
13 public interface Store {
14 /**
15 * Set the store root object with the given rootName to hold a reference
16 * to the specified model object.
17 * @param rootName The name of the root.
18 * @param value The model object to store.
19 */
20 void setRoot(String rootName,Object value);
21
22 /**
23 * Set the store root object with the given rootName to hold a
24 * reference to the specified model object if the value is
25 * currently null.
26 *
27 * @param rootName The name of the root.
28 * @param value The model object to store.
29 * @return The new root value, either the old one if it was not null, or the newly set one.
30 */
31 Object setRootIfNull(String rootName, Object value);
32
33 /**
34 * Return the model object set for the root named 'rootName'
35 * @param rootName The name of the root to fetch.
36 * @return Object reference if set, null otherwise.
37 */
38 Object getRoot(String rootName);
39
40 /**
41 * Shutdown should be called before the JVM is exited.
42 * The shutdown could be called multiple times and repeated runs should always
43 * succeed. Once the store is shutdown it should be able to be reinitialised
44 * with a call to initialise.
45 */
46 void shutdown();
47
48 /**
49 * Called by the Session.setStore method to inform the Store that is should start.
50 *
51 * In particular implementations should register a ConstructorListener with
52 * ConstructorLifecycle via its static methods so that object construction events
53 * are received.
54 */
55 void initialise();
56 }