KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > Storable


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage;
11
12
13 /**
14  * This interface contains functionality for retrieving a storage identifier - a name or id
15  * suitable for storing the object. It also holds status information (i.e. whether a field is in Storage
16  * or not) and storage-specific data.
17  *
18  * @author Pierre van Rooden
19  * @since MMBase-1.7
20  * @version $Id: Storable.java,v 1.6 2005/06/28 14:01:41 pierre Exp $
21  */

22 public interface Storable {
23
24     /**
25      * Returns a storage identifier for this object.
26      * This should return:
27      * <ul>
28      * <li>For MMBase: the object storage element identifier as a String (i.e. fully expanded table name)</li>
29      * <li>For MMObjectBuilder: the builder storage element identifier as a String (i.e. fully expanded table name)</li>
30      * <li>For MMObjectNode: the object number as a Integer</li>
31      * <li>For CoreField: a storage-compatible field name as a String (if no such name exists a StorageException is thrown)</li>
32      * </ul>
33      * A Storable object (except for MMObjectNode) should retrieve its storage identifier using
34      * {@link StorageManagerFactory#getStorageIdentifier()} when it is first instantiated.
35      * @return the identifier
36      */

37     public Object JavaDoc getStorageIdentifier() throws StorageException;
38
39     /**
40      * Returns whether an object is (or, for a new object, should be) defined in the storage.
41      * Virtual fields or builders should return <code>false</code>.
42      *
43      * @return <code>true</code> if the object is kept in the storage
44      */

45     public boolean inStorage();
46
47     /**
48      * Retrieves the storage type. The meaning of this type is dependent
49      * on the storage implementation.
50      */

51     public int getStorageType();
52
53     /**
54      * Sets the storage type. This method is called by the storage layer when first loading a builder.
55      * The meaning of this type is dependent on the storage implementation.
56      * @param value the value to set
57      */

58     public void setStorageType(int value);
59
60 }
61
Popular Tags