01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.storage;
11:
12: /**
13: * This interface contains functionality for retrieving a storage identifier - a name or id
14: * suitable for storing the object. It also holds status information (i.e. whether a field is in Storage
15: * or not) and storage-specific data.
16: *
17: * @author Pierre van Rooden
18: * @since MMBase-1.7
19: * @version $Id: Storable.java,v 1.6 2005/06/28 14:01:41 pierre Exp $
20: */
21: public interface Storable {
22:
23: /**
24: * Returns a storage identifier for this object.
25: * This should return:
26: * <ul>
27: * <li>For MMBase: the object storage element identifier as a String (i.e. fully expanded table name)</li>
28: * <li>For MMObjectBuilder: the builder storage element identifier as a String (i.e. fully expanded table name)</li>
29: * <li>For MMObjectNode: the object number as a Integer</li>
30: * <li>For CoreField: a storage-compatible field name as a String (if no such name exists a StorageException is thrown)</li>
31: * </ul>
32: * A Storable object (except for MMObjectNode) should retrieve its storage identifier using
33: * {@link StorageManagerFactory#getStorageIdentifier()} when it is first instantiated.
34: * @return the identifier
35: */
36: public Object getStorageIdentifier() throws StorageException;
37:
38: /**
39: * Returns whether an object is (or, for a new object, should be) defined in the storage.
40: * Virtual fields or builders should return <code>false</code>.
41: *
42: * @return <code>true</code> if the object is kept in the storage
43: */
44: public boolean inStorage();
45:
46: /**
47: * Retrieves the storage type. The meaning of this type is dependent
48: * on the storage implementation.
49: */
50: public int getStorageType();
51:
52: /**
53: * Sets the storage type. This method is called by the storage layer when first loading a builder.
54: * The meaning of this type is dependent on the storage implementation.
55: * @param value the value to set
56: */
57: public void setStorageType(int value);
58:
59: }
|