1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.db;
18
19
20 import javax.naming.NamingException;
21 import javax.naming.directory.Attributes;
22 import java.math.BigInteger;
23
24
25 /***
26 * The master table used to store the Attributes of entries.
27 *
28 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
29 * @version $Rev: 159259 $
30 */
31 public interface MasterTable extends Table
32 {
33 /*** the name of the dbf file for this table */
34 String DBF = "master";
35
36 /*** the sequence key - stores last sequence value in the admin table */
37 String SEQPROP_KEY = "__sequence__";
38
39 /***
40 * Gets the Attributes of an entry from this MasterTable.
41 *
42 * @param id the BigInteger id of the entry to retrieve.
43 * @return the Attributes of the entry with operational attributes and all.
44 * @throws NamingException if there is a read error on the underlying Db.
45 */
46 Attributes get( BigInteger id ) throws NamingException;
47
48 /***
49 * Puts the Attributes of an entry into this master table at an index
50 * specified by id. Used both to create new entries and update existing
51 * ones.
52 *
53 * @param entry the Attributes of entry w/ operational attributes
54 * @param id the BigInteger id of the entry to put
55 * @return the newly created entry's Attributes
56 * @throws NamingException if there is a write error on the underlying Db.
57 */
58 Attributes put( Attributes entry, BigInteger id ) throws NamingException;
59
60 /***
61 * Deletes a entry from the master table at an index specified by id.
62 *
63 * @param id the BigInteger id of the entry to delete
64 * @return the Attributes of the deleted entry
65 * @throws NamingException if there is a write error on the underlying Db
66 */
67 Attributes delete( BigInteger id ) throws NamingException;
68
69 /***
70 * Get's the current id value from this master database's sequence without
71 * affecting the seq.
72 *
73 * @return the current value.
74 * @throws NamingException if the admin table storing sequences cannot be
75 * read.
76 */
77 BigInteger getCurrentId() throws NamingException;
78
79 /***
80 * Get's the next value from this SequenceBDb. This has the side-effect of
81 * changing the current sequence values perminantly in memory and on disk.
82 *
83 * @return the current value incremented by one.
84 * @throws NamingException if the admin table storing sequences cannot be
85 * read and writen to.
86 */
87 BigInteger getNextId() throws NamingException;
88
89 /***
90 * Gets a persistant property stored in the admin table of this MasterTable.
91 *
92 * @param property the key of the property to get the value of
93 * @return the value of the property
94 * @throws NamingException when the underlying admin table cannot be read
95 */
96 String getProperty( String property ) throws NamingException;
97
98 /***
99 * Sets a persistant property stored in the admin table of this MasterTable.
100 *
101 * @param property the key of the property to set the value of
102 * @param value the value of the property
103 * @throws NamingException when the underlying admin table cannot be writen
104 */
105 void setProperty( String property, String value ) throws NamingException;
106 }