KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > db > MasterTable


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.ldap.server.db;
18
19
20 import javax.naming.NamingException JavaDoc;
21 import javax.naming.directory.Attributes JavaDoc;
22 import java.math.BigInteger JavaDoc;
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: 169198 $
30  */

31 public interface MasterTable extends Table
32 {
33     /** the name of the dbf file for this table */
34     String JavaDoc DBF = "master";
35
36     /** the sequence key - stores last sequence value in the admin table */
37     String JavaDoc 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 JavaDoc get( BigInteger JavaDoc id ) throws NamingException JavaDoc;
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 JavaDoc put( Attributes JavaDoc entry, BigInteger JavaDoc id ) throws NamingException JavaDoc;
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 JavaDoc delete( BigInteger JavaDoc id ) throws NamingException JavaDoc;
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 JavaDoc getCurrentId() throws NamingException JavaDoc;
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 JavaDoc getNextId() throws NamingException JavaDoc;
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 JavaDoc getProperty( String JavaDoc property ) throws NamingException JavaDoc;
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 JavaDoc property, String JavaDoc value ) throws NamingException JavaDoc;
106 }
Popular Tags